~kaction/config

7453c85b651ca3f003c1ae9c6c5d11520a3c0b6f — Dmitry Bogatov 7 months ago 2000b08
nix-sys: do not install during configure phase

Change nix-sys-generate to not install index database directly into $cdb
during configure phase. This change is supposed to make interactive
development (e.g nix-shell) simpler.
2 files changed, 5 insertions(+), 2 deletions(-)

M system-v2/nix-sys-generate/nix-sys-generate.py
M system-v2/nix-sys/default.nix
M system-v2/nix-sys-generate/nix-sys-generate.py => system-v2/nix-sys-generate/nix-sys-generate.py +3 -2
@@ 85,7 85,8 @@ def make_output_cdb(out, manifest):
@click.option("--template-directory", required=True)
@click.option("--output-config", required=True)
@click.option("--output-cdb", required=True)
def main(hash, manifest, template_directory, output_config, output_cdb):
@click.option("--staged-output-cdb")
def main(hash, manifest, template_directory, output_config, output_cdb, staged_output_cdb):
    manifest = json.loads(manifest)
    render = functools.partial(render_template, template_directory)
    manifest[CDB_PATH] = dict(path=output_cdb, action="symlink")


@@ 95,7 96,7 @@ def main(hash, manifest, template_directory, output_config, output_cdb):
            make_output_config(out, manifest, hash, render, output_cdb)

    if output_cdb:
        with open(output_cdb, "wb") as out:
        with open(staged_output_cdb or output_cdb, "wb") as out:
            make_output_cdb(out, manifest)

main()

M system-v2/nix-sys/default.nix => system-v2/nix-sys/default.nix +2 -0
@@ 13,12 13,14 @@ in stdenv.mkDerivation {
      --manifest "$manifest" \
      --output-config config.h \
      --output-cdb $cdb \
      --staged-output-cdb index.cdb \
      --hash $hash
  '';
  installPhase = ''
    mkdir -p $out/bin
    ${stdenv.hostPlatform.config}-cc -static -O2 -g main.c -lcdb -o $out/bin/nix-sys
    ${stdenv.hostPlatform.config}-strip -s $out/bin/nix-sys
    mv index.cdb $cdb
  '';
  manifest = builtins.toJSON manifest;
}