summary refs log tree commit diff stats
path: root/lib/default.nix
blob: 2cbaf55cb5124716dcc3daac914147b4df37f74e (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
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;
}