Parametrize systems using github:nix-systems (#97)

This commit is contained in:
Sridhar Ratnakumar 2023-04-09 09:51:56 -04:00 committed by GitHub
parent 2cc75cb614
commit 06e75e55e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 16 deletions

View file

@ -24,15 +24,9 @@ jobs:
nix build -j auto -L nix build -j auto -L
- name: Flake checks 🧪 - name: Flake checks 🧪
run: | 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: # Sandbox must be disabed for:
# https://github.com/srid/haskell-flake/issues/21 # https://github.com/srid/haskell-flake/issues/21
nix \ nix \
--option sandbox false \ --option sandbox false \
flake check -L flake check -L \
--override-input systems github:nix-systems/x86_64-linux

9
Jenkinsfile vendored
View file

@ -14,17 +14,12 @@ pipeline {
stage ('Flake checks') { stage ('Flake checks') {
steps { steps {
sh ''' 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: # Sandbox must be disabed for:
# https://github.com/srid/haskell-flake/issues/21 # https://github.com/srid/haskell-flake/issues/21
nix \ nix \
--option sandbox false \ --option sandbox false \
flake check -L flake check -L \
--override-input systems github:nix-systems/x86_64-linux
''' '''
} }
} }

16
flake.lock generated
View file

@ -104,9 +104,25 @@
"haskell-flake": "haskell-flake", "haskell-flake": "haskell-flake",
"mission-control": "mission-control", "mission-control": "mission-control",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"systems": "systems",
"treefmt-nix": "treefmt-nix" "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": { "treefmt-nix": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [

View file

@ -2,6 +2,7 @@
description = "srid/haskell-template: Nix template for Haskell projects"; description = "srid/haskell-template: Nix template for Haskell projects";
inputs = { inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
systems.url = "github:nix-systems/default";
flake-parts.url = "github:hercules-ci/flake-parts"; flake-parts.url = "github:hercules-ci/flake-parts";
haskell-flake.url = "github:srid/haskell-flake"; haskell-flake.url = "github:srid/haskell-flake";
treefmt-nix.url = "github:numtide/treefmt-nix"; treefmt-nix.url = "github:numtide/treefmt-nix";
@ -12,7 +13,7 @@
outputs = inputs@{ self, nixpkgs, flake-parts, ... }: outputs = inputs@{ self, nixpkgs, flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } { flake-parts.lib.mkFlake { inherit inputs; } {
systems = nixpkgs.lib.systems.flakeExposed; systems = import inputs.systems;
imports = [ imports = [
inputs.haskell-flake.flakeModule inputs.haskell-flake.flakeModule
inputs.treefmt-nix.flakeModule inputs.treefmt-nix.flakeModule