diff --git a/overlays/lidarr.nix b/overlays/lidarr.nix new file mode 100644 index 0000000..c600c36 --- /dev/null +++ b/overlays/lidarr.nix @@ -0,0 +1,5 @@ +self: super: + +{ + lidarr = super.callPackage ../pkgs/lidarr { }; +} diff --git a/overlays/organizr.nix b/overlays/organizr.nix new file mode 100644 index 0000000..c43ba5c --- /dev/null +++ b/overlays/organizr.nix @@ -0,0 +1,5 @@ +self: super: + +{ + organizr = super.callPackage ../pkgs/organizr { }; +} diff --git a/pkgs/lidarr/default.nix b/pkgs/lidarr/default.nix new file mode 100644 index 0000000..5356aec --- /dev/null +++ b/pkgs/lidarr/default.nix @@ -0,0 +1,30 @@ +{ stdenv, fetchurl, mono58, sqlite, curl, libmediainfo, makeWrapper }: + +stdenv.mkDerivation rec { + name = "lidarr-${version}"; + version = "0.3.0.430"; + + src = fetchurl { + url = "https://github.com/lidarr/Lidarr/releases/download/v${version}/Lidarr.develop.${version}.linux.tar.gz"; + sha256 = "1syj5j2qn33k1q76lbifnvbp3q6qix7lzpxpnhvikiw91h8116zd"; + }; + + buildInputs = [ makeWrapper ]; + + installPhase = '' + mkdir -p $out/{bin,share/${name}} + cp -r * $out/share/${name}/. + makeWrapper "${mono58}/bin/mono" $out/bin/lidarr \ + --add-flags "$out/share/${name}/Lidarr.exe" \ + --prefix LD_LIBRARY_PATH : ${stdenv.lib.makeLibraryPath [ + curl sqlite libmediainfo ]} + ''; + + meta = with stdenv.lib; { + description = "A Usenet/BitTorrent music downloader."; + homepage = http://lidarr.audio/; + license = licenses.gpl3; + maintainers = with maintainers; [ nyanloutre ]; + platforms = platforms.all; + }; +} diff --git a/pkgs/organizr/default.nix b/pkgs/organizr/default.nix new file mode 100644 index 0000000..5495f38 --- /dev/null +++ b/pkgs/organizr/default.nix @@ -0,0 +1,26 @@ +{ stdenv, fetchFromGitHub }: + +stdenv.mkDerivation rec { + name = "organizr-${version}"; + version = "1.75"; + + src = fetchFromGitHub { + owner = "causefx"; + repo = "Organizr"; + rev = version; + sha256 = "13h6cgqq3gyg5d3ikj7k85igpg6al7y9xdsxammkr8y5dzfbkm36"; + }; + + installPhase = '' + mkdir -p $out/ + cp -R . $out/ + ln -s /var/lib/organizr/config.php $out/config/config.php + ''; + + meta = { + description = "Organizr dashboard"; + homepage = https://github.com/causefx/Organizr; + license = stdenv.lib.licenses.gpl3; + platforms = stdenv.lib.platforms.all; + }; +} diff --git a/services/lidarr.nix b/services/lidarr.nix new file mode 100644 index 0000000..8e98f14 --- /dev/null +++ b/services/lidarr.nix @@ -0,0 +1,24 @@ +{ config, pkgs, lib, ... }: + +{ + systemd.services.lidarr = { + description = "Lidarr"; + after = [ "network.target" ]; + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + User = "lidarr"; + Group = "lidarr"; + ExecStart = "${pkgs.lidarr}/bin/lidarr"; + Restart = "on-failure"; + }; + }; + + users.extraUsers.lidarr = { + home = "/var/lib/lidarr"; + createHome = true; + group = "lidarr"; + isSystemUser = true; + }; + + users.extraGroups.lidarr = {}; +} diff --git a/systems/LoutreOS/configuration.nix b/systems/LoutreOS/configuration.nix index 588f0bf..5427b59 100644 --- a/systems/LoutreOS/configuration.nix +++ b/systems/LoutreOS/configuration.nix @@ -38,6 +38,8 @@ # $ nix-env -qaP | grep wget nixpkgs.overlays = [ (import ../../overlays/riot-web.nix) + (import ../../overlays/lidarr.nix) + (import ../../overlays/organizr.nix) (import ../../overlays/sudo.nix) (import ../../overlays/neovim.nix) (import ../../overlays/site-max.nix) diff --git a/systems/LoutreOS/services.nix b/systems/LoutreOS/services.nix index 9d11770..c713999 100644 --- a/systems/LoutreOS/services.nix +++ b/systems/LoutreOS/services.nix @@ -6,6 +6,7 @@ let domaine = "nyanlout.re"; riot_port = 52345; + organizr_port = 52346; pgmanage_port = 52347; max_port = 52348; musique_port = 52349; @@ -22,6 +23,7 @@ in imports = [ ../../services/haproxy-acme.nix ../../services/mail-server.nix + ../../services/lidarr.nix ../../services/site-musique.nix ../../services/site-max.nix ]; @@ -35,16 +37,18 @@ in services.haproxy-acme.enable = true; services.haproxy-acme.domaine = domaine; services.haproxy-acme.services = { - "grafana.${domaine}" = { ip = "127.0.0.1"; port = 3000; auth = true; }; + "grafana.${domaine}" = { ip = "127.0.0.1"; port = 3000; auth = false; }; "emby.${domaine}" = { ip = "127.0.0.1"; port = 8096; auth = false; }; "radarr.${domaine}" = { ip = "127.0.0.1"; port = 7878; auth = true; extraAcls = "acl API url_beg /api\n"; aclBool = "!AUTH_OK !API"; }; "sonarr.${domaine}" = { ip = "127.0.0.1"; port = 8989; auth = true; extraAcls = "acl API url_beg /api\n"; aclBool = "!AUTH_OK !API"; }; + "lidarr.${domaine}" = { ip = "127.0.0.1"; port = 8686; auth = true; extraAcls = "acl API url_beg /api\n"; aclBool = "!AUTH_OK !API"; }; "transmission.${domaine}" = { ip = "127.0.0.1"; port = 9091; auth = true; }; "syncthing.${domaine}" = { ip = "127.0.0.1"; port = 8384; auth = true; }; "jackett.${domaine}" = { ip = "127.0.0.1"; port = 9117; auth = true; }; "searx.${domaine}" = { ip = "127.0.0.1"; port = 8888; auth = false; }; "riot.${domaine}" = { ip = "127.0.0.1"; port = riot_port; auth = false; }; "matrix.${domaine}" = { ip = "127.0.0.1"; port = 8008; auth = false; }; + "organizr.${domaine}" = { ip = "127.0.0.1"; port = organizr_port; auth = true; }; "pgmanage.${domaine}" = { ip = "127.0.0.1"; port = pgmanage_port; auth = true; }; "gitea.${domaine}" = { ip = "127.0.0.1"; port = 3001; auth = false; }; }; @@ -93,11 +97,6 @@ in SMTP_ENABLED = "true"; SMTP_FROM_ADDRESS = "grafana@${domaine}"; SMTP_SKIP_VERIFY = "true"; - AUTH_DISABLE_LOGIN_FORM = "true"; - AUTH_DISABLE_SIGNOUT_MENU = "true"; - AUTH_ANONYMOUS_ENABLED = "true"; - AUTH_ANONYMOUS_ORG_ROLE = "Admin"; - AUTH_BASIC_ENABLED = "false"; }; services.emby.enable = true; @@ -141,8 +140,40 @@ in listen = [ { addr = "127.0.0.1"; port = riot_port; } ]; locations = { "/" = { root = pkgs.riot-web; }; }; }; + "organizr" = { + listen = [ { addr = "127.0.0.1"; port = organizr_port; } ]; + locations."/" = { + root = pkgs.organizr; + index = "index.php"; + extraConfig = '' + location ~* \.php$ { + fastcgi_split_path_info ^(.+\.php)(/.+)$; + fastcgi_pass unix:/run/phpfpm/nginx; + include ${pkgs.nginx}/conf/fastcgi_params; + include ${pkgs.nginx}/conf/fastcgi.conf; + } + ''; + }; + }; }; + services.phpfpm.poolConfigs.mypool = '' + listen = /run/phpfpm/nginx + listen.owner = nginx + listen.group = nginx + listen.mode = 0660 + user = nginx + pm = dynamic + pm.max_children = 75 + pm.start_servers = 2 + pm.min_spare_servers = 1 + pm.max_spare_servers = 20 + pm.max_requests = 500 + php_admin_value[error_log] = 'stderr' + php_admin_flag[log_errors] = on + catch_workers_output = yes + ''; + services.postgresql.enable = true; services.matrix-synapse = { enable = true; diff --git a/systems/LoutreOS/users.nix b/systems/LoutreOS/users.nix index cb68928..efa9bb4 100644 --- a/systems/LoutreOS/users.nix +++ b/systems/LoutreOS/users.nix @@ -37,6 +37,6 @@ users.extraGroups.medias = { gid = 498; - members = [ "slimserver" "radarr" "sonarr" "emby" "transmission" ]; + members = [ "slimserver" "radarr" "sonarr" "emby" "transmission" "lidarr" ]; }; }