Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attic build GitHub Action #171

Open
Svenum opened this issue Sep 4, 2024 · 3 comments
Open

Attic build GitHub Action #171

Svenum opened this issue Sep 4, 2024 · 3 comments

Comments

@Svenum
Copy link

Svenum commented Sep 4, 2024

Hi,
I like to let you know that I am currently working on an GitHub Action to bild a hole Flake (Packages and nixosConfigurations) to push them to you own Attic instance.

So that you can periodically or on every push build your config and cache the result in your Attic Cache.
As I have not much experience with GitHub Actions I appreciate every help form you guys. 😄

ULR: https://github.com/Svenum/attic-builder

@jzbor
Copy link
Contributor

jzbor commented Oct 17, 2024

Hi, I have build something similar with https://github.com/jzbor/nix-flake-workflow. Although this is currently mostly for my personal use and may change over time. But feel free to use it as inspiration or with a pinned commit.

@cottand
Copy link

cottand commented Nov 28, 2024

my personal approach:

env:
  ATTIC_SERVER: "https://my.attic.com/"
  ATTIC_CACHE: "default"

jobs:
  myjob:
   steps:
    - name: Install Attic and nix-fast-build
      shell: bash
      run: |
        nix profile install nixpkgs#attic-client github:Mic92/nix-fast-build/8e7c9d7

    - name: Configure Attic
      shell: bash
      run: |
        attic login --set-default central "$ATTIC_SERVER" "$ATTIC_TOKEN"
        attic use "$ATTIC_CACHE"

      env:
        ATTIC_TOKEN: ${{ secrets.ATTIC_TOKEN }}

    - name: Build
      shell: bash
      run: |
        nix-fast-build --eval-workers 1 --skip-cached --no-nom --attic-cache=$ATTIC_CACHE \
            -f .#myPackage

        # OR, ALTERNATIVELY:
        
        nix build .#myPackage
        attic push $ATTIC_CACHE result
   

You can package this as a composite action (my example here)

@Svenum
Copy link
Author

Svenum commented Jan 21, 2025

My builder has now reached version 2. with a Docker that can periodically pull an GitHub repo, to build and push the content. https://github.com/Svenum/attic-builder

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants