From c1af68a79e59c537f72c0ad3ae89140e2d811ea9 Mon Sep 17 00:00:00 2001 From: Aly Raffauf Date: Mon, 22 Apr 2024 23:14:28 -0400 Subject: [PATCH] moved greetd into a module and added sway module --- hosts/fallarbor/default.nix | 1 + hosts/lavaridge/default.nix | 1 + hosts/mauville/default.nix | 1 + hosts/petalburg/default.nix | 1 + hosts/rustboro/default.nix | 14 ++++----- nixosModules/desktop/default.nix | 9 +++++- nixosModules/desktop/greetd/default.nix | 30 +++++++++++++++++++ nixosModules/desktop/hyprland/default.nix | 10 +------ nixosModules/desktop/sway/default.nix | 35 +++++++++++++++++++++++ 9 files changed, 83 insertions(+), 19 deletions(-) create mode 100644 nixosModules/desktop/greetd/default.nix create mode 100644 nixosModules/desktop/sway/default.nix diff --git a/hosts/fallarbor/default.nix b/hosts/fallarbor/default.nix index 834fc95e..ac97e8e1 100644 --- a/hosts/fallarbor/default.nix +++ b/hosts/fallarbor/default.nix @@ -39,6 +39,7 @@ }; desktop = { enable = true; + greetd.enable = true; hyprland.enable = true; }; apps = { diff --git a/hosts/lavaridge/default.nix b/hosts/lavaridge/default.nix index 8e8362c1..d47a551a 100644 --- a/hosts/lavaridge/default.nix +++ b/hosts/lavaridge/default.nix @@ -37,6 +37,7 @@ }; desktop = { enable = true; + greetd.enable = true; hyprland.enable = true; }; apps = { diff --git a/hosts/mauville/default.nix b/hosts/mauville/default.nix index 9418f90d..435b2383 100644 --- a/hosts/mauville/default.nix +++ b/hosts/mauville/default.nix @@ -39,6 +39,7 @@ in { }; desktop = { enable = true; + greetd.enable = true; hyprland.enable = true; }; user = { diff --git a/hosts/petalburg/default.nix b/hosts/petalburg/default.nix index a4777e90..354ac30b 100644 --- a/hosts/petalburg/default.nix +++ b/hosts/petalburg/default.nix @@ -82,6 +82,7 @@ in { }; desktop = { enable = true; + greetd.enable = true; hyprland.enable = true; }; apps = { diff --git a/hosts/rustboro/default.nix b/hosts/rustboro/default.nix index e33850f7..4bfe23e6 100644 --- a/hosts/rustboro/default.nix +++ b/hosts/rustboro/default.nix @@ -58,20 +58,16 @@ }; desktop = { enable = true; - hyprland.enable = true; + greetd = { + enable = true; + session = config.programs.sway.package + "/bin/sway"; + }; + sway.enable = true; }; apps = { steam.enable = true; }; }; - - services.greetd = { - settings = rec { - default_session = { - command = "${pkgs.greetd.tuigreet}/bin/tuigreet --time --remember --cmd sway"; - }; - }; - }; users.users.aly.hashedPassword = "$y$j9T$VdtiEyMOegHpcUwgmCVFD0$K8Ne6.zk//VJNq2zxVQ0xE0Wg3LohvAQd3Xm9aXdM15"; diff --git a/nixosModules/desktop/default.nix b/nixosModules/desktop/default.nix index c7d7b084..09798c85 100644 --- a/nixosModules/desktop/default.nix +++ b/nixosModules/desktop/default.nix @@ -4,7 +4,14 @@ config, ... }: { - imports = [./gnome ./hyprland ./lightdm ./plasma]; + imports = [ + ./gnome + ./greetd + ./hyprland + ./lightdm + ./plasma + ./sway + ]; options = { alyraffauf.desktop.enable = diff --git a/nixosModules/desktop/greetd/default.nix b/nixosModules/desktop/greetd/default.nix new file mode 100644 index 00000000..618d2d2a --- /dev/null +++ b/nixosModules/desktop/greetd/default.nix @@ -0,0 +1,30 @@ +{ + inputs, + pkgs, + lib, + config, + ... +}: { + options = { + alyraffauf.desktop.greetd.enable = + lib.mkEnableOption "Enable greetd."; + alyraffauf.desktop.greetd.session = lib.mkOption { + description = "Default command to execute on login."; + default = inputs.hyprland.packages.${pkgs.system}.hyprland + "/bin/Hyprland"; + type = lib.types.str; + }; + }; + + config = lib.mkIf config.alyraffauf.desktop.greetd.enable { + services = { + greetd = { + enable = true; + settings = rec { + default_session = { + command = lib.mkDefault "${pkgs.greetd.tuigreet}/bin/tuigreet --time --remember --cmd ${config.alyraffauf.desktop.greetd.session}"; + }; + }; + }; + }; + }; +} diff --git a/nixosModules/desktop/hyprland/default.nix b/nixosModules/desktop/hyprland/default.nix index aa0c0ce8..1f72d092 100644 --- a/nixosModules/desktop/hyprland/default.nix +++ b/nixosModules/desktop/hyprland/default.nix @@ -7,20 +7,12 @@ }: { options = { alyraffauf.desktop.hyprland.enable = - lib.mkEnableOption "Enable hyprland and greetd."; + lib.mkEnableOption "Enable hyprland wayland compositor."; }; config = lib.mkIf config.alyraffauf.desktop.hyprland.enable { services = { dbus.packages = [pkgs.gcr]; - greetd = { - enable = lib.mkDefault true; - settings = rec { - default_session = { - command = lib.mkDefault "${pkgs.greetd.tuigreet}/bin/tuigreet --time --remember --cmd Hyprland"; - }; - }; - }; udev.packages = [pkgs.swayosd]; }; diff --git a/nixosModules/desktop/sway/default.nix b/nixosModules/desktop/sway/default.nix new file mode 100644 index 00000000..d28c5faa --- /dev/null +++ b/nixosModules/desktop/sway/default.nix @@ -0,0 +1,35 @@ +{ + inputs, + pkgs, + lib, + config, + ... +}: { + options = { + alyraffauf.desktop.sway.enable = + lib.mkEnableOption "Enable sway wayland compositor."; + }; + + config = lib.mkIf config.alyraffauf.desktop.sway.enable { + services = { + dbus.packages = [pkgs.gcr]; + udev.packages = [pkgs.swayosd]; + }; + + security.pam.services = { + greetd.enableKwallet = true; + greetd.enableGnomeKeyring = true; + swaylock = {}; + }; + + programs = { + gnupg.agent.pinentryPackage = pkgs.pinentry-gnome3; + sway = { + enable = true; + package = pkgs.swayfx; + }; + }; + + environment.sessionVariables.NIXOS_OZONE_WL = "1"; + }; +}