forked from nix-community/harmonia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
80 lines (73 loc) · 2.37 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
{
description = "Nix binary cache implemented in rust using libnix-store";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable-small";
inputs.flake-parts = {
url = "github:hercules-ci/flake-parts";
inputs.nixpkgs-lib.follows = "nixpkgs";
};
inputs.treefmt-nix.url = "github:numtide/treefmt-nix";
inputs.treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";
nixConfig.extra-substituters = [
"https://cache.garnix.io"
];
nixConfig.extra-trusted-public-keys = [
"cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g="
];
outputs = inputs@{ flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = [
"x86_64-linux"
"aarch64-linux"
"aarch64-darwin"
"x86_64-darwin"
];
imports = [
inputs.treefmt-nix.flakeModule
];
perSystem = { lib, config, pkgs, ... }: {
packages.harmonia = pkgs.callPackage ./. { };
packages.default = config.packages.harmonia;
checks =
let
testArgs = {
inherit pkgs;
inherit (inputs) self;
};
in
lib.optionalAttrs pkgs.stdenv.isLinux
{
t00-simple = import ./tests/t00-simple.nix testArgs;
t01-signing = import ./tests/t01-signing.nix testArgs;
t02-varnish = import ./tests/t02-varnish.nix testArgs;
t03-chroot = import ./tests/t03-chroot.nix testArgs;
} // {
clippy = config.packages.harmonia.override ({
enableClippy = true;
});
};
devShells.default = pkgs.callPackage ./shell.nix { };
treefmt = {
# Used to find the project root
projectRootFile = "flake.lock";
programs.rustfmt.enable = true;
programs.clang-format.enable = true;
settings.formatter = {
nix = {
command = "sh";
options = [
"-eucx"
''
export PATH=${lib.makeBinPath [ pkgs.coreutils pkgs.findutils pkgs.deadnix pkgs.nixpkgs-fmt ]}
deadnix --edit "$@"
nixpkgs-fmt "$@"
''
"--"
];
includes = [ "*.nix" ];
};
};
};
};
flake.nixosModules.harmonia = ./module.nix;
};
}