From 2db5c5cfe2aa4700dba8daef75e2e9f8e148c01e 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] jackett: init at 0.7.1197 + nixos module --- nixos/modules/module-list.nix | 1 + nixos/modules/services/misc/jackett.nix | 44 +++++++++++++++++++++++++ pkgs/servers/jackett/default.nix | 30 +++++++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 4 files changed, 77 insertions(+) create mode 100644 nixos/modules/services/misc/jackett.nix create mode 100644 pkgs/servers/jackett/default.nix diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 610c2a2b758a..145cf140847b 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -275,6 +275,7 @@ ./services/misc/gpsd.nix #./services/misc/ihaskell.nix ./services/misc/irkerd.nix + ./services/misc/jackett.nix ./services/misc/leaps.nix ./services/misc/mantisbt.nix ./services/misc/mathics.nix diff --git a/nixos/modules/services/misc/jackett.nix b/nixos/modules/services/misc/jackett.nix new file mode 100644 index 000000000000..e467e7ee85b8 --- /dev/null +++ b/nixos/modules/services/misc/jackett.nix @@ -0,0 +1,44 @@ +{ config, pkgs, lib, mono, ... }: + +with lib; + +let + cfg = config.services.jackett; +in +{ + options = { + services.jackett = { + enable = mkEnableOption "Jackett"; + }; + }; + + config = mkIf cfg.enable { + systemd.services.jackett = { + description = "Jackett"; + after = [ "network.target" ]; + wantedBy = [ "multi-user.target" ]; + preStart = '' + test -d /var/lib/jackett/ || { + echo "Creating jackett data directory in /var/lib/jackett/" + mkdir -p /var/lib/jackett/ + } + chown -R jackett /var/lib/jackett/ + chmod 0700 /var/lib/jackett/ + ''; + + serviceConfig = { + Type = "simple"; + User = "jackett"; + Group = "nogroup"; + PermissionsStartOnly = "true"; + ExecStart = "${pkgs.jackett}/bin/Jackett"; + Restart = "on-failure"; + }; + }; + + users.extraUsers.jackett = { + home = "/var/lib/jackett"; + }; + + }; +} diff --git a/pkgs/servers/jackett/default.nix b/pkgs/servers/jackett/default.nix new file mode 100644 index 000000000000..3b3f2e0cc0f1 --- /dev/null +++ b/pkgs/servers/jackett/default.nix @@ -0,0 +1,30 @@ +{ stdenv, fetchurl, mono, curl, makeWrapper }: + +stdenv.mkDerivation rec { + name = "jackett-${version}"; + version = "0.7.1197"; + + src = fetchurl { + url = "https://github.com/Jackett/Jackett/releases/download/v${version}/Jackett.Binaries.Mono.tar.gz"; + sha256 = "0p9xdfbb8pda5a3knnw6145jky3bf10y1dj2clgsbbygi2xnam2v"; + }; + + buildInputs = [ makeWrapper ]; + + installPhase = '' + mkdir -p $out/{bin,share/${name}} + cp -r * $out/share/${name} + + makeWrapper "${mono}/bin/mono" $out/bin/Jackett \ + --add-flags "$out/share/${name}/JackettConsole.exe" \ + --prefix LD_LIBRARY_PATH ':' "${curl.out}/lib" + ''; + + meta = with stdenv.lib; { + description = "API Support for your favorite torrent trackers."; + homepage = https://github.com/Jackett/Jackett/; + license = licenses.gpl2; + maintainers = with maintainers; [ edwtjo ]; + platforms = platforms.all; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 7970732ce3f6..3676d3c499c5 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -2436,6 +2436,8 @@ with pkgs; jaaa = callPackage ../applications/audio/jaaa { }; + jackett = callPackage ../servers/jackett { }; + jade = callPackage ../tools/text/sgml/jade { }; jd-gui = callPackage_i686 ../tools/security/jd-gui { };