nix: wrap fpkg
Some checks failed
Test / Flake checks (push) Blocked by required conditions
Test / Create distribution (push) Successful in 25s
Test / Fortify (push) Has been cancelled
Test / Data race detector (push) Has been cancelled

This is usable on nixos now due to the static build.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
Ophestra 2025-02-26 12:20:12 +09:00
parent 4fa38d6063
commit 8b16cbd4a6
Signed by: cat
SSH Key Fingerprint: SHA256:gQ67O0enBZ7UdZypgtspB2FDM1g3GVw8nX0XSdcFw8Q

View File

@ -14,6 +14,11 @@
wayland-scanner,
xorg,
# for fpkg
zstd,
gnutar,
coreutils,
glibc, # for ldd
withStatic ? stdenv.hostPlatform.isStatic,
}:
@ -80,19 +85,33 @@ buildGoModule rec {
HOME="$(mktemp -d)" PATH="${pkg-config}/bin:$PATH" go generate ./...
'';
postInstall = ''
install -D --target-directory=$out/share/zsh/site-functions comp/*
postInstall =
let
appPackages = [
glibc
bubblewrap
xdg-dbus-proxy
];
in
''
install -D --target-directory=$out/share/zsh/site-functions comp/*
mkdir "$out/libexec"
mv "$out"/bin/* "$out/libexec/"
mkdir "$out/libexec"
mv "$out"/bin/* "$out/libexec/"
makeBinaryWrapper "$out/libexec/fortify" "$out/bin/fortify" \
--inherit-argv0 --prefix PATH : ${
lib.makeBinPath [
glibc
bubblewrap
xdg-dbus-proxy
]
}
'';
makeBinaryWrapper "$out/libexec/fortify" "$out/bin/fortify" \
--inherit-argv0 --prefix PATH : ${lib.makeBinPath appPackages}
makeBinaryWrapper "$out/libexec/fpkg" "$out/bin/fpkg" \
--inherit-argv0 --prefix PATH : ${
lib.makeBinPath (
appPackages
++ [
zstd
gnutar
coreutils
]
)
}
'';
}