diff --git a/common/base-graphical/default.nix b/common/base-graphical/default.nix new file mode 100644 index 0000000..40542ce --- /dev/null +++ b/common/base-graphical/default.nix @@ -0,0 +1,18 @@ +{ config, lib, pkgs, ... }: + +with lib; +let + cfg = config.qenya.base-graphical; +in +{ + imports = [ + ./desktop.nix + ./sound.nix + ]; + + options.qenya.base-graphical.enable = mkEnableOption "Base configuration for graphical environments"; + + config = mkIf cfg.enable { + services.xserver.enable = true; + }; +} diff --git a/common/base-graphical/desktop.nix b/common/base-graphical/desktop.nix new file mode 100644 index 0000000..50ff84c --- /dev/null +++ b/common/base-graphical/desktop.nix @@ -0,0 +1,26 @@ +{ config, lib, pkgs, ... }: + +let + inherit (lib) mkIf mkOption types; + cfg = config.qenya.base-graphical; + + isGnome = cfg.desktop == "gnome"; + isPlasma6 = cfg.desktop == "plasma6"; +in +{ + options.qenya.base-graphical.desktop = mkOption { + type = types.enum [ "gnome" "plasma6" ]; + default = "gnome"; + example = "plasma6"; + description = "Which display manager and desktop manager to use."; + }; + + config = mkIf cfg.enable { + services.xserver.displayManager.gdm.enable = isGnome; + services.xserver.desktopManager.gnome.enable = isGnome; + + services.displayManager.sddm.enable = isPlasma6; + services.displayManager.sddm.wayland.enable = isPlasma6; + services.desktopManager.plasma6.enable = isPlasma6; + }; +} diff --git a/common/base-graphical/sound.nix b/common/base-graphical/sound.nix new file mode 100644 index 0000000..bb0c847 --- /dev/null +++ b/common/base-graphical/sound.nix @@ -0,0 +1,20 @@ +{ config, lib, pkgs, ... }: + +with lib; +let + cfg = config.qenya.base-graphical; +in +{ + config = mkIf cfg.enable { + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + jack.enable = true; + }; + hardware.pulseaudio.enable = false; # this theoretically defaults to false but something else seems to be flipping it + environment.systemPackages = with pkgs; [ helvum ]; # patchbay + }; +} diff --git a/common/sysadmin/default.nix b/common/base-server/default.nix similarity index 68% rename from common/sysadmin/default.nix rename to common/base-server/default.nix index 3709583..47a82fa 100644 --- a/common/sysadmin/default.nix +++ b/common/base-server/default.nix @@ -2,10 +2,10 @@ with lib; let - cfg = config.qenya.sysadmin; + cfg = config.qenya.base-server; in { - options.qenya.sysadmin.enable = mkEnableOption "Base configuration for headless servers"; + options.qenya.base-server.enable = mkEnableOption "Base configuration for headless servers"; config = mkIf cfg.enable { time.timeZone = "Etc/UTC"; diff --git a/common/default.nix b/common/default.nix index 849dc3d..fd0791c 100644 --- a/common/default.nix +++ b/common/default.nix @@ -1,6 +1,7 @@ { imports = [ - ./sysadmin + ./base-graphical + ./base-server ./users ./environment.nix ./home-manager.nix diff --git a/hosts/kalessin/configuration.nix b/hosts/kalessin/configuration.nix index 4e2ddea..3250f27 100644 --- a/hosts/kalessin/configuration.nix +++ b/hosts/kalessin/configuration.nix @@ -9,7 +9,7 @@ boot.loader.efi.canTouchEfiVariables = true; users.users.qenya.extraGroups = [ "wheel" ]; - qenya.sysadmin.enable = true; + qenya.base-server.enable = true; system.stateVersion = "23.11"; } diff --git a/hosts/kilgharrah/default.nix b/hosts/kilgharrah/default.nix index 3a834fb..b4e969f 100644 --- a/hosts/kilgharrah/default.nix +++ b/hosts/kilgharrah/default.nix @@ -6,7 +6,6 @@ ./filesystems.nix ./hardware.nix ./networking.nix - ./sound.nix ]; nixpkgs.hostPlatform = "x86_64-linux"; @@ -17,15 +16,12 @@ targetHost = null; # disallow remote deployment }; - time.timeZone = "Europe/London"; + qenya.base-graphical.enable = true; + qenya.base-graphical.desktop = "plasma6"; + time.timeZone = "Europe/London"; i18n.defaultLocale = "en_GB.UTF-8"; console.keyMap = "uk"; - - services.xserver.enable = true; - services.displayManager.sddm.enable = true; - services.displayManager.sddm.wayland.enable = true; - services.desktopManager.plasma6.enable = true; services.xserver.xkb.layout = "gb"; services.printing.enable = true; diff --git a/hosts/kilgharrah/sound.nix b/hosts/kilgharrah/sound.nix deleted file mode 100644 index cb97bd4..0000000 --- a/hosts/kilgharrah/sound.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ config, lib, pkgs, ... }: - -{ - security.rtkit.enable = true; - services.pipewire = { - enable = true; - alsa.enable = true; - alsa.support32Bit = true; - pulse.enable = true; - jack.enable = true; - }; - environment.systemPackages = with pkgs; [ helvum ]; # patchbay -} \ No newline at end of file diff --git a/hosts/orm/configuration.nix b/hosts/orm/configuration.nix index e0cbe89..c31dc6a 100644 --- a/hosts/orm/configuration.nix +++ b/hosts/orm/configuration.nix @@ -9,7 +9,7 @@ boot.loader.efi.canTouchEfiVariables = true; users.users.qenya.extraGroups = [ "wheel" ]; - qenya.sysadmin.enable = true; + qenya.base-server.enable = true; age.secrets.wireguard-peer-orm.file = ../../secrets/wireguard-peer-orm.age; diff --git a/hosts/tohru/default.nix b/hosts/tohru/default.nix index c8d2ec3..eab9a11 100644 --- a/hosts/tohru/default.nix +++ b/hosts/tohru/default.nix @@ -18,25 +18,15 @@ targetHost = null; # disallow remote deployment }; - time.timeZone = "Europe/London"; + qenya.base-graphical.enable = true; + time.timeZone = "Europe/London"; i18n.defaultLocale = "en_GB.UTF-8"; console.keyMap = "uk"; - - services.xserver.enable = true; - services.xserver.displayManager.gdm.enable = true; - services.xserver.desktopManager.gnome.enable = true; services.xserver.xkb.layout = "gb"; services.printing.enable = true; - sound.enable = true; - hardware.pulseaudio.enable = true; - # services.pipewire = { - # enable = true; - # pulse.enable = true; - # }; - age.secrets.user-password-tohru-qenya.file = ../../secrets/user-password-tohru-qenya.age; users.users.qenya.hashedPasswordFile = config.age.secrets.user-password-tohru-qenya.path; users.users.qenya.extraGroups = [ diff --git a/hosts/yevaud/configuration.nix b/hosts/yevaud/configuration.nix index 13b70b3..2fbd757 100644 --- a/hosts/yevaud/configuration.nix +++ b/hosts/yevaud/configuration.nix @@ -10,7 +10,7 @@ users.users.qenya.extraGroups = [ "wheel" ]; - qenya.sysadmin.enable = true; + qenya.base-server.enable = true; age.secrets.wireguard-peer-yevaud.file = ../../secrets/wireguard-peer-yevaud.age;