NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
16.66k stars 13.11k forks source link

Package request: cockpit-machines #287644

Open Pablo1107 opened 5 months ago

Pablo1107 commented 5 months ago

Project description

As a follow up to this ticket https://github.com/NixOS/nixpkgs/issues/38161 we need this package to be able to control and create libvirtd VMs.

Metadata

Add a :+1: reaction to issues you find important.

Pablo1107 commented 5 months ago

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 commented 4 months ago

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

lucasew commented 4 months ago

@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 commented 3 months ago

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.