File tree Expand file tree Collapse file tree 1 file changed +75
-0
lines changed
Expand file tree Collapse file tree 1 file changed +75
-0
lines changed Original file line number Diff line number Diff line change 1+ {
2+ lib ,
3+ stdenv ,
4+ fetchFromGitHub ,
5+ cmake ,
6+ pkg-config ,
7+ gz-cmake ,
8+ nix-update-script ,
9+ coreutils ,
10+ } :
11+
12+ stdenv . mkDerivation ( finalAttrs : {
13+ pname = "gz-tools" ;
14+ version = "2.0.2" ;
15+
16+ src = fetchFromGitHub {
17+ owner = "gazebosim" ;
18+ repo = "gz-tools" ;
19+ tag = "gz-tools${ lib . versions . major finalAttrs . version } _${ finalAttrs . version } " ;
20+ hash = "sha256-CY+W1jWIkszKwKuLgKmJpZMXHn0RnueMHFSDhOXIzLg=" ;
21+ } ;
22+
23+ strictDeps = true ;
24+
25+ nativeBuildInputs = [
26+ cmake
27+ pkg-config
28+ coreutils # For env
29+ ] ;
30+
31+ buildInputs = [ gz-cmake ] ;
32+
33+ # Disable automatic shebang patching since we'll do it manually
34+ dontPatchShebangs = true ;
35+
36+ postFixup = ''
37+ if [ -f "$out/bin/gz" ]; then
38+ # Check if it's a text file (script)
39+ if head -n1 "$out/bin/gz" | grep -q '^#!'; then
40+ # Replace the shebang with the correct path to env
41+ substituteInPlace "$out/bin/gz" \
42+ --replace '#!/usr/bin/env' '#!${ coreutils } /bin/env' \
43+ --replace '#!/bin/env' '#!${ coreutils } /bin/env'
44+
45+ # Ensure executable permissions
46+ chmod +x "$out/bin/gz"
47+ fi
48+ fi
49+ '' ;
50+
51+ doInstallCheck = true ;
52+
53+ installCheckPhase = ''
54+ # Verify the binary exists and can be executed
55+ if [ -x "$out/bin/gz" ]; then
56+ "$out/bin/gz" --help >/dev/null || true
57+ fi
58+ '' ;
59+
60+ passthru = {
61+ updateScript = nix-update-script {
62+ attrPath = "gz-tools" ;
63+ } ;
64+ } ;
65+
66+ meta = {
67+ description = "Gazebo Sim tools collection" ;
68+ homepage = "https://gazebosim.org/" ;
69+ downloadPage = "https://github.com/gazebosim/gz-tools" ;
70+ license = lib . licenses . asl20 ;
71+ maintainers = with lib . maintainers ; [ guelakais ] ;
72+ platforms = lib . platforms . all ;
73+ mainProgram = "gz" ;
74+ } ;
75+ } )
You can’t perform that action at this time.
0 commit comments