moved mainUser to components

This commit is contained in:
Ingolf Wagner 2023-06-01 14:02:57 +02:00
parent 4bee8a47ae
commit 922a5a66e2
No known key found for this signature in database
GPG key ID: 76BF5F1928B9618B
8 changed files with 29 additions and 39 deletions

View file

@ -3,5 +3,6 @@
./gui ./gui
./network ./network
./terminal ./terminal
./mainUser.nix
]; ];
} }

View file

@ -1,10 +1,9 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
with lib; with lib;
with types;
let let
cfg = config.system.custom.mainUser; cfg = config.components.mainUser;
dockerGroup = dockerGroup =
if (config.virtualisation.docker.enable) then [ "docker" ] else [ ]; if (config.virtualisation.docker.enable) then [ "docker" ] else [ ];
@ -18,19 +17,20 @@ let
in in
{ {
options.system.custom.mainUser = { options.components.mainUser = {
enable = mkEnableOption "enable mainUser for a desktop system"; enable = mkEnableOption "enable mainUser for a system";
userName = mkOption { userName = mkOption {
type = with types; str; type = str;
default = "palo";
description = '' description = ''
name of the main user name of the main user
''; '';
}; };
uid = mkOption { uid = mkOption {
type = with types; int; type = int;
default = 1337; default = 1337;
description = '' description = ''
uid of main user uid of main user
@ -39,7 +39,7 @@ in
extraGroups = mkOption { extraGroups = mkOption {
default = [ ]; default = [ ];
type = with types; listOf str; type = listOf str;
description = '' description = ''
list of groups the main user should also be in list of groups the main user should also be in
''; '';
@ -47,7 +47,7 @@ in
authorizedKeyFiles = mkOption { authorizedKeyFiles = mkOption {
default = [ ]; default = [ ];
type = with types; listOf str; type = listOf str;
description = '' description = ''
list of keys allowed to login as this user list of keys allowed to login as this user
''; '';
@ -78,10 +78,6 @@ in
group = config.users.groups.mainUser.name; group = config.users.groups.mainUser.name;
}; };
}; };
}; };
} }

View file

@ -48,6 +48,8 @@
components.network.enable = true; components.network.enable = true;
components.network.wifi.enable = false; components.network.wifi.enable = false;
services.printing.enable = false;
boot.loader.systemd-boot.enable = true; boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true; boot.loader.efi.canTouchEfiVariables = true;
boot.tmpOnTmpfs = true; # make /tmp a tmpfs (performance!) boot.tmpOnTmpfs = true; # make /tmp a tmpfs (performance!)
@ -89,14 +91,6 @@
# balance = false; # balance = false;
#}; #};
services.printing.enable = false;
#home-manager.users.mailUser.home.stateVersion = "22.11";
system.custom.mainUser = {
enable = true;
userName = "palo";
};
users.users.mainUser.extraGroups = [ "media" ];
} }

View file

@ -29,6 +29,7 @@
components.terminal.enable = true; components.terminal.enable = true;
components.network.enable = true; components.network.enable = true;
components.network.wifi.enable = true; components.network.wifi.enable = true;
components.mainUser.enable = true;
services.nginx.enable = true; services.nginx.enable = true;

View file

@ -61,9 +61,6 @@
components.network.enable = true; components.network.enable = true;
components.network.wifi.enable = false; components.network.wifi.enable = false;
system.custom.mainUser.enable = true;
system.custom.mainUser.userName = "palo";
# 2 hours = 2 * 60 * 60 = 7200 seconds # 2 hours = 2 * 60 * 60 = 7200 seconds
#services.netdata.config.global.history = 7200; #services.netdata.config.global.history = 7200;
# 4 hours = 4 * 60 * 60 = 14440 seconds # 4 hours = 4 * 60 * 60 = 14440 seconds

View file

@ -35,7 +35,7 @@
#./system/audio.nix #./system/audio.nix
#./system/bluetooth.nix #./system/bluetooth.nix
./system/font.nix ./system/font.nix
./system/mainUser.nix #./system/mainUser.nix
./system/on-failure.nix ./system/on-failure.nix
]; ];

View file

@ -245,19 +245,20 @@ in
lib.concatStringsSep "\n" extraRules; lib.concatStringsSep "\n" extraRules;
# create users # create users
users.users = flip mapAttrs cfg.configList (name: config: { users.users = flip mapAttrs cfg.configList
home = config.home; (name: config: {
createHome = true; home = config.home;
initialPassword = "${name}-browser"; createHome = true;
shell = pkgs.bashInteractive; initialPassword = "${name}-browser";
isNormalUser = true; shell = pkgs.bashInteractive;
group = "users"; isNormalUser = true;
# enable video usage group = "users";
extraGroups = if config.gpu then [ "video" "audio" "pipewire" ] else [ "audio" "pipewire" ]; # enable video usage
}); extraGroups = [ "audio" "pipewire" ] ++ (if config.gpu then [ "video" ] else [ ]);
}) // {
# add groups to mainUser # add groups to mainUser
system.custom.mainUser.extraGroups = builtins.attrNames cfg.configList; mainUser.extraGroups = builtins.attrNames cfg.configList;
};
environment.systemPackages = [ browserSelect (desktopFile browserSelect) ] environment.systemPackages = [ browserSelect (desktopFile browserSelect) ]
++ browserExecutableList ++ browserExecutableList

View file

@ -10,7 +10,7 @@
./mail-stuff.nix ./mail-stuff.nix
./packages.nix ./packages.nix
./size.nix ./size.nix
./user.nix #./user.nix
./yubikey.nix ./yubikey.nix
]; ];