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

Add outputHashMode argument attribute to bulitins that could support it #10480

Open
1 of 4 tasks
Ericson2314 opened this issue Apr 11, 2024 · 2 comments
Open
1 of 4 tasks
Labels
language The Nix expression language; parser, interpreter, primops, evaluation, etc

Comments

@Ericson2314
Copy link
Member

Ericson2314 commented Apr 11, 2024

An output outputHashMode argument attribute should be supported by all of

  • builtins.derivation
  • builtins.path
  • builtins.fetchTree
  • builtins.fetchurl

In order to specify which ContentAddressMethod is used for creating store paths.

Misc notes:

  • For builtins.derivation this is specifying that for a content addressed (fixed or floating) derivation output, for the other two, it is specifying that for the store path the builtin creates directly.

  • With lazy trees, builtins.fetchTree may not longer create a path. Perhaps paths created from it still turn into store objects, and it would affect those. Or maybe it's just better to separate concerns and not have this argument on builtins.fetchTree after all.

@Ericson2314 Ericson2314 added the language The Nix expression language; parser, interpreter, primops, evaluation, etc label Apr 11, 2024
@Ericson2314 Ericson2314 added this to the fetch-tree stabilisation milestone Apr 11, 2024
Ericson2314 added a commit to obsidiansystems/nix that referenced this issue Apr 13, 2024
Code operating on store objects (including creating them) should, in
general, use `ContentAddressMethod` rather than `FileIngestionMethod`.
Ericson2314 added a commit to obsidiansystems/nix that referenced this issue Apr 13, 2024
Code operating on store objects (including creating them) should, in
general, use `ContentAddressMethod` rather than `FileIngestionMethod`.

See also dfc8765 which included some
similar refactors.
@roberth
Copy link
Member

roberth commented Apr 14, 2024

  • builtins.fetchTree

Not sure.
If we factor it to be just the fetching, the hash mode is not relevant until we fetchToStore, ie builtins.path or interpolation.
Or should path values carry a preferred output hash mode? I doubt that, but maybe?

  • builtins.path

Possible use case:

  • In Disallow output changes in installCheckPhase nixpkgs#303361, I originally wanted to fetch just setup.sh directly from the API with fetchurl, which didn't give me a text-hashed path, resulting in a mass-rebuild (and the whole point was to avoid that). I tried to convert the path with builtins.path, but it didn't let me switch to text hashing. If I didn't control the fetchurl call, this would have been my only solution. However in general, let's add:
  • builtins.fetchurl

@roberth roberth changed the title Add outputHashMode arugment attribute to bulitins that oculd support it Add outputHashMode argument attribute to bulitins that could support it Apr 14, 2024
@Ericson2314
Copy link
Member Author

Good point with builtins.freeTree.

Ericson2314 added a commit to obsidiansystems/nix that referenced this issue May 17, 2024
Code operating on store objects (including creating them) should, in
general, use `ContentAddressMethod` rather than `FileIngestionMethod`.

See also dfc8765 which included some
similar refactors.
roberth added a commit that referenced this issue May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
language The Nix expression language; parser, interpreter, primops, evaluation, etc
Projects
None yet
Development

No branches or pull requests

2 participants