From 620300b1fb5c6a8b0bf2a1e03995e8b66dd9610e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Mon, 15 Mar 2021 06:19:54 +0100 Subject: [PATCH] add flake to ci --- .github/workflows/test-flakes.yml | 29 +++++++++++++++++++++++++++++ .gitignore | 2 ++ flake.nix | 2 +- hydra.nix | 4 ++-- 4 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/test-flakes.yml diff --git a/.github/workflows/test-flakes.yml b/.github/workflows/test-flakes.yml new file mode 100644 index 0000000..a241bae --- /dev/null +++ b/.github/workflows/test-flakes.yml @@ -0,0 +1,29 @@ +name: "Flake test" +on: + pull_request: + push: + branches: + - main + schedule: + - cron: '51 2 * * *' +jobs: + tests: + strategy: + matrix: + os: [ ubuntu-latest, macos-latest ] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v2 + with: + # Nix Flakes doesn't work on shallow clones + fetch-depth: 0 + - uses: cachix/install-nix-action@v12 + with: + install_url: https://github.com/numtide/nix-flakes-installer/releases/download/nix-2.4pre20210207_fd6eaa1/install + extra_nix_config: | + experimental-features = nix-command flakes + system-features = nixos-test benchmark big-parallel kvm + - name: List flake structure + run: nix flake show + - name: Build + run: nix build diff --git a/.gitignore b/.gitignore index a6f420b..4ec0ffd 100644 --- a/.gitignore +++ b/.gitignore @@ -40,3 +40,5 @@ tmp/ # build directory /build +# nix-build +/result diff --git a/flake.nix b/flake.nix index 1001694..10b15c4 100644 --- a/flake.nix +++ b/flake.nix @@ -6,7 +6,7 @@ outputs = { self, nixpkgs, flake-utils }: flake-utils.lib.eachDefaultSystem (system: { - packages.hydra-eval-jobs = nixpkgs.legacyPackages.${system}.callPackage ./. { + packages.hydra-eval-jobs = nixpkgs.legacyPackages.${system}.callPackage ./hydra.nix { srcDir = self; }; defaultPackage = self.packages.${system}.hydra-eval-jobs; diff --git a/hydra.nix b/hydra.nix index 36c3228..dc94ddd 100644 --- a/hydra.nix +++ b/hydra.nix @@ -6,7 +6,7 @@ , pkg-config , boost , nlohmann_json -, srcDir ? ./. +, srcDir ? null }: let @@ -16,7 +16,7 @@ in stdenv.mkDerivation rec { pname = "hydra-eval-jobs"; version = "0.0.1"; - src = filterMesonBuild srcDir; + src = if srcDir == null then filterMesonBuild ./. else srcDir; buildInputs = [ nlohmann_json nixFlakes boost ];