Skip to content

Commit

Permalink
Get rid of niv and test support for nixos-22.05
Browse files Browse the repository at this point in the history
  • Loading branch information
domenkozar committed Nov 21, 2022
1 parent 0c9555d commit 24c959a
Show file tree
Hide file tree
Showing 10 changed files with 118 additions and 156 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v18
with:
extra_nix_config: |
experimental-features = nix-command flakes
- uses: cachix/cachix-action@v12
with:
name: pre-commit-hooks
Expand Down
14 changes: 10 additions & 4 deletions default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
let
pkgs = import ./nix { };
in
pkgs.packages // pkgs.checks // { inherit (pkgs) run; }
(import
(
let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in
fetchTarball {
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
sha256 = lock.nodes.flake-compat.locked.narHash;
}
)
{ src = ./.; }
).defaultNix.lib.${builtins.currentSystem}
83 changes: 76 additions & 7 deletions flake.lock

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

18 changes: 15 additions & 3 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
{
description = "Seamless integration of https://pre-commit.com git hooks with Nix.";

inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
inputs.nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-22.05";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
inputs.gitignore.url = "github:hercules-ci/gitignore.nix";

outputs = { self, nixpkgs, flake-utils }:
outputs = { self, nixpkgs, flake-utils, gitignore, nixpkgs-stable, ... }:
let
defaultSystems = [
"aarch64-linux"
Expand All @@ -24,14 +31,19 @@
}
// flake-utils.lib.eachSystem defaultSystems (system:
let
exposed = import ./nix { nixpkgs = nixpkgs; inherit system; gitignore-nix-src = null; isFlakes = true; };
exposed = import ./nix { nixpkgs = nixpkgs; inherit system; gitignore-nix-src = gitignore; isFlakes = true; };
exposed-stable = import ./nix { nixpkgs = nixpkgs-stable; inherit system; gitignore-nix-src = gitignore; isFlakes = true; };
in
{
packages = exposed.packages;

defaultPackage = exposed.packages.pre-commit;

checks = exposed.checks;
devShell = nixpkgs.legacyPackages.${system}.mkShell {
inherit (exposed.checks.pre-commit-check) shellHook;
};

checks = exposed.checks // (builtins.removeAttrs exposed-stable.checks [ "revive" "purs-tidy" ]);

lib = { inherit (exposed) run; };
}
Expand Down
11 changes: 3 additions & 8 deletions nix/default.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{ sources ? import ./sources.nix
, system ? builtins.currentSystem
, nixpkgs ? sources.nixpkgs
, gitignore-nix-src ? sources."gitignore.nix"
{ system ? builtins.currentSystem
, nixpkgs
, gitignore-nix-src
, isFlakes ? false
}:
let
Expand All @@ -25,10 +24,6 @@ let
shellcheck.enable = true;
nixpkgs-fmt.enable = true;
};
excludes = [
# autogenerated by niv
"nix/sources.nix$"
];
};
};
};
Expand Down
2 changes: 1 addition & 1 deletion nix/run.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ let
} // (if isFlakes
then { rootSrc = src; }
else {
rootSrc = (import gitignore-nix-src { inherit (pkgs) lib; }).gitignoreSource src;
rootSrc = gitignore-nix-src.lib.gitignoreSource src;
});
}
];
Expand Down
26 changes: 0 additions & 26 deletions nix/sources.json

This file was deleted.

95 changes: 0 additions & 95 deletions nix/sources.nix

This file was deleted.

6 changes: 3 additions & 3 deletions nix/tools.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
, html-tidy
, hunspell
, luaPackages
, niv
, mdsh
, nix-linter
, nixfmt
Expand All @@ -40,7 +39,7 @@
, writeScript
, writeText
, go
, revive
, revive ? null
}:

{
Expand All @@ -49,8 +48,9 @@
# TODO: these two should be statically compiled
inherit (haskellPackages) brittany fourmolu;
inherit (luaPackages) luacheck;
inherit (nodePackages) eslint markdownlint-cli prettier purs-tidy;
inherit (nodePackages) eslint markdownlint-cli prettier;
inherit (python39Packages) ansible-lint yamllint;
purs-tidy = nodePackages.purs-tidy or null;
cabal2nix-dir = callPackage ./cabal2nix-dir { };
hpack-dir = callPackage ./hpack-dir { };
hunspell = callPackage ./hunspell { };
Expand Down
16 changes: 10 additions & 6 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
with { pkgs = import ./nix { }; };

pkgs.mkShell {
buildInputs = [ pkgs.niv ];
inherit ((import ./.).pre-commit-check) shellHook;
}
(import
(
let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in
fetchTarball {
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
sha256 = lock.nodes.flake-compat.locked.narHash;
}
)
{ src = ./.; }
).shellNix

0 comments on commit 24c959a

Please sign in to comment.