all repos — nixfiles @ 802741a5292636b9a1619c712e128a77976e9d31

System and user configuration, managed by nix and home-manager

lib/default.nix (view raw)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
{ pkgs }:
with builtins;
let
  inherit (pkgs) lib;
in
rec {
  importPathStore = p: "${append ../. "/${p}"}";

  mkPathable = s: toString (
    if lib.path.subpath.isValid s
    then (lib.path.append ../. s)
    else s
  );

  kvPath = k: v: "${k}=${v}";

  fromSources = sources:
    lib.attrsets.mapAttrs
      (k: v: v.outPath)
      sources;

  mkNixPath = sources: lib.attrsets.mapAttrsToList
    (k: v: kvPath k (mkPathable v))
    sources;
}