diff --git a/nixos/components/default.nix b/nixos/components/default.nix index 7302d30..ec9bf17 100644 --- a/nixos/components/default.nix +++ b/nixos/components/default.nix @@ -3,5 +3,6 @@ ./gui ./network ./terminal + ./mainUser.nix ]; } diff --git a/nixos/modules/system/mainUser.nix b/nixos/components/mainUser.nix similarity index 83% rename from nixos/modules/system/mainUser.nix rename to nixos/components/mainUser.nix index 34da7c6..6b26a31 100644 --- a/nixos/modules/system/mainUser.nix +++ b/nixos/components/mainUser.nix @@ -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; }; - }; - - - }; } diff --git a/nixos/machines/chungus/configuration.nix b/nixos/machines/chungus/configuration.nix index 20bc3bb..5866f22 100644 --- a/nixos/machines/chungus/configuration.nix +++ b/nixos/machines/chungus/configuration.nix @@ -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" ]; } diff --git a/nixos/machines/cream/configuration.nix b/nixos/machines/cream/configuration.nix index 271d505..ad8c2c3 100644 --- a/nixos/machines/cream/configuration.nix +++ b/nixos/machines/cream/configuration.nix @@ -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; diff --git a/nixos/machines/robi/configuration.nix b/nixos/machines/robi/configuration.nix index 28b549a..4f2edb8 100644 --- a/nixos/machines/robi/configuration.nix +++ b/nixos/machines/robi/configuration.nix @@ -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 diff --git a/nixos/modules/default.nix b/nixos/modules/default.nix index 0044ec5..4ef1ac5 100644 --- a/nixos/modules/default.nix +++ b/nixos/modules/default.nix @@ -35,7 +35,7 @@ #./system/audio.nix #./system/bluetooth.nix ./system/font.nix - ./system/mainUser.nix + #./system/mainUser.nix ./system/on-failure.nix ]; diff --git a/nixos/modules/programs/browser.nix b/nixos/modules/programs/browser.nix index b12d578..8331dd4 100644 --- a/nixos/modules/programs/browser.nix +++ b/nixos/modules/programs/browser.nix @@ -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 diff --git a/nixos/system/desktop/default.nix b/nixos/system/desktop/default.nix index b0282be..134b6e7 100644 --- a/nixos/system/desktop/default.nix +++ b/nixos/system/desktop/default.nix @@ -10,7 +10,7 @@ ./mail-stuff.nix ./packages.nix ./size.nix - ./user.nix + #./user.nix ./yubikey.nix ];