All checks were successful
Test / Create distribution (push) Successful in 6m57s
Test / Sandbox (push) Successful in 8m53s
Test / Hpkg (push) Successful in 10m40s
Test / Sandbox (race detector) (push) Successful in 10m50s
Test / Create distribution (pull_request) Successful in 10m12s
Test / Hakurei (race detector) (push) Successful in 11m27s
Test / Hakurei (race detector) (pull_request) Successful in 11m24s
Test / Sandbox (pull_request) Successful in 40s
Test / Sandbox (race detector) (pull_request) Successful in 40s
Test / Hpkg (pull_request) Successful in 41s
Test / Hakurei (push) Successful in 2m39s
Test / Hakurei (pull_request) Successful in 2m33s
Test / Flake checks (pull_request) Successful in 1m44s
Test / Flake checks (push) Successful in 1m46s
This is required for securely providing access to PipeWire. This change has already been manually tested and confirmed to work correctly. This unfortunately cannot be upstreamed in its current state as libpipewire-0.3 breaks static linking. Signed-off-by: Ophestra <cat@gensokyo.uk>
156 lines
2.8 KiB
Nix
156 lines
2.8 KiB
Nix
{
|
|
lib,
|
|
stdenv,
|
|
buildGoModule,
|
|
makeBinaryWrapper,
|
|
xdg-dbus-proxy,
|
|
pkg-config,
|
|
libffi,
|
|
libseccomp,
|
|
acl,
|
|
wayland,
|
|
wayland-protocols,
|
|
wayland-scanner,
|
|
pipewire,
|
|
xorg,
|
|
|
|
# for hpkg
|
|
zstd,
|
|
gnutar,
|
|
coreutils,
|
|
|
|
# for passthru.buildInputs
|
|
go,
|
|
clang,
|
|
|
|
# for check
|
|
util-linux,
|
|
nettools,
|
|
|
|
glibc, # for ldd
|
|
withStatic ? stdenv.hostPlatform.isStatic,
|
|
}:
|
|
|
|
buildGoModule rec {
|
|
pname = "hakurei";
|
|
version = "0.3.1";
|
|
|
|
srcFiltered = builtins.path {
|
|
name = "${pname}-src";
|
|
path = lib.cleanSource ./.;
|
|
filter = path: type: !(type == "regular" && (lib.hasSuffix ".nix" path || lib.hasSuffix ".py" path)) && !(type == "directory" && lib.hasSuffix "/test" path) && !(type == "directory" && lib.hasSuffix "/cmd/hsu" path);
|
|
};
|
|
vendorHash = null;
|
|
|
|
src = stdenv.mkDerivation {
|
|
name = "${pname}-src-full";
|
|
inherit version;
|
|
enableParallelBuilding = true;
|
|
src = srcFiltered;
|
|
|
|
buildInputs = [
|
|
wayland
|
|
wayland-protocols
|
|
];
|
|
|
|
nativeBuildInputs = [
|
|
go
|
|
pkg-config
|
|
wayland-scanner
|
|
];
|
|
|
|
buildPhase = "GOCACHE=$(mktemp -d) go generate ./...";
|
|
installPhase = "cp -r . $out";
|
|
};
|
|
|
|
ldflags =
|
|
lib.attrsets.foldlAttrs
|
|
(
|
|
ldflags: name: value:
|
|
ldflags ++ [ "-X hakurei.app/internal/info.${name}=${value}" ]
|
|
)
|
|
(
|
|
[ "-s -w" ]
|
|
++ lib.optionals withStatic [
|
|
"-linkmode external"
|
|
"-extldflags \"-static\""
|
|
]
|
|
)
|
|
{
|
|
buildVersion = "v${version}";
|
|
hakureiPath = "${placeholder "out"}/libexec/hakurei";
|
|
hsuPath = "/run/wrappers/bin/hsu";
|
|
};
|
|
|
|
env = {
|
|
# use clang instead of gcc
|
|
CC = "clang -O3 -Werror";
|
|
|
|
# nix build environment does not allow acls
|
|
GO_TEST_SKIP_ACL = 1;
|
|
};
|
|
|
|
buildInputs = [
|
|
libffi
|
|
libseccomp
|
|
acl
|
|
wayland
|
|
pipewire
|
|
]
|
|
++ (with xorg; [
|
|
libxcb
|
|
libXau
|
|
libXdmcp
|
|
]);
|
|
|
|
nativeBuildInputs = [
|
|
pkg-config
|
|
makeBinaryWrapper
|
|
|
|
# for container example
|
|
nettools
|
|
];
|
|
|
|
postInstall =
|
|
let
|
|
appPackages = [
|
|
glibc
|
|
xdg-dbus-proxy
|
|
];
|
|
in
|
|
''
|
|
install -D --target-directory=$out/share/zsh/site-functions dist/comp/*
|
|
|
|
mkdir "$out/libexec"
|
|
mv "$out"/bin/* "$out/libexec/"
|
|
|
|
makeBinaryWrapper "$out/libexec/hakurei" "$out/bin/hakurei" \
|
|
--inherit-argv0 --prefix PATH : ${lib.makeBinPath appPackages}
|
|
|
|
makeBinaryWrapper "$out/libexec/hpkg" "$out/bin/hpkg" \
|
|
--inherit-argv0 --prefix PATH : ${
|
|
lib.makeBinPath (
|
|
appPackages
|
|
++ [
|
|
zstd
|
|
gnutar
|
|
coreutils
|
|
]
|
|
)
|
|
}
|
|
'';
|
|
|
|
passthru.targetPkgs = [
|
|
go
|
|
clang
|
|
xorg.xorgproto
|
|
util-linux
|
|
|
|
# for go generate
|
|
wayland-protocols
|
|
wayland-scanner
|
|
]
|
|
++ buildInputs
|
|
++ nativeBuildInputs;
|
|
}
|