mirror of
https://github.com/librephoenix/nixos-config
synced 2025-10-19 01:54:02 +05:30
Major config overhaul: use custom modules, setup for multi-host config, and less boilerplate
This commit is contained in:
parent
1fa8b17b07
commit
0453901d17
303 changed files with 3560 additions and 5566 deletions
29
modules/system/default.nix
Normal file
29
modules/system/default.nix
Normal file
|
@ -0,0 +1,29 @@
|
|||
{ lib, ... }:
|
||||
|
||||
with lib;
|
||||
let
|
||||
# Recursively constructs an attrset of a given folder, recursing on directories, value of attrs is the filetype
|
||||
getDir = dir: mapAttrs
|
||||
(file: type:
|
||||
if type == "directory" then getDir "${dir}/${file}" else type
|
||||
)
|
||||
(builtins.readDir dir);
|
||||
|
||||
# Collects all files of a directory as a list of strings of paths
|
||||
files = dir: collect isString (mapAttrsRecursive (path: type: concatStringsSep "/" path) (getDir dir));
|
||||
|
||||
# Filters out directories that don't end with .nix or are this file, also makes the strings absolute
|
||||
importAll = dir: map
|
||||
(file: ./. + "/${file}")
|
||||
(filter
|
||||
(file: hasSuffix ".nix" file && file != "default.nix" &&
|
||||
! lib.hasPrefix "x/taffybar/" file &&
|
||||
! lib.hasSuffix "-hm.nix" file)
|
||||
(files dir));
|
||||
|
||||
in
|
||||
{
|
||||
|
||||
imports = importAll ./.;
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue