From cd7b686352dc0500dbbea7116b54abec883efdeb Mon Sep 17 00:00:00 2001 From: Daniel Thwaites Date: Mon, 25 Jul 2022 20:05:15 +0100 Subject: [PATCH] Install Swaylock settings using Home Manager :building_construction: Hoping to fix: https://github.com/danth/stylix/issues/8#issuecomment-1194459148 --- modules/swaylock.nix | 65 ++++++++++++++++++++++---------------------- 1 file changed, 32 insertions(+), 33 deletions(-) diff --git a/modules/swaylock.nix b/modules/swaylock.nix index 398034a9..591f2f84 100644 --- a/modules/swaylock.nix +++ b/modules/swaylock.nix @@ -10,37 +10,36 @@ let negative = base08-hex; in { - # mkAfter is important for those who use nixpkgs-wayland, - # as otherwise it could overwrite our wrapper - nixpkgs.overlays = lib.mkAfter [ - (final: prev: { - swaylock = final.writeShellScriptBin "swaylock" '' - exec ${prev.swaylock}/bin/swaylock \ - --image ${config.stylix.image} \ - --scaling fill \ - --inside-color ${inside} \ - --inside-clear-color ${inside} \ - --inside-caps-lock-color ${inside} \ - --inside-ver-color ${inside} \ - --inside-wrong-color ${inside} \ - --key-hl-color ${positive} \ - --layout-bg-color ${inside} \ - --layout-border-color ${ring} \ - --layout-text-color ${text} \ - --line-uses-inside \ - --ring-color ${ring} \ - --ring-clear-color ${negative} \ - --ring-caps-lock-color ${ring} \ - --ring-ver-color ${positive} \ - --ring-wrong-color ${negative} \ - --separator-color 00000000 \ - --text-color ${text} \ - --text-clear-color ${text} \ - --text-caps-lock-color ${text} \ - --text-ver-color ${text} \ - --text-wrong-color ${text} \ - "$@" - ''; - }) - ]; + home-manager.sharedModules = [( + { options, ... }: + { + # See https://github.com/danth/stylix/issues/8#issuecomment-1194484544 + # This check can be removed when programs.swaylock is in a stable release + programs.swaylock.settings = lib.mkIf (options.programs ? swaylock) { + image = config.stylix.image; + scaling = "fill"; + inside-color = inside; + inside-clear-color = inside; + inside-caps-lock-color = inside; + inside-ver-color = inside; + inside-wrong-color = inside; + key-hl-color = positive; + layout-bg-color = inside; + layout-border-color = ring; + layout-text-color = text; + line-uses-inside = true; + ring-color = ring; + ring-clear-color = negative; + ring-caps-lock-color = ring; + ring-ver-color = positive; + ring-wrong-color = negative; + separator-color = "00000000"; + text-color = text; + text-clear-color = text; + text-caps-lock-color = text; + text-ver-color = text; + text-wrong-color = text; + }; + } + )]; }