nix: Remove unecessary module handling

Who would have thought, someone thought about this before me :shockedpikachu:
This commit is contained in:
Geoffrey Frogeye 2023-10-22 22:50:22 +02:00
parent 3af998440f
commit 8ae219fb83
Signed by: geoffrey
GPG key ID: C72403E7F82E6AD8
2 changed files with 8 additions and 29 deletions

View file

@ -1,7 +1,9 @@
{ config, pkgs, ... }:
let
recursiveMerge = import ./recursiveMerge.nix;
getModule = name: import (./modules + "/${name}.nix") { inherit config pkgs; };
loadModules = modules: recursiveMerge ((map getModule) modules);
in
loadModules [ "common" "desktop" "battery" "wireless" ]
{
imports = [
./modules/common.nix
./modules/desktop.nix
./modules/battery.nix
./modules/wireless.nix
];
}

View file

@ -1,23 +0,0 @@
let
pkgs = import <nixpkgs> { };
# Somehow, if fed the pkgs from a nix-build, it creates an infinite recursion, hence the search path
lib = pkgs.lib;
recursiveMerge = with lib; attrList:
let f = attrPath:
zipAttrsWith (n: values:
if tail values == [ ]
then head values
else if all isList values
then unique (concatLists values)
else if all isAttrs values
then f (attrPath ++ [ n ]) values
else last values
);
in f [ ] attrList;
in
recursiveMerge