-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
95 lines (78 loc) · 2.55 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
{
inputs = {
nixpkgs.url = path:/home/mbrock/nixpkgs;
home-manager.url = github:nix-community/home-manager;
emacs-overlay.url = github:nix-community/emacs-overlay;
deploy-rs.url = github:serokell/deploy-rs;
# nc-vsock = {
# url = github:stefanha/nc-vsock;
# flake = false;
# };
figlet-fonts = {
flake = false;
url = github:xero/figlet-fonts;
};
};
outputs = { self, nixpkgs, home-manager, emacs-overlay, deploy-rs, figlet-fonts }:
let
systemKernel = system: system.config.system.build.kernel.dev;
firecrackerSystem = { isContainer }:
nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
(import ./firecracker/system.nix {
inherit nixpkgs figlet-fonts;
isContainer = isContainer;
})
home-manager.nixosModules.home-manager
{
nixpkgs.overlays = [emacs-overlay.overlay];
}
];
};
in {
nixosConfigurations.hetzner = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
home-manager.nixosModules.home-manager
(import ./hetzner-system.nix {
inherit self nixpkgs;
})
(import ./firecracker-guests.nix {
inherit self;
})
{
restless.firecracker.networkSize = 5;
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.mbrock = import ./mbrock.nix;
nixpkgs.overlays = [emacs-overlay.overlay];
environment.systemPackages = [
deploy-rs.packages.x86_64-linux.deploy-rs
];
}
];
};
nixosConfigurations.firecracker-container =
firecrackerSystem { isContainer = true; };
nixosConfigurations.firecracker =
firecrackerSystem { isContainer = false; };
firecracker-vmlinux =
let system = self.nixosConfigurations.firecracker;
in system.config.system.build.kernel.dev;
firecracker-rootfs =
let system = self.nixosConfigurations.firecracker-container;
in system.config.system.build.rootfs;
deploy.nodes.guest-1 = {
hostname = "tap1.local";
profiles.system = {
fastConnection = true;
sshUser = "mbrock";
user = "root";
path =
deploy-rs.lib.x86_64-linux.activate.nixos
self.nixosConfigurations.firecracker-container;
};
};
};
}