treewide: use attrs instead of list for types.loaOf options
This commit is contained in:
@@ -124,8 +124,7 @@ in {
|
||||
|
||||
environment.systemPackages = [cfg.package];
|
||||
|
||||
users.users = singleton {
|
||||
name = "apache-kafka";
|
||||
users.users.apache-kafka = {
|
||||
uid = config.ids.uids.apache-kafka;
|
||||
description = "Apache Kafka daemon user";
|
||||
home = head cfg.logDirs;
|
||||
|
||||
@@ -168,16 +168,12 @@ in
|
||||
})
|
||||
) cfg.servers;
|
||||
|
||||
users.users = [{
|
||||
uid = config.ids.uids.bepasty;
|
||||
name = user;
|
||||
group = group;
|
||||
home = default_home;
|
||||
}];
|
||||
users.users.${user} =
|
||||
{ uid = config.ids.uids.bepasty;
|
||||
group = group;
|
||||
home = default_home;
|
||||
};
|
||||
|
||||
users.groups = [{
|
||||
name = group;
|
||||
gid = config.ids.gids.bepasty;
|
||||
}];
|
||||
users.groups.${group}.gid = config.ids.gids.bepasty;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -110,11 +110,12 @@ in
|
||||
|
||||
config = mkIf config.services.cgminer.enable {
|
||||
|
||||
users.users = optionalAttrs (cfg.user == "cgminer") (singleton
|
||||
{ name = "cgminer";
|
||||
users.users = optionalAttrs (cfg.user == "cgminer") {
|
||||
cgminer = {
|
||||
uid = config.ids.uids.cgminer;
|
||||
description = "Cgminer user";
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
environment.systemPackages = [ cfg.package ];
|
||||
|
||||
|
||||
@@ -29,17 +29,14 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
users.users = singleton
|
||||
{ name = "couchpotato";
|
||||
group = "couchpotato";
|
||||
users.users.couchpotato =
|
||||
{ group = "couchpotato";
|
||||
home = "/var/lib/couchpotato/";
|
||||
description = "CouchPotato daemon user";
|
||||
uid = config.ids.uids.couchpotato;
|
||||
};
|
||||
|
||||
users.groups = singleton
|
||||
{ name = "couchpotato";
|
||||
gid = config.ids.gids.couchpotato;
|
||||
};
|
||||
users.groups.couchpotato =
|
||||
{ gid = config.ids.gids.couchpotato; };
|
||||
};
|
||||
}
|
||||
|
||||
@@ -45,18 +45,14 @@ in
|
||||
# get the command line client on system path to make some use of the service
|
||||
environment.systemPackages = [ pkgs.dict ];
|
||||
|
||||
users.users = singleton
|
||||
{ name = "dictd";
|
||||
group = "dictd";
|
||||
users.users.dictd =
|
||||
{ group = "dictd";
|
||||
description = "DICT.org dictd server";
|
||||
home = "${dictdb}/share/dictd";
|
||||
uid = config.ids.uids.dictd;
|
||||
};
|
||||
|
||||
users.groups = singleton
|
||||
{ name = "dictd";
|
||||
gid = config.ids.gids.dictd;
|
||||
};
|
||||
users.groups.dictd.gid = config.ids.gids.dictd;
|
||||
|
||||
systemd.services.dictd = {
|
||||
description = "DICT.org Dictionary Server";
|
||||
|
||||
@@ -186,8 +186,7 @@ in {
|
||||
|
||||
environment.systemPackages = [ pkgs.etcdctl ];
|
||||
|
||||
users.users = singleton {
|
||||
name = "etcd";
|
||||
users.users.etcd = {
|
||||
uid = config.ids.uids.etcd;
|
||||
description = "Etcd daemon user";
|
||||
home = cfg.dataDir;
|
||||
|
||||
@@ -410,8 +410,7 @@ in
|
||||
sed -i 's/'"$replace_what"'/'"$replace_with"'/g' ${cfg.baseDir}/zookeeper/bin/zk*.sh
|
||||
'';
|
||||
};
|
||||
users.users = singleton {
|
||||
name = "zookeeper";
|
||||
users.users.zookeeper = {
|
||||
uid = config.ids.uids.zookeeper;
|
||||
description = "Zookeeper daemon user";
|
||||
home = cfg.baseDir;
|
||||
|
||||
@@ -47,14 +47,10 @@ in
|
||||
###### implementation
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
users.groups = singleton
|
||||
{ name = "osgi";
|
||||
gid = config.ids.gids.osgi;
|
||||
};
|
||||
users.groups.osgi.gid = config.ids.gids.osgi;
|
||||
|
||||
users.users = singleton
|
||||
{ name = "osgi";
|
||||
uid = config.ids.uids.osgi;
|
||||
users.users.osgi =
|
||||
{ uid = config.ids.uids.osgi;
|
||||
description = "OSGi user";
|
||||
home = "/homeless-shelter";
|
||||
};
|
||||
|
||||
@@ -42,9 +42,8 @@ in {
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
users.users = singleton
|
||||
{ name = fahUser;
|
||||
uid = config.ids.uids.foldingathome;
|
||||
users.users.${fahUser} =
|
||||
{ uid = config.ids.uids.foldingathome;
|
||||
description = "Folding@Home user";
|
||||
home = stateDir;
|
||||
};
|
||||
|
||||
@@ -633,20 +633,14 @@ in {
|
||||
# Use postfix to send out mails.
|
||||
services.postfix.enable = mkDefault true;
|
||||
|
||||
users.users = [
|
||||
{ name = cfg.user;
|
||||
group = cfg.group;
|
||||
users.users.${cfg.user} =
|
||||
{ group = cfg.group;
|
||||
home = "${cfg.statePath}/home";
|
||||
shell = "${pkgs.bash}/bin/bash";
|
||||
uid = config.ids.uids.gitlab;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
users.groups = [
|
||||
{ name = cfg.group;
|
||||
gid = config.ids.gids.gitlab;
|
||||
}
|
||||
];
|
||||
users.groups.${cfg.group}.gid = config.ids.gids.gitlab;
|
||||
|
||||
systemd.tmpfiles.rules = [
|
||||
"d /run/gitlab 0755 ${cfg.user} ${cfg.group} -"
|
||||
|
||||
@@ -86,17 +86,13 @@ in
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
users.users = singleton
|
||||
{ name = "gpsd";
|
||||
inherit uid;
|
||||
users.users.gpsd =
|
||||
{ inherit uid;
|
||||
description = "gpsd daemon user";
|
||||
home = "/var/empty";
|
||||
};
|
||||
|
||||
users.groups = singleton
|
||||
{ name = "gpsd";
|
||||
inherit gid;
|
||||
};
|
||||
users.groups.gpsd = { inherit gid; };
|
||||
|
||||
systemd.services.gpsd = {
|
||||
description = "GPSD daemon";
|
||||
|
||||
@@ -59,19 +59,19 @@ in
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
users.users = optionalAttrs (cfg.user == name) (singleton {
|
||||
name = name;
|
||||
uid = config.ids.uids.headphones;
|
||||
group = cfg.group;
|
||||
description = "headphones user";
|
||||
home = cfg.dataDir;
|
||||
createHome = true;
|
||||
});
|
||||
users.users = optionalAttrs (cfg.user == name) {
|
||||
${name} = {
|
||||
uid = config.ids.uids.headphones;
|
||||
group = cfg.group;
|
||||
description = "headphones user";
|
||||
home = cfg.dataDir;
|
||||
createHome = true;
|
||||
};
|
||||
};
|
||||
|
||||
users.groups = optionalAttrs (cfg.group == name) (singleton {
|
||||
name = name;
|
||||
gid = config.ids.gids.headphones;
|
||||
});
|
||||
users.groups = optionalAttrs (cfg.group == name) {
|
||||
${name}.gid = config.ids.gids.headphones;
|
||||
};
|
||||
|
||||
systemd.services.headphones = {
|
||||
description = "Headphones Server";
|
||||
|
||||
@@ -657,19 +657,18 @@ in {
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
users.users = [
|
||||
{ name = "matrix-synapse";
|
||||
users.users.matrix-synapse =
|
||||
{ name = "";
|
||||
group = "matrix-synapse";
|
||||
home = cfg.dataDir;
|
||||
createHome = true;
|
||||
shell = "${pkgs.bash}/bin/bash";
|
||||
uid = config.ids.uids.matrix-synapse;
|
||||
} ];
|
||||
};
|
||||
|
||||
users.groups = [
|
||||
{ name = "matrix-synapse";
|
||||
gid = config.ids.gids.matrix-synapse;
|
||||
} ];
|
||||
users.groups.matrix-synapse = {
|
||||
gid = config.ids.gids.matrix-synapse;
|
||||
};
|
||||
|
||||
services.postgresql = mkIf (usePostgresql && cfg.create_local_database) {
|
||||
enable = mkDefault true;
|
||||
|
||||
@@ -266,19 +266,19 @@ in {
|
||||
serviceConfig.User = "${cfg.user}";
|
||||
};
|
||||
|
||||
users.groups = optionalAttrs (cfg.group == "mediatomb") (singleton {
|
||||
name = "mediatomb";
|
||||
gid = gid;
|
||||
});
|
||||
users.groups = optionalAttrs (cfg.group == "mediatomb") {
|
||||
mediatomb.gid = gid;
|
||||
};
|
||||
|
||||
users.users = optionalAttrs (cfg.user == "mediatomb") (singleton {
|
||||
name = "mediatomb";
|
||||
isSystemUser = true;
|
||||
group = cfg.group;
|
||||
home = "${cfg.dataDir}";
|
||||
createHome = true;
|
||||
description = "Mediatomb DLNA Server User";
|
||||
});
|
||||
users.users = optionalAttrs (cfg.user == "mediatomb") {
|
||||
mediatomb = {
|
||||
isSystemUser = true;
|
||||
group = cfg.group;
|
||||
home = "${cfg.dataDir}";
|
||||
createHome = true;
|
||||
description = "Mediatomb DLNA Server User";
|
||||
};
|
||||
};
|
||||
|
||||
networking.firewall = {
|
||||
allowedUDPPorts = [ 1900 cfg.port ];
|
||||
|
||||
@@ -12,8 +12,9 @@ let
|
||||
|
||||
isNix23 = versionAtLeast nixVersion "2.3pre";
|
||||
|
||||
makeNixBuildUser = nr:
|
||||
{ name = "nixbld${toString nr}";
|
||||
makeNixBuildUser = nr: {
|
||||
name = "nixbld${toString nr}";
|
||||
value = {
|
||||
description = "Nix build user ${toString nr}";
|
||||
|
||||
/* For consistency with the setgid(2), setuid(2), and setgroups(2)
|
||||
@@ -23,8 +24,9 @@ let
|
||||
group = "nixbld";
|
||||
extraGroups = [ "nixbld" ];
|
||||
};
|
||||
};
|
||||
|
||||
nixbldUsers = map makeNixBuildUser (range 1 cfg.nrBuildUsers);
|
||||
nixbldUsers = listToAttrs (map makeNixBuildUser (range 1 cfg.nrBuildUsers));
|
||||
|
||||
nixConf =
|
||||
assert versionAtLeast nixVersion "2.2";
|
||||
@@ -445,7 +447,7 @@ in
|
||||
|
||||
users.users = nixbldUsers;
|
||||
|
||||
services.xserver.displayManager.hiddenUsers = map ({ name, ... }: name) nixbldUsers;
|
||||
services.xserver.displayManager.hiddenUsers = attrNames nixbldUsers;
|
||||
|
||||
system.activationScripts.nix = stringAfter [ "etc" "users" ]
|
||||
''
|
||||
|
||||
@@ -86,16 +86,16 @@ in
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
users.users = optionalAttrs (cfg.user == "octoprint") (singleton
|
||||
{ name = "octoprint";
|
||||
users.users = optionalAttrs (cfg.user == "octoprint") {
|
||||
octoprint = {
|
||||
group = cfg.group;
|
||||
uid = config.ids.uids.octoprint;
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
users.groups = optionalAttrs (cfg.group == "octoprint") (singleton
|
||||
{ name = "octoprint";
|
||||
gid = config.ids.gids.octoprint;
|
||||
});
|
||||
users.groups = optionalAttrs (cfg.group == "octoprint") {
|
||||
octoprint.gid = config.ids.gids.octoprint;
|
||||
};
|
||||
|
||||
systemd.tmpfiles.rules = [
|
||||
"d '${cfg.stateDir}' - ${cfg.user} ${cfg.group} - -"
|
||||
|
||||
@@ -367,17 +367,17 @@ in
|
||||
|
||||
};
|
||||
|
||||
users.users = optionalAttrs (cfg.user == "redmine") (singleton
|
||||
{ name = "redmine";
|
||||
users.users = optionalAttrs (cfg.user == "redmine") {
|
||||
redmine = {
|
||||
group = cfg.group;
|
||||
home = cfg.stateDir;
|
||||
uid = config.ids.uids.redmine;
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
users.groups = optionalAttrs (cfg.group == "redmine") (singleton
|
||||
{ name = "redmine";
|
||||
gid = config.ids.gids.redmine;
|
||||
});
|
||||
users.groups = optionalAttrs (cfg.group == "redmine") {
|
||||
redmine.gid = config.ids.gids.redmine;
|
||||
};
|
||||
|
||||
warnings = optional (cfg.database.password != "")
|
||||
''config.services.redmine.database.password will be stored as plaintext
|
||||
|
||||
@@ -185,9 +185,8 @@ in {
|
||||
];
|
||||
};
|
||||
|
||||
users.users = singleton
|
||||
{ name = "ripple-data-api";
|
||||
description = "Ripple data api user";
|
||||
users.users.ripple-data-api =
|
||||
{ description = "Ripple data api user";
|
||||
uid = config.ids.uids.ripple-data-api;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -406,9 +406,8 @@ in
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
users.users = singleton
|
||||
{ name = "rippled";
|
||||
description = "Ripple server user";
|
||||
users.users.rippled =
|
||||
{ description = "Ripple server user";
|
||||
uid = config.ids.uids.rippled;
|
||||
home = cfg.databasePath;
|
||||
createHome = true;
|
||||
|
||||
@@ -63,20 +63,15 @@ in {
|
||||
};
|
||||
};
|
||||
|
||||
users.users = [
|
||||
{
|
||||
name = "serviio";
|
||||
group = "serviio";
|
||||
users.users.serviio =
|
||||
{ group = "serviio";
|
||||
home = cfg.dataDir;
|
||||
description = "Serviio Media Server User";
|
||||
createHome = true;
|
||||
isSystemUser = true;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
users.groups = [
|
||||
{ name = "serviio";}
|
||||
];
|
||||
users.groups.serviio = { };
|
||||
|
||||
networking.firewall = {
|
||||
allowedTCPPorts = [
|
||||
|
||||
@@ -63,19 +63,19 @@ in
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
users.users = optionalAttrs (cfg.user == name) (singleton {
|
||||
name = name;
|
||||
uid = config.ids.uids.sickbeard;
|
||||
group = cfg.group;
|
||||
description = "sickbeard user";
|
||||
home = cfg.dataDir;
|
||||
createHome = true;
|
||||
});
|
||||
users.users = optionalAttrs (cfg.user == name) {
|
||||
${name} = {
|
||||
uid = config.ids.uids.sickbeard;
|
||||
group = cfg.group;
|
||||
description = "sickbeard user";
|
||||
home = cfg.dataDir;
|
||||
createHome = true;
|
||||
};
|
||||
};
|
||||
|
||||
users.groups = optionalAttrs (cfg.group == name) (singleton {
|
||||
name = name;
|
||||
gid = config.ids.gids.sickbeard;
|
||||
});
|
||||
users.groups = optionalAttrs (cfg.group == name) {
|
||||
${name}.gid = config.ids.gids.sickbeard;
|
||||
};
|
||||
|
||||
systemd.services.sickbeard = {
|
||||
description = "Sickbeard Server";
|
||||
|
||||
@@ -161,8 +161,7 @@ in
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
users.users = singleton {
|
||||
name = "siproxyd";
|
||||
users.users.siproxyd = {
|
||||
uid = config.ids.uids.siproxd;
|
||||
};
|
||||
|
||||
|
||||
@@ -368,16 +368,16 @@ in {
|
||||
(mkIf cfg.enable {
|
||||
environment.systemPackages = [ nixos-taskserver ];
|
||||
|
||||
users.users = optional (cfg.user == "taskd") {
|
||||
name = "taskd";
|
||||
uid = config.ids.uids.taskd;
|
||||
description = "Taskserver user";
|
||||
group = cfg.group;
|
||||
users.users = optionalAttrs (cfg.user == "taskd") {
|
||||
taskd = {
|
||||
uid = config.ids.uids.taskd;
|
||||
description = "Taskserver user";
|
||||
group = cfg.group;
|
||||
};
|
||||
};
|
||||
|
||||
users.groups = optional (cfg.group == "taskd") {
|
||||
name = "taskd";
|
||||
gid = config.ids.gids.taskd;
|
||||
users.groups = optionalAttrs (cfg.group == "taskd") {
|
||||
taskd.gid = config.ids.gids.taskd;
|
||||
};
|
||||
|
||||
services.taskserver.config = {
|
||||
|
||||
@@ -41,31 +41,31 @@ in
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Whether to enable the uhub ADC hub.";
|
||||
description = "Whether to enable the uhub ADC hub.";
|
||||
};
|
||||
|
||||
port = mkOption {
|
||||
type = types.int;
|
||||
default = 1511;
|
||||
description = "TCP port to bind the hub to.";
|
||||
description = "TCP port to bind the hub to.";
|
||||
};
|
||||
|
||||
address = mkOption {
|
||||
type = types.str;
|
||||
default = "any";
|
||||
description = "Address to bind the hub to.";
|
||||
description = "Address to bind the hub to.";
|
||||
};
|
||||
|
||||
enableTLS = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Whether to enable TLS support.";
|
||||
description = "Whether to enable TLS support.";
|
||||
};
|
||||
|
||||
hubConfig = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
description = "Contents of uhub configuration file.";
|
||||
description = "Contents of uhub configuration file.";
|
||||
};
|
||||
|
||||
aclConfig = mkOption {
|
||||
@@ -77,11 +77,11 @@ in
|
||||
plugins = {
|
||||
|
||||
authSqlite = {
|
||||
enable = mkOption {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Whether to enable the Sqlite authentication database plugin";
|
||||
};
|
||||
};
|
||||
file = mkOption {
|
||||
type = types.path;
|
||||
example = "/var/db/uhub-users";
|
||||
@@ -161,14 +161,8 @@ in
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
users = {
|
||||
users = singleton {
|
||||
name = "uhub";
|
||||
uid = config.ids.uids.uhub;
|
||||
};
|
||||
groups = singleton {
|
||||
name = "uhub";
|
||||
gid = config.ids.gids.uhub;
|
||||
};
|
||||
users.uhub.uid = config.ids.uids.uhub;
|
||||
groups.uhub.gid = config.ids.gids.uhub;
|
||||
};
|
||||
|
||||
systemd.services.uhub = {
|
||||
|
||||
@@ -146,8 +146,7 @@ in {
|
||||
'';
|
||||
};
|
||||
|
||||
users.users = singleton {
|
||||
name = "zookeeper";
|
||||
users.users.zookeeper = {
|
||||
uid = config.ids.uids.zookeeper;
|
||||
description = "Zookeeper daemon user";
|
||||
home = cfg.dataDir;
|
||||
|
||||
Reference in New Issue
Block a user