29 lines
821 B
Nix
29 lines
821 B
Nix
{ config, pkgs, ... }:
|
|
|
|
{
|
|
systemd.services.numbus-activation = {
|
|
description = "Numbus Server Activation";
|
|
wantedBy = [ "multi-user.target" ];
|
|
after = [ "network.target" "local-fs.target" ];
|
|
serviceConfig = {
|
|
Type = "oneshot";
|
|
RemainAfterExit = true;
|
|
};
|
|
script = ''
|
|
if [[ -e /etc/numbus-server/activated.true ]]; then
|
|
exit 0
|
|
fi
|
|
|
|
${pkgs.coreutils}/bin/mkdir -p /mnt/config/ /mnt/data/
|
|
${pkgs.coreutils}/bin/chown -R numbus-admin:users /mnt/config/
|
|
${pkgs.coreutils}/bin/chown -R numbus-admin:users /mnt/data/
|
|
|
|
${pkgs.util-linux}/bin/runuser -u numbus-admin -- ${pkgs.bash}/bin/bash -c '
|
|
export XDG_RUNTIME_DIR=/run/user/1000
|
|
PODMAN_NETWORKS
|
|
'
|
|
|
|
${pkgs.coreutils}/bin/touch /etc/numbus-server/activated.true
|
|
'';
|
|
};
|
|
} |