nix: Remove unecessary module handling
Who would have thought, someone thought about this before me :shockedpikachu:
This commit is contained in:
parent
3af998440f
commit
8ae219fb83
|
@ -1,7 +1,9 @@
|
||||||
{ config, pkgs, ... }:
|
{ config, pkgs, ... }:
|
||||||
let
|
{
|
||||||
recursiveMerge = import ./recursiveMerge.nix;
|
imports = [
|
||||||
getModule = name: import (./modules + "/${name}.nix") { inherit config pkgs; };
|
./modules/common.nix
|
||||||
loadModules = modules: recursiveMerge ((map getModule) modules);
|
./modules/desktop.nix
|
||||||
in
|
./modules/battery.nix
|
||||||
loadModules [ "common" "desktop" "battery" "wireless" ]
|
./modules/wireless.nix
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
|
@ -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
|
|
Loading…
Reference in a new issue