Fixed system wide configuration system for user specific modules
This commit is contained in:
parent
1b4f8911fd
commit
f80047be52
|
@ -41,8 +41,8 @@ in {
|
|||
# Import home manager
|
||||
<home-manager/nixos>
|
||||
|
||||
# Import system configuration setup
|
||||
# ./system.nix
|
||||
# Import system wide configuration required for user modules
|
||||
./systemwide/waylock.nix
|
||||
];
|
||||
|
||||
options = {
|
||||
|
|
|
@ -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
|
||||
]);
|
||||
|
|
|
@ -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;
|
||||
}
|
|
@ -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 = {};
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue