2019-04-13 00:05:39 +02:00
|
|
|
{ config, lib, pkgs, ... }:
|
2019-02-26 13:44:40 +01:00
|
|
|
|
2019-03-23 02:50:48 +01:00
|
|
|
with lib;
|
|
|
|
|
2019-04-13 00:05:39 +02:00
|
|
|
let
|
|
|
|
administrators = user: {
|
|
|
|
name = user.name;
|
|
|
|
value = {
|
2019-02-26 13:44:40 +01:00
|
|
|
isNormalUser = true;
|
2019-04-13 00:05:39 +02:00
|
|
|
name = user.name;
|
|
|
|
uid = user.id;
|
|
|
|
home = builtins.toPath "/home/${user.name}";
|
2019-02-26 13:44:40 +01:00
|
|
|
createHome = true;
|
2019-04-13 00:05:39 +02:00
|
|
|
description = "Administrative user ${user.name}.";
|
|
|
|
group = user.name;
|
2019-03-23 02:50:48 +01:00
|
|
|
extraGroups = [ "audio" "wheel" "network" ]
|
|
|
|
++ (if config.services.xserver.enable then [ "input" ] else [])
|
|
|
|
++ (if config.services.printing.enable then [ "cups" "lp" ] else [])
|
|
|
|
++ (if config.virtualisation.docker.enable then [ "docker"] else []);
|
2019-04-13 00:05:39 +02:00
|
|
|
shell = "${pkgs.zsh}/bin/zsh";
|
2019-08-28 15:56:19 +02:00
|
|
|
passwordFile = "${config.machine.secretPath}/${user.name}";
|
|
|
|
openssh.authorizedKeys.keyFiles = if config.services.openssh.enable then [ "${config.machine.secretPath}/${user.name}.pub" ] else [];
|
2019-02-26 13:44:40 +01:00
|
|
|
};
|
2019-04-13 00:05:39 +02:00
|
|
|
};
|
2019-03-23 02:50:48 +01:00
|
|
|
|
2019-04-13 00:05:39 +02:00
|
|
|
mkusergroup = user: {
|
|
|
|
name = user.name;
|
|
|
|
value = {
|
|
|
|
name = user.name;
|
|
|
|
gid = user.id;
|
|
|
|
members = [ user.name ];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
in {
|
|
|
|
users = {
|
|
|
|
mutableUsers = false;
|
|
|
|
users = listToAttrs (map administrators config.machine.administrators);
|
|
|
|
groups = listToAttrs (map mkusergroup config.machine.administrators);
|
2019-02-26 13:44:40 +01:00
|
|
|
};
|
|
|
|
}
|