~kaction/config

42707d29c994c30956608b9c9f10cbaf1d00add4 — Dmitry Bogatov 2 years ago c15a3cb
nix-sys: generate build system inside of build system

This makes debugging easier that when installation exists only inside
Nix "installPhase".
M system-v2/nix-sys/all.do => system-v2/nix-sys/all.do +1 -1
@@ 1,2 1,2 @@
#!/bin/sh
exec redo-ifchange nix-sys .gitignore
exec redo-ifchange .gitignore nix-sys install.sh

M system-v2/nix-sys/default.nix => system-v2/nix-sys/default.nix +1 -5
@@ 19,11 19,7 @@ in stdenv.mkDerivation {
      > conf/feature-chattr
  '';
  buildPhase = "redo";
  installPhase = ''
    mkdir -p $out/bin
    install -m555 ./nix-sys $out/bin/nix-sys
    mv index.cdb $cdb
  '';
  installPhase = "./install.sh";
  postFixup = "rm -fr $out/nix-support";
  manifest = builtins.toJSON manifest;
}

A system-v2/nix-sys/install.in => system-v2/nix-sys/install.in +6 -0
@@ 0,0 1,6 @@
#!/bin/sh -eu
redo

install -d "@out@/bin"
install -m 755 ./nix-sys "@out@/bin"
install -m 444 ./index.cdb "@cdb@"

A system-v2/nix-sys/install.sh.do => system-v2/nix-sys/install.sh.do +7 -0
@@ 0,0 1,7 @@
#!/bin/sh
redo-ifchange conf/out conf/cdb install.in
out=$(cat conf/out)
cdb=$(cat conf/cdb)

sed -e "s#@out@#${out}#g" -e "s#@cdb@#${cdb}#g" < install.in > "$3"
chmod +x "$3"