It builds!

master
Inex Code 2021-11-15 13:29:20 +03:00
parent 85aaf52635
commit 4ba0dd5396
7 changed files with 41 additions and 38 deletions

View File

@ -35,7 +35,7 @@
};
nameservers = [ "1.1.1.1" "1.0.0.1" ];
};
time.timeZone = "Europe/Uzhgorod";
time.timeZone = config.services.userdata.timezone;
i18n.defaultLocale = "en_GB.UTF-8";
users.users.root.openssh.authorizedKeys.keys = config.services.userdata.rootSshKeys;
services.openssh = {

View File

@ -43,24 +43,24 @@ in
stop;
}
'';
} // builtins.listToAttrs (builtins.map
(user: {
name = "${user.username}@${cfg.domain}";
value = {
hashedPassword = user.hashedPassword;
catchAll = [ cfg.domain ];
sieveScript = ''
require ["fileinto", "mailbox"];
if header :contains "Chat-Version" "1.0"
{
fileinto :create "DeltaChat";
stop;
}
'';
};
})
cfg.users);
};
};
} // builtins.listToAttrs (builtins.map
(user: {
name = "${user.username}@${cfg.domain}";
value = {
hashedPassword = user.hashedPassword;
catchAll = [ cfg.domain ];
sieveScript = ''
require ["fileinto", "mailbox"];
if header :contains "Chat-Version" "1.0"
{
fileinto :create "DeltaChat";
stop;
}
'';
};
})
cfg.users);
extraVirtualAliases = {
"admin@${cfg.domain}" = "${cfg.username}@${cfg.domain}";

View File

@ -37,5 +37,7 @@ in
'';
users.users.pleroma = {
extraGroups = [ "postgres" ];
isNormalUser = false;
isSystemUser = true;
};
}

View File

@ -15,6 +15,9 @@
"hashedMasterPassword": {
"type": "string"
},
"timezone": {
"type": "string"
},
"backblaze": {
"type": "object",
"properties": {

View File

@ -1,12 +1,23 @@
{ pkgs, config, ... }:
let
cfg = config.services.userdata;
in
{
users.mutableUsers = false;
users = {
users = {
"${config.services.userdata.username}" = {
"${cfg.username}" = {
isNormalUser = true;
hashedPassword = config.services.userdata.hashedMasterPassword;
hashedPassword = cfg.hashedMasterPassword;
};
};
} // builtins.listToAttrs (builtins.map
(user: {
name = "${user.username}";
value = {
isNormalUser = true;
hashedPassword = user.hashedPassword;
};
})
cfg.users);
};
}

View File

@ -8,19 +8,6 @@ let
if cfg.direction == ""
then ""
else "--direction=${cfg.direction}";
userDef = {
options = {
username = mkOption {
type = types.nullOr types.string;
};
hashedPassword = mkOption {
type = types.nullOr types.string;
};
sshKeys = mkOption {
type = types.nullOr types.listOf types.string;
};
};
};
in
{
options.services.userdata = {
@ -134,7 +121,7 @@ in
description = ''
Root SSH Keys
'';
type = types.nullOr types.listOf types.string;
type = types.nullOr (types.listOf types.string);
};
timezone = mkOption {
description = ''
@ -147,7 +134,7 @@ in
description = ''
Users that will be created on the server
'';
type = with types; nullOr listOf attrsOf (submodule userDef);
type = types.nullOr (types.listOf (types.attrsOf types.anything));
};
};
}

View File

@ -1,6 +1,6 @@
{ pkgs, ... }:
{
services = {
userdata = builtins.fromJSON (builtins.readFile "./userdata/userdata.json");
userdata = builtins.fromJSON (builtins.readFile ./userdata/userdata.json);
};
}