diff --git a/enviroments/common/default.nix b/enviroments/common/default.nix index e79a47a..691acc7 100644 --- a/enviroments/common/default.nix +++ b/enviroments/common/default.nix @@ -1,4 +1,4 @@ -{pkgs, ...}: { +{...}: { imports = []; nix = { diff --git a/hosts/defiant/configuration.nix b/hosts/defiant/configuration.nix index cd76cdf..2063579 100644 --- a/hosts/defiant/configuration.nix +++ b/hosts/defiant/configuration.nix @@ -8,10 +8,7 @@ inputs.disko.nixosModules.disko ../../enviroments/server - ../../modules/hardware.nix - ../../modules/users.nix - ../../modules/desktop.nix - ../../modules/nix-development.nix + ../../modules ]; nixpkgs.config.allowUnfree = true; diff --git a/hosts/horizon/configuration.nix b/hosts/horizon/configuration.nix index a656840..6940726 100644 --- a/hosts/horizon/configuration.nix +++ b/hosts/horizon/configuration.nix @@ -3,10 +3,7 @@ inputs.nixos-hardware.nixosModules.framework-11th-gen-intel ../../enviroments/client - ../../modules/hardware.nix - ../../modules/users.nix - ../../modules/desktop.nix - ../../modules/nix-development.nix + ../../modules ]; nixpkgs.config.allowUnfree = true; diff --git a/hosts/twilight/configuration.nix b/hosts/twilight/configuration.nix index b49baa5..4a99069 100644 --- a/hosts/twilight/configuration.nix +++ b/hosts/twilight/configuration.nix @@ -2,10 +2,7 @@ imports = [ ../../enviroments/client - ../../modules/hardware.nix - ../../modules/users.nix - ../../modules/desktop.nix - ../../modules/nix-development.nix + ../../modules ]; nixpkgs.config.allowUnfree = true; diff --git a/modules/default.nix b/modules/default.nix new file mode 100644 index 0000000..58b93a0 --- /dev/null +++ b/modules/default.nix @@ -0,0 +1,8 @@ +{...}: { + imports = [ + ./hardware.nix + ./users.nix + ./desktop.nix + ./nix-development.nix + ]; +} diff --git a/modules/desktop.nix b/modules/desktop.nix index 14580ba..e349abe 100644 --- a/modules/desktop.nix +++ b/modules/desktop.nix @@ -1,41 +1,55 @@ -{pkgs, ...}: { - services = { - # Enable CUPS to print documents. - printing.enable = true; +{ + lib, + pkgs, + config, + ... +}: { + options.host.desktop.enable = lib.mkEnableOption "should desktop configuration be enabled"; - xserver = { - # Enable the X11 windowing system. - enable = true; + config = lib.mkMerge [ + { + host.desktop.enable = lib.mkDefault true; + } + (lib.mkIf config.host.desktop.enable { + services = { + # Enable CUPS to print documents. + printing.enable = true; - # Enable the GNOME Desktop Environment. - displayManager.gdm.enable = true; - desktopManager = { - gnome.enable = true; + xserver = { + # Enable the X11 windowing system. + enable = true; + + # Enable the GNOME Desktop Environment. + displayManager.gdm.enable = true; + desktopManager = { + gnome.enable = true; + }; + + # Get rid of xTerm + desktopManager.xterm.enable = false; + excludePackages = [pkgs.xterm]; + }; + + 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; + }; }; - # Get rid of xTerm - desktopManager.xterm.enable = false; - excludePackages = [pkgs.xterm]; - }; + # Enable sound with pipewire. + hardware.pulseaudio.enable = false; - 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 sound with pipewire. - hardware.pulseaudio.enable = false; - - # enable RealtimeKit for pulse audio - security.rtkit.enable = true; + # enable RealtimeKit for pulse audio + security.rtkit.enable = true; + }) + ]; } diff --git a/modules/nix-development.nix b/modules/nix-development.nix index c4eacac..d670418 100644 --- a/modules/nix-development.nix +++ b/modules/nix-development.nix @@ -1,14 +1,25 @@ { - inputs, + lib, + config, pkgs, + inputs, ... }: { - nix = { - nixPath = ["nixpkgs=${inputs.nixpkgs}"]; - }; + options.host.nix-development.enable = lib.mkEnableOption "should desktop configuration be enabled"; - environment.systemPackages = with pkgs; [ - # nix langauge server - nixd + config = lib.mkMerge [ + { + host.nix-development.enable = lib.mkDefault true; + } + (lib.mkIf config.host.nix-development.enable { + nix = { + nixPath = ["nixpkgs=${inputs.nixpkgs}"]; + }; + + environment.systemPackages = with pkgs; [ + # nix langauge server + nixd + ]; + }) ]; }