moved mainUser to components

feature/nixinite
Ingolf Wagner 2023-06-01 14:02:57 +02:00
parent 4bee8a47ae
commit 922a5a66e2
Signed by: palo
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,19 +245,20 @@ in
lib.concatStringsSep "\n" extraRules;
# create users
users.users = flip mapAttrs cfg.configList (name: config: {
home = config.home;
createHome = true;
initialPassword = "${name}-browser";
shell = pkgs.bashInteractive;
isNormalUser = true;
group = "users";
# enable video usage
extraGroups = if config.gpu then [ "video" "audio" "pipewire" ] else [ "audio" "pipewire" ];
});
# add groups to mainUser
system.custom.mainUser.extraGroups = builtins.attrNames cfg.configList;
users.users = flip mapAttrs cfg.configList
(name: config: {
home = config.home;
createHome = true;
initialPassword = "${name}-browser";
shell = pkgs.bashInteractive;
isNormalUser = true;
group = "users";
# enable video usage
extraGroups = [ "audio" "pipewire" ] ++ (if config.gpu then [ "video" ] else [ ]);
}) // {
# add groups to mainUser
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
];