-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
55 lines (54 loc) · 2.02 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
{
outputs = inputs@{ self, nixpkgs, flake-parts, pre-commit-hooks, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
flake = {
githubActions = inputs.nix-github-actions.lib.mkGithubMatrix {
checks = nixpkgs.lib.getAttrs [ "x86_64-linux" "x86_64-darwin" ] self.packages;
};
overlays = {
default = final: prev: import ./overlays final prev;
};
};
systems = [ "aarch64-linux" "aarch64-darwin" "x86_64-darwin" "x86_64-linux" ];
perSystem = { system, config, ... }:
let
pkgs = import nixpkgs {
inherit system;
config.allowAliases = false;
overlays = [ self.overlays.default ];
};
inherit (pkgs) lib;
overlayAttrs = builtins.attrNames (import ./overlays pkgs pkgs);
in
{
packages =
let
drvAttrs = builtins.filter (n: lib.isDerivation pkgs.${n}) overlayAttrs;
in
lib.listToAttrs (map (n: lib.nameValuePair n pkgs.${n}) drvAttrs);
checks = {
pre-commit-check = pre-commit-hooks.lib.${system}.run {
src = ./.;
hooks = {
nixpkgs-fmt.enable = true;
# nix-linter.enable = true;
# statix.enable = true;
};
};
};
devShells.default = pkgs.mkShell {
inherit (self.checks.${system}.pre-commit-check) shellHook;
buildInputs = with pkgs; [
pre-commit
];
};
};
};
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
inputs.flake-parts.url = "github:hercules-ci/flake-parts";
inputs.flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs";
inputs.pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
inputs.pre-commit-hooks.inputs.nixpkgs.follows = "nixpkgs";
inputs.nix-github-actions.url = "github:nix-community/nix-github-actions";
inputs.nix-github-actions.inputs.nixpkgs.follows = "nixpkgs";
}