feat(flake/inputs): recursively import all files instead of manual

importing
This commit is contained in:
Sk7Str1p3 2026-05-13 21:00:05 +03:00
parent faca496c63
commit e1e3a9c404
No known key found for this signature in database
GPG key ID: 4DD995933D06D43B
2 changed files with 8 additions and 3 deletions

View file

@ -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. 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 = [ imports = [
inputs.flake-file.flakeModules.default inputs.flake-file.flakeModules.default
@ -19,7 +19,7 @@
systems = [ "x86_64-linux" ]; 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.outputs = "inputs: inputs.flake-parts.lib.mkFlake { inherit inputs; } ./flake";
flake-file.description = "A very basic flake"; flake-file.description = "A very basic flake";
} }

View file

@ -1,3 +1,4 @@
{ lib, ... }:
# Flake inputs # Flake inputs
/** /**
@ -14,4 +15,8 @@
> Then accessing inputs in repl, remove {class}, so instead of calling e.g. `flake.inputs.core.nixpkgs`, > Then accessing inputs in repl, remove {class}, so instead of calling e.g. `flake.inputs.core.nixpkgs`,
> you call `flake.inputs.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 ./.))
)
)