Skip to content

Commit

Permalink
Nix Flake
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Sydney Kerckhove committed Nov 30, 2022
1 parent 657cf4b commit 68c0e18
Show file tree
Hide file tree
Showing 85 changed files with 1,273 additions and 595 deletions.
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
22 changes: 13 additions & 9 deletions .github/workflows/nix-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,26 @@ jobs:
os:
- ubuntu-latest
attribute:
- release
- pre-commit-check
- nixos-21_05
- nixos-21_11
- nixos-22_05
- .#devShells.x86_64-linux.default
- .#packages.x86_64-linux.default
- .#checks.x86_64-linux.pre-commit
- .#checks.x86_64-linux.nixpkgs-21_05
- .#checks.x86_64-linux.nixpkgs-21_11
- .#checks.x86_64-linux.nixpkgs-22_05
steps:
- uses: actions/[email protected]
- uses: cachix/install-nix-action@v13
- uses: actions/[email protected]
- uses: cachix/install-nix-action@v18
with:
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- name: free disk space
run: |
if [[ "${{matrix.os}}" == "ubuntu-latest" ]]
then
sudo rm -rf /opt
fi
- uses: cachix/cachix-action@v10
- uses: cachix/cachix-action@v11
with:
name: validity
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
- run: nix-build ci.nix -A ${{ matrix.attribute }}
- run: nix build "${{matrix.attribute}}"
2 changes: 2 additions & 0 deletions cabal.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
packages: */*.cabal
test-show-details: direct
25 changes: 0 additions & 25 deletions ci.nix

This file was deleted.

2 changes: 0 additions & 2 deletions default.nix

This file was deleted.

222 changes: 222 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

91 changes: 91 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
{
description = "validity";
nixConfig = {
extra-substituters = "https://validity.cachix.org";
extra-trusted-public-keys = "validity.cachix.org-1:CqZp6vt9ir3yB5f8GAtfkJxPZG8hKC5fhIdaQsf7eZE=";
};
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs?ref=nixos-22.11";
nixpkgs-22_05.url = "github:NixOS/nixpkgs?ref=nixos-22.05";
nixpkgs-21_11.url = "github:NixOS/nixpkgs?ref=nixos-21.11";
pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
autodocodec.url = "github:NorfairKing/autodocodec?ref=flake";
autodocodec.flake = false;
safe-coloured-text.url = "github:NorfairKing/safe-coloured-text?ref=flake";
safe-coloured-text.flake = false;
sydtest.url = "github:NorfairKing/sydtest?ref=flake";
sydtest.flake = false;
};

outputs =
{ self
, nixpkgs
, nixpkgs-22_05
, nixpkgs-21_11
, pre-commit-hooks
, autodocodec
, safe-coloured-text
, sydtest
}:
let
system = "x86_64-linux";
pkgsFor = nixpkgs: import nixpkgs {
inherit system;
overlays = [
self.overlays.${system}
(import (autodocodec + "/nix/overlay.nix"))
(import (safe-coloured-text + "/nix/overlay.nix"))
(import (sydtest + "/nix/overlay.nix"))
];
};
pkgs = pkgsFor nixpkgs;
in
{
overlays.${system} = import ./nix/overlay.nix;
packages.${system}.default = pkgs.haskellPackages.validityRelease;
checks.${system} =
let
backwardCompatibilityCheckFor = nixpkgs:
let pkgs' = pkgsFor nixpkgs;
in pkgs'.haskellPackages.validityRelease;
allNixpkgs = {
inherit
nixpkgs-22_05
nixpkgs-21_11;
};
backwardCompatibilityChecks = pkgs.lib.mapAttrs (_: nixpkgs: backwardCompatibilityCheckFor nixpkgs) allNixpkgs;
in
backwardCompatibilityChecks // {
pre-commit = pre-commit-hooks.lib.${system}.run {
src = ./.;
hooks = {
hlint.enable = true;
hpack.enable = true;
ormolu.enable = true;
nixpkgs-fmt.enable = true;
nixpkgs-fmt.excludes = [ ".*/default.nix" ];
cabal2nix.enable = true;
};
};
};
devShells.${system}.default = pkgs.haskellPackages.shellFor {
name = "validity-shell";
packages = p: builtins.attrValues p.validityPackages;
withHoogle = true;
doBenchmark = true;
buildInputs = (with pkgs; [
niv
zlib
cabal-install
]) ++ (with pre-commit-hooks.packages.${system};
[
hlint
hpack
nixpkgs-fmt
ormolu
cabal2nix
]);
shellHook = self.checks.${system}.pre-commit.shellHook;
};
};
}
Loading

0 comments on commit 68c0e18

Please sign in to comment.