Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Package request: cockpit-machines #287644

Open
Pablo1107 opened this issue Feb 10, 2024 · 4 comments
Open

Package request: cockpit-machines #287644

Pablo1107 opened this issue Feb 10, 2024 · 4 comments

Comments

@Pablo1107
Copy link
Contributor

Project description

As a follow up to this ticket #38161 we need this package to be able to control and create libvirtd VMs.

Metadata


Add a 👍 reaction to issues you find important.

@Pablo1107
Copy link
Contributor Author

Some information I found:

This article mentions that in the NUR has packaged cockpit-machines like this one:
https://github.com/nix-community/nur-combined/blob/4adeb491423345da5c831d339cd7c6dcfc7bc697/repos/procyon/nix/pkgs/cockpit-machines/default.nix

But when installed, as mentioned in the ticket for cockpit one cannot create a VM because it shows "No results found" on the OS select input:
image

This is because we lack two deps: libosinfo and osinfo-db as mentioned by this comment but just installing those in systemPackages don't work.

@Pablo1107
Copy link
Contributor Author

@lucasew did you try get this working when you worked on cockpit?

@lucasew
Copy link
Contributor

lucasew commented Feb 24, 2024

@lucasew did you try get this working when you worked on cockpit?

I didn't try to package any plugins, but I had to use a trick for cockpit to recognize the core plugin. Plugins should work out of the box but the problem is that these plugins have paths hardcoded so they require patching or upstream collaboration.

@inhumantsar
Copy link

inhumantsar commented Mar 26, 2024

i spent today messing around with this. i was able to get as far as getting machines to call their osinfo python script correctly.

.../packages/cockpit-machines/default.nix
{ lib, stdenv, fetchzip, gettext, gobject-introspection, osinfo-db-tools, python3Packages, pkgs, ... }:

pkgs.stdenv.mkDerivation rec {
  pname = "cockpit-machines";
  version = "309";

  src = fetchzip {
    url = "https://github.com/cockpit-project/cockpit-machines/releases/download/${version}/cockpit-machines-${version}.tar.xz";
    sha256 = "sha256-sVjP3KFmZH3c2tGzlEohAue0u2e7+vAmXBBA+5uuass=";
  };

  # gobject-introspection works now, thanks to the post below. but...
  # https://discourse.nixos.org/t/getting-things-gnome-modulenotfounderror-no-module-named-gi/8439/4
  #
  # ...the python script that cockpit-machines runs is failing with a "No such file or directory" error.
  # the script loads properly and i'm not getting an import or gi "Namespace Libosinfo is not available"
  # error, so i'm thinking that the OSINFO_DATA_DIR env var needs to be set. however...
  nativeBuildInputs = [
    gettext
    gobject-introspection
    osinfo-db-tools
  ];

  # ...osinfo-db doesn't show up in nix-support/propagated-build-inputs, and...
  propagatedBuildInputs = with pkgs; [
    python3Packages.pygobject3
    libosinfo
    osinfo-db
  ];

  makeFlags = [ "DESTDIR=$(out)" "PREFIX=" ];

  postPatch = ''
    touch pkg/lib/cockpit.js
    touch pkg/lib/cockpit-po-plugin.js
    touch dist/manifest.json
  '';

  postFixup = ''
    gunzip $out/share/cockpit/machines/index.js.gz
    sed -i "s#/usr/bin/python3#/usr/bin/env python3#ig" $out/share/cockpit/machines/index.js
    sed -i "s#/usr/bin/pwscore#/usr/bin/env pwscore#ig" $out/share/cockpit/machines/index.js
    gzip -9 $out/share/cockpit/machines/index.js

    # ...this doesn't work either
    # osinfo-db-import --dir "$out/share/osinfo" "${pkgs.osinfo-db.src}"
  '';

  dontBuild = true;

  meta = with lib; {
    description = "Cockpit UI for virtual machines";
    license = licenses.lgpl21;
    homepage = "https://github.com/cockpit-project/cockpit-machines";
    platforms = platforms.linux;
    maintainers = with maintainers; [ ];
  };
}
get os list returned error: "{"problem":null,"exit_status":127,"exit_signal":null,"message":"...the entire script...: No such file or directory"}"

the script loads properly. earlier during debugging, it was throwing python import errors. when i debug in a python interpreter, Namespace Libosinfo is not available throws before anything else. the fact that it's failing after those makes it seem that cockpit-machines, gobject-introspection, and libosinfo itself is set up correctly.

i think that either the script is is trying and failing to load the db files or libosinfo isn't installed properly and can't find the db files. not sure where to go from here though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants