mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-01-21 16:21:34 +01:00
Manage users with the option system
This commit is contained in:
parent
9386dc29d7
commit
d7070b6fb5
15 changed files with 79 additions and 71 deletions
61
modules/system/users/seb.nix
Normal file
61
modules/system/users/seb.nix
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
{
|
||||
config,
|
||||
self,
|
||||
inputs,
|
||||
pkgs,
|
||||
pkgs-unstable,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.custom.users.seb;
|
||||
in
|
||||
{
|
||||
imports = [ inputs.home-manager.nixosModules.home-manager ];
|
||||
|
||||
options.custom.users.seb = {
|
||||
enable = lib.mkEnableOption "";
|
||||
zsh.enable = lib.mkEnableOption "";
|
||||
homeManager = {
|
||||
enable = lib.mkEnableOption "";
|
||||
configPath = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.path;
|
||||
default = [
|
||||
"${self}/users/shared-home.nix"
|
||||
"${self}/users/seb/home.nix"
|
||||
"${self}/users/seb/@${config.networking.hostName}/home.nix"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable (
|
||||
lib.mkMerge [
|
||||
{
|
||||
sops.secrets."seb-password".neededForUsers = true;
|
||||
|
||||
users.users.seb = {
|
||||
isNormalUser = true;
|
||||
description = "Sebastian Stork";
|
||||
hashedPasswordFile = config.sops.secrets."seb-password".path;
|
||||
extraGroups = [ "wheel" ];
|
||||
shell = lib.mkIf cfg.zsh.enable pkgs.zsh;
|
||||
};
|
||||
|
||||
programs.zsh.enable = lib.mkIf cfg.zsh.enable true;
|
||||
}
|
||||
|
||||
(lib.mkIf cfg.homeManager.enable {
|
||||
home-manager = {
|
||||
useGlobalPkgs = true;
|
||||
useUserPackages = true;
|
||||
extraSpecialArgs = {
|
||||
inherit inputs self pkgs-unstable;
|
||||
};
|
||||
|
||||
users.seb.imports = cfg.homeManager.configPath;
|
||||
};
|
||||
})
|
||||
]
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue