aboutsummaryrefslogtreecommitdiffhomepage
path: root/flake.nix
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-07-07 04:22:55 +0900
committerOphestra <cat@gensokyo.uk>2025-07-07 04:22:55 +0900
commit72c2b66fc01f7bf20ced4b9de180e3d154e5fa39 (patch)
tree527bde4fa9f8b9992291f9f10ee3fce421262b78 /flake.nix
parent356b42a406efbdef63bb040e32c7b73b4bd86b3d (diff)
nix: cross-platform syscall wrapper
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix28
1 files changed, 17 insertions, 11 deletions
diff --git a/flake.nix b/flake.nix
index 53db737d..6cc94de8 100644
--- a/flake.nix
+++ b/flake.nix
@@ -185,17 +185,23 @@
'';
};
- generateSyscallTable = pkgs.mkShell {
- # this should be made cross-platform via nix
- shellHook = "exec ${pkgs.writeShellScript "generate-syscall-table" ''
- set -e
- ${pkgs.perl}/bin/perl \
- sandbox/seccomp/mksysnum_linux.pl \
- ${pkgs.linuxHeaders}/include/asm/unistd_64.h | \
- ${pkgs.go}/bin/gofmt > \
- sandbox/seccomp/syscall_linux_amd64.go
- ''}";
- };
+ generateSyscallTable =
+ let
+ GOARCH = {
+ x86_64-linux = "amd64";
+ aarch64-linux = "arm64";
+ };
+ in
+ pkgs.mkShell {
+ shellHook = "exec ${pkgs.writeShellScript "generate-syscall-table" ''
+ set -e
+ ${pkgs.perl}/bin/perl \
+ container/seccomp/mksysnum_linux.pl \
+ ${pkgs.linuxHeaders}/include/asm/unistd_64.h | \
+ ${pkgs.go}/bin/gofmt > \
+ container/seccomp/syscall_linux_${GOARCH.${system}}.go
+ ''}";
+ };
}
);
};