diff --git a/modules/users/default.nix b/modules/users/default.nix index ef07303..308304c 100644 --- a/modules/users/default.nix +++ b/modules/users/default.nix @@ -41,8 +41,8 @@ in { # Import home manager - # Import system configuration setup - # ./system.nix + # Import system wide configuration required for user modules + ./systemwide/waylock.nix ]; options = { diff --git a/modules/users/modules/desktop/lock-screen/waylock.nix b/modules/users/modules/desktop/lock-screen/waylock.nix index 2f0f20b..3539fb7 100644 --- a/modules/users/modules/desktop/lock-screen/waylock.nix +++ b/modules/users/modules/desktop/lock-screen/waylock.nix @@ -6,17 +6,9 @@ let in { options.modules.waylock = { enable = mkEnableOption "waylock"; - system = mkOption { - type = types.attrsOf types.anything; - description = "System wide configuration to apply if module is enabled"; - }; }; config = { - modules.waylock.system = mkForce { - security.pam.services.waylock = {}; - }; - home.packages = mkIf cfg.enable (with pkgs; [ waylock ]); diff --git a/modules/users/system.nix b/modules/users/system.nix deleted file mode 100644 index 9708505..0000000 --- a/modules/users/system.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ lib, config, pkgs, ... }: - -with lib; -let - users = config.home-manager.users; - allModules = flatten (map (user: (attrValues user.modules)) (attrValues users)); - modules = filter (module: module?system && module?enable) allModules; - configs = map (module: module.system) modules; - combined = (foldl (a: b: recursiveUpdate a b) {} configs); -in { - # Add the combined systemwide config required by the user modules. - config = combined; -} \ No newline at end of file diff --git a/modules/users/systemwide/waylock.nix b/modules/users/systemwide/waylock.nix new file mode 100644 index 0000000..c683175 --- /dev/null +++ b/modules/users/systemwide/waylock.nix @@ -0,0 +1,10 @@ +{ lib, config, pkgs, ... }: + +with lib; +let + enabled = any (user: user.modules.waylock.enable) (attrValues config.home-manager.users); +in { + config = mkIf enabled { + security.pam.services.waylock = {}; + }; +} \ No newline at end of file