How did this even work before!?
This commit is contained in:
Sandro - 2022-12-23 06:07:57 +01:00
parent 32d041f323
commit c31567d373
Signed by: sandro
GPG Key ID: 3AF5A43A3EECC2E5
2 changed files with 7 additions and 6 deletions

View File

@ -1,6 +1,6 @@
{
"nodes": {
"lib": {
"nixpkgs-lib": {
"locked": {
"lastModified": 1671324337,
"narHash": "sha256-OZVfw69LQi2RckjPdooYrhw1I2vd28QdzEGJwI3w+jk=",
@ -17,7 +17,7 @@
},
"root": {
"inputs": {
"lib": "lib"
"nixpkgs-lib": "nixpkgs-lib"
}
}
},

View File

@ -1,12 +1,13 @@
{
inputs = {
lib.url = "github:nix-community/nixpkgs.lib";
nixpkgs-lib.url = "github:nix-community/nixpkgs.lib";
};
outputs = { lib, ... }:
outputs = { nixpkgs-lib, ... }:
let
ls = dir: builtins.attrNames (builtins.readDir (./. + "/${dir}"));
importToAttr = dir: inputAttr: builtins.listToAttrs (map (file: { name = lib.removeSuffix ".nix" file; value = import (./. + "/${dir}/${file}.nix") inputAttr; }) (ls dir));
inherit (nixpkgs-lib) lib;
ls = dir: lib.attrNames (builtins.readDir (./. + "/${dir}"));
importToAttr = dir: inputAttr: lib.listToAttrs (map (file: { name = lib.removeSuffix ".nix" file; value = import (./. + "/${dir}/${file}") inputAttr; }) (ls dir));
in
{
lib = inputAttr: importToAttr "lib" inputAttr;