~kaction/config

ref: 42707d29c994c30956608b9c9f10cbaf1d00add4 config/system-v2/nix-sys/default.nix -rw-r--r-- 784 bytes
42707d29 — Dmitry Bogatov nix-sys: generate build system inside of build system 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
{ stdenv, tinycdb, nix-sys-generate, manifest ? { }, redo-c, cproto
, linuxHeaders ? null }:
assert manifest != null;
let
in stdenv.mkDerivation {
  name = "nix-sys";
  src = ./.;
  outputs = [ "out" "cdb" ];
  nativeBuildInputs = [ nix-sys-generate redo-c cproto ];
  buildInputs = [ tinycdb linuxHeaders ];
  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
    echo "${if linuxHeaders != null then "enable" else "disable"}" \
      > conf/feature-chattr
  '';
  buildPhase = "redo";
  installPhase = "./install.sh";
  postFixup = "rm -fr $out/nix-support";
  manifest = builtins.toJSON manifest;
}