summary refs log tree commit diff
path: root/pkgs/tools/misc/lorri/runtime.nix
blob: 96b14b26e82c7a5ca57299a00f440383ea376c0c (plain) (blame)
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
26
27
28
29
30
31
32
33
34
35
36
37
38
{
  # Plumbing tools:
  closureInfo
, runCommand
, writeText
, buildEnv
, # Actual dependencies to propagate:
  bash
, coreutils
}:
let
  tools = buildEnv {
    name = "lorri-runtime-tools";
    paths = [ coreutils bash ];
  };

  runtimeClosureInfo = closureInfo {
    rootPaths = [ tools ];
  };

  closureToNix = runCommand "closure.nix" {}
    ''
      (
        echo '{ dep, ... }: ['
        sed -E 's/^(.*)$/    (dep \1)/' ${runtimeClosureInfo}/store-paths
        echo ']'
      ) > $out
    '';

  runtimeClosureInfoAsNix = runCommand "runtime-closure.nix" {
    runtime_closure_list = closureToNix;
    tools_build_host = tools;
  }
    ''
      substituteAll ${./runtime-closure.nix.template} $out
    '';
in
runtimeClosureInfoAsNix