diff --git a/hosts/common/default.nix b/hosts/common/global/default.nix similarity index 52% rename from hosts/common/default.nix rename to hosts/common/global/default.nix index d4360be..d8e8105 100644 --- a/hosts/common/default.nix +++ b/hosts/common/global/default.nix @@ -1,10 +1,14 @@ { inputs, outputs, + pkgs, ... }: { imports = [ inputs.home-manager.nixosModules.home-manager + ./locales.nix + ./nix.nix + ./nix-ld.nix ]; home-manager.useGlobalPkgs = true; @@ -12,4 +16,10 @@ inherit inputs outputs; }; + environment.systemPackages = with pkgs; [ + cowsay + lolcat + ]; + + system.stateVersion = "24.11"; # Did you read the comment? } diff --git a/hosts/common/global/locales.nix b/hosts/common/global/locales.nix new file mode 100644 index 0000000..76e8617 --- /dev/null +++ b/hosts/common/global/locales.nix @@ -0,0 +1,19 @@ +{ + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + + i18n.extraLocaleSettings = { + LC_ADDRESS = "de_DE.UTF-8"; + LC_IDENTIFICATION = "de_DE.UTF-8"; + LC_MEASUREMENT = "de_DE.UTF-8"; + LC_MONETARY = "de_DE.UTF-8"; + LC_NAME = "de_DE.UTF-8"; + LC_NUMERIC = "de_DE.UTF-8"; + LC_PAPER = "de_DE.UTF-8"; + LC_TELEPHONE = "de_DE.UTF-8"; + LC_TIME = "de_DE.UTF-8"; + }; + + # Set your time zone. + time.timeZone = "Europe/Berlin"; +} \ No newline at end of file diff --git a/hosts/common/global/nix-ld.nix b/hosts/common/global/nix-ld.nix new file mode 100644 index 0000000..a211eeb --- /dev/null +++ b/hosts/common/global/nix-ld.nix @@ -0,0 +1,6 @@ +{ + # dynamic linking + programs.nix-ld.enable = true; + programs.nix-ld.libraries = with pkgs; [ + ]; +} diff --git a/hosts/common/global/nix.nix b/hosts/common/global/nix.nix new file mode 100644 index 0000000..4aa2671 --- /dev/null +++ b/hosts/common/global/nix.nix @@ -0,0 +1,11 @@ +{ + inputs, + lib, + ... +}: { + # flakes + nix.settings.experimental-features = [ + "nix-command" + "flakes" + ]; +} \ No newline at end of file diff --git a/hosts/common/optional/gnome.nix b/hosts/common/optional/gnome.nix new file mode 100644 index 0000000..9b749ed --- /dev/null +++ b/hosts/common/optional/gnome.nix @@ -0,0 +1,15 @@ +{ + # Enable the GNOME Desktop Environment. + services = { + xserver = { + enable = true; + desktopManager.gnome = { + enable = true; + }; + displayManager.gdm = { + enable = true; + autoSuspend = false; + } + }; + }; +} \ No newline at end of file diff --git a/hosts/common/optional/pipewire.nix b/hosts/common/optional/pipewire.nix new file mode 100644 index 0000000..e6fcfc7 --- /dev/null +++ b/hosts/common/optional/pipewire.nix @@ -0,0 +1,17 @@ +{ + # Enable sound with pipewire. + hardware.pulseaudio.enable = false; + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + # If you want to use JACK applications, uncomment this + #jack.enable = true; + + # use the example session manager (no others are packaged yet so this is enabled by default, + # no need to redefine it in your config for now) + #media-session.enable = true; + }; +} \ No newline at end of file diff --git a/hosts/hummingbird/configuration.nix b/hosts/hummingbird/configuration.nix index f8a04bc..a6385f0 100644 --- a/hosts/hummingbird/configuration.nix +++ b/hosts/hummingbird/configuration.nix @@ -9,7 +9,14 @@ ... }: { imports = [ - ../common + inputs.home-manager.nixosModules.home-manager + ../common/global + + # optional stuff + ../common/optional/gnome.nix + ../common/optional/pipewire.nix + + # Include the results of the hardware scan. ./hardware-configuration.nix ]; @@ -22,43 +29,10 @@ systemd.units."dev-tpmrm0.device".enable = false; networking.hostName = "hummingbird"; # Define your hostname. - # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. - - # flakes - nix.settings.experimental-features = ["nix-command" "flakes"]; - - # Configure network proxy if necessary - # networking.proxy.default = "http://user:password@proxy:port/"; - # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; # Enable networking networking.networkmanager.enable = true; - # Set your time zone. - time.timeZone = "Europe/Berlin"; - - # Select internationalisation properties. - i18n.defaultLocale = "en_US.UTF-8"; - - i18n.extraLocaleSettings = { - LC_ADDRESS = "de_DE.UTF-8"; - LC_IDENTIFICATION = "de_DE.UTF-8"; - LC_MEASUREMENT = "de_DE.UTF-8"; - LC_MONETARY = "de_DE.UTF-8"; - LC_NAME = "de_DE.UTF-8"; - LC_NUMERIC = "de_DE.UTF-8"; - LC_PAPER = "de_DE.UTF-8"; - LC_TELEPHONE = "de_DE.UTF-8"; - LC_TIME = "de_DE.UTF-8"; - }; - - # Enable the X11 windowing system. - services.xserver.enable = true; - - # Enable the GNOME Desktop Environment. - services.xserver.displayManager.gdm.enable = true; - services.xserver.desktopManager.gnome.enable = true; - # Configure keymap in X11 services.xserver.xkb = { layout = "de"; @@ -71,21 +45,7 @@ # Enable CUPS to print documents. services.printing.enable = true; - # Enable sound with pipewire. - hardware.pulseaudio.enable = false; - security.rtkit.enable = true; - services.pipewire = { - enable = true; - alsa.enable = true; - alsa.support32Bit = true; - pulse.enable = true; - # If you want to use JACK applications, uncomment this - #jack.enable = true; - # use the example session manager (no others are packaged yet so this is enabled by default, - # no need to redefine it in your config for now) - #media-session.enable = true; - }; # Enable touchpad support (enabled default in most desktopManager). # services.xserver.libinput.enable = true; @@ -103,10 +63,10 @@ rustup vscode.fhs nix-inspect + protonvpn-gui ]; }; - # flatpak services.flatpak.enable = true; @@ -123,43 +83,11 @@ inputs.nixos-conf-editor.packages.${system}.nixos-conf-editor ]; - # Some programs need SUID wrappers, can be configured further or are - # started in user sessions. - # programs.mtr.enable = true; - # programs.gnupg.agent = { - # enable = true; - # enableSSHSupport = true; - # }; - # ssh agent programs.ssh.startAgent = true; hardware.ckb-next.enable = true; - # dynamic linking - programs.nix-ld.enable = true; - programs.nix-ld.libraries = with pkgs; [ - ]; - - # List services that you want to enable: - - # Enable the OpenSSH daemon. - # services.openssh.enable = true; - - # Open ports in the firewall. - # networking.firewall.allowedTCPPorts = [ ... ]; - # networking.firewall.allowedUDPPorts = [ ... ]; - # Or disable the firewall altogether. - # networking.firewall.enable = false; - - # This value determines the NixOS release from which the default - # settings for stateful data, like file locations and database versions - # on your system were taken. It‘s perfectly fine and recommended to leave - # this value at the release version of the first install of this system. - # Before changing this value read the documentation for this option - # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). - system.stateVersion = "24.11"; # Did you read the comment? - programs.steam = { enable = true; remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play diff --git a/myLib/default.nix b/myLib/default.nix index 9aa653d..12e749c 100644 --- a/myLib/default.nix +++ b/myLib/default.nix @@ -1,17 +1,22 @@ -{inputs, nixpkgs, home-manager, systems }: let +{ + inputs, + nixpkgs, + home-manager, + systems, +}: let myLib = (import ./default.nix) {inherit inputs;}; outputs = inputs.self.outputs; in rec { - # copied from https://github.com/Misterio77/nix-config/blob/main/flake.nix - lib = nixpkgs.lib // home-manager.lib; - forEachSystem = f: lib.genAttrs (import systems) (system: f pkgsFor.${system}); - pkgsFor = lib.genAttrs (import systems) ( - system: - import nixpkgs { - inherit system; - config.allowUnfree = true; - } - ); + # copied from https://github.com/Misterio77/nix-config/blob/main/flake.nix + lib = nixpkgs.lib // home-manager.lib; + forEachSystem = f: lib.genAttrs (import systems) (system: f pkgsFor.${system}); + pkgsFor = lib.genAttrs (import systems) ( + system: + import nixpkgs { + inherit system; + config.allowUnfree = true; + } + ); mkSystem = config: inputs.nixpkgs.lib.nixosSystem { @@ -35,4 +40,4 @@ in rec { outputs.homeManagerModules.default ]; }; -} \ No newline at end of file +}