Closed linyinfeng closed 3 years ago
@talyz Thank you for your suggestion. I have added two commits for this PR. Now the script part will be written into store and the activation script should looks like this (test on my machine):
$ cat /run/current-system/activate
...
#### Activation script snippet createDirsIn--persist:
_localstatus=0
/nix/store/6a28cn56k9i8cfazs9bd4f45gchgv4fq-impermanence-create-directories "/persist" "/etc/nixos"
/nix/store/6a28cn56k9i8cfazs9bd4f45gchgv4fq-impermanence-create-directories "/persist" "/etc/NetworkManager/system-connections"
/nix/store/6a28cn56k9i8cfazs9bd4f45gchgv4fq-impermanence-create-directories "/persist" "/var/log"
/nix/store/6a28cn56k9i8cfazs9bd4f45gchgv4fq-impermanence-create-directories "/persist" "/var/lib/docker"
/nix/store/6a28cn56k9i8cfazs9bd4f45gchgv4fq-impermanence-create-directories "/persist" "/var/lib/flatpak"
/nix/store/6a28cn56k9i8cfazs9bd4f45gchgv4fq-impermanence-create-directories "/persist" "/var/lib/bluetooth"
/nix/store/6a28cn56k9i8cfazs9bd4f45gchgv4fq-impermanence-create-directories "/persist" "/var/lib/libvirt"
/nix/store/6a28cn56k9i8cfazs9bd4f45gchgv4fq-impermanence-create-directories "/persist" "/var/lib/systemd/coredump"
...
BTW, actually the old fix only create 1 file per persistence storage location per generation, but the file will have over 50 identical sections of codes.
Also, this TODO,
# TODO: Move this script to it's own file, add CI with shfmt/shellcheck.
can be performed easily if this PR is merged.
Finally, CI of this repository is broken now...
> Run cachix/install-nix-action@v9
...
Error: Unable to process command '::add-path::/nix/var/nix/profiles/per-user/runner/profile/bin' successfully.
Error: The `add-path` command is disabled. Please upgrade to using Environment Files or opt into unsecure command execution by setting the `ACTIONS_ALLOW_UNSECURE_COMMANDS` environment variable to `true`. For more information see: https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/
...
Please rebase to pick up the CI fixes :)
Thanks!
I encountered a weird "Argument list too long" error when building system configuration.
Because the configuration have over 50 directories in
environment.persistence."/persist".directories
...Seems the issue was caused by a too long activation script. It can be easily fixed by writing the generated script into nix store. This fix is borrowed from NixOS/nixops/pull/915.