diff options
| -rw-r--r-- | flake.nix | 14 | ||||
| -rw-r--r-- | hosts/kaworu/default.nix | 2 | ||||
| -rw-r--r-- | hosts/shinji/default.nix | 2 | ||||
| -rw-r--r-- | lib/default.nix | 16 | ||||
| -rw-r--r-- | lib/template.nix | 26 | ||||
| -rw-r--r-- | options.nix | 1 | ||||
| -rw-r--r-- | system/login/default.nix | 1 | ||||
| -rw-r--r-- | system/login/greetd.nix | 12 | ||||
| -rw-r--r-- | system/login/nwg/default.nix | 31 | ||||
| -rw-r--r-- | system/login/nwg/nwg-hello.css.mustache | 80 | ||||
| -rw-r--r-- | system/login/nwg/nwg-hello.json | 16 |
11 files changed, 178 insertions, 23 deletions
@@ -41,7 +41,6 @@ }; outputs = { - self, nixpkgs, home-manager, ... @@ -57,8 +56,13 @@ } ) systems); + + mkLib = system: let + pkgs = import nixpkgs {inherit system;}; + in + nixpkgs.lib.extend (_: lib: import ./lib {inherit lib pkgs;}); mkSystem = hostDir: system: let - lib = nixpkgs.lib.extend (_: _: self.lib); + lib = mkLib system; in lib.nixosSystem { inherit system; @@ -71,7 +75,7 @@ }; mkHome = hostDir: system: let hostModule = mkSystem hostDir system; - lib = nixpkgs.lib.extend (_: _: self.lib // home-manager.lib); + lib = (mkLib system) // home-manager.lib; in home-manager.lib.homeManagerConfiguration { inherit (hostModule) pkgs; @@ -101,10 +105,6 @@ kagamine = mkHome ./hosts/work "x86_64-linux"; }; - lib = import ./lib { - inherit (nixpkgs) lib; - }; - packages = perSystem ( pkgs: system: import ./pkgs { diff --git a/hosts/kaworu/default.nix b/hosts/kaworu/default.nix index 9a7effd..0a9e573 100644 --- a/hosts/kaworu/default.nix +++ b/hosts/kaworu/default.nix @@ -27,7 +27,7 @@ hyprland.enable = true; }; login = { - ly.enable = true; + nwg.enable = true; }; gaming = { enable = true; diff --git a/hosts/shinji/default.nix b/hosts/shinji/default.nix index e7b832a..e8604ff 100644 --- a/hosts/shinji/default.nix +++ b/hosts/shinji/default.nix @@ -61,7 +61,7 @@ sway.enable = true; }; login = { - ly.enable = true; + nwg.enable = true; }; development = { c.enable = true; diff --git a/lib/default.nix b/lib/default.nix index 2842af4..93b7cdc 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -1,8 +1,12 @@ -{lib}: let - callLibs = file: import file {inherit lib;}; +{ + lib, + pkgs, +}: let + callLibs = file: args: import file ({inherit lib;} // args); in { - colors = callLibs ./colors.nix; - files = callLibs ./files.nix; - home = callLibs ./home.nix; - monitors = callLibs ./monitors.nix; + colors = callLibs ./colors.nix {}; + files = callLibs ./files.nix {}; + home = callLibs ./home.nix {}; + monitors = callLibs ./monitors.nix {}; + template = callLibs ./template.nix {inherit pkgs;}; } diff --git a/lib/template.nix b/lib/template.nix new file mode 100644 index 0000000..5beb22a --- /dev/null +++ b/lib/template.nix @@ -0,0 +1,26 @@ +{ + lib, + pkgs, +}: { + mustache = templateFile: data: let + fileName = baseNameOf templateFile; + drvName = lib.strings.removeSuffix ".mustache" fileName; + in + pkgs.stdenv.mkDerivation { + name = drvName; + nativeBuildInputs = with pkgs; [mustache-go]; + + passAsFile = ["jsonData"]; + jsonData = builtins.toJSON data; + + dontUnpack = true; + + buildPhase = '' + mustache "$jsonDataPath" "${templateFile}" > rendered_config + ''; + + installPhase = '' + cp rendered_config $out + ''; + }; +} diff --git a/options.nix b/options.nix index 66c0436..b1b75fc 100644 --- a/options.nix +++ b/options.nix @@ -498,6 +498,7 @@ in { # login = { ly.enable = mkEnableOption "Install the ly display manager."; + nwg.enable = mkEnableOption "Enable the nwg-hello greetd greeter"; greetd = { enable = mkEnableOption "Enable the greetd login manager."; session = mkOption { diff --git a/system/login/default.nix b/system/login/default.nix index befb915..71f4622 100644 --- a/system/login/default.nix +++ b/system/login/default.nix @@ -1,5 +1,6 @@ _: { imports = [ + ./nwg ./greetd.nix ./ly.nix ]; diff --git a/system/login/greetd.nix b/system/login/greetd.nix index 74ab666..cb7290b 100644 --- a/system/login/greetd.nix +++ b/system/login/greetd.nix @@ -9,16 +9,12 @@ in { config = mkIf cfg.enable { services.greetd = { enable = true; - restart = false; - settings = let - session = { + settings = { + terminal.vt = 1; + default_session = { command = cfg.session; - user = config.user; + user = "greeter"; }; - in { - terminal.vt = 1; - default_session = session; - initial_session = session; }; }; }; diff --git a/system/login/nwg/default.nix b/system/login/nwg/default.nix new file mode 100644 index 0000000..0038e48 --- /dev/null +++ b/system/login/nwg/default.nix @@ -0,0 +1,31 @@ +{ + config, + lib, + pkgs, + ... +}: let + inherit (lib) mkIf; + cfg = config.login.nwg; + + nwg-style = lib.template.mustache ./nwg-hello.css.mustache config.theme; + nwg-command = "${pkgs.nwg-hello}/bin/nwg-hello --config ${./nwg-hello.json} --stylesheet ${nwg-style}"; + + hyprland-config = pkgs.writeText "hyprland.conf" '' + monitor=,preferred,auto,1 + bind = ALT, Q, killactive, + misc { + disable_hyprland_logo = true + } + animations { + enabled = false + } + exec-once = ${nwg-command}; hyprctl dispatch exit + ''; +in { + config = mkIf cfg.enable { + login.greetd = { + enable = true; + session = "${pkgs.hyprland}/bin/start-hyprland -- --config ${hyprland-config}"; + }; + }; +} diff --git a/system/login/nwg/nwg-hello.css.mustache b/system/login/nwg/nwg-hello.css.mustache new file mode 100644 index 0000000..a25e630 --- /dev/null +++ b/system/login/nwg/nwg-hello.css.mustache @@ -0,0 +1,80 @@ +window { + background-image: url("{{wallpaper}}"); + background-size: auto 100% +} + +#form-wrapper { + background-color: #{{colors.surface}}; +} + +* { + font-family: "{{font.header}}"; + font-weight: bold; + color: #{{colors.text}}; + text-shadow: none; +} + +entry, +button { + background: #{{colors.overlay}}; + border-radius: 18px; + padding: 12px; +} + +popup { + background: transparent; +} + +menu { + background: #{{colors.base}}; + border-radius: 4px; + padding: 4px; +} + +menuitem { + border-radius: 4px; +} + +menuitem:hover, +menuitem:selected { + background: #{{colors.overlay}}; +} + +entry, +entry:focus, +button, +button:focus { + border: transparent; + outline: none; + box-shadow: none; +} + +entry { + padding: 7px 12px; +} + +button:hover { + background-color: #{{colors.overlay}}; +} + +check { + border: 1px solid #{{colors.overlay}}; + background: transparent; +} + +check:checked { + background: transparent; +} + +#power-button, +#welcome-label { + opacity: 0; +} + +#clock-label { + font-size: 130px; +} + +#date-label { + font-size: 30px; +} diff --git a/system/login/nwg/nwg-hello.json b/system/login/nwg/nwg-hello.json new file mode 100644 index 0000000..e522891 --- /dev/null +++ b/system/login/nwg/nwg-hello.json @@ -0,0 +1,16 @@ +{ + "session_dirs": [ + "/run/current-system/sw/share/wayland-sessions", + "/run/current-system/sw/share/xsessions" + ], + "cmd-sleep": "true", + "cmd-reboot": "true", + "cmd-poweroff": "true", + "gtk-theme": "Adwaita", + "prefer-dark-theme": false, + "time-format": "%H:%M", + "date-format": "%A, %B %d", + "avatar-show": true, + "avatar-border-width": 0, + "avatar-circle": true +} |