summary refs log tree commit diff
path: root/pkgs/tools/misc/lorri/runtime.nix
blob: 71bc89b5af3297a1b62f28813678602a63e984f9 (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
{
  # 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