Installing an archive (.tar.gz, .zip, etc.) to a fixed location on NixOS

I’m running qBittorrent as a system service. qBit has a setting for a custom Web UI, so I decided to use VueTorrent. I want to install VueTorrent on the system using my NixOS configuration since my system is Opt-In State so the root gets reset after every reboot. I have a /persist btrfs subvolume that doesn’t get wiped so I’m housing the VueTorrent files there for the time being. I tried to create a derivation, but I don’t think any of the predefined directories in the $out suit what I’m trying to do, and I don’t want to point qBittorrent at the nix store location because I would have to change it every time I wanted to update VueTorrent. I feel like I’m close, but I just need a push in the right direction.

You can go ahead and use the derivation you created, and then point to it using environment.etc to create a fixed path in /etc.

1 Like

For those that want everything that I did, here is my custom derivation and the code to link it to /etc/vuetorrent.

{ stdenv
, lib
, fetchzip
stdenv.mkDerivation rec {
  pname = "vuetorrent";
  version = "1.5.7";

  src = fetchzip {
    url = "${version}/";
    sha256 = "5REe5wtYnmkPnP5wroRbHbiEAqYXx8OHht0O79eVBjY=";

  buildPhase = "";
  installPhase = ''
    mkdir -p $out
    mv public $out
  environment.etc."vuetorrent" = {
    source = pkgs.vuetorrent;
    target = "vuetorrent";

Thank you very much @emmanuelrosa!