From 5a2b629bcb6efe172ee771ccbe0969dc8c445d62 Mon Sep 17 00:00:00 2001 From: andre4ik3 Date: Mon, 29 Sep 2025 00:51:15 +0000 Subject: [PATCH 1/6] teams/cockpit: init --- maintainers/team-list.nix | 10 ++++++++++ pkgs/by-name/co/cockpit/package.nix | 5 +---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/maintainers/team-list.nix b/maintainers/team-list.nix index f12ce735d58a..0173885d07de 100644 --- a/maintainers/team-list.nix +++ b/maintainers/team-list.nix @@ -141,6 +141,16 @@ with lib.maintainers; enableFeatureFreezePing = true; }; + cockpit = { + members = [ + alexandru0-dev + andre4ik3 + lucasew + ]; + scope = "Maintain Cockpit and official plugins by the Cockpit project."; + shortName = "Cockpit"; + }; + coq = { members = [ cohencyril diff --git a/pkgs/by-name/co/cockpit/package.nix b/pkgs/by-name/co/cockpit/package.nix index acee0c9e2a02..3435db365eb9 100644 --- a/pkgs/by-name/co/cockpit/package.nix +++ b/pkgs/by-name/co/cockpit/package.nix @@ -264,9 +264,6 @@ stdenv.mkDerivation (finalAttrs: { homepage = "https://cockpit-project.org/"; changelog = "https://cockpit-project.org/blog/cockpit-${finalAttrs.version}.html"; license = lib.licenses.lgpl21; - maintainers = with lib.maintainers; [ - lucasew - andre4ik3 - ]; + teams = [ lib.teams.cockpit ]; }; }) From ace29d0cfa8edcd78879af6a208928858c51a885 Mon Sep 17 00:00:00 2001 From: andre4ik3 Date: Mon, 29 Sep 2025 01:34:08 +0000 Subject: [PATCH 2/6] cockpit-files: init at 34 Co-authored-by: lucasew --- pkgs/by-name/co/cockpit-files/package.nix | 56 +++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 pkgs/by-name/co/cockpit-files/package.nix diff --git a/pkgs/by-name/co/cockpit-files/package.nix b/pkgs/by-name/co/cockpit-files/package.nix new file mode 100644 index 000000000000..5b1ac0e97489 --- /dev/null +++ b/pkgs/by-name/co/cockpit-files/package.nix @@ -0,0 +1,56 @@ +{ + lib, + stdenv, + cockpit, + nodejs, + gettext, + writeShellScriptBin, + fetchFromGitHub, + gitUpdater, +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "cockpit-files"; + version = "34"; + + src = fetchFromGitHub { + owner = "cockpit-project"; + repo = "cockpit-files"; + tag = finalAttrs.version; + hash = "sha256-nxlPzNrX3mAwhR8mpRfoZ7d6tdfVOBEaTtzEHU14p68="; + + fetchSubmodules = true; + postFetch = "cp $out/node_modules/.package-lock.json $out/package-lock.json"; + }; + + buildInputs = [ + nodejs + gettext + (writeShellScriptBin "git" "true") + ]; + + cockpitSrc = cockpit.src; + + postPatch = '' + mkdir -p pkg; cp -r $cockpitSrc/pkg/lib pkg + mkdir -p test; cp -r $cockpitSrc/test/common test + + substituteInPlace Makefile \ + --replace-fail '$(MAKE) package-lock.json' 'true' \ + --replace-fail '$(COCKPIT_REPO_FILES) | tar x' "" \ + --replace-fail '/usr/local' "$out" + + patchShebangs build.js + ''; + + passthru.updateScript = gitUpdater { }; + + meta = { + description = "Featureful file browser for Cockpit"; + homepage = "https://github.com/cockpit-project/cockpit-files"; + changelog = "https://github.com/cockpit-project/cockpit-files/releases/tag/${finalAttrs.version}"; + platforms = lib.platforms.linux; + license = [ lib.licenses.lgpl21 ]; + teams = [ lib.teams.cockpit ]; + }; +}) From 67481c594a9c732b074ab784ec2c30d0b26c2181 Mon Sep 17 00:00:00 2001 From: andre4ik3 Date: Mon, 29 Sep 2025 01:34:34 +0000 Subject: [PATCH 3/6] cockpit-machines: init at 346 Co-authored-by: lucasew --- pkgs/by-name/co/cockpit-machines/package.nix | 67 ++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 pkgs/by-name/co/cockpit-machines/package.nix diff --git a/pkgs/by-name/co/cockpit-machines/package.nix b/pkgs/by-name/co/cockpit-machines/package.nix new file mode 100644 index 000000000000..742f72328bac --- /dev/null +++ b/pkgs/by-name/co/cockpit-machines/package.nix @@ -0,0 +1,67 @@ +{ + lib, + stdenv, + cockpit, + nodejs, + gettext, + writeShellScriptBin, + fetchFromGitHub, + gitUpdater, + libosinfo, + osinfo-db, +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "cockpit-machines"; + version = "346"; + + src = fetchFromGitHub { + owner = "cockpit-project"; + repo = "cockpit-machines"; + tag = finalAttrs.version; + hash = "sha256-fsEmxJ/9w4NbjgKhb4JTFY94FFTc735+ZQ8YieLQVpA="; + + fetchSubmodules = true; + postFetch = "cp $out/node_modules/.package-lock.json $out/package-lock.json"; + }; + + buildInputs = [ + nodejs + gettext + (writeShellScriptBin "git" "true") + ]; + + cockpitSrc = cockpit.src; + + postPatch = '' + mkdir -p pkg; cp -r $cockpitSrc/pkg/lib pkg + mkdir -p test; cp -r $cockpitSrc/test/common test + + substituteInPlace Makefile \ + --replace-fail '$(MAKE) package-lock.json' 'true' \ + --replace-fail '$(COCKPIT_REPO_FILES) | tar x' "" \ + --replace-fail '/usr/local' "$out" + + substituteInPlace src/manifest.json \ + --replace-fail '"/usr/share/dbus-1/system.d/org.libvirt.conf"' '"/etc/systemd/system/libvirt-dbus.service"' + + patchShebangs build.js + ''; + + passthru = { + updateScript = gitUpdater { }; + cockpitPath = [ + libosinfo + osinfo-db + ]; + }; + + meta = { + description = "Cockpit UI for virtual machines"; + homepage = "https://github.com/cockpit-project/cockpit-machines"; + changelog = "https://github.com/cockpit-project/cockpit-machines/releases/tag/${finalAttrs.version}"; + platforms = lib.platforms.linux; + license = [ lib.licenses.lgpl21 ]; + teams = [ lib.teams.cockpit ]; + }; +}) From 994ff0fb04dbd1b2e756ea556379ba1bfc552366 Mon Sep 17 00:00:00 2001 From: andre4ik3 Date: Mon, 29 Sep 2025 01:34:56 +0000 Subject: [PATCH 4/6] cockpit-podman: init at 119.1 Co-authored-by: lucasew --- pkgs/by-name/co/cockpit-podman/package.nix | 63 ++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 pkgs/by-name/co/cockpit-podman/package.nix diff --git a/pkgs/by-name/co/cockpit-podman/package.nix b/pkgs/by-name/co/cockpit-podman/package.nix new file mode 100644 index 000000000000..d4cd27c96f5c --- /dev/null +++ b/pkgs/by-name/co/cockpit-podman/package.nix @@ -0,0 +1,63 @@ +{ + lib, + stdenv, + cockpit, + nodejs, + gettext, + writeShellScriptBin, + fetchFromGitHub, + gitUpdater, + podman, +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "cockpit-podman"; + version = "119.1"; + + src = fetchFromGitHub { + owner = "cockpit-project"; + repo = "cockpit-podman"; + tag = finalAttrs.version; + hash = "sha256-XAOHkul9oh1mUJ27ghJgZLtriBGjofyoGhQ3gb7Gunc="; + + fetchSubmodules = true; + postFetch = "cp $out/node_modules/.package-lock.json $out/package-lock.json"; + }; + + buildInputs = [ + nodejs + gettext + (writeShellScriptBin "git" "true") + ]; + + cockpitSrc = cockpit.src; + + postPatch = '' + mkdir -p pkg; cp -r $cockpitSrc/pkg/lib pkg + mkdir -p test; cp -r $cockpitSrc/test/common test + + substituteInPlace Makefile \ + --replace-fail '$(MAKE) package-lock.json' 'true' \ + --replace-fail '$(COCKPIT_REPO_FILES) | tar x' "" \ + --replace-fail '/usr/local' "$out" + + substituteInPlace src/manifest.json \ + --replace-fail '"/lib/systemd' '"/run/current-system/sw/lib/systemd' + + patchShebangs build.js + ''; + + passthru = { + updateScript = gitUpdater { }; + cockpitPath = [ podman ]; + }; + + meta = { + description = "Cockpit UI for podman containers"; + homepage = "https://github.com/cockpit-project/cockpit-podman"; + changelog = "https://github.com/cockpit-project/cockpit-podman/releases/tag/${finalAttrs.version}"; + platforms = lib.platforms.linux; + license = [ lib.licenses.lgpl21 ]; + teams = [ lib.teams.cockpit ]; + }; +}) From f166cb37267dcf51e2f827e5ecf45bcaac4662b1 Mon Sep 17 00:00:00 2001 From: andre4ik3 Date: Wed, 12 Nov 2025 23:57:10 +0000 Subject: [PATCH 5/6] cockpit: wrap with osinfo and python with gobject Co-authored-by: Alexandru Nechita --- pkgs/by-name/co/cockpit/package.nix | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/pkgs/by-name/co/cockpit/package.nix b/pkgs/by-name/co/cockpit/package.nix index 3435db365eb9..05ff7c45767e 100644 --- a/pkgs/by-name/co/cockpit/package.nix +++ b/pkgs/by-name/co/cockpit/package.nix @@ -168,7 +168,15 @@ stdenv.mkDerivation (finalAttrs: { configureFlags = [ "--enable-prefix-only=yes" "--disable-pcp" # TODO: figure out how to package its dependency - "--with-default-session-path=${placeholder "out"}/bin:/etc/cockpit/bin:${util-linux}/bin:/run/wrappers/bin:/run/current-system/sw/bin" + "--with-default-session-path=${ + lib.makeBinPath [ + (placeholder "out") + "/etc/cockpit" + util-linux + "/run/wrappers" + "/run/current-system/sw" + ] + }" "--with-admin-group=root" # TODO: really? Maybe "wheel"? ]; @@ -192,8 +200,15 @@ stdenv.mkDerivation (finalAttrs: { for binary in $out/bin/cockpit-bridge $out/libexec/cockpit-askpass; do chmod +x $binary wrapProgram $binary \ - --prefix PYTHONPATH : $out/${python3Packages.python.sitePackages} \ - --prefix XDG_DATA_DIRS : /etc/cockpit/share # Cockpit apps will be stored at /etc/cockpit/share/cockpit/ (managed by Cockpit nixos service) + --prefix PYTHONPATH : ${ + lib.makeSearchPath python3Packages.python.sitePackages [ + "$out" + python3Packages.pygobject3 + "/etc/cockpit" + ] + } \ + --prefix GI_TYPELIB_PATH : "/etc/cockpit/lib/girepository-1.0" \ + --prefix XDG_DATA_DIRS : "/etc/cockpit/share" done patchShebangs $out/share/cockpit/issue/update-issue From 549f5e6ddbbcaa5c9fea9eb39754e7104871bfe9 Mon Sep 17 00:00:00 2001 From: andre4ik3 Date: Sat, 17 Jan 2026 09:53:44 +0000 Subject: [PATCH 6/6] nixos/cockpit: place more dependencies into /etc/cockpit --- nixos/modules/services/monitoring/cockpit.nix | 44 +++++++++++++------ pkgs/by-name/co/cockpit/package.nix | 15 +++++-- 2 files changed, 41 insertions(+), 18 deletions(-) diff --git a/nixos/modules/services/monitoring/cockpit.nix b/nixos/modules/services/monitoring/cockpit.nix index 8a7192f635eb..a349e2b22611 100644 --- a/nixos/modules/services/monitoring/cockpit.nix +++ b/nixos/modules/services/monitoring/cockpit.nix @@ -15,6 +15,33 @@ let mkPackageOption ; settingsFormat = pkgs.formats.ini { }; + + pathPkgs = [ cfg.package ] ++ cfg.plugins; + + resourcesEnv = pkgs.buildEnv { + name = "cockpit-plugins"; + paths = pathPkgs; + pathsToLink = [ "/share/cockpit" ]; + }; + + depsEnv = pkgs.buildEnv { + name = "cockpit-plugins-env"; + paths = lib.concatMap (p: p.passthru.cockpitPath or [ ]) pathPkgs; + pathsToLink = [ + "/bin" + "/share" + "/lib" + ]; + }; + + share = pkgs.buildEnv { + name = "cockpit-share"; + paths = [ + resourcesEnv + depsEnv + ]; + pathsToLink = [ "/share" ]; + }; in { options = { @@ -100,22 +127,11 @@ in }; # Add plugins in discoverable folder - "cockpit/share/cockpit".source = "${ - pkgs.buildEnv { - name = "cockpit-plugins"; - paths = cfg.plugins ++ [ cfg.package ]; - pathsToLink = [ "/share/cockpit" ]; - } - }/share/cockpit"; + "cockpit/share".source = "${share}/share"; # Add plugins dependencies - "cockpit/bin".source = "${ - pkgs.buildEnv { - name = "cockpit-path"; - paths = lib.concatMap (p: p.passthru.cockpitPath or [ ]) cfg.plugins; - pathsToLink = [ "/bin" ]; - } - }/bin"; + "cockpit/bin".source = "${depsEnv}/bin"; + "cockpit/lib".source = "${depsEnv}/lib"; }; security.pam.services.cockpit = { diff --git a/pkgs/by-name/co/cockpit/package.nix b/pkgs/by-name/co/cockpit/package.nix index 05ff7c45767e..a5ce3e74a015 100644 --- a/pkgs/by-name/co/cockpit/package.nix +++ b/pkgs/by-name/co/cockpit/package.nix @@ -14,6 +14,7 @@ git, glib, glib-networking, + gobject-introspection, gnused, gnutls, hostname, @@ -160,9 +161,9 @@ stdenv.mkDerivation (finalAttrs: { --replace-warn '"/usr/share' '"/run/current-system/sw/share' \ --replace-warn '"/lib/systemd' '"/run/current-system/sw/lib/systemd' - # replace reference to system python interpreter, used for e.g. sosreport - substituteInPlace pkg/lib/python.ts \ - --replace-fail /usr/libexec/platform-python ${python3Packages.python.interpreter} + # fix polkit agent helper path + substituteInPlace src/cockpit/polkit.py \ + --replace-fail "/usr/lib/polkit-1/polkit-agent-helper-1" "/run/wrappers/bin/polkit-agent-helper-1" ''; configureFlags = [ @@ -200,10 +201,10 @@ stdenv.mkDerivation (finalAttrs: { for binary in $out/bin/cockpit-bridge $out/libexec/cockpit-askpass; do chmod +x $binary wrapProgram $binary \ + --prefix PATH : "/etc/cockpit/bin" \ --prefix PYTHONPATH : ${ lib.makeSearchPath python3Packages.python.sitePackages [ "$out" - python3Packages.pygobject3 "/etc/cockpit" ] } \ @@ -271,6 +272,12 @@ stdenv.mkDerivation (finalAttrs: { passthru = { tests = { inherit (nixosTests) cockpit; }; updateScript = nix-update-script { }; + cockpitPath = [ + glib + gobject-introspection + python3Packages.python + python3Packages.pygobject3 + ]; }; meta = {