-
-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathflake.nix
More file actions
108 lines (104 loc) · 3.09 KB
/
flake.nix
File metadata and controls
108 lines (104 loc) · 3.09 KB
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
{
description = "Nix binary cache implemented in rust using libnix-store";
inputs.nixpkgs.url = "git+https://github.com/NixOS/nixpkgs?shallow=1&ref=nixpkgs-unstable";
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";
inputs.crane.url = "github:ipetkov/crane";
inputs.nix = {
url = "github:nixos/nix/2.34-maintenance";
# We just need some test data, we're not building upstream nix.
flake = false;
};
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
./herculesCI.nix
];
perSystem =
{
lib,
pkgs,
self',
...
}:
let
packageSet = pkgs.callPackages ./packages.nix {
crane = inputs.crane;
nix-src = inputs.nix;
};
in
{
packages = {
inherit (packageSet)
clippy
default
harmonia
;
# Benchmark closure - a decent-sized Python environment for download benchmarks
bench-closure = pkgs.python3.withPackages (
ps: with ps; [
numpy
pandas
requests
]
);
};
checks =
let
testArgs = {
inherit pkgs;
inherit (inputs) self;
};
packages = lib.mapAttrs' (n: lib.nameValuePair "package-${n}") self'.packages;
devShells = lib.mapAttrs' (n: lib.nameValuePair "devShell-${n}") self'.devShells;
in
{
inherit (packageSet) tests;
}
// lib.optionalAttrs pkgs.stdenv.isLinux {
nix-daemon = import ./tests/nix-daemon.nix testArgs;
harmonia-daemon = import ./tests/harmonia-daemon.nix testArgs;
chroot-store = import ./tests/chroot-store.nix testArgs;
}
// packages
// devShells;
devShells.default = pkgs.callPackage ./devShell.nix {
nix-src = inputs.nix;
};
treefmt = {
# Used to find the project root
projectRootFile = "flake.lock";
programs.rustfmt = {
enable = true;
edition = "2024";
};
programs.nixfmt.enable = true;
programs.deadnix.enable = true;
programs.clang-format.enable = true;
programs.taplo.enable = true;
};
};
flake.nixosModules.harmonia =
{ lib, ... }:
{
imports = [
(lib.modules.importApply ./module.nix {
crane = inputs.crane;
nix-src = inputs.nix;
})
];
};
};
}