From 278bae388bf22a806787064b9492a03581ac33f4 Mon Sep 17 00:00:00 2001 From: 514fpv Date: Wed, 14 Feb 2024 13:04:17 +0800 Subject: [PATCH] fix(swaylock): isolate from sway --- home/sway/home.nix | 20 -------------------- home/sway/nixos.nix | 1 - home/swaylock/home.nix | 24 ++++++++++++++++++++++++ home/swaylock/nixos.nix | 8 ++++++++ 4 files changed, 32 insertions(+), 21 deletions(-) create mode 100644 home/swaylock/home.nix create mode 100644 home/swaylock/nixos.nix diff --git a/home/sway/home.nix b/home/sway/home.nix index 139995cd..0f389fe4 100644 --- a/home/sway/home.nix +++ b/home/sway/home.nix @@ -45,24 +45,4 @@ output."*".bg = "#000000 solid_color"; }; }; - - programs.swaylock = { - enable = true; - package = pkgs.swaylock-effects; - settings = { - indicator-caps-lock = true; - font-size = 20; - ignore-empty-password = true; - show-failed-attempts = true; - color = mkDefault "#00000000"; - - # Ring - indicator-radius = 115; - - # Swaylock-effects specific settings - clock = true; - timestr = "%r"; - grace = 2; - }; - }; } diff --git a/home/sway/nixos.nix b/home/sway/nixos.nix index 3817720f..f5b2bbdc 100644 --- a/home/sway/nixos.nix +++ b/home/sway/nixos.nix @@ -33,6 +33,5 @@ in mkIf gui { } // { providedSessions = [ pkgs.sway.meta.mainProgram ]; }) ]; - security.pam.services.swaylock = { }; programs.light.enable = true; } diff --git a/home/swaylock/home.nix b/home/swaylock/home.nix new file mode 100644 index 00000000..25a72c88 --- /dev/null +++ b/home/swaylock/home.nix @@ -0,0 +1,24 @@ +{ pkgs +, lib +, config +, ... }: with lib; mkIf config.passthrough.gui { + programs.swaylock = { + enable = true; + package = pkgs.swaylock-effects; + settings = { + indicator-caps-lock = true; + font-size = 20; + ignore-empty-password = true; + show-failed-attempts = true; + color = mkDefault "#00000000"; + + # Ring + indicator-radius = 115; + + # Swaylock-effects specific settings + clock = true; + timestr = "%r"; + grace = 2; + }; + }; +} diff --git a/home/swaylock/nixos.nix b/home/swaylock/nixos.nix new file mode 100644 index 00000000..3891904b --- /dev/null +++ b/home/swaylock/nixos.nix @@ -0,0 +1,8 @@ +{ pkgs +, lib +, config +, ... }: with lib; let + gui = with config.global.gpu; enable && session; +in mkIf gui { + security.pam.services.swaylock = { }; +}