From 984654610a57093a6c39d8e8e73039e33e54db6d Mon Sep 17 00:00:00 2001 From: xenia Date: Mon, 2 Dec 2024 01:53:59 -0500 Subject: [PATCH] add option for nixpkgs reference in flake registry --- flake.nix | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/flake.nix b/flake.nix index 211702a..10d495a 100644 --- a/flake.nix +++ b/flake.nix @@ -89,10 +89,20 @@ defaultText = lib.literalExpression "true"; example = lib.literalExpression "false"; }; + + setNixpkgsFlakeAlias = lib.mkOption { + description = "Set nix path entry for `nixpkgs` to self"; + type = lib.types.bool; + default = true; + defaultText = lib.literalExpression "true"; + example = lib.literalExpression "false"; + }; }; - config.nix.registry = lib.mkIf config.dragnpkgs.setFlakeRegistry { - dragnpkgs = self.meta.registry-entry; + config.nix.registry.dragnpkgs = lib.mkIf config.dragnpkgs.setFlakeRegistry self.meta.registry-entry; + config.nix.registry.nixpkgs = lib.mkIf config.dragnpkgs.setNixpkgsFlakeAlias { + from = { id = "nixpkgs"; type = "indirect"; }; + to = { id = "dragnpkgs"; type = "indirect"; }; }; config.nix.nixPath = lib.mkIf config.dragnpkgs.setNixPath [