MatthewCroughan / nixinate

Another NixOS Deployment Tool - Nixinate your systems 🕶️
MIT License
240 stars 32 forks source link

`flock` not a dependency #29

Closed quinn-dougherty closed 1 year ago

quinn-dougherty commented 1 year ago

I'm deploying my herc agent on digital ocean from itself, with a herc effect.

bug from logs

🚀 Deploying nixosConfigurations.herc-agent from /nix/store/dxbvs58xw7c7pzjq9xdgnj59d1a49nib-source
👤 SSH User: root
🌐 SSH Host: 142.93.190.80
🔨 Building system closure locally, copying it to remote store and activating it:
+++ NIX_SSHOPTS=-t
+++ flock -w 60 /dev/shm/nixinate-herc-agent -c '/nix/store/z7pwpz0fkdcnqhypmjqrqpj11m9ny8pc-nixos-rebuild/bin/nixos-rebuild  switch --flake /nix/store/dxbvs58xw7c7pzjq9xdgnj59d1a49nib-source#herc-agent --target-host root@142.93.190.80 --use-remote-sudo -s'
/nix/store/4k148qpmy1b9xck6v4dah417k6w22p25-deploy-herc-agent.sh: line 6: flock: command not found

See my effect/default.nix at the relevant commit

It would be nice if flock was made explicit. I do not currently have a workaround. In the commit after the one I linked above, I tried to put flock in environment.systemPackages, which also did not work.

Btw, my agent says it has a flock, so maybe this is on the herc agent codebase...

[herc-admin@herc-agent:~]$ which flock
/run/current-system/sw/bin/flock

Edit, workaround

with agent.pkgs;
effects.runIf (ref == "refs/heads/main") (effects.mkEffect {
  effectScript = ''
    mkdir -p flockpath
    cp ${util-linux}/bin/flock flockpath/flock
    export PATH=$PATH:flockpath
    ${nixination.${agent.hostname}.program}
  '';
quinn-dougherty commented 1 year ago

Thanks a ton! (for the record, ssh was the same deal and I'm doing the same workaround)

MatthewCroughan commented 1 year ago

Ah of course.. I need to generally fix the structure of Nixinate to be more proper anyway, I will sort this out as soon as I get a moment to myself.