diff --git a/hosts/default.nix b/hosts/default.nix index a788fdc..556e606 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -9,9 +9,7 @@ in { system = "x86_64-linux"; modules = [ ./vamos - inputs.self.nixosModules.theme - inputs.nixos-hardware.nixosModules.framework-13-7040-amd ]; }; diff --git a/system/services/greetd.nix b/system/services/greetd.nix index 6a651a3..8cbb3e8 100644 --- a/system/services/greetd.nix +++ b/system/services/greetd.nix @@ -1,23 +1,80 @@ { + inputs, + config, lib, pkgs, - config, ... -}: { - services.greetd = { +}: let + inherit (lib) getExe evalModules; + inherit (inputs) niri; +in { + services.greetd = let + home-config = config.home-manager.users.nezia; + # huge thanks to https://github.com/sodiboo/system/blob/262e7e80ac9ae0511f8565713feaa8315d084025/login.mod.nix#L22-L67 + # this is needed because we are also importing the default settings + niri-cfg-modules = evalModules { + modules = [ + niri.lib.internal.settings-module + (let + cfg = home-config.programs.niri.settings; + in { + programs.niri.settings = { + inherit (cfg) input outputs layout; + hotkey-overlay.skip-at-startup = true; + # causes a deprecation warning otherwise + cursor = builtins.removeAttrs cfg.cursor ["hide-on-key-press"]; + + window-rules = [ + { + draw-border-with-background = false; + clip-to-geometry = true; + geometry-corner-radius = { + top-left = 8.0; + top-right = 8.0; + bottom-left = 8.0; + bottom-right = 8.0; + }; + } + ]; + }; + }) + ]; + }; + + # validates config and creates a derivation + niri-config = niri.lib.internal.validated-config-for pkgs config.programs.niri.package niri-cfg-modules.config.programs.niri.finalConfig; + in { enable = true; - settings = rec { - initial_session = { - command = '' - ${lib.getExe pkgs.greetd.tuigreet} - --time - --asterisks - --user-menu - --cmd ${lib.getExe config.programs.niri.package} --session - ''; + settings = { + default_session = let + niri = getExe config.programs.niri.package; + regreet = getExe config.programs.regreet.package; + in { + # TODO: kill niri after logging in so we don't have to wait for greetd to do it (can get pretty long) + command = "${niri} -c ${niri-config} -- ${regreet}"; user = "greeter"; }; - default_session = initial_session; + }; + }; + programs.regreet = { + enable = true; + theme = { + inherit (config.theme.gtk.theme) name package; + }; + iconTheme = { + inherit (config.theme.gtk.iconTheme) name package; + }; + cursorTheme = { + inherit (config.theme.cursorTheme) name package; + }; + settings = { + background = { + path = config.theme.wallpaper; + fit = "Fill"; + }; + GTK = { + application_prefer_dark_theme = true; + }; }; }; security.pam.services = {