From 0403ff8fb49c0be333aaa9be8d85060e92992792 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Tue, 25 Jun 2024 00:35:40 +0200 Subject: [PATCH 1/5] Move to rosepine cursor theme --- options/home/theme.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/options/home/theme.nix b/options/home/theme.nix index e53d8de..1503539 100644 --- a/options/home/theme.nix +++ b/options/home/theme.nix @@ -125,13 +125,13 @@ in cursor = { name = mkOption { type = types.str; - default = "catppuccin-mocha-dark-cursors"; + default = "BreezeX-RosePine-Linux"; description = "The name of the cursor inside the package"; }; package = mkOption { type = types.package; - default = pkgs.catppuccin-cursors.mochaDark; + default = pkgs.rose-pine-cursor; description = "The package providing the cursors"; }; From a6eb7496f76522e27d7ca3e16d1d611cad1d8c75 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Tue, 25 Jun 2024 01:03:02 +0200 Subject: [PATCH 2/5] Add gnome-keyring --- home/services/default.nix | 1 + home/services/gnome-keyring.nix | 12 ++++++++++++ 2 files changed, 13 insertions(+) create mode 100644 home/services/gnome-keyring.nix diff --git a/home/services/default.nix b/home/services/default.nix index 9799edc..603ff47 100644 --- a/home/services/default.nix +++ b/home/services/default.nix @@ -1,5 +1,6 @@ _: { imports = [ ./dunst.nix + ./gnome-keyring.nix ]; } diff --git a/home/services/gnome-keyring.nix b/home/services/gnome-keyring.nix new file mode 100644 index 0000000..6e369ad --- /dev/null +++ b/home/services/gnome-keyring.nix @@ -0,0 +1,12 @@ +{pkgs, ...}: { + config = { + services.gnome-keyring.enable = true; + xdg.portal.config.common = { + "org.freedesktop.impl.portal.Secret" = [ "gnome-keyring" ]; + }; + + # Enable seahorse (application for managing encryption keys + # and passwords in the gnome keyring) + home.packages = with pkgs; [ seahorse ]; + }; +} From 70800ff0abeabb105694d69fc18aba7d119355c5 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Tue, 25 Jun 2024 01:30:54 +0200 Subject: [PATCH 3/5] Move gnome-keyring to system-wide config --- home/services/default.nix | 1 - home/services/gnome-keyring.nix | 12 ----------- system/roles/workstation/services/default.nix | 1 + .../workstation/services/gnome-keyring.nix | 20 +++++++++++++++++++ 4 files changed, 21 insertions(+), 13 deletions(-) delete mode 100644 home/services/gnome-keyring.nix create mode 100644 system/roles/workstation/services/gnome-keyring.nix diff --git a/home/services/default.nix b/home/services/default.nix index 603ff47..9799edc 100644 --- a/home/services/default.nix +++ b/home/services/default.nix @@ -1,6 +1,5 @@ _: { imports = [ ./dunst.nix - ./gnome-keyring.nix ]; } diff --git a/home/services/gnome-keyring.nix b/home/services/gnome-keyring.nix deleted file mode 100644 index 6e369ad..0000000 --- a/home/services/gnome-keyring.nix +++ /dev/null @@ -1,12 +0,0 @@ -{pkgs, ...}: { - config = { - services.gnome-keyring.enable = true; - xdg.portal.config.common = { - "org.freedesktop.impl.portal.Secret" = [ "gnome-keyring" ]; - }; - - # Enable seahorse (application for managing encryption keys - # and passwords in the gnome keyring) - home.packages = with pkgs; [ seahorse ]; - }; -} diff --git a/system/roles/workstation/services/default.nix b/system/roles/workstation/services/default.nix index 3f856bc..dcd7aee 100644 --- a/system/roles/workstation/services/default.nix +++ b/system/roles/workstation/services/default.nix @@ -4,6 +4,7 @@ ./mount.nix ./printing.nix ./misc.nix + ./gnome-keyring.nix ]; } diff --git a/system/roles/workstation/services/gnome-keyring.nix b/system/roles/workstation/services/gnome-keyring.nix new file mode 100644 index 0000000..23d8589 --- /dev/null +++ b/system/roles/workstation/services/gnome-keyring.nix @@ -0,0 +1,20 @@ +{pkgs, lib, config, ...}: let + inherit (lib) mkIf; + deviceType = config.myOptions.device.roles.type; + acceptedTypes = ["laptop" "desktop"]; +in { + config = mkIf (builtins.elem deviceType acceptedTypes) { + services = { + udev.packages = with pkgs; [gnome.gnome-settings-daemon]; + gnome.gnome-keyring.enable = true; + }; + + # seahorse is an application for managing encryption keys + # and passwords in the gnome keyring + programs.seahorse.enable = true; + + xdg.portal.config.common = { + "org.freedesktop.impl.portal.Secret" = [ "gnome-keyring" ]; + }; + }; +} From 6bbebb3cd24d45feb2c1e48aad6c5586f0df2cc1 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Tue, 25 Jun 2024 01:32:59 +0200 Subject: [PATCH 4/5] Add greetd DM --- .../terminal/shell/zsh/rc/profile.zsh | 16 ++--- system/roles/workstation/display/default.nix | 1 + .../workstation/display/login/default.nix | 6 ++ .../workstation/display/login/greetd.nix | 58 +++++++++++++++++++ .../roles/workstation/display/login/pam.nix | 31 ++++++++++ 5 files changed, 104 insertions(+), 8 deletions(-) create mode 100644 system/roles/workstation/display/login/default.nix create mode 100644 system/roles/workstation/display/login/greetd.nix create mode 100644 system/roles/workstation/display/login/pam.nix diff --git a/home/programs/terminal/shell/zsh/rc/profile.zsh b/home/programs/terminal/shell/zsh/rc/profile.zsh index de4a41f..1abf3fa 100644 --- a/home/programs/terminal/shell/zsh/rc/profile.zsh +++ b/home/programs/terminal/shell/zsh/rc/profile.zsh @@ -9,12 +9,12 @@ if [ -d "$HOME/.local/bin" ]; then PATH+=":${$(find -L ~/.local/bin -type d | tr '\n' ':')%%:}" fi +# I'm using a greeter now, so the below is disabled. # Start graphical session automatically on tty1 if Hyprland or startx is available -if [ "$(tty)" = "/dev/tty1" ] && [ "$UID" != 0 ]; then - if command -v Hyprland >/dev/null; then - ! pidof -s Hyprland >/dev/null 2>&1 && Hyprland - elif command -v startx >/dev/null; then - ! pidof -s Xorg >/dev/null 2>&1 && exec startx "$XINITRC" - fi -fi - +#if [ "$(tty)" = "/dev/tty1" ] && [ "$UID" != 0 ]; then +# if command -v Hyprland >/dev/null; then +# ! pidof -s Hyprland >/dev/null 2>&1 && Hyprland +# elif command -v startx >/dev/null; then +# ! pidof -s Xorg >/dev/null 2>&1 && exec startx "$XINITRC" +# fi +#fi diff --git a/system/roles/workstation/display/default.nix b/system/roles/workstation/display/default.nix index 638bb65..438f8c9 100644 --- a/system/roles/workstation/display/default.nix +++ b/system/roles/workstation/display/default.nix @@ -1,5 +1,6 @@ { imports = [ + ./login ./wayland ]; } diff --git a/system/roles/workstation/display/login/default.nix b/system/roles/workstation/display/login/default.nix new file mode 100644 index 0000000..9163d23 --- /dev/null +++ b/system/roles/workstation/display/login/default.nix @@ -0,0 +1,6 @@ +{ + imports = [ + ./greetd.nix + ./pam.nix + ]; +} diff --git a/system/roles/workstation/display/login/greetd.nix b/system/roles/workstation/display/login/greetd.nix new file mode 100644 index 0000000..9590df6 --- /dev/null +++ b/system/roles/workstation/display/login/greetd.nix @@ -0,0 +1,58 @@ +{ + config, + pkgs, + lib, + ... +}: let + inherit (lib) mkIf getExe; + inherit (lib.strings) concatStringsSep; + + + deviceType = config.myOptions.device.roles.type; + acceptedTypes = ["laptop" "desktop"]; + + sessionData = config.services.displayManager.sessionData.desktops; + sessionPaths = concatStringsSep ":" [ + "${sessionData}/share/xsessions" + "${sessionData}/share/wayland-sessions" + ]; + + defaultSession = { + user = "greeter"; + command = concatStringsSep " " [ + (getExe pkgs.greetd.tuigreet) + "--time" + "--remember" + "--remember-user-session" + "--asterisks" + "--sessions '${sessionPaths}'" + ]; + }; +in { + config = mkIf (builtins.elem deviceType acceptedTypes) { + services.greetd = { + enable = true; + vt = 2; + + # + settings = { + # default session is what will be used if no session is selected + # in this case it'll be a TUI greeter + default_session = defaultSession; + }; + }; + + # Suppress error messages on tuigreet. They sometimes obscure the TUI + # boundaries of the greeter. + # See: https://github.com/apognu/tuigreet/issues/68#issuecomment-1586359960 + systemd.services.greetd.serviceConfig = { + Type = "idle"; + StandardInputs = "tty"; + StandardOutput = "tty"; + StandardError = "journal"; + TTYReset = true; + TTYVHangup = true; + TTYVTDisallocate = true; + }; + }; +} diff --git a/system/roles/workstation/display/login/pam.nix b/system/roles/workstation/display/login/pam.nix new file mode 100644 index 0000000..7848f9a --- /dev/null +++ b/system/roles/workstation/display/login/pam.nix @@ -0,0 +1,31 @@ +{lib, config, ...}: let + inherit (lib) mkIf; + deviceType = config.myOptions.device.roles.type; + acceptedTypes = ["laptop" "desktop"]; +in { + config = mkIf (builtins.elem deviceType acceptedTypes) { + # unlock GPG keyring on login + security.pam.services = let + gnupg = { + enable = true; + noAutostart = true; + storeOnly = true; + }; + in { + login = { + enableGnomeKeyring = true; + inherit gnupg; + }; + + greetd = { + enableGnomeKeyring = true; + inherit gnupg; + }; + + tuigreet = { + enableGnomeKeyring = true; + inherit gnupg; + }; + }; + }; +} From b930b14cf22b074e4fdd1f1f8175137a661af139 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Tue, 25 Jun 2024 01:38:05 +0200 Subject: [PATCH 5/5] Configure power actions with logind This configures what happens on lid close (on battery / on AC) and control what happens on the power button press. --- system/roles/workstation/services/default.nix | 1 + system/roles/workstation/services/logind.nix | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 system/roles/workstation/services/logind.nix diff --git a/system/roles/workstation/services/default.nix b/system/roles/workstation/services/default.nix index dcd7aee..ec9cd53 100644 --- a/system/roles/workstation/services/default.nix +++ b/system/roles/workstation/services/default.nix @@ -4,6 +4,7 @@ ./mount.nix ./printing.nix ./misc.nix + ./logind.nix ./gnome-keyring.nix ]; } diff --git a/system/roles/workstation/services/logind.nix b/system/roles/workstation/services/logind.nix new file mode 100644 index 0000000..86f778b --- /dev/null +++ b/system/roles/workstation/services/logind.nix @@ -0,0 +1,18 @@ +{lib, config, ...}: let + inherit (lib) mkIf; + deviceType = config.myOptions.device.roles.type; + acceptedTypes = ["laptop" "desktop"]; +in { + config = mkIf (builtins.elem deviceType acceptedTypes) { + # despite being under logind, this has nothing to do with login + # it's about power management + services.logind = { + lidSwitch = "suspend-then-hibernate"; + lidSwitchExternalPower = "lock"; + extraConfig = '' + HandlePowerKey=suspend-then-hibernate + HibernateDelaySec=3600 + ''; + }; + }; +}