-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
89 lines (80 loc) · 2.32 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
{
description = "embr - simple automation for booting Ubuntu microVMs with firecracker";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
nix-formatter-pack.url = "github:Gerschtli/nix-formatter-pack";
nix-formatter-pack.inputs.nixpkgs.follows = "nixpkgs";
};
outputs =
{ self
, nixpkgs
, nix-formatter-pack
, ...
}:
let
supportedSystems = [
"x86_64-linux"
# "aarch64-linux"
];
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
pkgsForSystem = system: (import nixpkgs {
inherit system;
overlays = [ self.overlay ];
});
in
{
overlay = final: _prev: {
embr-unwrapped = (final.writeScriptBin "embr" (builtins.readFile ./embr)).overrideAttrs (old: {
buildCommand = "${old.buildCommand}\n patchShebangs $out";
});
extract-vmlinux-unwrapped = (final.writeScriptBin "extract-vmlinux" (builtins.readFile ./util/extract-vmlinux)).overrideAttrs (old: {
buildCommand = "${old.buildCommand}\n patchShebangs $out";
});
embr = final.symlinkJoin {
name = "embr";
paths = (with final; [
embr-unwrapped
extract-vmlinux-unwrapped
])
++ (with final; [
curl
dnsmasq
e2fsprogs
firecracker
iptables
jq
killall
openssh
openssl
yq-go
# The following are dependencies of the extract-vmlinuz script
binutils
bzip2
gzip
lzip
lzop
lz4
zstd
unzip
xz
]);
buildInputs = [ final.makeWrapper ];
postBuild = "wrapProgram $out/bin/embr --prefix PATH : $out/bin";
};
};
packages = forAllSystems (system: {
inherit (pkgsForSystem system) embr;
});
defaultPackage = forAllSystems (system: (pkgsForSystem system).embr);
formatter = forAllSystems (system:
nix-formatter-pack.lib.mkFormatter {
pkgs = nixpkgs.legacyPackages.${system};
config.tools = {
deadnix.enable = true;
nixpkgs-fmt.enable = true;
statix.enable = true;
};
}
);
};
}