aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--flake.nix8
-rw-r--r--internal/outcome/shim-signal.c2
-rw-r--r--package.nix13
-rw-r--r--test/default.nix2
4 files changed, 17 insertions, 8 deletions
diff --git a/flake.nix b/flake.nix
index e158b502..109551b7 100644
--- a/flake.nix
+++ b/flake.nix
@@ -114,7 +114,7 @@
inherit (pkgs)
# passthru.buildInputs
go
- gcc
+ clang
# nativeBuildInputs
pkg-config
@@ -129,6 +129,10 @@
zstd
gnutar
coreutils
+
+ # for check
+ util-linux
+ nettools
;
};
hsu = pkgs.callPackage ./cmd/hsu/package.nix { inherit (self.packages.${system}) hakurei; };
@@ -144,7 +148,7 @@
&& chmod -R +w .
export HAKUREI_VERSION="v${hakurei.version}"
- ./dist/release.sh && mkdir $out && cp -v "dist/hakurei-$HAKUREI_VERSION.tar.gz"* $out
+ CC="clang -O3 -Werror" ./dist/release.sh && mkdir $out && cp -v "dist/hakurei-$HAKUREI_VERSION.tar.gz"* $out
'';
}
);
diff --git a/internal/outcome/shim-signal.c b/internal/outcome/shim-signal.c
index 7e562068..0e04abb4 100644
--- a/internal/outcome/shim-signal.c
+++ b/internal/outcome/shim-signal.c
@@ -38,7 +38,7 @@ static void hakurei_shim_sigaction(int sig, siginfo_t *si, void *ucontext) {
void hakurei_shim_setup_cont_signal(pid_t ppid, int fd) {
if (hakurei_shim_param_ppid != -1 || hakurei_shim_fd != -1)
- *(int *)NULL = 0; /* unreachable */
+ *(volatile int *)NULL = 0; /* unreachable */
struct sigaction new_action = {0}, old_action = {0};
if (sigaction(SIGCONT, NULL, &old_action) != 0)
diff --git a/package.nix b/package.nix
index 21aee353..fb449c11 100644
--- a/package.nix
+++ b/package.nix
@@ -20,7 +20,7 @@
# for passthru.buildInputs
go,
- gcc,
+ clang,
# for check
util-linux,
@@ -81,8 +81,13 @@ buildGoModule rec {
hsuPath = "/run/wrappers/bin/hsu";
};
- # nix build environment does not allow acls
- env.GO_TEST_SKIP_ACL = 1;
+ env = {
+ # use clang instead of gcc
+ CC = "clang -O3 -Werror";
+
+ # nix build environment does not allow acls
+ GO_TEST_SKIP_ACL = 1;
+ };
buildInputs = [
libffi
@@ -135,7 +140,7 @@ buildGoModule rec {
passthru.targetPkgs = [
go
- gcc
+ clang
xorg.xorgproto
util-linux
diff --git a/test/default.nix b/test/default.nix
index 037d7dee..edca9fdc 100644
--- a/test/default.nix
+++ b/test/default.nix
@@ -44,7 +44,7 @@ nixosTest {
cd ${self.packages.${system}.hakurei.src}
${fhs}/bin/hakurei-fhs -c \
- 'go test ${if withRace then "-race" else "-count 16"} ./...' \
+ 'CC="clang -O3 -Werror" go test ${if withRace then "-race" else "-count 16"} ./...' \
&> /tmp/hakurei-test.log && \
touch /tmp/hakurei-test-ok
touch /tmp/hakurei-test-done