aboutsummaryrefslogtreecommitdiff
path: root/src/libcmd/installable-flake.hh
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2023-05-09 11:50:22 -0400
committerJohn Ericson <John.Ericson@Obsidian.Systems>2023-05-10 11:29:45 -0400
commita93110ab19085eeda1b4244fef49d18f91a1d7b8 (patch)
treec199184cb8c31b16d14f9f8ca8659e4d772028d8 /src/libcmd/installable-flake.hh
parent53a1354acfa9a3d7e0a6c3914ff3c53115d4c452 (diff)
Fix `nix print-dev-env` & `nix develop` with drv paths
Fixes #8309 This regression was because both `CmdDevelop` and `CmdPrintDevEnv` were switched to be `InstallableValueCommand` subclasses, but actually neither should have been. The `nixpkgsFlakeRef` method should indeed not be on the base installable class, because "flake refs" and "nixpkgs" are not installable-wide notions, but that doesn't mean these commands should only accept installable values.
Diffstat (limited to 'src/libcmd/installable-flake.hh')
-rw-r--r--src/libcmd/installable-flake.hh15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/libcmd/installable-flake.hh b/src/libcmd/installable-flake.hh
index afe64d977..7ac4358d2 100644
--- a/src/libcmd/installable-flake.hh
+++ b/src/libcmd/installable-flake.hh
@@ -67,9 +67,22 @@ struct InstallableFlake : InstallableValue
std::shared_ptr<flake::LockedFlake> getLockedFlake() const;
- FlakeRef nixpkgsFlakeRef() const override;
+ FlakeRef nixpkgsFlakeRef() const;
};
+/**
+ * Default flake ref for referring to Nixpkgs. For flakes that don't
+ * have their own Nixpkgs input, or other installables.
+ *
+ * It is a layer violation for Nix to know about Nixpkgs; currently just
+ * `nix develop` does. Be wary of using this /
+ * `InstallableFlake::nixpkgsFlakeRef` more places.
+ */
+static inline FlakeRef defaultNixpkgsFlakeRef()
+{
+ return FlakeRef::fromAttrs({{"type","indirect"}, {"id", "nixpkgs"}});
+}
+
ref<eval_cache::EvalCache> openEvalCache(
EvalState & state,
std::shared_ptr<flake::LockedFlake> lockedFlake);