I was looking to manage my server through Cockpit project.

I would like to also be able to use cockpit-machines to manage VMs on my server. However, that module is not present in nixpkgs.

I know how to deploy simple-ish packages, however, JS based projects seem a bit complicated.

https://github.com/cockpit-project/cockpit-machines

Could you suggest a starting point with this project? Any similar modules I can refer to?

  • Matej@matejc.com
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    You need a Nix package first, so how I do this for NodeJS is, clone your NodeJS repo to your computer, then you will need node2nix to package it (https://github.com/svanderburg/node2nix). You can use this command inside the repo: node2nix -18 (you need to specify -18 since by default node 14 is being used). After nix files are generated, you can test it by running nix-build -A package. Now that you have this done, its time to make a PR to nixpkgs and add all the new generated files along with package.json and that is your cockpit-machines package.

    After all this its time to integrate into existing cockpit NixOS module. I would maybe add a new option called extraPackages, like so: services.cockpit.extraPackages = [ pkgs.cockpit-machines ];. On the other hand you could just add option to the cockpit package option, like so: services.cockpit.package = pkgs.cockpit.override { enableCockpitMachines = true; };. This might be easier.

    ps: I havent tested this so ask if you have any difficulties

  • chkno@lemmy.ml
    link
    fedilink
    arrow-up
    1
    ·
    1 year ago

    If you haven’t read through them already:

    It looks like cockpit has been packaged and moduled. Maybe look at cockpit’s package and module definitions for inspiration for cockpit-machines? It looks like cockpit is a hybrid python+javascript project and has been packaged primarily as a python package, and cockpit-machines is also a hybrid python+javascript project but maybe the python aspect is less central, as I don’t see a top-level pyproject.toml, so you may not be able to exactly mimic the cockpit package?