abstract user config

This commit is contained in:
Daylin Morgan 2024-01-28 13:09:34 -06:00
parent b07f50a77a
commit 06ecfb4310
Signed by: daylin
GPG key ID: C1E52E7DD81DF79F
6 changed files with 47 additions and 23 deletions

View file

@ -30,12 +30,9 @@
security.sudo.wheelNeedsPassword = false; security.sudo.wheelNeedsPassword = false;
users.extraUsers = { users.users = {
daylin = { daylin = {
shell = pkgs.zsh; extraGroups = ["docker"];
isNormalUser = true;
extraGroups = ["wheel" "docker"];
initialPassword = "nix";
}; };
git = { git = {
isNormalUser = true; isNormalUser = true;

View file

@ -1,5 +1,5 @@
{...}: { {...}: {
users.motd = builtins.readFile ./rune; users.motdFile = ./rune;
swapDevices = [ swapDevices = [
{ {

View file

@ -13,14 +13,5 @@
nix-ld nix-ld
]; ];
users = { users.users.daylin.extraGroups = ["docker"];
extraUsers = {
daylin = {
shell = pkgs.zsh;
isNormalUser = true;
extraGroups = ["wheel" "docker" "networkmanager"];
initialPassword = "nix";
};
};
};
} }

View file

@ -43,13 +43,19 @@
enableSSHSupport = true; enableSSHSupport = true;
}; };
users.users.daylin = { users.users.daylin.extraGroups = [
isNormalUser = true;
shell = pkgs.zsh;
extraGroups = [
"wheel" # sudo
"video" # backlight control via light "video" # backlight control via light
"audio" "audio"
]; ];
};
# users.users.daylin = {
# isNormalUser = true;
# shell = pkgs.zsh;
# extraGroups = [
# "wheel" # sudo
# "video" # backlight control via light
# "audio"
# ];
# };
} }

View file

@ -1,5 +1,6 @@
{inputs, ...}: { {inputs, ...}: {
imports = with inputs.self.nixosModules; [ imports = with inputs.self.nixosModules; [
users
nix nix
cli cli
dev dev

29
modules/users/default.nix Normal file
View file

@ -0,0 +1,29 @@
{
nixpkgs,
config,
lib,
pkgs,
...
}: let
inherit (lib) mkOption mkIf types;
cfg = config.users.defaultUser;
in {
options.users.defaultUser = mkOption {
default = true;
type = types.bool;
description = ''
include default user "daylin"
'';
};
config = mkIf cfg {
users.users.daylin = {
isNormalUser = true;
shell = pkgs.zsh;
extraGroups = [
"wheel" # sudo
];
initialPassword = "nix";
};
};
}