Skip to content

Commit 24c959a

Browse files
committedNov 21, 2022
Get rid of niv and test support for nixos-22.05
1 parent 0c9555d commit 24c959a

File tree

10 files changed

+118
-156
lines changed

10 files changed

+118
-156
lines changed
 

‎.github/workflows/ci.yaml

-3
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ jobs:
2424
steps:
2525
- uses: actions/checkout@v3
2626
- uses: cachix/install-nix-action@v18
27-
with:
28-
extra_nix_config: |
29-
experimental-features = nix-command flakes
3027
- uses: cachix/cachix-action@v12
3128
with:
3229
name: pre-commit-hooks

‎default.nix

+10-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
let
2-
pkgs = import ./nix { };
3-
in
4-
pkgs.packages // pkgs.checks // { inherit (pkgs) run; }
1+
(import
2+
(
3+
let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in
4+
fetchTarball {
5+
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
6+
sha256 = lock.nodes.flake-compat.locked.narHash;
7+
}
8+
)
9+
{ src = ./.; }
10+
).defaultNix.lib.${builtins.currentSystem}

‎flake.lock

+76-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎flake.nix

+15-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
{
22
description = "Seamless integration of https://pre-commit.com git hooks with Nix.";
33

4+
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
5+
inputs.nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-22.05";
46
inputs.flake-utils.url = "github:numtide/flake-utils";
7+
inputs.flake-compat = {
8+
url = "github:edolstra/flake-compat";
9+
flake = false;
10+
};
11+
inputs.gitignore.url = "github:hercules-ci/gitignore.nix";
512

6-
outputs = { self, nixpkgs, flake-utils }:
13+
outputs = { self, nixpkgs, flake-utils, gitignore, nixpkgs-stable, ... }:
714
let
815
defaultSystems = [
916
"aarch64-linux"
@@ -24,14 +31,19 @@
2431
}
2532
// flake-utils.lib.eachSystem defaultSystems (system:
2633
let
27-
exposed = import ./nix { nixpkgs = nixpkgs; inherit system; gitignore-nix-src = null; isFlakes = true; };
34+
exposed = import ./nix { nixpkgs = nixpkgs; inherit system; gitignore-nix-src = gitignore; isFlakes = true; };
35+
exposed-stable = import ./nix { nixpkgs = nixpkgs-stable; inherit system; gitignore-nix-src = gitignore; isFlakes = true; };
2836
in
2937
{
3038
packages = exposed.packages;
3139

3240
defaultPackage = exposed.packages.pre-commit;
3341

34-
checks = exposed.checks;
42+
devShell = nixpkgs.legacyPackages.${system}.mkShell {
43+
inherit (exposed.checks.pre-commit-check) shellHook;
44+
};
45+
46+
checks = exposed.checks // (builtins.removeAttrs exposed-stable.checks [ "revive" "purs-tidy" ]);
3547

3648
lib = { inherit (exposed) run; };
3749
}

‎nix/default.nix

+3-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
{ sources ? import ./sources.nix
2-
, system ? builtins.currentSystem
3-
, nixpkgs ? sources.nixpkgs
4-
, gitignore-nix-src ? sources."gitignore.nix"
1+
{ system ? builtins.currentSystem
2+
, nixpkgs
3+
, gitignore-nix-src
54
, isFlakes ? false
65
}:
76
let
@@ -25,10 +24,6 @@ let
2524
shellcheck.enable = true;
2625
nixpkgs-fmt.enable = true;
2726
};
28-
excludes = [
29-
# autogenerated by niv
30-
"nix/sources.nix$"
31-
];
3227
};
3328
};
3429
};

‎nix/run.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ let
2424
} // (if isFlakes
2525
then { rootSrc = src; }
2626
else {
27-
rootSrc = (import gitignore-nix-src { inherit (pkgs) lib; }).gitignoreSource src;
27+
rootSrc = gitignore-nix-src.lib.gitignoreSource src;
2828
});
2929
}
3030
];

‎nix/sources.json

-26
This file was deleted.

‎nix/sources.nix

-95
This file was deleted.

‎nix/tools.nix

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
, html-tidy
2222
, hunspell
2323
, luaPackages
24-
, niv
2524
, mdsh
2625
, nix-linter
2726
, nixfmt
@@ -40,7 +39,7 @@
4039
, writeScript
4140
, writeText
4241
, go
43-
, revive
42+
, revive ? null
4443
}:
4544

4645
{
@@ -49,8 +48,9 @@
4948
# TODO: these two should be statically compiled
5049
inherit (haskellPackages) brittany fourmolu;
5150
inherit (luaPackages) luacheck;
52-
inherit (nodePackages) eslint markdownlint-cli prettier purs-tidy;
51+
inherit (nodePackages) eslint markdownlint-cli prettier;
5352
inherit (python39Packages) ansible-lint yamllint;
53+
purs-tidy = nodePackages.purs-tidy or null;
5454
cabal2nix-dir = callPackage ./cabal2nix-dir { };
5555
hpack-dir = callPackage ./hpack-dir { };
5656
hunspell = callPackage ./hunspell { };

‎shell.nix

+10-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
with { pkgs = import ./nix { }; };
2-
3-
pkgs.mkShell {
4-
buildInputs = [ pkgs.niv ];
5-
inherit ((import ./.).pre-commit-check) shellHook;
6-
}
1+
(import
2+
(
3+
let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in
4+
fetchTarball {
5+
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
6+
sha256 = lock.nodes.flake-compat.locked.narHash;
7+
}
8+
)
9+
{ src = ./.; }
10+
).shellNix

0 commit comments

Comments
 (0)
Please sign in to comment.