From c1214547da21d0075b63bedf1ca5f54af60c3691 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Mon, 20 Feb 2023 22:26:51 +0100 Subject: [PATCH] modules: system: nix: add '/etc/nix/inputs' links --- modules/system/nix/default.nix | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/modules/system/nix/default.nix b/modules/system/nix/default.nix index f8e7c24..bae6e6f 100644 --- a/modules/system/nix/default.nix +++ b/modules/system/nix/default.nix @@ -7,6 +7,8 @@ in options.my.system.nix = with lib; { enable = my.mkDisableOption "nix configuration"; + linkInputs = my.mkDisableOption "link inputs to `/etc/nix/inputs/`"; + addToRegistry = my.mkDisableOption "add inputs and self to registry"; addToNixPath = my.mkDisableOption "add inputs and self to nix path"; @@ -38,6 +40,24 @@ in }; }) + (lib.mkIf cfg.linkInputs { + environment.etc = + let + makeLink = n: v: { + name = "nix/inputs/${n}"; + value = { source = v.outPath; }; + }; + makeLinks = lib.mapAttrs' makeLink; + in + makeLinks { + inherit (inputs) + self + nixpkgs + nur + ; + }; + }) + (lib.mkIf cfg.addToNixPath { nix.nixPath = [ "self=${inputs.self}"