From 3fc4efab9ce24d27001c34df9225d5ebf26b9dbc Mon Sep 17 00:00:00 2001 From: Katherina Walshe-Grey Date: Wed, 11 Sep 2024 05:17:19 +0100 Subject: [PATCH 1/3] rename sysadmin module to base-server --- common/{sysadmin => base-server}/default.nix | 4 ++-- common/default.nix | 2 +- hosts/kalessin/configuration.nix | 2 +- hosts/orm/configuration.nix | 2 +- hosts/yevaud/configuration.nix | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) rename common/{sysadmin => base-server}/default.nix (68%) 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..e380932 100644 --- a/common/default.nix +++ b/common/default.nix @@ -1,6 +1,6 @@ { imports = [ - ./sysadmin + ./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/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/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; From aeab8016021127832e0b33016a93653506b23319 Mon Sep 17 00:00:00 2001 From: Katherina Walshe-Grey Date: Wed, 11 Sep 2024 05:43:35 +0100 Subject: [PATCH 2/3] base-graphical: init with pipewire config --- common/base-graphical/default.nix | 17 +++++++++++++++++ common/base-graphical/sound.nix | 20 ++++++++++++++++++++ common/default.nix | 1 + hosts/kilgharrah/default.nix | 4 ++-- hosts/kilgharrah/sound.nix | 13 ------------- hosts/tohru/default.nix | 10 ++-------- 6 files changed, 42 insertions(+), 23 deletions(-) create mode 100644 common/base-graphical/default.nix create mode 100644 common/base-graphical/sound.nix delete mode 100644 hosts/kilgharrah/sound.nix diff --git a/common/base-graphical/default.nix b/common/base-graphical/default.nix new file mode 100644 index 0000000..1ef5c98 --- /dev/null +++ b/common/base-graphical/default.nix @@ -0,0 +1,17 @@ +{ config, lib, pkgs, ... }: + +with lib; +let + cfg = config.qenya.base-graphical; +in +{ + imports = [ + ./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/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/default.nix b/common/default.nix index e380932..fd0791c 100644 --- a/common/default.nix +++ b/common/default.nix @@ -1,5 +1,6 @@ { imports = [ + ./base-graphical ./base-server ./users ./environment.nix diff --git a/hosts/kilgharrah/default.nix b/hosts/kilgharrah/default.nix index 3a834fb..bafc19d 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,12 +16,13 @@ targetHost = null; # disallow remote deployment }; + qenya.base-graphical.enable = true; + 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; 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/tohru/default.nix b/hosts/tohru/default.nix index c8d2ec3..7373dd5 100644 --- a/hosts/tohru/default.nix +++ b/hosts/tohru/default.nix @@ -18,25 +18,19 @@ targetHost = null; # disallow remote deployment }; + 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 = [ From 9e638c009f37bf4ffb33b96b278a14cb5aea741b Mon Sep 17 00:00:00 2001 From: Katherina Walshe-Grey Date: Wed, 11 Sep 2024 06:36:21 +0100 Subject: [PATCH 3/3] base-graphical: add desktop manager config --- common/base-graphical/default.nix | 1 + common/base-graphical/desktop.nix | 26 ++++++++++++++++++++++++++ hosts/kilgharrah/default.nix | 6 +----- hosts/tohru/default.nix | 4 ---- 4 files changed, 28 insertions(+), 9 deletions(-) create mode 100644 common/base-graphical/desktop.nix diff --git a/common/base-graphical/default.nix b/common/base-graphical/default.nix index 1ef5c98..40542ce 100644 --- a/common/base-graphical/default.nix +++ b/common/base-graphical/default.nix @@ -6,6 +6,7 @@ let in { imports = [ + ./desktop.nix ./sound.nix ]; 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/hosts/kilgharrah/default.nix b/hosts/kilgharrah/default.nix index bafc19d..b4e969f 100644 --- a/hosts/kilgharrah/default.nix +++ b/hosts/kilgharrah/default.nix @@ -17,15 +17,11 @@ }; qenya.base-graphical.enable = true; + qenya.base-graphical.desktop = "plasma6"; time.timeZone = "Europe/London"; - i18n.defaultLocale = "en_GB.UTF-8"; console.keyMap = "uk"; - - 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/tohru/default.nix b/hosts/tohru/default.nix index 7373dd5..eab9a11 100644 --- a/hosts/tohru/default.nix +++ b/hosts/tohru/default.nix @@ -21,12 +21,8 @@ qenya.base-graphical.enable = true; time.timeZone = "Europe/London"; - i18n.defaultLocale = "en_GB.UTF-8"; console.keyMap = "uk"; - - services.xserver.displayManager.gdm.enable = true; - services.xserver.desktopManager.gnome.enable = true; services.xserver.xkb.layout = "gb"; services.printing.enable = true;