~kaction/config

ref: fb2cfdb0b2cf032054cde714b9732ab2b9d0a5de config/system-v2/nix-sys/default.nix -rw-r--r-- 719 bytes
fb2cfdb0 — Dmitry Bogatov nix-sys: move more of build process out of Nix 9 months ago
                                                                                
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
{ stdenv, tinycdb, nix-sys-generate, redo-c, manifest ? {} }:
assert manifest != null;
let
in stdenv.mkDerivation {
  name = "nix-sys";
  src = ./.;
  outputs = [ "out" "cdb" ];
  nativeBuildInputs = [ nix-sys-generate redo-c ];
  buildInputs = [ tinycdb ];
  configurePhase = ''
    mkdir conf
    echo $out > conf/out
    echo $cdb > conf/cdb
    echo "$manifest" > conf/manifest
    echo "${stdenv.cc.targetPrefix}cc -static -O2" > conf/cc
    echo "${stdenv.cc.targetPrefix}cc" > conf/ld
  '';
  buildPhase = "redo";
  installPhase = ''
    mkdir -p $out/bin
    install -m555 ./nix-sys $out/bin/nix-sys
    mv index.cdb $cdb
  '';
  postFixup = "rm -fr $out/nix-support";
  manifest = builtins.toJSON manifest;
}