forked from ConferLabs/confer-image
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
83 lines (70 loc) · 2.64 KB
/
Copy pathflake.nix
File metadata and controls
83 lines (70 loc) · 2.64 KB
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
{
description = "Confer Confidential VM Image Builder - Reproducible builds for TDX and SEV-SNP";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true; # For CUDA if needed
};
# Use mkosi with QEMU support (includes systemdForMkosi with repart, ukify, etc.)
mkosi-with-qemu = pkgs.mkosi-full;
in {
devShells.default = pkgs.mkShell {
name = "confer-cvm-builder";
buildInputs = [
# Core build tools - mkosi with QEMU support
mkosi-with-qemu
pkgs.qemu
pkgs.qemu-utils
# Filesystem tools required by mkosi (not included in mkosi package)
pkgs.dosfstools # mkfs.vfat for ESP
pkgs.e2fsprogs # mkfs.ext4 with SOURCE_DATE_EPOCH support (>= 1.47.1)
pkgs.cryptsetup # veritysetup for dm-verity
pkgs.squashfsTools # mksquashfs
pkgs.mtools # mcopy for FAT filesystem operations
# Ubuntu/Debian package management (for mkosi to install packages)
pkgs.apt
pkgs.dpkg
pkgs.debootstrap
pkgs.gnupg
# Python tooling (for build scripts)
pkgs.python312
pkgs.python312Packages.pip
pkgs.python312Packages.virtualenv
# XML libraries for lxml compilation (needed by nv-attestation-sdk)
pkgs.libxml2
pkgs.libxslt
# Utilities
pkgs.git
pkgs.gnumake
pkgs.coreutils
pkgs.util-linux
pkgs.binutils # Provides objcopy for UKI extraction
pkgs.gzip
pkgs.xz
pkgs.zstd
];
shellHook = ''
# Ensure python3 points to Python 3.12 (required for lxml compatibility)
export PATH="${pkgs.python312}/bin:$PATH"
echo "Confer Confidential VM Image Builder"
echo "====================================="
echo ""
echo "Available commands:"
echo " make build - Build confidential VM image (TDX/SEV-SNP)"
echo " make clean - Clean build artifacts"
echo ""
echo "mkosi version: $(mkosi --version)"
echo "python3 version: $(python3 --version)"
'';
};
# For CI/CD
packages.default = mkosi-with-qemu;
}
);
}