about summary refs log tree commit diff
path: root/pkgs/os-specific/linux/lxcfs/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/os-specific/linux/lxcfs/default.nix')
-rw-r--r--pkgs/os-specific/linux/lxcfs/default.nix61
1 files changed, 41 insertions, 20 deletions
diff --git a/pkgs/os-specific/linux/lxcfs/default.nix b/pkgs/os-specific/linux/lxcfs/default.nix
index 28777d36e6beb..ee923786c2952 100644
--- a/pkgs/os-specific/linux/lxcfs/default.nix
+++ b/pkgs/os-specific/linux/lxcfs/default.nix
@@ -1,41 +1,58 @@
-{ config, lib, stdenv, fetchFromGitHub, autoreconfHook, pkg-config, help2man, fuse
-, util-linux, makeWrapper
-, enableDebugBuild ? config.lxcfs.enableDebugBuild or false }:
+{
+  lib,
+  stdenv,
+  fetchFromGitHub,
+  fuse3,
+  help2man,
+  makeWrapper,
+  meson,
+  ninja,
+  nixosTests,
+  pkg-config,
+  python3,
+  util-linux,
+}:
 
 stdenv.mkDerivation rec {
   pname = "lxcfs";
-  version = "4.0.12";
+  version = "5.0.4";
 
   src = fetchFromGitHub {
     owner = "lxc";
     repo = "lxcfs";
     rev = "lxcfs-${version}";
-    sha256 = "sha256-+wp29GD+toXGfQbPGYbDJ7/P+FY1uQY4uK3OQxTE9GM=";
+    sha256 = "sha256-vusxbFV7cnQVBOOo7E+fSyaE63f5QiE2xZhYavc8jJU=";
   };
 
-  postPatch = ''
-    sed -i -e '1i #include <sys/pidfd.h>' src/bindings.c
-  '';
+  patches = [
+    # skip RPM spec generation
+    ./no-spec.patch
 
-  nativeBuildInputs = [ pkg-config help2man autoreconfHook makeWrapper ];
-  buildInputs = [ fuse ];
+    # skip installing systemd files
+    ./skip-init.patch
+
+    # fix pidfd checks and include
+    ./pidfd.patch
+  ];
 
-  preConfigure = lib.optionalString enableDebugBuild ''
-    sed -i 's,#AM_CFLAGS += -DDEBUG,AM_CFLAGS += -DDEBUG,' Makefile.am
-  '';
 
-  configureFlags = [
-    "--with-init-script=systemd"
-    "--sysconfdir=/etc"
-    "--localstatedir=/var"
+  nativeBuildInputs = [
+    meson
+    help2man
+    makeWrapper
+    ninja
+    (python3.withPackages (p: [ p.jinja2 ]))
+    pkg-config
   ];
+  buildInputs = [ fuse3 ];
 
-  installFlags = [ "SYSTEMD_UNIT_DIR=\${out}/lib/systemd" ];
+  preConfigure = ''
+    patchShebangs tools/
+  '';
 
   postInstall = ''
     # `mount` hook requires access to the `mount` command from `util-linux`:
-    wrapProgram "$out/share/lxcfs/lxc.mount.hook" \
-      --prefix PATH : "${util-linux}/bin"
+    wrapProgram "$out/share/lxcfs/lxc.mount.hook" --prefix PATH : "${util-linux}/bin"
   '';
 
   postFixup = ''
@@ -43,6 +60,10 @@ stdenv.mkDerivation rec {
     patchelf --set-rpath "$(patchelf --print-rpath "$out/bin/lxcfs"):$out/lib" "$out/bin/lxcfs"
   '';
 
+  passthru.tests = {
+    incus-container = nixosTests.incus.container;
+  };
+
   meta = {
     description = "FUSE filesystem for LXC";
     homepage = "https://linuxcontainers.org/lxcfs";