gn: merge generic and package

Signed-off-by: Marcin Serwin <marcin@serwin.dev>

+69 -82
-79
pkgs/by-name/gn/gn/generic.nix
··· 1 - { 2 - stdenv, 3 - lib, 4 - fetchgit, 5 - fetchpatch, 6 - cctools, 7 - writeText, 8 - ninja, 9 - python3, 10 - ... 11 - }: 12 - 13 - { 14 - rev, 15 - revNum, 16 - version, 17 - sha256, 18 - }: 19 - 20 - let 21 - revShort = builtins.substring 0 7 rev; 22 - lastCommitPosition = writeText "last_commit_position.h" '' 23 - #ifndef OUT_LAST_COMMIT_POSITION_H_ 24 - #define OUT_LAST_COMMIT_POSITION_H_ 25 - 26 - #define LAST_COMMIT_POSITION_NUM ${revNum} 27 - #define LAST_COMMIT_POSITION "${revNum} (${revShort})" 28 - 29 - #endif // OUT_LAST_COMMIT_POSITION_H_ 30 - ''; 31 - 32 - in 33 - stdenv.mkDerivation { 34 - pname = "gn-unstable"; 35 - inherit version; 36 - 37 - src = fetchgit { 38 - # Note: The TAR-Archives (+archive/${rev}.tar.gz) are not deterministic! 39 - url = "https://gn.googlesource.com/gn"; 40 - inherit rev sha256; 41 - }; 42 - 43 - nativeBuildInputs = [ 44 - ninja 45 - python3 46 - ]; 47 - buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ 48 - cctools 49 - ]; 50 - 51 - env.NIX_CFLAGS_COMPILE = "-Wno-error"; 52 - # Relax hardening as otherwise gn unstable 2024-06-06 and later fail with: 53 - # cc1plus: error: '-Wformat-security' ignored without '-Wformat' [-Werror=format-security] 54 - hardeningDisable = [ "format" ]; 55 - 56 - buildPhase = '' 57 - python build/gen.py --no-last-commit-position 58 - ln -s ${lastCommitPosition} out/last_commit_position.h 59 - ninja -j $NIX_BUILD_CORES -C out gn 60 - ''; 61 - 62 - installPhase = '' 63 - install -vD out/gn "$out/bin/gn" 64 - ''; 65 - 66 - setupHook = ./setup-hook.sh; 67 - 68 - meta = with lib; { 69 - description = "Meta-build system that generates build files for Ninja"; 70 - mainProgram = "gn"; 71 - homepage = "https://gn.googlesource.com/gn"; 72 - license = licenses.bsd3; 73 - platforms = platforms.unix; 74 - maintainers = with maintainers; [ 75 - stesie 76 - matthewbauer 77 - ]; 78 - }; 79 - }
+69 -3
pkgs/by-name/gn/gn/package.nix
··· 1 - { callPackage, ... }@args: 2 - 3 - callPackage ./generic.nix args { 1 + { 2 + stdenv, 3 + lib, 4 + fetchgit, 5 + cctools, 6 + writeText, 7 + ninja, 8 + python3, 9 + }: 10 + let 4 11 # Note: Please use the recommended version for Chromium stable, i.e. from 5 12 # <nixpkgs>/pkgs/applications/networking/browsers/chromium/info.json 6 13 rev = "85cc21e94af590a267c1c7a47020d9b420f8a033"; 7 14 revNum = "2233"; # git describe $rev --match initial-commit | cut -d- -f3 8 15 version = "2025-04-28"; 9 16 sha256 = "sha256-+nKP2hBUKIqdNfDz1vGggXSdCuttOt0GwyGUQ3Z1ZHI="; 17 + 18 + revShort = builtins.substring 0 7 rev; 19 + lastCommitPosition = writeText "last_commit_position.h" '' 20 + #ifndef OUT_LAST_COMMIT_POSITION_H_ 21 + #define OUT_LAST_COMMIT_POSITION_H_ 22 + 23 + #define LAST_COMMIT_POSITION_NUM ${revNum} 24 + #define LAST_COMMIT_POSITION "${revNum} (${revShort})" 25 + 26 + #endif // OUT_LAST_COMMIT_POSITION_H_ 27 + ''; 28 + 29 + in 30 + stdenv.mkDerivation { 31 + pname = "gn-unstable"; 32 + inherit version; 33 + 34 + src = fetchgit { 35 + # Note: The TAR-Archives (+archive/${rev}.tar.gz) are not deterministic! 36 + url = "https://gn.googlesource.com/gn"; 37 + inherit rev sha256; 38 + }; 39 + 40 + nativeBuildInputs = [ 41 + ninja 42 + python3 43 + ]; 44 + buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ 45 + cctools 46 + ]; 47 + 48 + env.NIX_CFLAGS_COMPILE = "-Wno-error"; 49 + # Relax hardening as otherwise gn unstable 2024-06-06 and later fail with: 50 + # cc1plus: error: '-Wformat-security' ignored without '-Wformat' [-Werror=format-security] 51 + hardeningDisable = [ "format" ]; 52 + 53 + buildPhase = '' 54 + python build/gen.py --no-last-commit-position 55 + ln -s ${lastCommitPosition} out/last_commit_position.h 56 + ninja -j $NIX_BUILD_CORES -C out gn 57 + ''; 58 + 59 + installPhase = '' 60 + install -vD out/gn "$out/bin/gn" 61 + ''; 62 + 63 + setupHook = ./setup-hook.sh; 64 + 65 + meta = with lib; { 66 + description = "Meta-build system that generates build files for Ninja"; 67 + mainProgram = "gn"; 68 + homepage = "https://gn.googlesource.com/gn"; 69 + license = licenses.bsd3; 70 + platforms = platforms.unix; 71 + maintainers = with maintainers; [ 72 + stesie 73 + matthewbauer 74 + ]; 75 + }; 10 76 }