Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop garbage-collecting and rebuilding fish completions #6157

Open
marienz opened this issue Dec 1, 2024 · 0 comments
Open

Stop garbage-collecting and rebuilding fish completions #6157

marienz opened this issue Dec 1, 2024 · 0 comments
Assignees

Comments

@marienz
Copy link

marienz commented Dec 1, 2024

I noticed nixos-rebuild (re)building -fish-completion packages more than I'd expect.

What I think is happening is that the destructiveSymlinkJoin of all packages' fish-completions (here) filters out packages without completions, and those then get garbage-collected by nix-collect-garbage. That is:

> nix derivation show /nix/store/hx407a4i3s4490i05jr3fcapdij1h1xh-marienz-fish-completions
...
      "paths": "/nix/store/gvglak58m5fm0kjzpqr90r9p4mlpq014-man-pages-6.9.1-fish-completions /nix/store/bk4g9wk1p4f0j75hhvbvisgl0k81hpzf-sqlite-3.46.1-fish-completions ...

(long list of per-package completions as input)

> ls /nix/store/gvglak58m5fm0kjzpqr90r9p4mlpq014-man-pages-6.9.1-fish-completions /nix/store/bk4g9wk1p4f0j75hhvbvisgl0k81hpzf-sqlite-3.46.1-fish-completions
/nix/store/bk4g9wk1p4f0j75hhvbvisgl0k81hpzf-sqlite-3.46.1-fish-completions:

/nix/store/gvglak58m5fm0kjzpqr90r9p4mlpq014-man-pages-6.9.1-fish-completions:
iconvconfig.fish  ldconfig.fish  ld.so.fish  nscd.fish  sched.fish  string_copying.fish  symlink.fish  time_namespaces.fish  zdump.fish

(man-pages has completions, sqlite does not, it's an empty directory)

> nix-store --query --roots /nix/store/gvglak58m5fm0kjzpqr90r9p4mlpq014-man-pages-6.9.1-fish-completions
/nix/var/nix/profiles/system-574-link -> /nix/store/gdglrxcs5fk3nrd4639giqyfb9fja6ah-nixos-system-jian-24.11.20241128.c71ad5c
/run/booted-system -> /nix/store/gdglrxcs5fk3nrd4639giqyfb9fja6ah-nixos-system-jian-24.11.20241128.c71ad5c
/nix/var/nix/profiles/system-575-link -> /nix/store/7cn84xsm972racjrsc3ikj0j6g7idxbv-nixos-system-jian-24.11.20241128.c71ad5c
/run/current-system -> /nix/store/7cn84xsm972racjrsc3ikj0j6g7idxbv-nixos-system-jian-24.11.20241128.c71ad5c
/home/marienz/.local/state/nix/profiles/home-manager-547-link -> /nix/store/0c82mxkjxnpgvzmpjyzprcqj3cp7fx4i-home-manager-generation
/home/marienz/.local/state/nix/profiles/home-manager-548-link -> /nix/store/c7pv6ff1ax1mbz4vhp927y9f94knzad9-home-manager-generation
/home/marienz/.local/state/home-manager/gcroots/current-home -> /nix/store/c7pv6ff1ax1mbz4vhp927y9f94knzad9-home-manager-generation

> nix-store --query --roots /nix/store/bk4g9wk1p4f0j75hhvbvisgl0k81hpzf-sqlite-3.46.1-fish-completions

(the man-pages completions have garbage collector roots, sqlite ones do not, so next time nix-collect-gc runs it'll delete them)

> nix-store --query --referrers /nix/store/gvglak58m5fm0kjzpqr90r9p4mlpq014-man-pages-6.9.1-fish-completions
/nix/store/92fmx3cjn04vl6r8i0wc5z4dfhynpmz0-marienz-fish-completions
/nix/store/hx407a4i3s4490i05jr3fcapdij1h1xh-marienz-fish-completions

(the only referrers to those man-pages completions are those symlink joins, as you'd expect)

And on my system 65 of the inputs are empty (57 are not).

Would it make sense to forcibly include those empty directories in the closure somehow, and if so: is there some standard way of doing so in home-manager (something similar to system.extraDependencies in nixpkgs) so I can write a PR? They're not that expensive to rebuild, but keeping them around should only cost one extra symlink (and one extra empty directory that would previously get removed by nix-collect-gc), which seems cheaper.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants