aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/flake.nix167
-rw-r--r--test/hakurei/configuration.nix (renamed from test/configuration.nix)0
-rw-r--r--test/hakurei/default.nix (renamed from test/default.nix)0
-rw-r--r--test/hakurei/flake.lock (renamed from test/flake.lock)0
-rw-r--r--test/hakurei/flake.nix76
-rw-r--r--test/hakurei/hsu.nix (renamed from test/hsu.nix)2
-rw-r--r--test/hakurei/nixos.nix (renamed from test/nixos.nix)0
-rw-r--r--test/hakurei/options.nix (renamed from test/options.nix)0
-rw-r--r--test/hakurei/package.nix (renamed from test/package.nix)4
-rw-r--r--test/hakurei/test.py (renamed from test/test.py)0
10 files changed, 79 insertions, 170 deletions
diff --git a/test/flake.nix b/test/flake.nix
deleted file mode 100644
index 9b18c9b6..00000000
--- a/test/flake.nix
+++ /dev/null
@@ -1,167 +0,0 @@
-{
- description = "hakurei container tool and nixos module";
-
- inputs = {
- nixpkgs.url = "github:NixOS/nixpkgs/nixos-26.05";
-
- home-manager = {
- url = "github:nix-community/home-manager/release-26.05";
- inputs.nixpkgs.follows = "nixpkgs";
- };
- };
-
- outputs =
- {
- self,
- nixpkgs,
- home-manager,
- }:
- let
- supportedSystems = [
- "aarch64-linux"
- "i686-linux"
- "x86_64-linux"
- ];
-
- forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
- nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; });
- in
- {
- nixosModules.hakurei = import ./nixos.nix self.packages;
-
- checks = forAllSystems (
- system:
- let
- pkgs = nixpkgsFor.${system};
-
- inherit (pkgs)
- runCommandLocal
- callPackage
- nixfmt
- ;
- in
- {
- hakurei = callPackage ./. { inherit system self; };
- race = callPackage ./. {
- inherit system self;
- withRace = true;
- };
- }
- );
-
- packages = forAllSystems (
- system:
- let
- inherit (self.packages.${system}) hakurei hsu;
- pkgs = nixpkgsFor.${system};
- in
- {
- default = hakurei;
- hakurei = pkgs.pkgsStatic.callPackage ./package.nix {
- inherit (pkgs)
- # passthru.buildInputs
- go_1_27
- clang
-
- # nativeBuildInputs
- pkg-config
- wayland-scanner
- makeBinaryWrapper
-
- # appPackages
- glibc
- xdg-dbus-proxy
-
- # for check
- util-linux
- nettools
- ;
- };
- hsu = pkgs.callPackage ./hsu.nix { inherit (self.packages.${system}) hakurei; };
- sharefs = pkgs.linkFarm "sharefs" {
- "bin/sharefs" = "${hakurei}/libexec/sharefs";
- "bin/mount.fuse.sharefs" = "${hakurei}/libexec/sharefs";
- };
-
- dist =
- pkgs.runCommand "${hakurei.name}-dist"
- {
- buildInputs = hakurei.targetPkgs ++ [
- pkgs.pkgsStatic.musl
- ];
- }
- ''
- cd $(mktemp -d) \
- && cp -r ${hakurei.src}/. . \
- && chmod +w cmd && cp -r ${hsu.src}/. cmd/hsu/ \
- && chmod -R +w .
-
- CC="musl-clang -O3 -Werror -Qunused-arguments" \
- GOCACHE="$(mktemp -d)" \
- PATH="${pkgs.pkgsStatic.musl.bin}/bin:$PATH" \
- DESTDIR="$out" \
- ./all.sh
- '';
- }
- );
-
- devShells = forAllSystems (
- system:
- let
- inherit (self.packages.${system}) hakurei;
- pkgs = nixpkgsFor.${system};
- in
- {
- default = pkgs.mkShell {
- buildInputs = hakurei.targetPkgs;
- hardeningDisable = [ "fortify" ];
- };
- withPackage = pkgs.mkShell { buildInputs = [ hakurei ] ++ hakurei.targetPkgs; };
-
- generateDoc =
- let
- inherit (pkgs) lib;
-
- doc =
- let
- eval = lib.evalModules {
- specialArgs = {
- inherit pkgs;
- };
- modules = [ (import ./options.nix self.packages) ];
- };
- cleanEval = lib.filterAttrsRecursive (n: _: n != "_module") eval;
- in
- pkgs.nixosOptionsDoc { inherit (cleanEval) options; };
- docText = pkgs.runCommand "hakurei-module-docs.md" { } ''
- cat ${doc.optionsCommonMark} > $out
- sed -i '/*Declared by:*/,+1 d' $out
- '';
- in
- pkgs.mkShell {
- shellHook = ''
- exec cat ${docText} > options.md
- '';
- };
-
- 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/std/mksysnum_linux.pl \
- ${pkgs.linuxHeaders}/include/asm/unistd_64.h | \
- ${pkgs.go}/bin/gofmt > \
- container/std/syscall_linux_${GOARCH.${system}}.go
- ''}";
- };
- }
- );
- };
-}
diff --git a/test/configuration.nix b/test/hakurei/configuration.nix
index 62d8239d..62d8239d 100644
--- a/test/configuration.nix
+++ b/test/hakurei/configuration.nix
diff --git a/test/default.nix b/test/hakurei/default.nix
index 81daa0a2..81daa0a2 100644
--- a/test/default.nix
+++ b/test/hakurei/default.nix
diff --git a/test/flake.lock b/test/hakurei/flake.lock
index 5537506a..5537506a 100644
--- a/test/flake.lock
+++ b/test/hakurei/flake.lock
diff --git a/test/hakurei/flake.nix b/test/hakurei/flake.nix
new file mode 100644
index 00000000..dc42b1cb
--- /dev/null
+++ b/test/hakurei/flake.nix
@@ -0,0 +1,76 @@
+{
+ description = "hakurei container tool and nixos module";
+
+ inputs = {
+ nixpkgs.url = "github:NixOS/nixpkgs/nixos-26.05";
+
+ home-manager = {
+ url = "github:nix-community/home-manager/release-26.05";
+ inputs.nixpkgs.follows = "nixpkgs";
+ };
+ };
+
+ outputs =
+ {
+ self,
+ nixpkgs,
+ home-manager,
+ }:
+ let
+ supportedSystems = [ "x86_64-linux" ];
+
+ forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
+ nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; });
+ in
+ {
+ nixosModules.hakurei = import ./nixos.nix self.packages;
+
+ checks = forAllSystems (
+ system:
+ let
+ pkgs = nixpkgsFor.${system};
+
+ inherit (pkgs) callPackage;
+ in
+ {
+ hakurei = callPackage ./. { inherit system self; };
+ race = callPackage ./. {
+ inherit system self;
+ withRace = true;
+ };
+ }
+ );
+
+ packages = forAllSystems (
+ system:
+ let
+ inherit (self.packages.${system}) hakurei hsu;
+ pkgs = nixpkgsFor.${system};
+ in
+ {
+ default = hakurei;
+ hakurei = pkgs.pkgsStatic.callPackage ./package.nix {
+ inherit (pkgs)
+ # passthru.buildInputs
+ go_1_27
+ clang
+
+ # nativeBuildInputs
+ pkg-config
+ wayland-scanner
+ makeBinaryWrapper
+
+ # appPackages
+ glibc
+ xdg-dbus-proxy
+
+ # for check
+ util-linux
+ nettools
+ ;
+ };
+ hsu = pkgs.callPackage ./hsu.nix { inherit (self.packages.${system}) hakurei; };
+ }
+ );
+ };
+}
diff --git a/test/hsu.nix b/test/hakurei/hsu.nix
index 7acb3529..5dd4cf5d 100644
--- a/test/hsu.nix
+++ b/test/hakurei/hsu.nix
@@ -8,7 +8,7 @@ buildGoModule {
pname = "${hakurei.pname}-hsu";
inherit (hakurei) version;
- src = ../cmd/hsu;
+ src = ../../cmd/hsu;
inherit (hakurei) vendorHash;
env.CGO_ENABLED = 0;
diff --git a/test/nixos.nix b/test/hakurei/nixos.nix
index 49bfffb6..49bfffb6 100644
--- a/test/nixos.nix
+++ b/test/hakurei/nixos.nix
diff --git a/test/options.nix b/test/hakurei/options.nix
index f624b6f5..f624b6f5 100644
--- a/test/options.nix
+++ b/test/hakurei/options.nix
diff --git a/test/package.nix b/test/hakurei/package.nix
index e68420e3..0facf291 100644
--- a/test/package.nix
+++ b/test/hakurei/package.nix
@@ -34,11 +34,11 @@
buildGo127Module rec {
pname = "hakurei";
- version = with lib.strings; removePrefix "v" (trim (builtins.readFile ../cmd/dist/VERSION));
+ version = with lib.strings; removePrefix "v" (trim (builtins.readFile ../../cmd/dist/VERSION));
srcFiltered = builtins.path {
name = "${pname}-src";
- path = lib.cleanSource ../.;
+ 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;
diff --git a/test/test.py b/test/hakurei/test.py
index 98f08275..98f08275 100644
--- a/test/test.py
+++ b/test/hakurei/test.py