summary refs log tree commit diff
path: root/pkgs/tools/virtualization
diff options
context:
space:
mode:
authorPaul Meyer <49727155+katexochen@users.noreply.github.com>2023-08-16 16:48:04 +0200
committerPaul Meyer <49727155+katexochen@users.noreply.github.com>2023-08-19 22:56:41 +0200
commitf008df3863548efaf2dce688fef9a314b9f3d744 (patch)
treee7bb73f23d82b9a4745d99330de35dbaa5d5d9ca /pkgs/tools/virtualization
parent9dc1cef1ae7be94630b86eeaef1f93580d565919 (diff)
downloadnixpkgs-f008df3863548efaf2dce688fef9a314b9f3d744.tar
nixpkgs-f008df3863548efaf2dce688fef9a314b9f3d744.tar.gz
nixpkgs-f008df3863548efaf2dce688fef9a314b9f3d744.tar.bz2
nixpkgs-f008df3863548efaf2dce688fef9a314b9f3d744.tar.lz
nixpkgs-f008df3863548efaf2dce688fef9a314b9f3d744.tar.xz
nixpkgs-f008df3863548efaf2dce688fef9a314b9f3d744.tar.zst
nixpkgs-f008df3863548efaf2dce688fef9a314b9f3d744.zip
mkosi: init at 15.2-pre
Co-authored-by: Malte Poll <mp@edgeless.systems>
Co-authored-by: Jonas Heinrich <onny@project-insanity.org>
Signed-off-by: Paul Meyer <49727155+katexochen@users.noreply.github.com>
Diffstat (limited to 'pkgs/tools/virtualization')
-rw-r--r--pkgs/tools/virtualization/mkosi/default.nix69
1 files changed, 69 insertions, 0 deletions
diff --git a/pkgs/tools/virtualization/mkosi/default.nix b/pkgs/tools/virtualization/mkosi/default.nix
new file mode 100644
index 00000000000..345e65d0488
--- /dev/null
+++ b/pkgs/tools/virtualization/mkosi/default.nix
@@ -0,0 +1,69 @@
+{ lib
+, fetchFromGitHub
+, setuptools
+, buildPythonApplication
+, pytestCheckHook
+, bubblewrap
+, systemd
+, stdenv
+}:
+let
+  # For systemd features used by mkosi, see
+  # https://github.com/systemd/mkosi/blob/19bb5e274d9a9c23891905c4bcbb8f68955a701d/action.yaml#L64-L72
+  systemdForMkosi = systemd.override {
+    # Will be added in #243242
+    # withRepart = true;
+    # withBootloader = true;
+    withEfi = true;
+    withUkify = true;
+  };
+in
+buildPythonApplication rec {
+  pname = "mkosi";
+  version = "15.2-pre"; # 15.1 is the latest release, but we require a newer commit
+  format = "pyproject";
+
+  src = fetchFromGitHub {
+    owner = "systemd";
+    repo = "mkosi";
+    # Fix from the commit is needed to run on NixOS,
+    # see https://github.com/systemd/mkosi/issues/1792
+    rev = "ca9673cbcbd9f293e5566cec4a1ba14bbcd075b8";
+    hash = "sha256-y5gG/g33HBpH1pTXfjHae25bc5p/BvlCm9QxOIYtcA8=";
+  };
+
+  # Fix ctypes finding library
+  # https://github.com/NixOS/nixpkgs/issues/7307
+  patchPhase = lib.optionalString stdenv.isLinux ''
+    substituteInPlace mkosi/run.py --replace \
+      'ctypes.util.find_library("c")' "'${stdenv.cc.libc}/lib/libc.so.6'"
+  '';
+
+  nativeBuildInputs = [
+    setuptools
+  ];
+
+
+  propagatedBuildInputs = [
+    systemdForMkosi
+    bubblewrap
+  ];
+
+  postInstall = ''
+    wrapProgram $out/bin/mkosi \
+      --prefix PYTHONPATH : "$PYTHONPATH"
+  '';
+
+  checkInputs = [
+    pytestCheckHook
+  ];
+
+  meta = with lib; {
+    description = "Build legacy-free OS images";
+    homepage = "https://github.com/systemd/mkosi";
+    license = licenses.lgpl21Only;
+    mainProgram = "mkosi";
+    maintainers = with maintainers; [ malt3 katexochen ];
+    platforms = platforms.linux;
+  };
+}