blob: a87c3f636bc42f0b52be2d36804e9b455e04a7aa (
plain)
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
|
{
description = "Personal monorepo";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
disko.url = "github:nix-community/disko/latest";
disko.inputs.nixpkgs.follows = "nixpkgs";
nixos-hardware.url = "github:nixos/nixos-hardware/master";
};
outputs = { self, nixpkgs, ... } @ inputs:
let
inherit (builtins) mapAttrs;
inherit (nixpkgs) lib;
systems = [ "x86_64-linux" "aarch64-linux" ];
inherit (import ./lib/depot-tools.nix { inherit inputs systems lib; })
importDir
eachSystem
systemArgs
;
packages = eachSystem (
{ newScope, ... }:
mapAttrs (pname: { path, ... }: newScope { inherit pname; } path { })
(importDir ./packages lib.id)
);
nixosModules = importDir ./modules
(mapAttrs (_: { path, ... }: path));
nixosConfigurations = importDir ./machines (
entries:
let
flake = self;
defaultModule = { config, ... }:
let
perSystemArg = system: {
_module.args.perSystem = systemArgs.${system}.perSystem;
};
in
{
imports = [ (perSystemArg config.nixpkgs.hostPlatform.system) ];
};
buildNixOS = hostName: entry:
lib.nixosSystem {
modules = [
defaultModule
entry.path
nixosModules.xnet
];
specialArgs = { inherit inputs flake hostName; };
};
in
mapAttrs buildNixOS entries
);
in
{ inherit packages nixosModules nixosConfigurations; };
}
|