aboutsummaryrefslogtreecommitdiff
path: root/infra/libkookie/modules/harness/lib.nix
blob: 842f02adfd36785e316df95369ea24eb00792b4d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
{ config, lib, pkgs, ... } @ args:

let
  makeModPath = (base: name: base + "/${name}.nix");
  loader = import ./hm-loader.nix;
in
{
  # Load a home-manager configuration module
  #
  # Returns a home-manager loader closure configured with the
  # correct module derivation (by device) and active user set
  # enabled via `libkookie.activeUsers`.
  loadModule = (mod: dev:
    (loader (makeModPath mod dev) config.libkookie.activeUsers));

  # Load a simple path with the standard set of arguments
  load = path: (import path) args;

  # Patch an attribute set with access to the original set
  #
  # This function wraps around lib.recursiveUpdate to make it slighly
  # less cumbersome to work with in one-liners.
  patchAttrs = attrs: f: (lib.recursiveUpdate attrs (f attrs));
}