-
Notifications
You must be signed in to change notification settings - Fork 165
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 nix
package type
#314
base: master
Are you sure you want to change the base?
Add nix
package type
#314
Conversation
This adds a first version of the Nix package type. Signed-off-by: Raito Bezarius <[email protected]>
pkg:nix/[email protected]?drvpath=/nix/store/3nxf8kw3vgghz2y72b9qwi01sz62nhyk-glibc-2.39-52.drv&output=out&repository=github:user/nixpkgs | ||
pkg:nix/[email protected]?drvpath=/nix/store/r34i4md1cmc19392zbbp9ya5nmd0av0k-systemd-255.6.drv&output=dev | ||
|
||
|
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.
You probably want to remove "nix" from the old list below.
nix | ||
--- | ||
|
||
``nix`` for Nix derivations: |
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.
``nix`` for Nix derivations: | |
``nix`` for Nix store paths: |
The PURL is for each store path, and we may have multiple PURL for different output paths in the same derivation.
``nix`` for Nix derivations: | ||
|
||
- The default package repository is <https://github.com/NixOS/nixpkgs> but the ``repository`` qualifier can override the package repository. | ||
- The ``name`` is the package ``pname`` field of the given derivation. It is case sensitive. |
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.
We don't always have the pname / version separate. Deep down pname and version are concatenated into a single string. Should something creating a PURL try to split this off? (Probably fine, but in that case, see the comment on the version
field).
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.
the current state of name, pname, and versioning standards was part of why I didn't expect there to be a PURL standard yet for nix. (TBH I haven't checked on the current-state of discussions for a while so maybe it's settled lol)
Although it'd be great if this spec discussion helps push things forwards
|
||
- The default package repository is <https://github.com/NixOS/nixpkgs> but the ``repository`` qualifier can override the package repository. | ||
- The ``name`` is the package ``pname`` field of the given derivation. It is case sensitive. | ||
- The ``version`` is the ``version`` field of the given derivation. |
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.
How do PURL look like for store paths where the version cannot be extracted? Is this field (and other fields) optional or required? The spec for other PURLs in this file do explicitly say what's required and what not.
- The default package repository is <https://github.com/NixOS/nixpkgs> but the ``repository`` qualifier can override the package repository. | ||
- The ``name`` is the package ``pname`` field of the given derivation. It is case sensitive. | ||
- The ``version`` is the ``version`` field of the given derivation. | ||
- The ``drvpath`` qualifier is the derivation path (``.drvPath``). |
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.
Do we want to have an outpath here too, or are PURL always for individual output paths, so this information would be redundant?
Is drvpath optional or required?
- The ``name`` is the package ``pname`` field of the given derivation. It is case sensitive. | ||
- The ``version`` is the ``version`` field of the given derivation. | ||
- The ``drvpath`` qualifier is the derivation path (``.drvPath``). | ||
- The ``output`` qualifier is the output field, by default: ``out`` |
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.
- The ``output`` qualifier is the output field, by default: ``out`` | |
- The ``output`` qualifier is the name of the output, which helps to distinguish in the case of multi-output derivations |
The "default" behavior is confusing. It doesn't describe if it should always be set, or if it is "out" in case the field is not present.
Or should it always be set to something, and the fact it's "out" in single-output derivations is an implementation detail of Nix that should be left out of the spec? I prefer this one, which is my the suggestion uses this variant.
I don't think it should be omitted in case of single-output derivations, it'd be odd if it suddenly would appear if an expression is refactored to multiple outputs.
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.
including the output field also accounts for if the default is changed in the future and shouldn't be very painful to just include
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.
we should just map this to outputName
of the drv
. Then this works with lib.getLib
etc
|
||
``nix`` for Nix derivations: | ||
|
||
- The default package repository is <https://github.com/NixOS/nixpkgs> but the ``repository`` qualifier can override the package repository. |
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.
Does this field even matter at all? With just the PURL we cannot reproduce the drv path anyways, there's a lot of other details (like rev, system, ...) we'd need. Also, the line gets blurry if you have a repo that imports nixpkgs, but overrides an expression, what should this be set to?
Inclined to remove this, this can only be a hint at most.
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.
With this field being mostly informative I feel we'd want a nar
package type or at least a nar
field to better identify where you got the package from if using a cache like cache.nixos.org
. ommitted or something for if you built it locally?
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.
It is not identifying the package. If you have a nar sha256 hash, you can fetch it from any content-addressed store.
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.
"what" being covered by the hash, but "where" can also useful for some governance.
Also if you can find that hash in your content-addressed store then great, but if you can't you might at least want a possible alternative location to check to find the same artifact described by the PURL.
Also lightning quick response! ⚡
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.
General thanks for kicking this off.
Added some comments :)
- The ``name`` is the package ``pname`` field of the given derivation. It is case sensitive. | ||
- The ``version`` is the ``version`` field of the given derivation. | ||
- The ``drvpath`` qualifier is the derivation path (``.drvPath``). | ||
- The ``output`` qualifier is the output field, by default: ``out`` |
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.
including the output field also accounts for if the default is changed in the future and shouldn't be very painful to just include
|
||
``nix`` for Nix derivations: | ||
|
||
- The default package repository is <https://github.com/NixOS/nixpkgs> but the ``repository`` qualifier can override the package repository. |
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.
With this field being mostly informative I feel we'd want a nar
package type or at least a nar
field to better identify where you got the package from if using a cache like cache.nixos.org
. ommitted or something for if you built it locally?
``nix`` for Nix derivations: | ||
|
||
- The default package repository is <https://github.com/NixOS/nixpkgs> but the ``repository`` qualifier can override the package repository. | ||
- The ``name`` is the package ``pname`` field of the given derivation. It is case sensitive. |
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.
the current state of name, pname, and versioning standards was part of why I didn't expect there to be a PURL standard yet for nix. (TBH I haven't checked on the current-state of discussions for a while so maybe it's settled lol)
Although it'd be great if this spec discussion helps push things forwards
see #149 |
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.
- please also add examples to the test suite
- please also remove
nix
from the list of "Other candidate types to define"
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.
please rebase onto latest master branch, and then remove nix
from the Other candidate types to define
Thanks for the review, and sorry for the delay, this PR was opened to spark discussions and discussions are still continuing in the Nix ecosystem on what is the best format as we have some special challenges. In terms of expectations, I'd like to ensure that most stakeholders are willing to carry on this, if so, I will apply the changes and add some examples whenever I have time (the other stakeholders are of course welcome to send me patches :P). If we are not to continue this path, we will probably close this PR and document why we cannot continue on this path. Sorry again for the delay and thanks to flokli to pester me. |
This adds a first version of the Nix package type.