user factory
This commit is contained in:
@@ -1,9 +1,7 @@
|
|||||||
{ inputs, ... }:
|
{ inputs, ... }:
|
||||||
{
|
{
|
||||||
|
|
||||||
imports = [
|
imports = [
|
||||||
# https://github.com/vic/flake-file/tree/main/modules/dendritic
|
# https://github.com/vic/flake-file/tree/main/modules/dendritic
|
||||||
inputs.flake-file.flakeModules.dendritic
|
inputs.flake-file.flakeModules.dendritic
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
28
modules/nix-tools/user.nix
Normal file
28
modules/nix-tools/user.nix
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
# Lifted from:
|
||||||
|
# https://github.com/Doc-Steve/dendritic-design-with-flake-parts/blob/69edacdb5a4a6ca71d649bb8eb62cf8c630c8627/modules/users/bob%20%5BNDn%5D/bob.nix#L8
|
||||||
|
{ self, ... }:
|
||||||
|
{
|
||||||
|
config.flake.factory.user = username: isAdmin: {
|
||||||
|
|
||||||
|
nixos."${username}" = { lib, pkgs, ... }: {
|
||||||
|
users.users."${username}" = {
|
||||||
|
isNormalUser = true;
|
||||||
|
home = "/home/${username}";
|
||||||
|
extraGroups = lib.optionals isAdmin [
|
||||||
|
"input"
|
||||||
|
"networkmanager"
|
||||||
|
"wheel"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
home-manager.users."${username}" = {
|
||||||
|
imports = [
|
||||||
|
self.modules.homeManager."${username}"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
homeManager."${username}" = {
|
||||||
|
home.username = "${username}";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -9,6 +9,8 @@
|
|||||||
system.stateVersion = "25.11";
|
system.stateVersion = "25.11";
|
||||||
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
||||||
environment.systemPackages = with pkgs; [ git zsh ];
|
environment.systemPackages = with pkgs; [ git zsh ];
|
||||||
|
|
||||||
|
security.sudo-rs.enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
# Generic bootstrapping lxc, use a specific host file for more
|
# Generic bootstrapping lxc, use a specific host file for more
|
||||||
|
|||||||
@@ -16,10 +16,12 @@ in
|
|||||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMOkGLo4N/L3RYvaIZ1FmePlxa1HK0fMciZxKtRhN58F root@janus"
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMOkGLo4N/L3RYvaIZ1FmePlxa1HK0fMciZxKtRhN58F root@janus"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
|
||||||
|
|
||||||
|
modules = lib.mkMerge [
|
||||||
|
(inputs.self.factory.user username true)
|
||||||
|
{
|
||||||
# https://github.com/Doc-Steve/dendritic-design-with-flake-parts/wiki/Dendritic_Aspects#multi-context-aspect
|
# https://github.com/Doc-Steve/dendritic-design-with-flake-parts/wiki/Dendritic_Aspects#multi-context-aspect
|
||||||
flake.modules.nixos."${username}" = { pkgs, ... }: {
|
nixos."${username}" = { pkgs, ... }: {
|
||||||
home-manager.users."${username}" = {
|
home-manager.users."${username}" = {
|
||||||
imports = [
|
imports = [
|
||||||
inputs.self.modules.homeManager."${username}"
|
inputs.self.modules.homeManager."${username}"
|
||||||
@@ -27,16 +29,12 @@ in
|
|||||||
};
|
};
|
||||||
users.users."${username}" = {
|
users.users."${username}" = {
|
||||||
isNormalUser = true;
|
isNormalUser = true;
|
||||||
shell = pkgs.zsh;
|
|
||||||
openssh.authorizedKeys.keys = inputs.self.meta.users."${username}".authorizedKeys;
|
openssh.authorizedKeys.keys = inputs.self.meta.users."${username}".authorizedKeys;
|
||||||
extraGroups = [ "docker "];
|
extraGroups = [ "docker" ];
|
||||||
};
|
};
|
||||||
programs.zsh.enable = true;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
flake.modules.homeManager."${username}" = {
|
homeManager."${username}" = {
|
||||||
home.username = "${username}";
|
|
||||||
home.homeDirectory = "/home/${username}";
|
|
||||||
home.stateVersion = "25.11";
|
home.stateVersion = "25.11";
|
||||||
xdg.enable = true;
|
xdg.enable = true;
|
||||||
|
|
||||||
@@ -44,11 +42,14 @@ in
|
|||||||
programs.git.settings.user.email = "32917998+jsl12@users.noreply.github.com";
|
programs.git.settings.user.email = "32917998+jsl12@users.noreply.github.com";
|
||||||
|
|
||||||
imports = with inputs.self.modules.homeManager; [
|
imports = with inputs.self.modules.homeManager; [
|
||||||
base
|
# base
|
||||||
# docker
|
# docker
|
||||||
# resticprofile
|
# resticprofile
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
# This is the base homeConfiguration for the john user that will be used if no other
|
# This is the base homeConfiguration for the john user that will be used if no other
|
||||||
flake.homeConfigurations."${username}" = inputs.home-manager.lib.homeManagerConfiguration {
|
flake.homeConfigurations."${username}" = inputs.home-manager.lib.homeManagerConfiguration {
|
||||||
|
|||||||
Reference in New Issue
Block a user