From 06e75e55e3caf312aeb2ca3a185c6c0499b16db7 Mon Sep 17 00:00:00 2001 From: Sridhar Ratnakumar <3998+srid@users.noreply.github.com> Date: Sun, 9 Apr 2023 09:51:56 -0400 Subject: [PATCH] Parametrize `systems` using `github:nix-systems` (#97) --- .github/workflows/ci.yaml | 10 ++-------- Jenkinsfile | 9 ++------- flake.lock | 16 ++++++++++++++++ flake.nix | 3 ++- 4 files changed, 22 insertions(+), 16 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c25917a..422b275 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -24,15 +24,9 @@ jobs: nix build -j auto -L - name: Flake checks 🧪 run: | - # Because 'nix flake check' is not system-aware - # See https://srid.ca/haskell-template/checks - nix run nixpkgs#sd \ - 'systems = nixpkgs.lib.systems.flakeExposed' \ - 'systems = [ "x86_64-linux" ]' \ - flake.nix - # Sandbox must be disabed for: # https://github.com/srid/haskell-flake/issues/21 nix \ --option sandbox false \ - flake check -L + flake check -L \ + --override-input systems github:nix-systems/x86_64-linux diff --git a/Jenkinsfile b/Jenkinsfile index 18a64e6..b53c34c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -14,17 +14,12 @@ pipeline { stage ('Flake checks') { steps { sh ''' - # Because 'nix flake check' is not system-aware - # See https://srid.ca/haskell-template/checks - nix run nixpkgs#sd \ - 'systems = nixpkgs.lib.systems.flakeExposed' \ - 'systems = [ "x86_64-linux" ]' \ - flake.nix # Sandbox must be disabed for: # https://github.com/srid/haskell-flake/issues/21 nix \ --option sandbox false \ - flake check -L + flake check -L \ + --override-input systems github:nix-systems/x86_64-linux ''' } } diff --git a/flake.lock b/flake.lock index d0d2905..8e37510 100644 --- a/flake.lock +++ b/flake.lock @@ -104,9 +104,25 @@ "haskell-flake": "haskell-flake", "mission-control": "mission-control", "nixpkgs": "nixpkgs", + "systems": "systems", "treefmt-nix": "treefmt-nix" } }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "treefmt-nix": { "inputs": { "nixpkgs": [ diff --git a/flake.nix b/flake.nix index 4ecd6e0..456b61c 100644 --- a/flake.nix +++ b/flake.nix @@ -2,6 +2,7 @@ description = "srid/haskell-template: Nix template for Haskell projects"; inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; + systems.url = "github:nix-systems/default"; flake-parts.url = "github:hercules-ci/flake-parts"; haskell-flake.url = "github:srid/haskell-flake"; treefmt-nix.url = "github:numtide/treefmt-nix"; @@ -12,7 +13,7 @@ outputs = inputs@{ self, nixpkgs, flake-parts, ... }: flake-parts.lib.mkFlake { inherit inputs; } { - systems = nixpkgs.lib.systems.flakeExposed; + systems = import inputs.systems; imports = [ inputs.haskell-flake.flakeModule inputs.treefmt-nix.flakeModule