2024-09-04 17:03:21 +09:00
|
|
|
{
|
2024-09-09 04:37:12 +09:00
|
|
|
lib,
|
|
|
|
buildGoModule,
|
|
|
|
makeBinaryWrapper,
|
|
|
|
xdg-dbus-proxy,
|
2024-09-23 18:21:12 +09:00
|
|
|
bubblewrap,
|
2024-12-06 03:34:13 +09:00
|
|
|
pkg-config,
|
2024-09-04 17:03:21 +09:00
|
|
|
acl,
|
2024-12-06 03:34:13 +09:00
|
|
|
wayland,
|
|
|
|
wayland-scanner,
|
|
|
|
wayland-protocols,
|
2024-09-04 17:03:21 +09:00
|
|
|
xorg,
|
|
|
|
}:
|
|
|
|
|
|
|
|
buildGoModule rec {
|
|
|
|
pname = "fortify";
|
2024-12-20 00:28:48 +09:00
|
|
|
version = "0.2.5";
|
2024-09-04 17:03:21 +09:00
|
|
|
|
2024-12-21 17:39:42 +09:00
|
|
|
src = builtins.path {
|
|
|
|
name = "fortify-src";
|
|
|
|
path = lib.cleanSource ./.;
|
|
|
|
filter = path: type: !(type != "directory" && lib.hasSuffix ".nix" path);
|
|
|
|
};
|
2024-09-04 17:03:21 +09:00
|
|
|
vendorHash = null;
|
|
|
|
|
2024-11-02 03:03:44 +09:00
|
|
|
ldflags =
|
|
|
|
lib.attrsets.foldlAttrs
|
|
|
|
(
|
|
|
|
ldflags: name: value:
|
|
|
|
ldflags
|
|
|
|
++ [
|
|
|
|
"-X"
|
2024-12-20 00:20:02 +09:00
|
|
|
"git.gensokyo.uk/security/fortify/internal.${name}=${value}"
|
2024-11-02 03:03:44 +09:00
|
|
|
]
|
|
|
|
)
|
|
|
|
[
|
|
|
|
"-s"
|
|
|
|
"-w"
|
2024-11-04 12:32:14 +09:00
|
|
|
"-X"
|
2024-11-18 12:58:47 +09:00
|
|
|
"main.Fmain=${placeholder "out"}/libexec/fortify"
|
2024-11-16 21:19:45 +09:00
|
|
|
"-X"
|
2024-11-17 02:03:18 +09:00
|
|
|
"main.Fshim=${placeholder "out"}/libexec/fshim"
|
2024-11-02 03:03:44 +09:00
|
|
|
]
|
|
|
|
{
|
|
|
|
Version = "v${version}";
|
|
|
|
Fsu = "/run/wrappers/bin/fsu";
|
2024-11-17 02:03:18 +09:00
|
|
|
Finit = "${placeholder "out"}/libexec/finit";
|
2024-11-02 03:03:44 +09:00
|
|
|
};
|
2024-09-04 17:03:21 +09:00
|
|
|
|
2024-12-16 19:29:01 +09:00
|
|
|
# nix build environment does not allow acls
|
|
|
|
GO_TEST_SKIP_ACL = 1;
|
|
|
|
|
2024-09-04 17:03:21 +09:00
|
|
|
buildInputs = [
|
|
|
|
acl
|
2024-12-06 03:34:13 +09:00
|
|
|
wayland
|
|
|
|
wayland-protocols
|
2024-09-04 17:03:21 +09:00
|
|
|
xorg.libxcb
|
|
|
|
];
|
2024-09-09 04:37:12 +09:00
|
|
|
|
2024-12-06 03:34:13 +09:00
|
|
|
nativeBuildInputs = [
|
|
|
|
pkg-config
|
|
|
|
wayland-scanner
|
|
|
|
makeBinaryWrapper
|
|
|
|
];
|
|
|
|
|
|
|
|
preConfigure = ''
|
|
|
|
HOME=$(mktemp -d) go generate ./...
|
|
|
|
'';
|
2024-09-09 04:37:12 +09:00
|
|
|
|
|
|
|
postInstall = ''
|
2024-11-20 01:25:19 +09:00
|
|
|
install -D --target-directory=$out/share/zsh/site-functions comp/*
|
|
|
|
|
2024-11-18 12:58:47 +09:00
|
|
|
mkdir "$out/libexec"
|
|
|
|
mv "$out"/bin/* "$out/libexec/"
|
2024-10-27 23:45:52 +09:00
|
|
|
|
2024-11-18 12:58:47 +09:00
|
|
|
makeBinaryWrapper "$out/libexec/fortify" "$out/bin/fortify" \
|
|
|
|
--inherit-argv0 --prefix PATH : ${
|
|
|
|
lib.makeBinPath [
|
|
|
|
bubblewrap
|
|
|
|
xdg-dbus-proxy
|
|
|
|
]
|
|
|
|
}
|
2024-09-09 04:37:12 +09:00
|
|
|
'';
|
2024-09-04 17:03:21 +09:00
|
|
|
}
|