Refactor user management functions to use inputs
Removed the `lib.nix` file and refactored various modules to utilize `inputs.self.lib` for user package and attribute management. This change enhances consistency and maintainability across the configuration files.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
{
|
||||
config,
|
||||
inputs,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
@@ -14,11 +15,9 @@
|
||||
description = "The shell to use system-wide (bash or zsh)";
|
||||
};
|
||||
config = {
|
||||
users.users = let
|
||||
userLib = import ../lib.nix { inherit lib; };
|
||||
in lib.mkMerge (map (user: {
|
||||
users.users = lib.mkMerge (map (user: {
|
||||
${user}.shell = pkgs.${config.my.shell.type};
|
||||
}) (userLib.normalizeUsers config.my.toggleUsers.shell));
|
||||
}) (inputs.self.lib.normalizeUsers config.my.toggleUsers.shell));
|
||||
programs.zsh.enable = config.my.shell.type == "zsh";
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{
|
||||
config,
|
||||
inputs,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
@@ -8,13 +9,12 @@
|
||||
options.my.shell.exercism.enable = lib.mkEnableOption "Exercism coding practice platform";
|
||||
config = lib.mkIf config.my.shell.exercism.enable {
|
||||
users.users = let
|
||||
userLib = import ../lib.nix { inherit lib; };
|
||||
packages = builtins.attrValues {
|
||||
inherit (pkgs)
|
||||
exercism # learn to code
|
||||
bats # testing system, required by Exercism
|
||||
;
|
||||
};
|
||||
in userLib.mkUserPackages config.my.toggleUsers.shell packages;
|
||||
in inputs.self.lib.mkUserPackages lib config.my.toggleUsers.shell packages;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -9,17 +9,14 @@
|
||||
options.my.shell.multimedia.enable = lib.mkEnableOption "multimedia CLI tools and codecs";
|
||||
config = lib.mkIf config.my.shell.multimedia.enable {
|
||||
sops.secrets."gallery-dl/secrets" = let
|
||||
userLib = import ../lib.nix { inherit lib; };
|
||||
# Use first user for secret ownership
|
||||
user = userLib.getFirstUser config.my.toggleUsers.shell;
|
||||
user = inputs.self.lib.getFirstUser config.my.toggleUsers.shell;
|
||||
in {
|
||||
sopsFile = ../../secrets/gallery.yaml;
|
||||
owner = user;
|
||||
mode = "0400";
|
||||
};
|
||||
home-manager.users = let
|
||||
userLib = import ../lib.nix { inherit lib; };
|
||||
in userLib.mkHomeManagerUsers config.my.toggleUsers.shell (user: {
|
||||
home-manager.users = inputs.self.lib.mkHomeManagerUsers lib config.my.toggleUsers.shell (user: {
|
||||
programs = {
|
||||
yt-dlp = {
|
||||
enable = true;
|
||||
@@ -46,7 +43,6 @@
|
||||
};
|
||||
});
|
||||
users.users = let
|
||||
userLib = import ../lib.nix { inherit lib; };
|
||||
packages = builtins.attrValues {
|
||||
inherit (pkgs)
|
||||
ffmpeg # not ffmpreg, the coolest video conversion tool!
|
||||
@@ -54,6 +50,6 @@
|
||||
ffpb # make ffmpeg encoding... a bit fun
|
||||
;
|
||||
};
|
||||
in userLib.mkUserPackages config.my.toggleUsers.shell packages;
|
||||
in inputs.self.lib.mkUserPackages lib config.my.toggleUsers.shell packages;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -11,9 +11,7 @@ in
|
||||
{
|
||||
options.my.shell.tools.enable = lib.mkEnableOption "shell tools and utilities";
|
||||
config = lib.mkIf config.my.shell.tools.enable {
|
||||
home-manager.users = let
|
||||
userLib = import ../lib.nix { inherit lib; };
|
||||
in userLib.mkHomeManagerUsers config.my.toggleUsers.shell (user: {
|
||||
home-manager.users = inputs.self.lib.mkHomeManagerUsers lib config.my.toggleUsers.shell (user: {
|
||||
programs = {
|
||||
hstr.enable = true;
|
||||
htop = {
|
||||
@@ -99,7 +97,6 @@ in
|
||||
};
|
||||
};
|
||||
users.users = let
|
||||
userLib = import ../lib.nix { inherit lib; };
|
||||
packages = builtins.attrValues {
|
||||
inherit (pkgs)
|
||||
ripgrep # modern grep
|
||||
@@ -115,7 +112,7 @@ in
|
||||
rmlint # amazing dupe finder that integrates well with BTRFS
|
||||
;
|
||||
};
|
||||
in userLib.mkUserPackages config.my.toggleUsers.shell packages;
|
||||
in inputs.self.lib.mkUserPackages lib config.my.toggleUsers.shell packages;
|
||||
environment.variables = {
|
||||
HISTFILE = "\${XDG_STATE_HOME}/bash/history";
|
||||
LESSHISTFILE = "-";
|
||||
|
||||
Reference in New Issue
Block a user