nix #11

Manually merged
geoffrey merged 113 commits from nix into main 2023-12-09 21:43:01 +01:00
2 changed files with 8 additions and 29 deletions
Showing only changes of commit 8ae219fb83 - Show all commits

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