-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
69 lines (58 loc) · 2.5 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
{
description = "Build bit-by-bit reproducible OS images with mkosi";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs =
{ self
, nixpkgs
, flake-utils
}:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
# mkosi, built from main. Used for the daily e2e test.
mkosi-nightly = (pkgs.mkosi.overrideAttrs (oldAttrs: {
version = "unstable-2024-02-02";
src = pkgs.fetchFromGitHub {
owner = "systemd";
repo = "mkosi";
rev = "d3b035a1e1cef4f744d982b6187cbfd07894dd5b";
hash = "sha256-lS9RBmt2RUpbCYD/5nuTD5MZudl31J2c+uFWvq+re2Q=";
};
patches = [ ];
})).override {
# Uncomment the following line to build mkosi from main with QEMU support.
# withQemu = true;
};
tools = import ./tools/default.nix { inherit pkgs; };
in
{
packages = {
inherit mkosi-nightly;
# extract extracts partions from a disk image based on the partition table.
extract = tools.extract;
# diffimage builds two mkosi images, extracts and compares them.
diffimage = tools.diffimage;
};
# Activate a devShell using `nix develop .#<shell-name>`.
devShells = {
# Build environments for reproducible mkosi builds.
# Contain mkosi and tools used by mkosi to build images.
mkosi-fedora = import ./shells/fedora.nix { inherit pkgs tools; };
mkosi-ubuntu = import ./shells/ubuntu.nix { inherit pkgs tools; };
# Build environments for reproducible mkosi builds with QEMU support,
# enabling `mkosi qemu` to start the built image in a local VM.
mkosi-fedora-qemu = import ./shells/fedora.nix { inherit pkgs tools; mkosi = pkgs.mkosi-full; };
mkosi-ubuntu-qemu = import ./shells/ubuntu.nix { inherit pkgs tools; mkosi = pkgs.mkosi-full; };
# Build environments using the nightly mkosi builds (for testing).
mkosi-fedora-nightly = import ./shells/fedora.nix { inherit pkgs tools; mkosi = mkosi-nightly; };
mkosi-ubuntu-nightly = import ./shells/ubuntu.nix { inherit pkgs tools; mkosi = mkosi-nightly; };
# Development envionment for hacking on mkosi.
mkosi-dev = import ./shells/mkosi-dev.nix { inherit pkgs; };
};
# Run `nix fmt` to format the Nix code.
formatter = nixpkgs.legacyPackages.${system}.nixpkgs-fmt;
});
}