Unable to package ostui due to url error

Hello, I have trouble getting the correct url to package ostui. It uses sourcehut to host the code, I can’t figure out the url to download the tar.gz file from.

The releases only have .gz file . The official README has curl -L -o ostui.tgz https://hg.sr.ht/~ser/ostui/archive/v0.1.0.tar.gz to download the source, but i don’t know how to implement it in fetchurl.

Here is my build.nix file

{ lib
, stdenv
, fetchurl
, buildGoModule
, mpv
}:

let
  version = "1.0.1";
  pname = "ostui";
  hash = "";
in

buildGoModule {
  inherit pname;
  inherit version;

  src = fetchurl {
    name = "${pname}-${version}.tar.gz";
    url = "https://hg.sr.ht/~ser/ostui/archive/v${version}.tar.gz";
    inherit hash;
  };

  buildInputs = [
    mpv
  ];

  ldflags = [
    "-s" "-w"
    "-X main.Version=${version}"
    "-L ${mpv}/lib"
  ];

  vendorHash = "";

  meta = with lib; {
    homepage = "https://git.sr.ht/~ser/ostui";
    description = "Ostui is a terminal client for *sonic music servers, inspired by ncmpcpp and musickube.";
    license = licenses.gpl3Plus;
    maintainers = [ ];
  };
}

Probably old instructions… The mercurial repo mentioned here doesn’t exist. Use git instead of hg in the URL.

Also 1.0.3 seems to be the latest release.

1 Like

Thank You,

If you don’t mind how do I set a default config file for the program in .config/ostui or
usr/share/doc/ostui/config-example.toml .

Create the file manually or use NixOS modules or HM or hjem or nix-maid.

Aren’t these only useful after you have installed the program ? I want to copy the toml file from the source during build process . I imagine it would be achieved through modPostBuild but I didn’t find any examples regarding the same.

postInstall or preInstall would probably be usable to copy those over, though then again you need to sure the config is found. How to deal with that depends on the details of your program.

1 Like