fucked up some parens
This commit is contained in:
parent
2344b78ebd
commit
ebcc0bc919
1 changed files with 49 additions and 48 deletions
|
@ -36,54 +36,55 @@ in
|
|||
};
|
||||
});
|
||||
};
|
||||
config = mkMerge (map (name: mkIf cfg.${name}.enable
|
||||
{
|
||||
systemd.services."storj-gateway@${name}" = {
|
||||
description = "storj gateway ${name}";
|
||||
after = [ "network.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
preStart = let cfg = cfg.${name}; in
|
||||
''
|
||||
cd $HOME
|
||||
mkdir -p ${name}
|
||||
echo -n "access: " > ${name}/config.yaml
|
||||
cat ${cfg.accessGrantFile} >> ${name}/config.yaml
|
||||
echo "" >> ${name}/config.yaml
|
||||
echo -n "minio.access-key: " >> ${name}/config.yaml
|
||||
cat ${cfg.accessKeyFile} >> ${name}/config.yaml
|
||||
echo "" >> ${name}/config.yaml
|
||||
echo -n "minio.secret-key: " >> ${name}/config.yaml
|
||||
cat ${cfg.secretKeyFile} >> ${name}/config.yaml
|
||||
echo "" >> ${name}/config.yaml
|
||||
'';
|
||||
serviceConfig = {
|
||||
Type = "simple";
|
||||
User = "storj";
|
||||
Group = "storj";
|
||||
WorkingDirectory = "/var/lib/storj";
|
||||
ExecStart = "${gateway}/bin/gateway run --config-dir /var/lib/storj/${name} --server.address 127.0.0.1:${cfg.port}";
|
||||
Restart = "always";
|
||||
RuntimeDirectory = "storj";
|
||||
RuntimeDirectoryMode = "0700";
|
||||
Umask = "0077";
|
||||
ReadWritePaths = [ "/var/lib/storj" ]; # Grant access to the state directory
|
||||
config = mkMerge (map
|
||||
(name: mkIf cfg.${name}.enable
|
||||
{
|
||||
systemd.services."storj-gateway@${name}" = {
|
||||
description = "storj gateway ${name}";
|
||||
after = [ "network.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
preStart = let cfg = cfg.${name}; in
|
||||
''
|
||||
cd $HOME
|
||||
mkdir -p ${name}
|
||||
echo -n "access: " > ${name}/config.yaml
|
||||
cat ${cfg.accessGrantFile} >> ${name}/config.yaml
|
||||
echo "" >> ${name}/config.yaml
|
||||
echo -n "minio.access-key: " >> ${name}/config.yaml
|
||||
cat ${cfg.accessKeyFile} >> ${name}/config.yaml
|
||||
echo "" >> ${name}/config.yaml
|
||||
echo -n "minio.secret-key: " >> ${name}/config.yaml
|
||||
cat ${cfg.secretKeyFile} >> ${name}/config.yaml
|
||||
echo "" >> ${name}/config.yaml
|
||||
'';
|
||||
serviceConfig = {
|
||||
Type = "simple";
|
||||
User = "storj";
|
||||
Group = "storj";
|
||||
WorkingDirectory = "/var/lib/storj";
|
||||
ExecStart = "${gateway}/bin/gateway run --config-dir /var/lib/storj/${name} --server.address 127.0.0.1:${cfg.port}";
|
||||
Restart = "always";
|
||||
RuntimeDirectory = "storj";
|
||||
RuntimeDirectoryMode = "0700";
|
||||
Umask = "0077";
|
||||
ReadWritePaths = [ "/var/lib/storj" ]; # Grant access to the state directory
|
||||
};
|
||||
environment = {
|
||||
USER = "storj";
|
||||
HOME = "/var/lib/storj";
|
||||
};
|
||||
};
|
||||
environment = {
|
||||
USER = "storj";
|
||||
HOME = "/var/lib/storj";
|
||||
users.users.storj = mkDefault {
|
||||
description = "storj user";
|
||||
home = "/var/lib/storj";
|
||||
useDefaultShell = true;
|
||||
group = "storj";
|
||||
isSystemUser = true;
|
||||
};
|
||||
};
|
||||
users.users.storj = mkDefault {
|
||||
description = "storj user";
|
||||
home = "/var/lib/storj";
|
||||
useDefaultShell = true;
|
||||
group = "storj";
|
||||
isSystemUser = true;
|
||||
};
|
||||
users.groups.storj = { };
|
||||
systemd.tmpfiles.rules = [
|
||||
"d '/var/lib/storj' 0700 storj storj - -"
|
||||
];
|
||||
}
|
||||
(builtins.attrNames cfg)));
|
||||
users.groups.storj = { };
|
||||
systemd.tmpfiles.rules = [
|
||||
"d '/var/lib/storj' 0700 storj storj - -"
|
||||
];
|
||||
})
|
||||
(builtins.attrNames cfg));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue