-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
72 lines (68 loc) · 2.06 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
{
inputs = {
nixpkgs.url = github:nixos/nixpkgs/nixos-22.05;
};
outputs = { self, nixpkgs, ... }:
let
kernelVersion = "5.10.135";
in
{
nixosConfigurations.firecracker = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
(import ./configuration.nix {
kernelVersion = kernelVersion;
})
];
};
packages.x86_64-linux = {
firecracker-vmlinux =
let
system = self.nixosConfigurations.firecracker;
in
system.config.system.build.kernel.dev;
ignite-kernel-image =
let
system = self.nixosConfigurations.firecracker;
pkgs = nixpkgs.legacyPackages.x86_64-linux;
in
with pkgs;
dockerTools.buildImage {
name = "strum355/ignite-kernel";
tag = kernelVersion;
contents = builtins.derivation {
name = "kernel-image";
system = "x86_64-linux";
builder = "${bash}/bin/bash";
args = [
"-c"
''
set -e
# ignite requires /lib/modules to be present in the image
${coreutils}/bin/mkdir -p $out/boot/ $out/lib/modules
# copy the kernel vmlinux bin
${coreutils}/bin/cp ${system.config.system.build.kernel.dev}/vmlinux $out/boot
''
];
};
};
firecracker-rootfs =
let
system = self.nixosConfigurations.firecracker;
pkgs = nixpkgs.legacyPackages.x86_64-linux;
in
import "${nixpkgs}/nixos/lib/make-disk-image.nix" {
inherit pkgs;
inherit (nixpkgs) lib;
diskSize = "auto";
config = system.config;
additionalSpace = "1K";
format = "raw";
partitionTableType = "none";
installBootLoader = false;
fsType = "ext4";
copyChannel = false;
};
};
};
}