about summary refs log tree commit diff
path: root/pkgs/by-name/lx
diff options
context:
space:
mode:
authorAdam Stephens <adam@valkor.net>2024-03-29 22:27:22 -0400
committerAdam Stephens <adam@valkor.net>2024-03-29 22:27:22 -0400
commit248dc21a54b85fd3c613252416eb309719569c2f (patch)
tree36cde0d98a3bd018959e3da029c9ebcbbfaffe37 /pkgs/by-name/lx
parentd5766175de1b5b0e09f7d25c0d552fe4ee617a91 (diff)
treewide: fix renamed incus container tests
Diffstat (limited to 'pkgs/by-name/lx')
-rw-r--r--pkgs/by-name/lx/lxcfs/package.nix82
1 files changed, 82 insertions, 0 deletions
diff --git a/pkgs/by-name/lx/lxcfs/package.nix b/pkgs/by-name/lx/lxcfs/package.nix
new file mode 100644
index 0000000000000..07dec2a8dc8fc
--- /dev/null
+++ b/pkgs/by-name/lx/lxcfs/package.nix
@@ -0,0 +1,82 @@
+{
+  lib,
+  stdenv,
+  fetchFromGitHub,
+  fuse3,
+  help2man,
+  makeWrapper,
+  meson,
+  ninja,
+  nixosTests,
+  pkg-config,
+  python3,
+  util-linux,
+}:
+
+stdenv.mkDerivation rec {
+  pname = "lxcfs";
+  version = "5.0.4";
+
+  src = fetchFromGitHub {
+    owner = "lxc";
+    repo = "lxcfs";
+    rev = "lxcfs-${version}";
+    sha256 = "sha256-vusxbFV7cnQVBOOo7E+fSyaE63f5QiE2xZhYavc8jJU=";
+  };
+
+  patches = [
+    # skip RPM spec generation
+    ./no-spec.patch
+
+    # skip installing systemd files
+    ./skip-init.patch
+
+    # fix pidfd checks and include
+    ./pidfd.patch
+  ];
+
+
+  nativeBuildInputs = [
+    meson
+    help2man
+    makeWrapper
+    ninja
+    (python3.withPackages (p: [ p.jinja2 ]))
+    pkg-config
+  ];
+  buildInputs = [ fuse3 ];
+
+  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"
+  '';
+
+  postFixup = ''
+    # liblxcfs.so is reloaded with dlopen()
+    patchelf --set-rpath "$(patchelf --print-rpath "$out/bin/lxcfs"):$out/lib" "$out/bin/lxcfs"
+  '';
+
+  passthru.tests = {
+    incus-container-old-init = nixosTests.incus.container-old-init;
+    incus-container-new-init = nixosTests.incus.container-new-init;
+  passthru = {
+    tests = {
+      incus-container-legacy-init = nixosTests.incus.container-legacy-init;
+      incus-container-systemd-init = nixosTests.incus.container-systemd-init;
+    };
+  };
+
+  meta = {
+    description = "FUSE filesystem for LXC";
+    mainProgram = "lxcfs";
+    homepage = "https://linuxcontainers.org/lxcfs";
+    changelog = "https://linuxcontainers.org/lxcfs/news/";
+    license = lib.licenses.asl20;
+    platforms = lib.platforms.linux;
+    maintainers = lib.teams.lxc.members;
+  };
+}