Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into enis/add-nixos-module
Browse files Browse the repository at this point in the history
  • Loading branch information
enobayram committed Oct 4, 2023
2 parents e97b620 + f836ab8 commit bc93963
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/nix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build and cache with Nix

on:
workflow_dispatch:
push:
paths:
- '**'

jobs:
build-and-cache:
runs-on: ${{ matrix.os }}
timeout-minutes: 740
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, macos-m1]
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Nix with caching
uses: kadena-io/setup-nix-with-cache/by-root@v3
with:
cache_url: s3://nixcache.chainweb.com?region=us-east-1
signing_private_key: ${{ secrets.NIX_CACHE_PRIVATE_KEY }}

- name: Set up AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.NIX_CACHE_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.NIX_CACHE_AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1

- name: Give root user AWS credentials
uses: kadena-io/setup-nix-with-cache/copy-root-aws-credentials@v3

- name: Build and cache artifacts
run: |
echo Building the project and its devShell
nix build .#check --log-lines 500 --show-trace
14 changes: 14 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,23 @@
defaultNix = import ./default.nix { inherit pkgs; };
flake = defaultNix.flake;
executable = defaultNix.default;
# This package depends on other packages at buildtime, but its output does not
# depend on them. This way, we don't have to download the entire closure to verify
# that those packages build.
mkCheck = name: package: pkgs.runCommand ("check-"+name) {} ''
echo ${name}: ${package}
echo works > $out
'';
in flake // {
packages.default = executable;
packages.chainweb-data-docker = defaultNix.dockerImage;
nixosModules.default = nix/nixos-module.nix;

# Built by CI
packages.check = pkgs.runCommand "check" {} ''
echo ${self.packages.${system}.default}
echo ${mkCheck "devShell" flake.devShell}
echo works > $out
'';
});
}

0 comments on commit bc93963

Please sign in to comment.