1
Fork 0
mirror of https://github.com/RGBCube/ncc synced 2025-07-29 19:17:45 +00:00

Import better, ignore files starting with _

This commit is contained in:
RGBCube 2024-02-04 22:07:22 +03:00
parent e04291a4a2
commit b3532173c2
No known key found for this signature in database
2 changed files with 31 additions and 15 deletions

View file

@ -2,19 +2,21 @@
description = "All my NixOS configurations."; description = "All my NixOS configurations.";
nixConfig = { nixConfig = {
extra-substituters = '' extra-substituters = [
https://nix-community.cachix.org/ "https://nix-community.cachix.org/"
https://hyprland.cachix.org/ "https://ghostty.cachix.org/"
https://cache.privatevoid.net/ "https://hyprland.cachix.org/"
https://cache.garnix.io/ "https://cache.privatevoid.net/"
''; "https://cache.garnix.io/"
];
extra-trusted-public-keys = '' extra-trusted-public-keys = [
nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs= "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc= "ghostty.cachix.org-1:QB389yTa6gTyneehvqG58y0WnHjQOqgnA+wBnpWWxns="
cache.privatevoid.net-1:SErQ8bvNWANeAvtsOESUwVYr2VJynfuc9JRwlzTTkVg= "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g= "cache.privatevoid.net-1:SErQ8bvNWANeAvtsOESUwVYr2VJynfuc9JRwlzTTkVg="
''; "cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g="
];
}; };
inputs = { inputs = {
@ -169,7 +171,21 @@
inherit system; inherit system;
specialArgs = { inherit inputs ulib upkgs keys theme; }; specialArgs = { inherit inputs ulib upkgs keys theme; };
modules = [
modules = let
mapDirectory = function: directory: with builtins;
attrValues (mapAttrs function (readDir directory));
nullIfUnderscore = name: if (builtins.substring 0 1 name) == "_" then
null
else
name;
filterNull = builtins.filter (x: x != null);
importDirectory = directory:
filterNull (mapDirectory (name: _: lib.mapNullable (name: /${directory}/${name}) (nullIfUnderscore name)) directory);
in [
homeManager.nixosModules.default homeManager.nixosModules.default
agenix.nixosModules.default agenix.nixosModules.default
@ -179,8 +195,8 @@
site.nixosModules.default site.nixosModules.default
defaultConfiguration defaultConfiguration
] ++ (builtins.attrValues (builtins.mapAttrs (name: _: ./modules/${name}) (builtins.readDir ./modules))) ] ++ (importDirectory ./hosts/${host})
++ (builtins.attrValues (builtins.mapAttrs (name: _: ./hosts/${host}/${name}) (builtins.readDir ./hosts/${host}))); ++ (importDirectory ./modules);
}; };
hosts = (builtins.attrNames (builtins.readDir ./hosts)); hosts = (builtins.attrNames (builtins.readDir ./hosts));