@@ -24,6 +24,9 @@ const (
24
24
// For example, the string "nixpkgs" and "./flake" are valid flake references,
25
25
// but "nixpkgs#hello" and "./flake#app^bin,dev" are not.
26
26
//
27
+ // The JSON encoding of FlakeRef corresponds to the exploded attribute set
28
+ // form of the flake reference in Nix.
29
+ //
27
30
// See the [Nix manual] for details on flake references.
28
31
//
29
32
// [Nix manual]: https://nixos.org/manual/nix/unstable/command-ref/new-cli/nix3-flake
@@ -350,6 +353,8 @@ func isGitHash(s string) bool {
350
353
}
351
354
352
355
func 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
353
358
return strings .HasSuffix (path , ".tar" ) ||
354
359
strings .HasSuffix (path , ".tar.gz" ) ||
355
360
strings .HasSuffix (path , ".tgz" ) ||
@@ -447,14 +452,30 @@ const (
447
452
//
448
453
// [Nix manual]: https://nixos.org/manual/nix/unstable/command-ref/new-cli/nix#installables
449
454
type 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.
451
460
AttrPath string
452
461
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 "*".
453
474
Outputs string
454
475
}
455
476
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
458
479
// #attrpath and/or an ^output.
459
480
func ParseFlakeInstallable (raw string ) (FlakeInstallable , error ) {
460
481
if raw == "" {
0 commit comments