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
./network
./terminal
./mainUser.nix
];
}

View file

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

View file

@ -48,6 +48,8 @@
components.network.enable = true;
components.network.wifi.enable = false;
services.printing.enable = false;
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
boot.tmpOnTmpfs = true; # make /tmp a tmpfs (performance!)
@ -89,14 +91,6 @@
# 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.network.enable = true;
components.network.wifi.enable = true;
components.mainUser.enable = true;
services.nginx.enable = true;

View file

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

View file

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

View file

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

View file

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