From b35d22b30c8c6834842382c71124021372e837a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edward=20Tj=C3=B6rnhammar?= Date: Sat, 25 Mar 2017 21:18:34 +0100 Subject: [PATCH] radarr: init at 0.2.0.553 + nixos module --- nixos/modules/module-list.nix | 1 + nixos/modules/services/misc/radarr.nix | 44 ++++++++++++++++++++++++++ pkgs/servers/radarr/default.nix | 31 ++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 4 files changed, 78 insertions(+) create mode 100644 nixos/modules/services/misc/radarr.nix create mode 100644 pkgs/servers/radarr/default.nix diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 145cf140847b..4e9154f1740e 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -296,6 +296,7 @@ ./services/misc/parsoid.nix ./services/misc/phd.nix ./services/misc/plex.nix + ./services/misc/radarr.nix ./services/misc/redmine.nix ./services/misc/rippled.nix ./services/misc/ripple-rest.nix diff --git a/nixos/modules/services/misc/radarr.nix b/nixos/modules/services/misc/radarr.nix new file mode 100644 index 000000000000..cc5efffca448 --- /dev/null +++ b/nixos/modules/services/misc/radarr.nix @@ -0,0 +1,44 @@ +{ config, pkgs, lib, mono, ... }: + +with lib; + +let + cfg = config.services.radarr; +in +{ + options = { + services.radarr = { + enable = mkEnableOption "Radarr"; + }; + }; + + config = mkIf cfg.enable { + systemd.services.radarr = { + description = "Radarr"; + after = [ "network.target" ]; + wantedBy = [ "multi-user.target" ]; + preStart = '' + test -d /var/lib/radarr/ || { + echo "Creating radarr data directory in /var/lib/radarr/" + mkdir -p /var/lib/radarr/ + } + chown -R radarr /var/lib/radarr/ + chmod 0700 /var/lib/radarr/ + ''; + + serviceConfig = { + Type = "simple"; + User = "radarr"; + Group = "nogroup"; + PermissionsStartOnly = "true"; + ExecStart = "${pkgs.radarr}/bin/Radarr"; + Restart = "on-failure"; + }; + }; + + users.extraUsers.radarr = { + home = "/var/lib/radarr"; + }; + + }; +} diff --git a/pkgs/servers/radarr/default.nix b/pkgs/servers/radarr/default.nix new file mode 100644 index 000000000000..446927745a90 --- /dev/null +++ b/pkgs/servers/radarr/default.nix @@ -0,0 +1,31 @@ +{ stdenv, fetchurl, mono, libmediainfo, sqlite, makeWrapper }: + +stdenv.mkDerivation rec { + name = "radarr-${version}"; + version = "0.2.0.535"; + + src = fetchurl { + url = "https://github.com/Radarr/Radarr/releases/download/v${version}/Radarr.develop.${version}.linux.tar.gz"; + sha256 = "1ccvblklqn5iki7gc16bzzbwms28mv4kxzv1nwhlm9vf0cw4qxbr"; + }; + + buildInputs = [ makeWrapper ]; + + installPhase = '' + mkdir -p $out/{bin,share/${name}} + cp -r * $out/share/${name}/. + + makeWrapper "${mono}/bin/mono" $out/bin/Radarr \ + --add-flags "$out/share/${name}/Radarr.exe" \ + --prefix LD_LIBRARY_PATH ':' "${sqlite.out}/lib" \ + --prefix LD_LIBRARY_PATH ':' "${libmediainfo}/lib" + ''; + + meta = with stdenv.lib; { + description = "A Usenet/BitTorrent movie downloader."; + homepage = https://radarr.video/; + license = licenses.gpl3; + maintainers = with maintainers; [ edwtjo ]; + platforms = platforms.all; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 3676d3c499c5..86205f329f04 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -3670,6 +3670,8 @@ with pkgs; radamsa = callPackage ../tools/security/radamsa { }; + radarr = callPackage ../servers/radarr { }; + radvd = callPackage ../tools/networking/radvd { }; rambox = callPackage ../applications/networking/instant-messengers/rambox { };