diff options
author | Azat Bahawi <azat@bahawi.net> | 2022-02-16 02:15:52 +0300 |
---|---|---|
committer | Azat Bahawi <azat@bahawi.net> | 2022-02-16 02:15:52 +0300 |
commit | 13964faa53b09924bdd27328311ba27457b0b61d (patch) | |
tree | 73dcca227f3084fd1fa09fd4d3323544b61218ea /flake.nix | |
parent | meh (diff) |
I hate the Antichrist
Diffstat (limited to 'flake.nix')
-rw-r--r-- | flake.nix | 64 |
1 files changed, 54 insertions, 10 deletions
diff --git a/flake.nix b/flake.nix index 426f9bd..9664dd0 100644 --- a/flake.nix +++ b/flake.nix @@ -24,25 +24,38 @@ ref = "master"; flake = false; }; + + pre-commit-hooks = { + type = "github"; + owner = "cachix"; + repo = "pre-commit-hooks.nix"; + ref = "master"; + inputs = { + nixpkgs.follows = "nixpkgs"; + flake-utils.follows = "flake-utils"; + }; + }; }; - outputs = { self, nixpkgs, flake-utils, ... }: - flake-utils.lib.eachDefaultSystem (system: + outputs = inputs: + with inputs; + let name = "xmonad-ng"; + in flake-utils.lib.eachDefaultSystem (system: let pkgs = nixpkgs.legacyPackages.${system}; project = returnShellEnv: pkgs.haskellPackages.developPackage { - inherit returnShellEnv; - name = "xmonad-ng"; + inherit name returnShellEnv; root = ./.; overrides = self: _: with pkgs.haskell.lib; - let version = "0.17.0"; + let + mkPackage = packageName: + dontCheck (self.callHackage packageName "0.17.0" { }); in { - xmonad = dontCheck (self.callHackage "xmonad" version { }); - xmonad-contrib = - dontCheck (self.callHackage "xmonad-contrib" version { }); + xmonad = mkPackage "xmonad"; + xmonad-contrib = mkPackage "xmonad-contrib"; }; modifier = drv: pkgs.haskell.lib.addBuildTools drv (with pkgs.haskellPackages; [ @@ -57,8 +70,39 @@ in { defaultPackage = project false; - devShell = project true; + checks.preCommit = pre-commit-hooks.lib.${system}.run { + src = ./.; + hooks = { + nix-linter.enable = true; + nixfmt.enable = true; + hpack.enable = true; + hlint.enable = true; + yamllint.enable = true; + brittany.enable = true; + shellcheck.enable = true; + shfmt = { + enable = true; + name = "shfmt"; + entry = "${pkgs.shfmt}/bin/shfmt -s -w"; + types = [ "shell" ]; + }; + prettier = { + enable = true; + types = [ ]; + files = "\\.((yaml)|\\d)$"; + }; + }; + }; + + shells = { + dev = project true; + commit = pkgs.mkShell { + inherit (self.checks.${system}.preCommit) shellHook; + }; + }; + + devShell = self.shells.${system}.dev; }) // { - overlay = _: _: { xmonad-ng = self.defaultPackage; }; + overlay = _: _: { ${name} = self.defaultPackage; }; }; } |