Remix.run Logo
▲ nicce 21 hours ago

So, for most common services, you don't need a library. NixOS itself disallows invalid states and provides configuration options in pure .nix to represent the configuration of the target service regardless of how it actually works.

For example, configuring basic Immich setup is few lines of code, this also includes downloading Immich and relevant dependencies, following uses unstable channel, so using latest version:

  {
    services.immich = {
      enable = true;
      package = nixpkgs-unstable.legacyPackages ${pkgs.stdenv.hostPlatform.system}.immich;
      host = "127.0.0.1";
      port = 2283;
      mediaLocation = "/myzfs/media/immich";
      machine-learning.enable = false;
  };

  systemd.services.immich-server = {
    unitConfig.RequiresMountsFor = "/myzfs/media/immich";
    serviceConfig.ExecStartPre = [
      "+${pkgs.coreutils}/bin/install -d -m 0750 -o immich -g immich /myzfs/media/immich"
    ];
  };
}

Jellyfin is even less with defaults:

  services.jellyfin = {
    enable = true;
    openFirewall = true;
  };

  users.users.jellyfin.extraGroups = [ "media" ];

Samba is a bit more but less than 30 lines. And then you run `nixos-rebuild switch` on remote target to have previous to run as systemd services.

For those that are not part of the core NixOS, are usually provided with NixOS Home Manager: https://wiki.nixos.org/wiki/Home_Manager

Libraries are usually something more complex than single service in NixOS. Complete build pipelines for some package or specific kind of complex configuration that has many services to provide some single goal.