From 96dc4c924dd36c0df711ca4df48d4e58fe23056b Mon Sep 17 00:00:00 2001 From: Paul Brinkmeier Date: Tue, 30 Sep 2025 17:24:58 +0200 Subject: [PATCH 1/4] Nix CI tryouts --- .gitea/workflows/build-image.yml | 34 ++++++++++++++++++++------------ flake.nix | 21 ++++++++++++++++---- 2 files changed, 38 insertions(+), 17 deletions(-) diff --git a/.gitea/workflows/build-image.yml b/.gitea/workflows/build-image.yml index 763446d..e66aea1 100644 --- a/.gitea/workflows/build-image.yml +++ b/.gitea/workflows/build-image.yml @@ -6,27 +6,35 @@ on: jobs: build-image: container: - image: catthehacker/ubuntu:act-latest + image: node:24-bookworm + env: + USER: node + HOME: /home/node + NIX_CONFIG: experimental-features = nix-command flakes + volumes: + - /home/paul/nix-ci/nix-runner-nix:/nix + - /home/paul/nix-ci/nix-runner-etc-nix:/etc/nix + - /home/paul/nix-ci/nix-runner-home-node:/home/node + options: --user 1000:1000 --group-add 988 steps: + - name: Prep nix env + run: | + if [ ! -f ~/.nix-profile/etc/profile.d/nix.sh ]; then + curl -L https://nixos.org/nix/install | bash -s -- --no-daemon + fi + . ~/.nix-profile/etc/profile.d/nix.sh + env >> "$GITHUB_ENV" - name: Checkout repo uses: actions/checkout@v4 - # Required for installing nix - - name: Install sudo - run: apt-get update && apt-get install -y sudo - - name: Install Nix - uses: cachix/install-nix-action@v31 - with: - enable_kvm: false - name: Get image meta run: nix build .#image-meta -o image-meta - name: Version check run: | VERSION=$(cat image-meta/version) [ "$GITHUB_REF_NAME" = v"$VERSION" ] - - name: Build image - run: nix build .#image -o image.tar.gz - - run: docker login -u paul -p "$PASSWORD" git.pbrinkmeier.de + - run: nix build --log-format raw --print-build-logs .#image -o image.tar.gz + - run: gunzip -c image.tar.gz > image.tar + - run: nix run .#crane -- auth login git.pbrinkmeier.de -u paul -p "$PASSWORD" env: PASSWORD: "${{ secrets.REGISTRY_PASSWORD }}" - - run: docker load < image.tar.gz - - run: docker image push $(cat image-meta/name) + - run: nix run .#crane -- push image.tar $(cat image-meta/name) diff --git a/flake.nix b/flake.nix index 90f37c0..ea2d266 100644 --- a/flake.nix +++ b/flake.nix @@ -16,15 +16,22 @@ vrnp-static = pkgs.buildGoModule { pname = "vrnp"; - version = "0.0.10"; + version = "0.0.10-test"; vendorHash = null; # For building the package, we use only the files not ignored by Git as inputs. - # Also, flake.nix and flake.lock are not included to avoid annoying rebuilds when + # Also, flake.nix, flake.lock and .gitea are not included to avoid annoying rebuilds when # working on them. src = pkgs.lib.cleanSourceWith { - src = gitignore.lib.gitignoreSource ./.; - filter = path: type: builtins.baseNameOf path != "flake.nix" && builtins.baseNameOf path != "flake.lock"; + src = ./.; + filter = gitignore.lib.gitignoreFilterWith { + basePath = ./.; + extraRules = '' + flake.nix + flake.lock + .gitea + ''; + }; }; # Avoid linking against libc @@ -55,6 +62,12 @@ config.Cmd = [ "${vrnp-static}/bin/vrnp" ]; }; }; + apps = { + crane = { + type = "app"; + program = "${pkgs.crane}/bin/crane"; + }; + }; } ); } From 959630f7b6df3760849bc523d5bf33a6e7c5a9bd Mon Sep 17 00:00:00 2001 From: Paul Brinkmeier Date: Mon, 6 Oct 2025 09:44:52 +0200 Subject: [PATCH 2/4] Change version back to 0.0.10 and remove docker group --- .gitea/workflows/build-image.yml | 2 +- flake.nix | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/build-image.yml b/.gitea/workflows/build-image.yml index e66aea1..b061cf4 100644 --- a/.gitea/workflows/build-image.yml +++ b/.gitea/workflows/build-image.yml @@ -15,7 +15,7 @@ jobs: - /home/paul/nix-ci/nix-runner-nix:/nix - /home/paul/nix-ci/nix-runner-etc-nix:/etc/nix - /home/paul/nix-ci/nix-runner-home-node:/home/node - options: --user 1000:1000 --group-add 988 + options: --user 1000:1000 steps: - name: Prep nix env run: | diff --git a/flake.nix b/flake.nix index ea2d266..9227f18 100644 --- a/flake.nix +++ b/flake.nix @@ -16,7 +16,7 @@ vrnp-static = pkgs.buildGoModule { pname = "vrnp"; - version = "0.0.10-test"; + version = "0.0.10"; vendorHash = null; # For building the package, we use only the files not ignored by Git as inputs. From 54099afcb14d4d91df2250244c75270cbda04c3f Mon Sep 17 00:00:00 2001 From: Paul Brinkmeier Date: Tue, 7 Oct 2025 00:02:21 +0200 Subject: [PATCH 3/4] Use new bind mounts --- .gitea/workflows/build-image.yml | 6 +++--- flake.nix | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.gitea/workflows/build-image.yml b/.gitea/workflows/build-image.yml index b061cf4..78cbe86 100644 --- a/.gitea/workflows/build-image.yml +++ b/.gitea/workflows/build-image.yml @@ -12,9 +12,9 @@ jobs: HOME: /home/node NIX_CONFIG: experimental-features = nix-command flakes volumes: - - /home/paul/nix-ci/nix-runner-nix:/nix - - /home/paul/nix-ci/nix-runner-etc-nix:/etc/nix - - /home/paul/nix-ci/nix-runner-home-node:/home/node + - /var/lib/pbri/docker/nix_runner_nix:/nix + - /var/lib/pbri/docker/nix_runner_etc:/etc/nix + - /var/lib/pbri/docker/nix_runner_home_node:/home/node options: --user 1000:1000 steps: - name: Prep nix env diff --git a/flake.nix b/flake.nix index 9227f18..0624ff2 100644 --- a/flake.nix +++ b/flake.nix @@ -16,7 +16,7 @@ vrnp-static = pkgs.buildGoModule { pname = "vrnp"; - version = "0.0.10"; + version = "0.0.10-bindmounts"; vendorHash = null; # For building the package, we use only the files not ignored by Git as inputs. From da8e8f15c8eb00d686ce9c1e25d9d35e02bd1e3b Mon Sep 17 00:00:00 2001 From: Paul Brinkmeier Date: Tue, 7 Oct 2025 00:11:59 +0200 Subject: [PATCH 4/4] Reset version --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 0624ff2..9227f18 100644 --- a/flake.nix +++ b/flake.nix @@ -16,7 +16,7 @@ vrnp-static = pkgs.buildGoModule { pname = "vrnp"; - version = "0.0.10-bindmounts"; + version = "0.0.10"; vendorHash = null; # For building the package, we use only the files not ignored by Git as inputs.