2024-02-07 01:22:34 +00:00
|
|
|
{
|
|
|
|
lts ? false,
|
|
|
|
|
|
|
|
lib,
|
|
|
|
callPackage,
|
|
|
|
linkFarm,
|
|
|
|
makeWrapper,
|
|
|
|
stdenv,
|
|
|
|
symlinkJoin,
|
|
|
|
writeShellScriptBin,
|
|
|
|
acl,
|
|
|
|
apparmor-parser,
|
|
|
|
apparmor-profiles,
|
|
|
|
attr,
|
|
|
|
bash,
|
|
|
|
btrfs-progs,
|
|
|
|
cdrkit,
|
|
|
|
criu,
|
|
|
|
dnsmasq,
|
|
|
|
e2fsprogs,
|
|
|
|
getent,
|
|
|
|
gnutar,
|
|
|
|
gptfdisk,
|
|
|
|
gzip,
|
|
|
|
iproute2,
|
|
|
|
iptables,
|
|
|
|
kmod,
|
|
|
|
lvm2,
|
|
|
|
minio,
|
|
|
|
nftables,
|
|
|
|
OVMF,
|
|
|
|
qemu_kvm,
|
|
|
|
qemu-utils,
|
|
|
|
rsync,
|
|
|
|
spice-gtk,
|
|
|
|
squashfsTools,
|
|
|
|
thin-provisioning-tools,
|
|
|
|
util-linux,
|
|
|
|
virtiofsd,
|
|
|
|
xz,
|
2023-10-19 13:55:26 +00:00
|
|
|
}:
|
|
|
|
let
|
2024-02-07 01:22:34 +00:00
|
|
|
unwrapped = callPackage ./unwrapped.nix { inherit lts; };
|
|
|
|
client = callPackage ./client.nix { inherit lts; };
|
|
|
|
name = "incus${lib.optionalString lts "-lts"}";
|
|
|
|
|
2023-10-19 13:55:26 +00:00
|
|
|
binPath = lib.makeBinPath [
|
|
|
|
acl
|
|
|
|
attr
|
|
|
|
bash
|
|
|
|
btrfs-progs
|
2024-01-25 14:12:00 +00:00
|
|
|
cdrkit
|
2023-10-19 13:55:26 +00:00
|
|
|
criu
|
|
|
|
dnsmasq
|
2024-01-25 14:12:00 +00:00
|
|
|
e2fsprogs
|
|
|
|
getent
|
2023-10-19 13:55:26 +00:00
|
|
|
gnutar
|
|
|
|
gptfdisk
|
|
|
|
gzip
|
|
|
|
iproute2
|
|
|
|
iptables
|
2024-01-25 14:12:00 +00:00
|
|
|
kmod
|
|
|
|
lvm2
|
|
|
|
minio
|
|
|
|
nftables
|
2023-10-19 13:55:26 +00:00
|
|
|
qemu_kvm
|
|
|
|
qemu-utils
|
|
|
|
rsync
|
|
|
|
squashfsTools
|
2024-01-25 14:12:00 +00:00
|
|
|
thin-provisioning-tools
|
2023-11-16 04:20:00 +00:00
|
|
|
util-linux
|
2023-10-19 13:55:26 +00:00
|
|
|
virtiofsd
|
|
|
|
xz
|
|
|
|
|
|
|
|
(writeShellScriptBin "apparmor_parser" ''
|
|
|
|
exec '${apparmor-parser}/bin/apparmor_parser' -I '${apparmor-profiles}/etc/apparmor.d' "$@"
|
|
|
|
'')
|
|
|
|
];
|
|
|
|
|
2024-02-07 01:22:34 +00:00
|
|
|
clientBinPath = [ spice-gtk ];
|
2023-10-19 13:55:26 +00:00
|
|
|
|
|
|
|
ovmf-2mb = OVMF.override {
|
|
|
|
secureBoot = true;
|
|
|
|
fdSize2MB = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
ovmf-4mb = OVMF.override {
|
|
|
|
secureBoot = true;
|
|
|
|
fdSize4MB = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
ovmf-prefix = if stdenv.hostPlatform.isAarch64 then "AAVMF" else "OVMF";
|
|
|
|
|
|
|
|
# mimic ovmf from https://github.com/canonical/incus-pkg-snap/blob/3abebe1dfeb20f9b7729556960c7e9fe6ad5e17c/snapcraft.yaml#L378
|
|
|
|
# also found in /snap/incus/current/share/qemu/ on a snap install
|
|
|
|
ovmf = linkFarm "incus-ovmf" [
|
2024-02-07 01:22:34 +00:00
|
|
|
{
|
|
|
|
name = "OVMF_CODE.2MB.fd";
|
|
|
|
path = "${ovmf-2mb.fd}/FV/${ovmf-prefix}_CODE.fd";
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "OVMF_CODE.4MB.fd";
|
|
|
|
path = "${ovmf-4mb.fd}/FV/${ovmf-prefix}_CODE.fd";
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "OVMF_CODE.fd";
|
|
|
|
path = "${ovmf-2mb.fd}/FV/${ovmf-prefix}_CODE.fd";
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
name = "OVMF_VARS.2MB.fd";
|
|
|
|
path = "${ovmf-2mb.fd}/FV/${ovmf-prefix}_VARS.fd";
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "OVMF_VARS.2MB.ms.fd";
|
|
|
|
path = "${ovmf-2mb.fd}/FV/${ovmf-prefix}_VARS.fd";
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "OVMF_VARS.4MB.fd";
|
|
|
|
path = "${ovmf-4mb.fd}/FV/${ovmf-prefix}_VARS.fd";
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "OVMF_VARS.4MB.ms.fd";
|
|
|
|
path = "${ovmf-4mb.fd}/FV/${ovmf-prefix}_VARS.fd";
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "OVMF_VARS.fd";
|
|
|
|
path = "${ovmf-2mb.fd}/FV/${ovmf-prefix}_VARS.fd";
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "OVMF_VARS.ms.fd";
|
|
|
|
path = "${ovmf-2mb.fd}/FV/${ovmf-prefix}_VARS.fd";
|
|
|
|
}
|
2023-10-19 13:55:26 +00:00
|
|
|
];
|
|
|
|
in
|
|
|
|
symlinkJoin {
|
2024-02-07 01:22:34 +00:00
|
|
|
name = "${name}-${unwrapped.version}";
|
2023-10-19 13:55:26 +00:00
|
|
|
|
2024-02-07 01:22:34 +00:00
|
|
|
paths = [ unwrapped ];
|
2023-10-19 13:55:26 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
|
|
|
|
postBuild = ''
|
|
|
|
wrapProgram $out/bin/incusd --prefix PATH : ${lib.escapeShellArg binPath}:${qemu_kvm}/libexec:$out/bin --set INCUS_OVMF_PATH ${ovmf}
|
|
|
|
|
|
|
|
wrapProgram $out/bin/incus --prefix PATH : ${lib.makeBinPath clientBinPath}
|
|
|
|
'';
|
|
|
|
|
|
|
|
passthru = {
|
2024-02-07 01:22:34 +00:00
|
|
|
inherit client unwrapped;
|
2024-02-29 20:09:43 +00:00
|
|
|
ui = callPackage ./ui.nix {};
|
2024-02-07 01:22:34 +00:00
|
|
|
|
|
|
|
inherit (unwrapped) tests;
|
2023-10-19 13:55:26 +00:00
|
|
|
};
|
|
|
|
|
2024-02-07 01:22:34 +00:00
|
|
|
inherit (unwrapped) meta pname version;
|
2023-10-19 13:55:26 +00:00
|
|
|
}
|