diff --git a/.github/actions/build-action/Dockerfile b/.github/actions/build-action/Dockerfile index b623b2a..651fbe1 100644 --- a/.github/actions/build-action/Dockerfile +++ b/.github/actions/build-action/Dockerfile @@ -5,12 +5,17 @@ # Container image that runs your code FROM ubuntu:22.04 +ARG USER=builder + ENV TZ=Europe/Helsinki ENV LANG=en_US.utf8 RUN apt-get update && apt-get -y install curl xz-utils git -# Install nixos +RUN groupadd nix +RUN useradd -m -d /home/${USER} -s /bin/bash -G nix ${USER} + +# Install nix COPY ./installer.conf /tmp/installer.conf #COPY install_nix.sh /install_nix.sh #RUN /install_nix.sh @@ -23,6 +28,8 @@ RUN curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/ RUN rm -f /tmp/installer.conf ENV PATH="${PATH}:/nix/var/nix/profiles/default/bin" +USER ${USER} + # Copies your code file from your action repository to the filesystem path `/` of the container COPY entrypoint.sh /entrypoint.sh diff --git a/.github/actions/build-action/installer.conf b/.github/actions/build-action/installer.conf index 5d4ca4f..3a25767 100644 --- a/.github/actions/build-action/installer.conf +++ b/.github/actions/build-action/installer.conf @@ -1,3 +1,5 @@ +trusted-users = root @nix +allowed-users = root @nix extra-system-features = kvm sandbox = false show-trace = true diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d669e7e..5f69848 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -77,15 +77,34 @@ jobs: large-packages: true docker-images: true swap-storage: true - - name: Build - id: build - uses: ./.github/actions/build-action - env: - FMO_BUILD_VERSION: "${{ steps.fmo-build-version.outputs.BUILD_VERSION }}" + - name: Install Nix + uses: cachix/install-nix-action@v30 with: - BUILD_TARGET: "fmo-os-installer-debug" - CACHIX_TOKEN: ${{ secrets.CACHIX_TOKEN }} - RA_TOKEN: ${{ secrets.RA_TOKEN }} + name: fmo-os + authToken: '${{ secrets.CACHIX_TOKEN }}' + nix_path: nixpkgs=channel:nixos-unstable + enable_kvm: true + extra_nix_config: | + show-trace = true + max-jobs = auto + cores = 0 + substitute = true + always-allow-substitute = true + substituters = https://cache.nixos.org https://nixpkgs.cachix.org https://nixpkgs-unfree.cachix.org https://nix-community.cachix.org + trusted-substituters = https://cache.nixos.org https://nixpkgs.cachix.org https://nixpkgs-unfree.cachix.org https://nix-community.cachix.org + trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= nixpkgs.cachix.org-1:q91R6hxbwFvDqTSDKwDAV4T5PxqXGxswD8vhONFMeOE= nixpkgs-unfree.cachix.org-1:hqvoInulhbV4nJ9yJOEr+4wxhDV4xq2d1DK7S6Nj6rs= nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs= + run: | + nix run nixpkgs#hello + nix flake show + #- name: Build + # id: build + # uses: ./.github/actions/build-action + # env: + # FMO_BUILD_VERSION: "${{ steps.fmo-build-version.outputs.BUILD_VERSION }}" + # with: + # BUILD_TARGET: "fmo-os-installer-debug" + # CACHIX_TOKEN: ${{ secrets.CACHIX_TOKEN }} + # RA_TOKEN: ${{ secrets.RA_TOKEN }} #- name: Push to JFrog artifactory # uses: ./.github/actions/upload-action-jfrog # with: