From 15c7953f41f0a85d2467f6f15a522196799db426 Mon Sep 17 00:00:00 2001 From: Paul Brinkmeier Date: Tue, 30 Sep 2025 17:24:58 +0200 Subject: [PATCH] Nix CI tryouts --- .gitea/workflows/build-image.yml | 30 +++++++++++++++++++----------- flake.nix | 4 ++-- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/.gitea/workflows/build-image.yml b/.gitea/workflows/build-image.yml index 763446d..42d6687 100644 --- a/.gitea/workflows/build-image.yml +++ b/.gitea/workflows/build-image.yml @@ -6,25 +6,33 @@ on: jobs: build-image: container: - image: catthehacker/ubuntu:act-latest + image: node:24-bookworm + env: + USER: 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 steps: + - run: | + if [ ! -f ~/.nix-profile/etc/profile.d/nix.sh ]; then + bash <(curl -L https://nixos.org/nix/install) --no-daemon + fi - 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 + run: | + . ~/.nix-profile/etc/profile.d/nix.sh + 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: | + . ~/.nix-profile/etc/profile.d/nix.sh + nix build --log-format raw --print-build-logs .#image -o image.tar.gz - run: docker login -u paul -p "$PASSWORD" git.pbrinkmeier.de env: PASSWORD: "${{ secrets.REGISTRY_PASSWORD }}" diff --git a/flake.nix b/flake.nix index 90f37c0..bca0e46 100644 --- a/flake.nix +++ b/flake.nix @@ -20,11 +20,11 @@ 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"; + filter = path: type: builtins.baseNameOf path != "flake.nix" && builtins.baseNameOf path != "flake.lock" && builtins.match "^\\.gitea.*" path != null; }; # Avoid linking against libc