Unverified Commit 8fa5a28d authored by Sandro Jäckel's avatar Sandro Jäckel Committed by GitHub
Browse files

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

parents 1dea22c1 549f5e6d
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -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
Original line number Diff line number Diff line
@@ -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 −0
Original line number Diff line number Diff line
{
  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 ];
  };
})
+67 −0
Original line number Diff line number Diff line
{
  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 ];
  };
})
+63 −0
Original line number Diff line number Diff line
{
  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 ];
  };
})
Loading