From 951506084364021a4b82114841eb6bb6d0eb869a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anselm=20Sch=C3=BCler?= Date: Sat, 12 Mar 2022 22:04:30 +0100 Subject: [PATCH 01/14] =?UTF-8?q?=F0=9F=93=82=20Add=20RFC=20=E2=80=9Cflake?= =?UTF-8?q?-names=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 0000-flake-names.md | 54 +++++++++++++++++++++++++++++++++++++++++ 0000-template.md | 58 --------------------------------------------- 2 files changed, 54 insertions(+), 58 deletions(-) create mode 100644 0000-flake-names.md delete mode 100644 0000-template.md diff --git a/0000-flake-names.md b/0000-flake-names.md new file mode 100644 index 000000000..178d1ebd6 --- /dev/null +++ b/0000-flake-names.md @@ -0,0 +1,54 @@ +--- +feature: flake-names +start-date: 2022-03-12 +author: Anselm Schüler +co-authors: None +shepherd-team: None +shepherd-leader: None +related-issues: None +--- + +# Summary +[summary]: #summary + +Flakes can declare the field `name`. +It represents the name of the flake. +The derivations for a flake are no longer called `source`, but use the flake name. + +# Motivation +[motivation]: #motivation + +Flake-centric workflows often end up with a lot of derivations named “source”, and it’s difficult to navigate this. +Also, the discoverability and usability of flakes needs to be improved. Current commands mostly show technical information. This would be a step in the right direction. + +# Detailed design +[design]: #detailed-design + +A new supported property for flakes is introduced, `name`. +Running `nix flake metadata` on a flake that declares this field displays it at the top. +The derivation that contains the flake’s content is called `flake-source-${name}` or, if a short revision identifier is available, `flake-source-${name}-${shortRev}`. + +# Examples and Interactions +[examples-and-interactions]: #examples-and-interactions + +A flake that is in the registry should have its name match the registry identifier. + +# Drawbacks +[drawbacks]: #drawbacks + +This may cause clutter and additional maintenance. + +# Alternatives +[alternatives]: #alternatives + +Flake names could be handled entirely through outside means, with things like the global registry merely pointing to flakes under names. + +# Unresolved questions +[unresolved]: #unresolved-questions + +The name scheme could be changed. `flake-source-${name}-${shortRev}` could be too long. + +# Future work +[future]: #future-work + +Flake discoverability and usability needs to be improved. diff --git a/0000-template.md b/0000-template.md deleted file mode 100644 index 43569cf57..000000000 --- a/0000-template.md +++ /dev/null @@ -1,58 +0,0 @@ ---- -feature: (fill me in with a unique ident, my_awesome_feature) -start-date: (fill me in with today's date, YYYY-MM-DD) -author: (name of the main author) -co-authors: (find a buddy later to help out with the RFC) -shepherd-team: (names, to be nominated and accepted by RFC steering committee) -shepherd-leader: (name to be appointed by RFC steering committee) -related-issues: (will contain links to implementation PRs) ---- - -# Summary -[summary]: #summary - -One paragraph explanation of the feature. - -# Motivation -[motivation]: #motivation - -Why are we doing this? What use cases does it support? What is the expected -outcome? - -# Detailed design -[design]: #detailed-design - -This is the core, normative part of the RFC. Explain the design in enough -detail for somebody familiar with the ecosystem to understand, and implement. -This should get into specifics and corner-cases. Yet, this section should also -be terse, avoiding redundancy even at the cost of clarity. - -# Examples and Interactions -[examples-and-interactions]: #examples-and-interactions - -This section illustrates the detailed design. This section should clarify all -confusion the reader has from the previous sections. It is especially important -to counterbalance the desired terseness of the detailed design; if you feel -your detailed design is rudely short, consider making this section longer -instead. - -# Drawbacks -[drawbacks]: #drawbacks - -Why should we *not* do this? - -# Alternatives -[alternatives]: #alternatives - -What other designs have been considered? What is the impact of not doing this? - -# Unresolved questions -[unresolved]: #unresolved-questions - -What parts of the design are still TBD or unknowns? - -# Future work -[future]: #future-work - -What future work, if any, would be implied or impacted by this feature -without being directly part of the work? From 08d1fc59eaae48ae24773c245b3584f82f341c40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anselm=20Sch=C3=BCler?= Date: Sat, 12 Mar 2022 22:14:37 +0100 Subject: [PATCH 02/14] [RFC 0123] Flake names --- 0000-template.md | 58 +++++++++++++++++++ .../0123-flake-names.md | 0 2 files changed, 58 insertions(+) create mode 100644 0000-template.md rename 0000-flake-names.md => rfcs/0123-flake-names.md (100%) diff --git a/0000-template.md b/0000-template.md new file mode 100644 index 000000000..43569cf57 --- /dev/null +++ b/0000-template.md @@ -0,0 +1,58 @@ +--- +feature: (fill me in with a unique ident, my_awesome_feature) +start-date: (fill me in with today's date, YYYY-MM-DD) +author: (name of the main author) +co-authors: (find a buddy later to help out with the RFC) +shepherd-team: (names, to be nominated and accepted by RFC steering committee) +shepherd-leader: (name to be appointed by RFC steering committee) +related-issues: (will contain links to implementation PRs) +--- + +# Summary +[summary]: #summary + +One paragraph explanation of the feature. + +# Motivation +[motivation]: #motivation + +Why are we doing this? What use cases does it support? What is the expected +outcome? + +# Detailed design +[design]: #detailed-design + +This is the core, normative part of the RFC. Explain the design in enough +detail for somebody familiar with the ecosystem to understand, and implement. +This should get into specifics and corner-cases. Yet, this section should also +be terse, avoiding redundancy even at the cost of clarity. + +# Examples and Interactions +[examples-and-interactions]: #examples-and-interactions + +This section illustrates the detailed design. This section should clarify all +confusion the reader has from the previous sections. It is especially important +to counterbalance the desired terseness of the detailed design; if you feel +your detailed design is rudely short, consider making this section longer +instead. + +# Drawbacks +[drawbacks]: #drawbacks + +Why should we *not* do this? + +# Alternatives +[alternatives]: #alternatives + +What other designs have been considered? What is the impact of not doing this? + +# Unresolved questions +[unresolved]: #unresolved-questions + +What parts of the design are still TBD or unknowns? + +# Future work +[future]: #future-work + +What future work, if any, would be implied or impacted by this feature +without being directly part of the work? diff --git a/0000-flake-names.md b/rfcs/0123-flake-names.md similarity index 100% rename from 0000-flake-names.md rename to rfcs/0123-flake-names.md From bae96eaadbff10724e3e7cf841b329958a087a27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anselm=20Sch=C3=BCler?= Date: Sun, 13 Mar 2022 15:45:17 +0100 Subject: [PATCH 03/14] Remove statement about flake registry interaction with flake names --- rfcs/0123-flake-names.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rfcs/0123-flake-names.md b/rfcs/0123-flake-names.md index 178d1ebd6..00cd914bb 100644 --- a/rfcs/0123-flake-names.md +++ b/rfcs/0123-flake-names.md @@ -31,7 +31,7 @@ The derivation that contains the flake’s content is called `flake-source-${nam # Examples and Interactions [examples-and-interactions]: #examples-and-interactions -A flake that is in the registry should have its name match the registry identifier. +None # Drawbacks [drawbacks]: #drawbacks From 53b1dc7eb08fa9270b9755056e5da8c0bbd3c54d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anselm=20Sch=C3=BCler?= Date: Sun, 13 Mar 2022 15:50:02 +0100 Subject: [PATCH 04/14] Add example to flake names --- rfcs/0123-flake-names.md | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/rfcs/0123-flake-names.md b/rfcs/0123-flake-names.md index 00cd914bb..714261eba 100644 --- a/rfcs/0123-flake-names.md +++ b/rfcs/0123-flake-names.md @@ -31,7 +31,27 @@ The derivation that contains the flake’s content is called `flake-source-${nam # Examples and Interactions [examples-and-interactions]: #examples-and-interactions -None +Example: + +File `./example/flake.nix` +```nix +{ + name = "example"; + outputs = { ... }: { + lib.example = "example"; + }; +} +``` + +Shell +```console +$ nix eval git+file://./example +[…] copying flake-source-example +"example" +$ nix flake metadata ./example +Name: example +Resolved URL: … +``` # Drawbacks [drawbacks]: #drawbacks From a108a3b62037129fa6f4a5e8dc00cb0227e49e6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anselm=20Sch=C3=BCler?= Date: Sun, 13 Mar 2022 15:51:46 +0100 Subject: [PATCH 05/14] Fix invalid URL in flake names example --- rfcs/0123-flake-names.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/rfcs/0123-flake-names.md b/rfcs/0123-flake-names.md index 714261eba..0801201c5 100644 --- a/rfcs/0123-flake-names.md +++ b/rfcs/0123-flake-names.md @@ -33,7 +33,7 @@ The derivation that contains the flake’s content is called `flake-source-${nam Example: -File `./example/flake.nix` +File `/example/flake.nix` ```nix { name = "example"; @@ -45,12 +45,13 @@ File `./example/flake.nix` Shell ```console -$ nix eval git+file://./example +$ nix eval git+file:///example […] copying flake-source-example "example" -$ nix flake metadata ./example +$ nix flake metadata /example Name: example -Resolved URL: … +Resolved URL: git+file:///example +Locked URL: … ``` # Drawbacks From 9acd46fc11824e09ce657bd4740dc496e1108fa7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anselm=20Sch=C3=BCler?= Date: Sun, 13 Mar 2022 16:02:15 +0100 Subject: [PATCH 06/14] Add note that nix flake show should use this, too --- rfcs/0123-flake-names.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rfcs/0123-flake-names.md b/rfcs/0123-flake-names.md index 0801201c5..f4e98ae4d 100644 --- a/rfcs/0123-flake-names.md +++ b/rfcs/0123-flake-names.md @@ -26,6 +26,7 @@ Also, the discoverability and usability of flakes needs to be improved. Current A new supported property for flakes is introduced, `name`. Running `nix flake metadata` on a flake that declares this field displays it at the top. +Running `nix flake show` on a flake that declares this field shows the name instead of the URL, followed by the URL in parentheses. The derivation that contains the flake’s content is called `flake-source-${name}` or, if a short revision identifier is available, `flake-source-${name}-${shortRev}`. # Examples and Interactions @@ -52,6 +53,9 @@ $ nix flake metadata /example Name: example Resolved URL: git+file:///example Locked URL: … +$ nix flake show /example +example (git+file:///home/anselmschueler/Code/example?rev=b0&rev=c714c8624f5d49a9d88e6e24550dd88515923c18) +└───lib: unknown ``` # Drawbacks From 23e44a1d905770f8a2291eeec9e26e45edafd299 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anselm=20Sch=C3=BCler?= Date: Sun, 13 Mar 2022 16:05:38 +0100 Subject: [PATCH 07/14] Update 0123-flake-names.md --- rfcs/0123-flake-names.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/rfcs/0123-flake-names.md b/rfcs/0123-flake-names.md index f4e98ae4d..fcdf4fca8 100644 --- a/rfcs/0123-flake-names.md +++ b/rfcs/0123-flake-names.md @@ -61,7 +61,8 @@ example (git+file:///home/anselmschueler/Code/example?rev=b0&rev=c714c8624f5d49a # Drawbacks [drawbacks]: #drawbacks -This may cause clutter and additional maintenance. +This may cause clutter and additional maintenance. +Since this changes the output of nix flake metadata and nix flake show, it might cause scripts that read this output to break. # Alternatives [alternatives]: #alternatives @@ -71,7 +72,8 @@ Flake names could be handled entirely through outside means, with things like th # Unresolved questions [unresolved]: #unresolved-questions -The name scheme could be changed. `flake-source-${name}-${shortRev}` could be too long. +The name scheme could be changed. `flake-source-${name}-${shortRev}` could be too long. +The interactions with nix flake metadata and nix flake show are not critical to the design, which is mostly aimed at clarifying derivation names. # Future work [future]: #future-work From bb09d85b02f68dd36c281546347cf916aec3b384 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anselm=20Sch=C3=BCler?= Date: Sun, 13 Mar 2022 19:54:33 +0100 Subject: [PATCH 08/14] (Flake names) Move & demote interactions --- rfcs/0123-flake-names.md | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/rfcs/0123-flake-names.md b/rfcs/0123-flake-names.md index fcdf4fca8..1f04630c9 100644 --- a/rfcs/0123-flake-names.md +++ b/rfcs/0123-flake-names.md @@ -25,14 +25,15 @@ Also, the discoverability and usability of flakes needs to be improved. Current [design]: #detailed-design A new supported property for flakes is introduced, `name`. -Running `nix flake metadata` on a flake that declares this field displays it at the top. -Running `nix flake show` on a flake that declares this field shows the name instead of the URL, followed by the URL in parentheses. The derivation that contains the flake’s content is called `flake-source-${name}` or, if a short revision identifier is available, `flake-source-${name}-${shortRev}`. # Examples and Interactions [examples-and-interactions]: #examples-and-interactions -Example: +Running `nix flake metadata` on a flake that declares this field displays it at the top. +Running `nix flake show` on a flake that declares this field shows the name instead of the URL, followed by the URL in parentheses. + +Examples: File `/example/flake.nix` ```nix @@ -47,8 +48,14 @@ File `/example/flake.nix` Shell ```console $ nix eval git+file:///example -[…] copying flake-source-example +[…] copying flake-source-example-e1279e9 "example" +``` + +Example of interactions: + +Shell (using the previous file) +``` $ nix flake metadata /example Name: example Resolved URL: git+file:///example From b077d31ed3915c9cd25048966d4b8030904b0b27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anselm=20Sch=C3=BCler?= Date: Sun, 13 Mar 2022 19:56:32 +0100 Subject: [PATCH 09/14] (flake names)Change short rev to tag < --- rfcs/0123-flake-names.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rfcs/0123-flake-names.md b/rfcs/0123-flake-names.md index 1f04630c9..f7d45563a 100644 --- a/rfcs/0123-flake-names.md +++ b/rfcs/0123-flake-names.md @@ -25,7 +25,7 @@ Also, the discoverability and usability of flakes needs to be improved. Current [design]: #detailed-design A new supported property for flakes is introduced, `name`. -The derivation that contains the flake’s content is called `flake-source-${name}` or, if a short revision identifier is available, `flake-source-${name}-${shortRev}`. +The derivation that contains the flake’s content is called `flake-source-${name}` or, if a source control tag (e.g. git tag such as V3) is available, `flake-source-${name}-${tag}`. # Examples and Interactions [examples-and-interactions]: #examples-and-interactions @@ -48,7 +48,7 @@ File `/example/flake.nix` Shell ```console $ nix eval git+file:///example -[…] copying flake-source-example-e1279e9 +[…] copying flake-source-example "example" ``` @@ -79,7 +79,7 @@ Flake names could be handled entirely through outside means, with things like th # Unresolved questions [unresolved]: #unresolved-questions -The name scheme could be changed. `flake-source-${name}-${shortRev}` could be too long. +The name scheme could be changed. `flake-source-${name}-${tag}` could be too long. The interactions with nix flake metadata and nix flake show are not critical to the design, which is mostly aimed at clarifying derivation names. # Future work From 79d2e615f75bcdbd19e14ec43085f335db2f7071 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anselm=20Sch=C3=BCler?= Date: Mon, 14 Mar 2022 12:26:13 +0100 Subject: [PATCH 10/14] Remove references to discoverability and separate statement about git tags for easier future removal --- rfcs/0123-flake-names.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/rfcs/0123-flake-names.md b/rfcs/0123-flake-names.md index f7d45563a..fc1f637e2 100644 --- a/rfcs/0123-flake-names.md +++ b/rfcs/0123-flake-names.md @@ -19,13 +19,14 @@ The derivations for a flake are no longer called `source`, but use the flake nam [motivation]: #motivation Flake-centric workflows often end up with a lot of derivations named “source”, and it’s difficult to navigate this. -Also, the discoverability and usability of flakes needs to be improved. Current commands mostly show technical information. This would be a step in the right direction. +This can also make flake-centric commands friendlier and easier to approach. # Detailed design [design]: #detailed-design A new supported property for flakes is introduced, `name`. -The derivation that contains the flake’s content is called `flake-source-${name}` or, if a source control tag (e.g. git tag such as V3) is available, `flake-source-${name}-${tag}`. +The derivation that contains the flake’s content is called `flake-source-${name}` +If a source control tag (e.g. git tag such as V3) is available, it is `flake-source-${name}-${tag}`. # Examples and Interactions [examples-and-interactions]: #examples-and-interactions @@ -79,10 +80,10 @@ Flake names could be handled entirely through outside means, with things like th # Unresolved questions [unresolved]: #unresolved-questions -The name scheme could be changed. `flake-source-${name}-${tag}` could be too long. +The name scheme could be changed. `flake-source-${name}` could be too long. Alternatives include `source-${name}`. The interactions with nix flake metadata and nix flake show are not critical to the design, which is mostly aimed at clarifying derivation names. # Future work [future]: #future-work -Flake discoverability and usability needs to be improved. +Flake usability can be improved. From 0cb078f3f5ea9c592cab38347c9d2921f9c71ed7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anselm=20Sch=C3=BCler?= Date: Fri, 20 May 2022 20:14:23 +0200 Subject: [PATCH 11/14] Update rfcs/0123-flake-names.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Théophane Hufschmitt <7226587+thufschmitt@users.noreply.github.com> --- rfcs/0123-flake-names.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rfcs/0123-flake-names.md b/rfcs/0123-flake-names.md index fc1f637e2..f3ced5f2e 100644 --- a/rfcs/0123-flake-names.md +++ b/rfcs/0123-flake-names.md @@ -13,7 +13,7 @@ related-issues: None Flakes can declare the field `name`. It represents the name of the flake. -The derivations for a flake are no longer called `source`, but use the flake name. +The store paths corresponding to a flake source are no longer called `source`, but use the flake name. # Motivation [motivation]: #motivation From e3b651f254037152fd1a0d9a925d62e547afc2a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anselm=20Sch=C3=BCler?= Date: Fri, 20 May 2022 20:18:28 +0200 Subject: [PATCH 12/14] Remove source control mention --- rfcs/0123-flake-names.md | 1 - 1 file changed, 1 deletion(-) diff --git a/rfcs/0123-flake-names.md b/rfcs/0123-flake-names.md index fc1f637e2..1643c871b 100644 --- a/rfcs/0123-flake-names.md +++ b/rfcs/0123-flake-names.md @@ -26,7 +26,6 @@ This can also make flake-centric commands friendlier and easier to approach. A new supported property for flakes is introduced, `name`. The derivation that contains the flake’s content is called `flake-source-${name}` -If a source control tag (e.g. git tag such as V3) is available, it is `flake-source-${name}-${tag}`. # Examples and Interactions [examples-and-interactions]: #examples-and-interactions From d8c2e19ca1d8392073f5d13598dae45f199bb533 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anselm=20Sch=C3=BCler?= Date: Sat, 21 May 2022 17:12:14 +0200 Subject: [PATCH 13/14] Slightly rewrite RFC 0123 --- rfcs/0123-flake-names.md | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/rfcs/0123-flake-names.md b/rfcs/0123-flake-names.md index 9fafaa709..5ee653426 100644 --- a/rfcs/0123-flake-names.md +++ b/rfcs/0123-flake-names.md @@ -18,8 +18,8 @@ The store paths corresponding to a flake source are no longer called `source`, b # Motivation [motivation]: #motivation -Flake-centric workflows often end up with a lot of derivations named “source”, and it’s difficult to navigate this. -This can also make flake-centric commands friendlier and easier to approach. +- Flake-centric workflows often end up with a lot of derivations named “source”, and it’s difficult to navigate this. +- This metadata can be used to make flakes more discoverable and usable, in particular, it can be output instead or with the URI, making the command friendlier. # Detailed design [design]: #detailed-design @@ -68,21 +68,24 @@ example (git+file:///home/anselmschueler/Code/example?rev=b0&rev=c714c8624f5d49a # Drawbacks [drawbacks]: #drawbacks -This may cause clutter and additional maintenance. -Since this changes the output of nix flake metadata and nix flake show, it might cause scripts that read this output to break. +- This may cause clutter and additional maintenance. +- Since this changes the output of nix flake metadata and nix flake show, it might cause scripts that read this output to break. +- This requires a significant change to the way flakes are handled. +- This treats the Nix store as a user-facing part of Nix, which is generally not intended. # Alternatives [alternatives]: #alternatives -Flake names could be handled entirely through outside means, with things like the global registry merely pointing to flakes under names. +- Flake names could be handled entirely through outside means, with things like the global registry merely pointing to flakes under names. # Unresolved questions [unresolved]: #unresolved-questions -The name scheme could be changed. `flake-source-${name}` could be too long. Alternatives include `source-${name}`. -The interactions with nix flake metadata and nix flake show are not critical to the design, which is mostly aimed at clarifying derivation names. +- The name scheme could be changed. `flake-source-${name}` could be too long. Alternatives include `source-${name}`. +- The interactions with nix flake metadata and nix flake show are not critical to the design, which is mostly aimed at clarifying derivation names. # Future work [future]: #future-work -Flake usability can be improved. +- Flake usability can be improved. +- Issues with indicipherable derivations named “source” also exist elsewhere. From c3bdc8d892082930b10300ccebe90e6484b55d93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anselm=20Sch=C3=BCler?= Date: Wed, 15 Jun 2022 15:51:33 +0200 Subject: [PATCH 14/14] RFC 0123: Slightly change wording --- rfcs/0123-flake-names.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rfcs/0123-flake-names.md b/rfcs/0123-flake-names.md index 5ee653426..29764ebd0 100644 --- a/rfcs/0123-flake-names.md +++ b/rfcs/0123-flake-names.md @@ -18,8 +18,8 @@ The store paths corresponding to a flake source are no longer called `source`, b # Motivation [motivation]: #motivation -- Flake-centric workflows often end up with a lot of derivations named “source”, and it’s difficult to navigate this. -- This metadata can be used to make flakes more discoverable and usable, in particular, it can be output instead or with the URI, making the command friendlier. +- Flakes generate store paths named “source”, and it’s difficult to navigate this when manually inspecting the store. +- This metadata can be used to make flakes more approachable and usable, in particular, it can be output instead or with the URI, making the nix commands friendlier. # Detailed design [design]: #detailed-design