Unverified Commit 667be135 authored by Sandro Jäckel's avatar Sandro Jäckel Committed by GitHub
Browse files

cockpit-zfs: use Python from cockpit, drop firewalld dependency (#486802)

parents 24abfd5a 503c0e88
Loading
Loading
Loading
Loading
+5 −14
Original line number Diff line number Diff line
{
  acl,
  bash,
  cockpit,
  coreutils,
  fetchFromGitHub,
  firewalld,
  getent,
  glibc,
  iproute2,
@@ -15,7 +15,6 @@
  msmtp,
  nodejs,
  openssh,
  python312,
  samba,
  shadow,
  smartmontools,
@@ -27,15 +26,6 @@
  zfs,
}:

let
  # Using python312 because py-libzfs is not compatible with newer versions
  python = (
    python312.withPackages (ps: [
      ps.pyudev
      ps.py-libzfs
    ])
  );
in
stdenv.mkDerivation (finalAttrs: {
  pname = "cockpit-zfs";
  version = "1.2.12-2";
@@ -67,7 +57,6 @@ stdenv.mkDerivation (finalAttrs: {
    acl
    bash
    coreutils
    firewalld
    getent
    glibc
    iproute2
@@ -76,7 +65,6 @@ stdenv.mkDerivation (finalAttrs: {
    msmtp
    nodejs
    openssh
    python
    samba
    shadow
    smartmontools
@@ -84,6 +72,8 @@ stdenv.mkDerivation (finalAttrs: {
    systemd
    util-linux
    zfs
    cockpit.passthru.python3Packages.pyudev
    cockpit.passthru.python3Packages.py-libzfs
  ];

  env = {
@@ -151,11 +141,12 @@ stdenv.mkDerivation (finalAttrs: {
    for script in $out/etc/zfs/zed.d/*; do
      if [ -f "$script" ]; then
        wrapProgram "$script" \
          --set PYTHONPATH "/etc/cockpit/${cockpit.passthru.python3Packages.python.sitePackages}" \
          --set PATH "${
            lib.makeBinPath [
              "/etc/cockpit"
              coreutils
              bash
              python
              jq
            ]
          }"
+13 −1
Original line number Diff line number Diff line
@@ -34,7 +34,7 @@
  pam,
  pkg-config,
  polkit,
  python3Packages,
  python312Packages,
  sscg,
  systemd,
  udev,
@@ -45,6 +45,12 @@
  nixos-icons,
}:

let
  # Pinned to 3.12 due to cockpit-zfs dependency py-libzfs not being compatible
  # with 3.13+
  python3Packages = python312Packages;
in

stdenv.mkDerivation (finalAttrs: {
  pname = "cockpit";
  version = "355";
@@ -165,6 +171,11 @@ stdenv.mkDerivation (finalAttrs: {
      --replace-fail "/usr/lib/polkit-1/polkit-agent-helper-1" "/run/wrappers/bin/polkit-agent-helper-1"
  '';

  preConfigure = ''
    # Make sure our Python comes before any other Python (e.g. from asciidoc)
    export PATH="${lib.makeBinPath [ python3Packages.python ]}:$PATH"
  '';

  configureFlags = [
    "--enable-prefix-only=yes"
    "--disable-pcp" # TODO: figure out how to package its dependency
@@ -269,6 +280,7 @@ stdenv.mkDerivation (finalAttrs: {
  '';

  passthru = {
    inherit python3Packages;
    tests = { inherit (nixosTests) cockpit; };
    updateScript = nix-update-script { };
    cockpitPath = [