I’m a new NixOS user, currently trying to get all the software up an running on a NixOS system (currently inside a VM, but hopefully on my laptop soon).
I was amazed to find packages for almost any software I wished for - great work!
Now there is one application for which no package exists and I am trying to find a configuration that installs it to my NixOS: JAlbum.
I’d appreciate if someone could help me find my way around the NixOS configuration to package this.
Include pkgs.jdk23 with JavaFX enabled or depend on it.
download the ZIP + check sha256
extract it to an appropriate location
create a starter script that calls Java with all the arguments
Create a .desktop launcher to make it show up in the menu (I am using KDE Plasma, in case that matters)
I don’t really know how to start – found some hints on the internet so I have a very vague understanding, but I’m not able to get it to work by myself.
Is the information above everything we need to create a custom package in my configuration?
How to proceed?
Specifically in this case, you’re going to need to poke around the provided zip a bit, and see if they provide a starter script or something. If so, you’ll probably want to wrap it with makeWrapper, and possibly modify it a bit first with substituteInPlace. If not, you’ll just want to make one (actually, you may want to make it with makeWrapper anyway, just wrap the java binary and add additional arguments).
They probably also don’t provide a FHS-style directory structure (bin, share, lib, etc), so you’ll need to at least minimally conform to that, maybe by throwing everything in $out/share/jalbum or the like.
Great job. For a first derivation, this is particularly impressive. I haven’t tried to build and run it, but just by reading it, I suspect this is pretty much nixpkgs-ready code.
One (very) minor note: dontBuild = true; is almost certainly not necessary. The default buildPhase will just do nothing if it can’t find a Makefile. You might want to specify it anyway for clarity, though. Up to you.
At which point will this be called?
Will NixOs use this every time I call sudo nixos-rebuild switch --upgrade or is this rather something that happens on the repo server side?
I’m unsure about contributing this to nixpkgs, since I currently cannot promise to keep this updated (I don’t even know if I’ll still be using Nix in a month).
Are one-time-contributions something that’s appreciated or is this frowned upon?
Packages generally need a maintainer, i.e. someone who promises to use the software and help maintain it. Unmaintained software will generally not be accepted.
But if you do stop using the software, or nix, you can send another PR removing yourself as maintainer - just be aware that the software may be removed from nixpkgs if no one steps up to maintain it and it becomes a maintenance burden.