cockpit-{files,machines,podman}: init packages (#447043)

This commit is contained in:
Sandro
2026-02-02 14:01:42 +00:00
committed by GitHub
6 changed files with 255 additions and 24 deletions
+10
View File
@@ -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
+30 -14
View File
@@ -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 = {
+56
View File
@@ -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 ];
};
})
@@ -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 ];
};
})
@@ -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 ];
};
})
+29 -10
View File
@@ -14,6 +14,7 @@
git,
glib,
glib-networking,
gobject-introspection,
gnused,
gnutls,
hostname,
@@ -160,15 +161,23 @@ 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 = [
"--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 +201,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 PATH : "/etc/cockpit/bin" \
--prefix PYTHONPATH : ${
lib.makeSearchPath python3Packages.python.sitePackages [
"$out"
"/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
@@ -256,6 +272,12 @@ stdenv.mkDerivation (finalAttrs: {
passthru = {
tests = { inherit (nixosTests) cockpit; };
updateScript = nix-update-script { };
cockpitPath = [
glib
gobject-introspection
python3Packages.python
python3Packages.pygobject3
];
};
meta = {
@@ -264,9 +286,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 ];
};
})