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;
users.extraUsers = {
users.users = {
daylin = {
shell = pkgs.zsh;
isNormalUser = true;
extraGroups = ["wheel" "docker"];
initialPassword = "nix";
extraGroups = ["docker"];
};
git = {
isNormalUser = true;

View file

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

View file

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

View file

@ -43,13 +43,19 @@
enableSSHSupport = true;
};
users.users.daylin = {
isNormalUser = true;
shell = pkgs.zsh;
extraGroups = [
"wheel" # sudo
users.users.daylin.extraGroups = [
"video" # backlight control via light
"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, ...}: {
imports = with inputs.self.nixosModules; [
users
nix
cli
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";
};
};
}