mirror of
https://github.com/NuschtOS/nixos-modules.git
synced 2024-06-26 06:38:27 +02:00
19 lines
608 B
Nix
19 lines
608 B
Nix
{
|
|
inputs = {
|
|
lib.url = "github:nix-community/nixpkgs.lib";
|
|
};
|
|
|
|
outputs = { lib, ... }:
|
|
let
|
|
ls = dir: builtins.attrNames (builtins.readDir (./. + "/${dir}"));
|
|
importToAttr = dir: inputAttr: lib.listToAttrs (map (file: { name = lib.removeSuffix ".nix" file; value = import (./. + "/${dir}/${file}.nix") inputAttr; }) (ls dir));
|
|
in
|
|
{
|
|
lib = inputAttr: importToAttr "lib" inputAttr;
|
|
nixosModules = inputAttr: importToAttr "modules" inputAttr;
|
|
nixosModule = _: {
|
|
imports = (dir: map (file: ./. + "/${dir}/${file}") (ls dir)) "modules";
|
|
};
|
|
};
|
|
}
|