diff --git a/.github/actions/common-setup/action.yml b/.github/actions/common-setup/action.yml new file mode 100644 index 0000000..8eff60e --- /dev/null +++ b/.github/actions/common-setup/action.yml @@ -0,0 +1,19 @@ +name: Setup Environment +inputs: + CACHIX_AUTH_TOKEN: + required: true + description: "Cachix Auth Token" + SECRET_GITHUB_TOKEN: + required: true + description: "Github Secret Token" +runs: + using: "composite" + steps: + - uses: DeterminateSystems/nix-installer-action@main + with: + github_token: ${{ inputs.SECRET_GITHUB_TOKEN }} + + - uses: DeterminateSystems/magic-nix-cache-action@main + - uses: yaxitech/nix-install-pkgs-action@v3 + with: + packages: "nixpkgs#nixci" diff --git a/.github/workflows/checks.yaml b/.github/workflows/checks.yaml index 9278bc0..0adc94f 100644 --- a/.github/workflows/checks.yaml +++ b/.github/workflows/checks.yaml @@ -5,15 +5,17 @@ on: branches: - main jobs: - nix: + checks: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: DeterminateSystems/nix-installer-action@main - - uses: DeterminateSystems/magic-nix-cache-action@main + - name: Setup + uses: ./.github/actions/common-setup + with: + SECRET_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Build Example/nixos run: nix -Lv build ./local#eval.nixos.expr.nixosConfiguration.config.system.build.toplevel --dry-run diff --git a/.github/workflows/packages.yaml b/.github/workflows/packages.yaml new file mode 100644 index 0000000..3ee0506 --- /dev/null +++ b/.github/workflows/packages.yaml @@ -0,0 +1,20 @@ +name: "CI" +on: + pull_request: + push: + branches: + - main +jobs: + packages: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup + uses: ./.github/actions/common-setup + with: + SECRET_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - run: nixci diff --git a/flake.nix b/flake.nix index e81da89..8809019 100644 --- a/flake.nix +++ b/flake.nix @@ -23,7 +23,7 @@ inherit (src) lib ops errors; nixci.default = { - dir1.dir = "./local"; + dir1.dir = "./local/ci"; }; templates = { diff --git a/local/ci/flake.lock b/local/ci/flake.lock new file mode 100644 index 0000000..7e03967 --- /dev/null +++ b/local/ci/flake.lock @@ -0,0 +1,26 @@ +{ + "nodes": { + "call-flake": { + "locked": { + "lastModified": 1700357078, + "narHash": "sha256-bmhE1TmrJG4ba93l9WQTLuYM53kwGQAjYHRvHOeuxWU=", + "owner": "divnix", + "repo": "call-flake", + "rev": "81eb70478e1891627fc8cf68f3d00507476a8573", + "type": "github" + }, + "original": { + "owner": "divnix", + "repo": "call-flake", + "type": "github" + } + }, + "root": { + "inputs": { + "call-flake": "call-flake" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/local/ci/flake.nix b/local/ci/flake.nix new file mode 100644 index 0000000..0026c76 --- /dev/null +++ b/local/ci/flake.nix @@ -0,0 +1,15 @@ +{ + description = "A very basic flake"; + + inputs.call-flake.url = "github:divnix/call-flake"; + + outputs = + { self, call-flake }: + let + local = call-flake ../.; + inherit (local) examples; + in + { + packages.x86_64-linux = examples.packages.exports.derivations; + }; +}