-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
66 lines (62 loc) · 1.91 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
{
description = "Flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
};
outputs = { self, nixpkgs, ... }@inputs:
let
lastModifiedDate = self.lastModifiedDate or self.lastModified or "19700101";
version = builtins.substring 0 8 lastModifiedDate;
supportedSystems = [
"x86_64-linux"
"x86_64-darwin"
"aarch64-linux"
"aarch64-darwin"
];
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; });
in
{
checks = forAllSystems (system: {
pre-commit-check = inputs.pre-commit-hooks.lib.${system}.run {
src = ./.;
hooks = {
nixpkgs-fmt.enable = true;
flake-checker.enable = true;
end-of-file-fixer.enable = true;
trim-trailing-whitespace.enable = true;
check-case-conflicts.enable = true;
# commitizen.enable = true;
# markdown-lint.enable = true;
# no-commit-to-branch = {
# enable = true;
# settings.branch = [ "main" ];
# };
# check-added-large-files.enable = true;
};
};
});
packages = forAllSystems (system:
let
pkgs = nixpkgsFor.${system};
in
{
default = pkgs.writeShellScriptBin "cowsay-moo" ''
${pkgs.cowsay}/bin/cowsay moo
'';
});
devShells = forAllSystems (system:
let
pkgs = nixpkgsFor.${system};
in
{
default = pkgs.mkShell {
inherit (self.checks.${system}.pre-commit-check) shellHook;
buildInputs = (with pkgs; [
# cowsay
]) ++ self.checks.${system}.pre-commit-check.enabledPackages;
};
});
};
}