Kieran's opinionated (and probably slightly dumb) nix config

bug: fix pre start

dunkirk.sh 7ec347f0 60b1512e

verified
Changed files
+8 -17
modules
nixos
+4 -4
modules/nixos/services/cachet.nix
···
path = [ pkgs.git ];
preStart = ''
-
cd ${cfg.dataDir}/app
-
-
if [ ! -d .git ]; then
-
${pkgs.git}/bin/git clone ${cfg.repository} .
+
if [ ! -d ${cfg.dataDir}/app/.git ]; then
+
${pkgs.git}/bin/git clone ${cfg.repository} ${cfg.dataDir}/app
fi
+
+
cd ${cfg.dataDir}/app
'' + lib.optionalString cfg.autoUpdate ''
${pkgs.git}/bin/git pull
'' + ''
+4 -13
modules/nixos/services/hn-alerts.nix
···
path = [ pkgs.git ];
preStart = ''
-
cd ${cfg.dataDir}/app
-
-
if [ ! -d .git ]; then
-
${pkgs.git}/bin/git clone ${cfg.repository} .
+
if [ ! -d ${cfg.dataDir}/app/.git ]; then
+
${pkgs.git}/bin/git clone ${cfg.repository} ${cfg.dataDir}/app
fi
+
+
cd ${cfg.dataDir}/app
'' + lib.optionalString cfg.autoUpdate ''
${pkgs.git}/bin/git pull
'' + ''
···
Restart = "always";
RestartSec = "10s";
};
-
-
serviceConfig.ExecStartPre = [
-
"+${pkgs.writeShellScript "hn-alerts-setup" ''
-
mkdir -p ${cfg.dataDir}/data
-
mkdir -p ${cfg.dataDir}/app
-
chown -R hn-alerts:services ${cfg.dataDir}
-
chmod -R g+rwX ${cfg.dataDir}
-
''}"
-
];
};
services.caddy.virtualHosts.${cfg.domain} = {