From 8902317d7f6d20361d96212a5e41621e90df8b67 Mon Sep 17 00:00:00 2001 From: Alejandro Soto Date: Sat, 7 Jan 2023 00:56:53 -0600 Subject: env/users: move user list out of sys/users.nix --- env/default.nix | 6 ++++++ env/users/default.nix | 25 +++++++++++++++++++++++++ env/users/users.nix | 1 + sys/default.nix | 1 + sys/users.nix | 26 ++++++++------------------ 5 files changed, 41 insertions(+), 18 deletions(-) create mode 100644 env/default.nix create mode 100644 env/users/default.nix create mode 100644 env/users/users.nix diff --git a/env/default.nix b/env/default.nix new file mode 100644 index 0000000..0290518 --- /dev/null +++ b/env/default.nix @@ -0,0 +1,6 @@ +{ lib, ... }: +with lib; { + imports = [ + ./users + ]; +} diff --git a/env/users/default.nix b/env/users/default.nix new file mode 100644 index 0000000..60ee8d8 --- /dev/null +++ b/env/users/default.nix @@ -0,0 +1,25 @@ +{ lib, ... }: +with lib; { + options.local.users = with types; mkOption { + default = { }; + + type = attrsOf (submodule { + options = { + uid = mkOption { + type = int; + }; + + gid = mkOption { + type = int; + }; + + groups = mkOption { + type = listOf str; + default = [ ]; + }; + }; + }); + }; + + config.local.users = import ./users.nix; +} diff --git a/env/users/users.nix b/env/users/users.nix new file mode 100644 index 0000000..1bb3788 --- /dev/null +++ b/env/users/users.nix @@ -0,0 +1 @@ +# This file has been lustrated. diff --git a/sys/default.nix b/sys/default.nix index 3224c40..f19bc0a 100644 --- a/sys/default.nix +++ b/sys/default.nix @@ -1,6 +1,7 @@ { lib, config, pkgs, ... }: with lib; { imports = [ + ../env ./auth.nix ./boot.nix ./fs diff --git a/sys/users.nix b/sys/users.nix index d446276..e5ebc8d 100644 --- a/sys/users.nix +++ b/sys/users.nix @@ -25,27 +25,17 @@ in environment.pathsToLink = [ "/share/zsh" ]; - users.users = { - ale = { + users.users = mapAttrs + (username: user: { + inherit (user) uid; isNormalUser = true; - uid = 1000; - group = "ale"; - extraGroups = [ "users" "wheel" "adbusers" ]; + group = username; + extraGroups = [ "users" ] ++ user.groups; shell = pkgs.zsh; - }; + }) + cfg.users; - tutorias = { - isNormalUser = true; - uid = 1004; - group = "tutorias"; - extraGroups = [ "users" ]; - shell = pkgs.zsh; - }; - }; - - users.groups = { - ale.gid = 1001; - tutorias.gid = 1007; + users.groups = mapAttrs (_: user: { inherit (user) gid; }) cfg.users // { adbusers.gid = 1008; }; }; -- cgit v1.2.3