mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-17 19:21:04 +00:00
mkosi: format
This commit is contained in:
parent
edd502ffd9
commit
12f6399c1e
|
@ -1,30 +1,31 @@
|
|||
{ lib
|
||||
, fetchFromGitHub
|
||||
, stdenv
|
||||
, python3
|
||||
, systemd
|
||||
, pandoc
|
||||
, kmod
|
||||
, gnutar
|
||||
, util-linux
|
||||
, cpio
|
||||
, bash
|
||||
, coreutils
|
||||
, btrfs-progs
|
||||
, libseccomp
|
||||
, replaceVars
|
||||
{
|
||||
lib,
|
||||
fetchFromGitHub,
|
||||
stdenv,
|
||||
python3,
|
||||
systemd,
|
||||
pandoc,
|
||||
kmod,
|
||||
gnutar,
|
||||
util-linux,
|
||||
cpio,
|
||||
bash,
|
||||
coreutils,
|
||||
btrfs-progs,
|
||||
libseccomp,
|
||||
replaceVars,
|
||||
|
||||
# Python packages
|
||||
, setuptools
|
||||
, setuptools-scm
|
||||
, wheel
|
||||
, buildPythonApplication
|
||||
, pytestCheckHook
|
||||
, pefile
|
||||
setuptools,
|
||||
setuptools-scm,
|
||||
wheel,
|
||||
buildPythonApplication,
|
||||
pytestCheckHook,
|
||||
pefile,
|
||||
|
||||
# Optional dependencies
|
||||
, withQemu ? false
|
||||
, qemu
|
||||
withQemu ? false,
|
||||
qemu,
|
||||
}:
|
||||
let
|
||||
# For systemd features used by mkosi, see
|
||||
|
@ -39,16 +40,21 @@ let
|
|||
withKernelInstall = true;
|
||||
};
|
||||
|
||||
python3pefile = python3.withPackages (ps: with ps; [
|
||||
pefile
|
||||
]);
|
||||
python3pefile = python3.withPackages (
|
||||
ps: with ps; [
|
||||
pefile
|
||||
]
|
||||
);
|
||||
in
|
||||
buildPythonApplication rec {
|
||||
pname = "mkosi";
|
||||
version = "24.3-unstable-2024-08-28";
|
||||
format = "pyproject";
|
||||
|
||||
outputs = [ "out" "man" ];
|
||||
outputs = [
|
||||
"out"
|
||||
"man"
|
||||
];
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "systemd";
|
||||
|
@ -57,26 +63,29 @@ buildPythonApplication rec {
|
|||
hash = "sha256-rO/4ki2nAJQN2slmYuHKESGBBDMXC/ikGf6dMDcKFr4=";
|
||||
};
|
||||
|
||||
patches = [
|
||||
(replaceVars ./0001-Use-wrapped-binaries-instead-of-Python-interpreter.patch {
|
||||
UKIFY = "${systemdForMkosi}/lib/systemd/ukify";
|
||||
PYTHON_PEFILE = "${python3pefile}/bin/python3.12";
|
||||
MKOSI_SANDBOX = "~MKOSI_SANDBOX~"; # to satisfy replaceVars, will be replaced in postPatch
|
||||
})
|
||||
(replaceVars ./0002-Fix-library-resolving.patch {
|
||||
LIBC = "${stdenv.cc.libc}/lib/libc.so.6";
|
||||
LIBSECCOMP = "${libseccomp.lib}/lib/libseccomp.so.2";
|
||||
})
|
||||
] ++ lib.optional withQemu (replaceVars ./0003-Fix-QEMU-firmware-path.patch {
|
||||
QEMU_FIRMWARE = "${qemu}/share/qemu/firmware";
|
||||
});
|
||||
patches =
|
||||
[
|
||||
(replaceVars ./0001-Use-wrapped-binaries-instead-of-Python-interpreter.patch {
|
||||
UKIFY = "${systemdForMkosi}/lib/systemd/ukify";
|
||||
PYTHON_PEFILE = "${python3pefile}/bin/python3.12";
|
||||
MKOSI_SANDBOX = "~MKOSI_SANDBOX~"; # to satisfy replaceVars, will be replaced in postPatch
|
||||
})
|
||||
(replaceVars ./0002-Fix-library-resolving.patch {
|
||||
LIBC = "${stdenv.cc.libc}/lib/libc.so.6";
|
||||
LIBSECCOMP = "${libseccomp.lib}/lib/libseccomp.so.2";
|
||||
})
|
||||
]
|
||||
++ lib.optional withQemu (
|
||||
replaceVars ./0003-Fix-QEMU-firmware-path.patch {
|
||||
QEMU_FIRMWARE = "${qemu}/share/qemu/firmware";
|
||||
}
|
||||
);
|
||||
|
||||
postPatch =
|
||||
''
|
||||
# As we need the $out reference, we can't use `replaceVars` here.
|
||||
substituteInPlace mkosi/run.py \
|
||||
--replace-fail '~MKOSI_SANDBOX~' "\"$out/bin/mkosi-sandbox\""
|
||||
'';
|
||||
postPatch = ''
|
||||
# As we need the $out reference, we can't use `replaceVars` here.
|
||||
substituteInPlace mkosi/run.py \
|
||||
--replace-fail '~MKOSI_SANDBOX~' "\"$out/bin/mkosi-sandbox\""
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [
|
||||
pandoc
|
||||
|
@ -85,18 +94,20 @@ buildPythonApplication rec {
|
|||
wheel
|
||||
];
|
||||
|
||||
propagatedBuildInputs = [
|
||||
bash
|
||||
btrfs-progs
|
||||
coreutils
|
||||
cpio
|
||||
gnutar
|
||||
kmod
|
||||
systemdForMkosi
|
||||
util-linux
|
||||
] ++ lib.optional withQemu [
|
||||
qemu
|
||||
];
|
||||
propagatedBuildInputs =
|
||||
[
|
||||
bash
|
||||
btrfs-progs
|
||||
coreutils
|
||||
cpio
|
||||
gnutar
|
||||
kmod
|
||||
systemdForMkosi
|
||||
util-linux
|
||||
]
|
||||
++ lib.optional withQemu [
|
||||
qemu
|
||||
];
|
||||
|
||||
postBuild = ''
|
||||
./tools/make-man-page.sh
|
||||
|
|
Loading…
Reference in a new issue