-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
114 lines (94 loc) · 3.01 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
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
111
112
113
114
{
description = "A highly structured configuration database.";
inputs = {
nixos.url = "nixpkgs/master";
home = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixos";
};
};
outputs = inputs@{ self, home, nixos }:
let
inherit (builtins) attrNames attrValues readDir mapAttrs;
inherit (nixos) lib;
inherit (lib) removeSuffix recursiveUpdate genAttrs filterAttrs hydraJob;
inherit (utils) pathsToImportedAttrs;
utils = import ./lib/utils.nix { inherit lib; };
system = "x86_64-linux";
pkgImport = system: pkgs:
import pkgs {
inherit system;
overlays = attrValues self.overlays;
config = {
allowUnfree = true;
permittedInsecurePackages = [ "openssl-1.1.1w" ];
};
};
pkgsetFor = system: {
osPkgs = pkgImport system nixos;
pkgs = pkgImport system nixos;
};
pkgset = pkgsetFor system;
in
with pkgset;
{
nixosConfigurations = import ./hosts (
recursiveUpdate inputs {
inherit lib pkgset system utils;
}
) // import ./aarch64 (
recursiveUpdate inputs {
inherit lib utils;
system = "aarch64-linux";
pkgset = pkgsetFor "aarch64-linux";
}
);
hydraJobs = {
hosts = mapAttrs (n: v: hydraJob v.config.system.build.toplevel) self.nixosConfigurations;
};
devShells."${system}".default = import ./shell.nix {
inherit pkgs;
};
sdFlasher = import ./sd-flasher.nix {
inherit pkgs;
crossPkgs = (pkgsetFor "aarch64-linux").pkgs;
config = self.nixosConfigurations.librarian.config;
};
overlay = import ./pkgs;
overlays =
let
overlayDir = ./overlays;
fullPath = name: overlayDir + "/${name}";
overlayPaths = map fullPath (attrNames (readDir overlayDir));
in
pathsToImportedAttrs overlayPaths;
packages."${system}" =
let
packages = self.overlay osPkgs osPkgs;
overlays = lib.filterAttrs (n: v: n != "pkgs") self.overlays;
overlayPkgs =
genAttrs
(attrNames overlays)
(name: (overlays."${name}" osPkgs osPkgs)."${name}");
in
recursiveUpdate packages overlayPkgs;
nixosModules =
let
# binary cache
cachix = import ./cachix.nix;
cachixAttrs = { inherit cachix; };
# modules
moduleList = import ./modules/list.nix;
modulesAttrs = pathsToImportedAttrs moduleList;
# profiles
profilesList = import ./profiles/list.nix;
profilesAttrs = { profiles = pathsToImportedAttrs profilesList; };
in
recursiveUpdate
(recursiveUpdate cachixAttrs modulesAttrs)
profilesAttrs;
templates.flk.path = ./.;
templates.flk.description = "flk template";
templates.default = self.templates.flk;
};
}