forked from nrabulinski/attic
nixos: Add atticd-atticadm wrapper
Now `atticd-atticadm` can be used to run `atticadm` as the `atticd` user. `atticd` is no longer added to the system path.
This commit is contained in:
parent
740c09beb9
commit
257a84ad74
2 changed files with 18 additions and 2 deletions
|
@ -5,7 +5,7 @@ let
|
||||||
serverConfigFile = config.nodes.server.services.atticd.configFile;
|
serverConfigFile = config.nodes.server.services.atticd.configFile;
|
||||||
|
|
||||||
cmd = {
|
cmd = {
|
||||||
atticadm = ". /etc/atticd.env && export ATTIC_SERVER_TOKEN_HS256_SECRET_BASE64 && atticadm -f ${serverConfigFile}";
|
atticadm = "atticd-atticadm";
|
||||||
atticd = ". /etc/atticd.env && export ATTIC_SERVER_TOKEN_HS256_SECRET_BASE64 && atticd -f ${serverConfigFile}";
|
atticd = ". /etc/atticd.env && export ATTIC_SERVER_TOKEN_HS256_SECRET_BASE64 && atticd -f ${serverConfigFile}";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -129,6 +129,8 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
environment.systemPackages = [ pkgs.attic-server ];
|
||||||
|
|
||||||
networking.firewall.allowedTCPPorts = [ 8080 ];
|
networking.firewall.allowedTCPPorts = [ 8080 ];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,20 @@ let
|
||||||
cat <$configFile >$out
|
cat <$configFile >$out
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
atticadmWrapper = pkgs.writeShellScriptBin "atticd-atticadm" ''
|
||||||
|
exec systemd-run \
|
||||||
|
--pty \
|
||||||
|
--same-dir \
|
||||||
|
--wait \
|
||||||
|
--collect \
|
||||||
|
--service-type=exec \
|
||||||
|
--property=EnvironmentFile=${cfg.credentialsFile} \
|
||||||
|
--property=DynamicUser=yes \
|
||||||
|
--property=User=atticd \
|
||||||
|
-- \
|
||||||
|
${cfg.package}/bin/atticadm -f ${checkedConfigFile} "$@"
|
||||||
|
'';
|
||||||
|
|
||||||
hasLocalPostgresDB = let
|
hasLocalPostgresDB = let
|
||||||
url = cfg.settings.database.url;
|
url = cfg.settings.database.url;
|
||||||
localStrings = [ "localhost" "127.0.0.1" "/run/postgresql" ];
|
localStrings = [ "localhost" "127.0.0.1" "/run/postgresql" ];
|
||||||
|
@ -129,7 +143,7 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
environment.systemPackages = [ cfg.package ];
|
environment.systemPackages = [ atticadmWrapper ];
|
||||||
}
|
}
|
||||||
(lib.mkIf cfg.useFlakeCompatOverlay {
|
(lib.mkIf cfg.useFlakeCompatOverlay {
|
||||||
nixpkgs.overlays = [ overlay ];
|
nixpkgs.overlays = [ overlay ];
|
||||||
|
|
Loading…
Reference in a new issue