@@ -24,6 +24,9 @@ const (
2424// For example, the string "nixpkgs" and "./flake" are valid flake references,
2525// but "nixpkgs#hello" and "./flake#app^bin,dev" are not.
2626//
27+ // The JSON encoding of FlakeRef corresponds to the exploded attribute set
28+ // form of the flake reference in Nix.
29+ //
2730// See the [Nix manual] for details on flake references.
2831//
2932// [Nix manual]: https://nixos.org/manual/nix/unstable/command-ref/new-cli/nix3-flake
@@ -350,6 +353,8 @@ func isGitHash(s string) bool {
350353}
351354
352355func isArchive (path string ) bool {
356+ // As documented under the tarball type:
357+ // https://nixos.org/manual/nix/unstable/command-ref/new-cli/nix3-flake#types
353358 return strings .HasSuffix (path , ".tar" ) ||
354359 strings .HasSuffix (path , ".tar.gz" ) ||
355360 strings .HasSuffix (path , ".tgz" ) ||
@@ -447,14 +452,30 @@ const (
447452//
448453// [Nix manual]: https://nixos.org/manual/nix/unstable/command-ref/new-cli/nix#installables
449454type FlakeInstallable struct {
450- Ref FlakeRef
455+ // Ref is the flake reference portion of the installable.
456+ Ref FlakeRef
457+
458+ // AttrPath is an attribute path of the flake, encoded as a URL
459+ // fragment.
451460 AttrPath string
452461
462+ // Outputs is the installable's output spec, which is a comma-separated
463+ // list of package outputs to install. The outputs spec is anything
464+ // after the last caret '^' in an installable. Unlike the
465+ // attribute path, output specs are not URL-encoded.
466+ //
467+ // The special values DefaultOutputs ("") and AllOutputs ("*") specify
468+ // the default set of package outputs and all package outputs,
469+ // respectively.
470+ //
471+ // ParseFlakeInstallable cleans the list of outputs by removing empty
472+ // elements and sorting the results. Lists containing a "*" are
473+ // simplified to a single "*".
453474 Outputs string
454475}
455476
456- // ParseFlakeInstallable parses a flake installable. The string s must contain a
457- // valid flake reference parsable by ParseFlakeRef, optionally followed by an
477+ // ParseFlakeInstallable parses a flake installable. The raw string must contain
478+ // a valid flake reference parsable by ParseFlakeRef, optionally followed by an
458479// #attrpath and/or an ^output.
459480func ParseFlakeInstallable (raw string ) (FlakeInstallable , error ) {
460481 if raw == "" {
0 commit comments