1 { stdenv, lib, fetchgit, darwin, writeText
6 { rev, revNum, version, sha256 }:
9 revShort = builtins.substring 0 7 rev;
10 lastCommitPosition = writeText "last_commit_position.h" ''
11 #ifndef OUT_LAST_COMMIT_POSITION_H_
12 #define OUT_LAST_COMMIT_POSITION_H_
14 #define LAST_COMMIT_POSITION_NUM ${revNum}
15 #define LAST_COMMIT_POSITION "${revNum} (${revShort})"
17 #endif // OUT_LAST_COMMIT_POSITION_H_
20 in stdenv.mkDerivation {
21 pname = "gn-unstable";
25 # Note: The TAR-Archives (+archive/${rev}.tar.gz) are not deterministic!
26 url = "https://gn.googlesource.com/gn";
30 nativeBuildInputs = [ ninja python3 ];
31 buildInputs = lib.optionals stdenv.isDarwin (with darwin; with apple_sdk.frameworks; [
41 env.NIX_CFLAGS_COMPILE = "-Wno-error";
44 python build/gen.py --no-last-commit-position
45 ln -s ${lastCommitPosition} out/last_commit_position.h
46 ninja -j $NIX_BUILD_CORES -C out gn
50 install -vD out/gn "$out/bin/gn"
53 setupHook = ./setup-hook.sh;
56 description = "A meta-build system that generates build files for Ninja";
58 homepage = "https://gn.googlesource.com/gn";
59 license = licenses.bsd3;
60 platforms = platforms.unix;
61 maintainers = with maintainers; [ stesie matthewbauer primeos ];