-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathflake.nix
More file actions
110 lines (100 loc) · 2.79 KB
/
flake.nix
File metadata and controls
110 lines (100 loc) · 2.79 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
109
110
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
fenix.url = "github:nix-community/fenix";
devenv = {
url = "github:cachix/devenv";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{
self,
nixpkgs,
fenix,
devenv,
...
}@inputs:
let
inherit (nixpkgs) lib;
eachDefaultSystem = lib.genAttrs [
"x86_64-linux"
# untested
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
importNixpkgs = system: import nixpkgs { inherit system; };
mkDevShell =
{
system,
root ? null,
}:
devenv.lib.mkShell {
inputs = inputs // {
packages = self.packages.${system};
};
pkgs = importNixpkgs system;
modules = [
./nix/dev.nix
{ devenv.root = lib.mkIf (root != null) root; }
];
};
in
{
packages = eachDefaultSystem (
system:
let
pkgs = importNixpkgs system;
in
(pkgs.callPackages ./nix/packages.nix { inherit fenix self; })
// {
tests = pkgs.callPackages ./nix/tests { inherit self; };
scripts = pkgs.callPackages ./nix/scripts.nix { inherit fenix; };
devenv-up = self.devShells.${system}.default.config.procfileScript;
checks = pkgs.linkFarm "academy-checks" (
lib.removeAttrs self.packages.${system} [ "checks" ]
// rec {
tests = self.packages.${system}.tests.composite;
scripts = pkgs.linkFarm "scripts" self.packages.${system}.scripts;
devShell = mkDevShell {
inherit system;
root = "/fake-root";
};
devenv-up = devShell.config.procfileScript;
}
);
}
);
nixosModules = {
default = import ./nix/module.nix self;
};
devShells = eachDefaultSystem (system: {
default = mkDevShell { inherit system; };
});
formatter = eachDefaultSystem (
system:
let
pkgs = inputs.nixpkgs.legacyPackages.${system};
in
pkgs.treefmt.withConfig {
settings = lib.mkMerge [
./treefmt.nix
{ _module.args = { inherit pkgs; }; }
];
}
);
};
nixConfig = {
extra-substituters = [
"https://cache.bootstrap.academy/academy"
"https://nix-community.cachix.org"
"https://devenv.cachix.org"
];
extra-trusted-public-keys = [
"academy:JU67oyd32Kzh7XFkUD/rZ6I3wVT8xMtgghwBvEINGus="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw="
];
};
}