-
-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Precision strike #23560
Precision strike #23560
Conversation
@lheckemann, thanks for your PR! By analyzing the history of the files in this pull request, we identified @peterhoeg, @pshendry and @jokogr to be potential reviewers. |
echo "-t argument must be a Nix store path" | ||
exit 1 | ||
fi | ||
targets+=("$storeId") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here $storeId
is not escaped, is that intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call, fixed.
2b9c131
to
50e7f69
Compare
No problems at first glance, thanks! I like the name :D I'll merge in several days if noone beats me to it. |
Turns out it's actually rather broken because apparently I don't test this kind of stuff properly. Hold on the merge... |
50e7f69
to
5c3e20c
Compare
Fixed, now happy to have it merged. |
I'd like to merge but can't help but ask if we could do away with the perl dep and just use sed for the substitution, or is there some special sauce in the perl invocation not easily replicable with sed? |
Yes, that should be fine. IIRC it's used in nuke-refs (which I copied from) because that requires lookahead, but this doesn't so I'll replace it with sed. |
5c3e20c
to
d42b4cc
Compare
@joachifm done. This assumes it's GNU sed, I hope that's okay. This is because of inconsistency across sed implementations in terms of handling the |
From what I can tell, all the stdenvs use the GNU tools so it should be okay ( |
Just my two cents: I don't think tools like these should have novelty names. Something like |
I do agree that the novelty name feels inappropriate. However, I think in this case it describes the functionality a bit better than something like |
killReferences? |
|
Also doesn't really convey that it's killing specific references rather than all of them. Precision Ref Strike. [sorry…] |
removeReferences? |
|
This allows for a less blanket approach than nuke-refs, targetting specific references that we know we don't want rather than all references that we don't know we want.
d42b4cc
to
a80e4d7
Compare
Changed name to removeReferencesTo, rebased on master, and switched to using |
This LGTM. An idea for the future: what if there was a |
Yes, I like that! That also allows expressing the outputs as a nix list rather than manual calls to |
Seems to me to work as advertised. Thank you |
@lheckemann this is an awful hackup of what it could look like (sans stdenv integration, so the hook still needs to be added to inputs manually): https://github.com/joachifm/nixpkgs/tree/remove-reference-to-setup-hook An actual implementation I think would end up unifying the two and add some checks for robustness and whatnot, but the demo seems to work. Not sure if it'll be used enough to warrant this sort of integration, though it'd save quite a bit of boilerplate. |
This copies the builder of |
The only code that's almost copied verbatim is the option-getting part, and the code implementing the actual functionality is very different. I don't think it would be very beneficial to make the option-getting code common to the two. |
Motivation for this change
#21852 It would be nice to allow removing specific references rather than all references besides the ones specifically listed.
Also includes a sample usage for syncthing. I think this should be used in more places (e.g. buildGoPackage, perhaps some places that currently use nuke-refs), but was hoping to get some feedback on the idea, the implementation and the name (chosen by analogy to “nuke”).
Things done
(nix.useSandbox on NixOS,
or option
build-use-sandbox
innix.conf
on non-NixOS)
nix-shell -p nox --run "nox-review wip"
./result/bin/
)