-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
86 lines (74 loc) · 3.07 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
{
inputs = {
# Vicuña
vicuna-nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
vicuna-hm.url = "github:nix-community/home-manager/release-24.11";
vicuna-hm.inputs.nixpkgs.follows = "vicuna-nixpkgs";
vicuna-sops-nix.url = "github:Mic92/sops-nix";
vicuna-sops-nix.inputs.nixpkgs.follows = "vicuna-nixpkgs";
# Unstable
unstable-nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
unstable-hm.url = "github:nix-community/home-manager";
unstable-hm.inputs.nixpkgs.follows = "unstable-nixpkgs";
unstable-sops-nix.url = "github:Mic92/sops-nix";
unstable-sops-nix.inputs.nixpkgs.follows = "unstable-nixpkgs";
unstable-nur.url = "github:nix-community/NUR";
unstable-cosmic.url = "github:lilyinstarlight/nixos-cosmic";
unstable-cosmic.inputs.nixpkgs.follows = "unstable-nixpkgs";
# Agnostic
flake-utils.url = "github:numtide/flake-utils";
flake-registry.url = "github:NixOS/flake-registry";
flake-registry.flake = false;
};
outputs = inputs@{ self, flake-utils, ... }: let
# Distributions
vicuna = with inputs; {
inherit (inputs) self flake-utils flake-registry;
nixpkgs = vicuna-nixpkgs;
hm = vicuna-hm;
sops-nix = vicuna-sops-nix;
};
unstable = with inputs; {
inherit (inputs) self flake-utils flake-registry;
nixpkgs = unstable-nixpkgs;
hm = unstable-hm;
sops-nix = unstable-sops-nix;
nur = unstable-nur;
cosmic = unstable-cosmic;
};
lib = unstable.nixpkgs.lib;
mkSystem = dist: cfg:
import ./nix/eval-flake-system.nix "x86_64-linux" dist cfg;
forAllSystems = { self, nixpkgs, flake-utils, ... }: fn:
lib.genAttrs flake-utils.lib.defaultSystems
(s: fn (import nixpkgs { system = s; overlays = [ self.overlay ]; }));
hosts = {
Mimir = mkSystem unstable ./nix/machines/Mimir.nix;
Mimir-vm = mkSystem unstable ({ modulesPath, ... }: {
imports = [ ./nix/machines/Mimir.nix ./nix/modules/vm-compat.nix ];
});
Minerva = mkSystem vicuna ./nix/machines/Minerva.nix;
Heimdaalr = mkSystem vicuna ./nix/machines/Heimdaalr.nix;
strong-ghost = import ./nix/eval-flake-system.nix "aarch64-linux"
unstable ./nix/machines/strong-ghost.nix;
};
in {
nixosConfigurations = {
inherit (hosts) Mimir Mimir-vm Minerva Heimdaalr strong-ghost;
};
apps = with lib; forAllSystems unstable (pkgs: with lib; let
toApp = name: drv:
{ type = "app"; program = "${drv}/bin/run-${name}-vm"; };
nixosConfigApps = mapAttrs
(name: _: toApp name self.packages."${pkgs.system}"."${name}") hosts;
in nixosConfigApps);
overlay = import ./software/overlay.nix;
templates = import ./software/templates.nix;
packages = forAllSystems unstable (pkgs: with lib; let
overlayPackages = getAttrs (attrNames (self.overlay {} {})) pkgs;
nixosConfigPackages = mapAttrs (_: c: c.config.system.build.vm) hosts;
in nixosConfigPackages // overlayPackages);
devShells = forAllSystems unstable
(pkgs: import ./nix/dev-shells.nix { inherit pkgs; });
};
}