From e1e3a9c404d0545a290f38a313933c48ec32bcae Mon Sep 17 00:00:00 2001 From: Sk7Str1p3 Date: Wed, 13 May 2026 21:00:05 +0300 Subject: [PATCH] feat(flake/inputs): recursively import all files instead of manual importing --- flake/default.nix | 4 ++-- flake/inputs/default.nix | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/flake/default.nix b/flake/default.nix index 7c059db..cce2f29 100644 --- a/flake/default.nix +++ b/flake/default.nix @@ -8,7 +8,7 @@ Essentially, `flake.nix` is like `Cargo.toml` in Rust or `package.json` in Node.js, but for an entire operating system. */ -{ inputs, ... }: +{ inputs, lib, ... }: { imports = [ inputs.flake-file.flakeModules.default @@ -19,7 +19,7 @@ systems = [ "x86_64-linux" ]; - flake-file.inputs = import ./inputs; + flake-file.inputs = import ./inputs { inherit lib; }; flake-file.outputs = "inputs: inputs.flake-parts.lib.mkFlake { inherit inputs; } ./flake"; flake-file.description = "A very basic flake"; } diff --git a/flake/inputs/default.nix b/flake/inputs/default.nix index 8d10537..ce4828c 100644 --- a/flake/inputs/default.nix +++ b/flake/inputs/default.nix @@ -1,3 +1,4 @@ +{ lib, ... }: # Flake inputs /** @@ -14,4 +15,8 @@ > Then accessing inputs in repl, remove {class}, so instead of calling e.g. `flake.inputs.core.nixpkgs`, > you call `flake.inputs.nixpkgs`. */ -(import ./core.nix) // (import ./home.nix) +lib.foldl' (acc: value: acc // value) { } ( + map (file: import ./${file}) ( + builtins.filter (name: name != "default.nix") (builtins.attrNames (builtins.readDir ./.)) + ) +)