💾 Archived View for tilde.pink › ~kaction › log › 2020-02-14.1.gmi captured on 2023-01-29 at 04:33:59. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2021-12-03)
-=-=-=-=-=-=-
It is possible to have derivation that builds some file for system directory in your `~/.config/nixpkgs/overrides`. It is more complicated than managing user personal files, but still major improvement over manual editing.
For example, I can build `/var/service/user` service directory for system-wide `runit` installation with following command:
$ nix-build '<nixpkgs>' -A system.sv-user -o /tmp/sv-user
After that I move generated link to intended location in system directory, like following:
$ doas cp -vf /tmp/sv-user /var/service/user
Next, it is necessary to register final destination as Nix garbage collection root, otherwise the link will become dangling after garbage collection, which can be triggered by unprivileged user.
$ nix-store --add-root /var/service/user -r --indirect
When you update derivation for system-wide file, these three steps must to be performed again.
It can be noted that this poor-man implementation of what `nixos-rebuild` in NixOS does. Unfortunately, NixOS depends on systemd heavily, and my experience suggests that it is much simplier to add missing feature to sound base system than eradicate bloatware specially designed to make it almost impossible.