Hi all!
I am trying to extend the default autoUpgrade service by an “ExecPost” line, called “postStop” in nix.
Do do this, I looked at the systemd service, guessing a bit:
run0 systemctl edit nixos-upgrade.service --runtime
I did the following, trying to make it “declarative” I guess
# service overrides
systemd.services.nixos-upgrade.postStop = "ExecPost=${pkgs.dash}/bin/dash -c '${pkgs.flatpak}/bin/flatpak update -y && ${pkgs.flatpak}/bin/flatpak remove --delete-data --unused -y'";
But I get the following error
error: Cannot build '/nix/store/jglgdl7zqnh2lg8w2v26pr42zff2klka-unit-script-nixos-upgrade-post-stop.drv'.
Reason: builder failed with exit code 1.
Output paths:
/nix/store/2zgymcym93pnppmhbip7x164mclsmqkb-unit-script-nixos-upgrade-post-stop
Last 7 log lines:
>
> In /nix/store/2zgymcym93pnppmhbip7x164mclsmqkb-unit-script-nixos-upgrade-post-stop/bin/nixos-upgrade-post-stop line 8:
> ExecPost=/nix/store/ilg3144cns61ir9swgmdr1p7zidnvhhj-dash-0.5.13.2/bin/dash -c '/nix/store/3lnpblx0qc1wsrrcm5a57szp09n5dwg5-flatpak-1.16.6/bin/flatpak update -y && /nix/store/3lnpblx0qc1wsrrcm5a57szp09n5dwg5-flatpak-1.16.6/bin/flatpak remove --delete-data --unused -y'
> ^-- SC2037 (error): To assign the output of a command, use var=$(cmd) .
As far as I remember, this built fine on my other system also running unstable, without flakes. On this system WITH flakes the error occurs.