Formatted
This commit is contained in:
@@ -11,8 +11,7 @@
|
|||||||
nixpkgs,
|
nixpkgs,
|
||||||
vpnconfinement,
|
vpnconfinement,
|
||||||
...
|
...
|
||||||
} @ inputs:
|
} @ inputs: let
|
||||||
let
|
|
||||||
# Systems supported
|
# Systems supported
|
||||||
supportedSystems = [
|
supportedSystems = [
|
||||||
"x86_64-linux" # 64-bit Intel/AMD Linux
|
"x86_64-linux" # 64-bit Intel/AMD Linux
|
||||||
@@ -22,17 +21,19 @@
|
|||||||
];
|
];
|
||||||
|
|
||||||
# Helper to provide system-specific attributes
|
# Helper to provide system-specific attributes
|
||||||
forAllSystems = f: nixpkgs.lib.genAttrs supportedSystems (system: f {
|
forAllSystems = f:
|
||||||
pkgs = import nixpkgs { inherit system; };
|
nixpkgs.lib.genAttrs supportedSystems (system:
|
||||||
|
f {
|
||||||
|
pkgs = import nixpkgs {inherit system;};
|
||||||
});
|
});
|
||||||
in {
|
in {
|
||||||
nixosModules = {
|
nixosModules = {
|
||||||
default = {
|
default = {
|
||||||
imports = [ ./nixarr vpnconfinement.nixosModules.default ];
|
imports = [./nixarr vpnconfinement.nixosModules.default];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
devShells = forAllSystems ({ pkgs } : {
|
devShells = forAllSystems ({pkgs}: {
|
||||||
default = pkgs.mkShell {
|
default = pkgs.mkShell {
|
||||||
packages = with pkgs; [
|
packages = with pkgs; [
|
||||||
alejandra
|
alejandra
|
||||||
@@ -41,10 +42,10 @@
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
packages = forAllSystems ({ pkgs } : {
|
packages = forAllSystems ({pkgs}: {
|
||||||
default = pkgs.callPackage ./mkDocs.nix {inherit inputs;};
|
default = pkgs.callPackage ./mkDocs.nix {inherit inputs;};
|
||||||
});
|
});
|
||||||
|
|
||||||
formatter = forAllSystems ({ pkgs }: pkgs.alejandra);
|
formatter = forAllSystems ({pkgs}: pkgs.alejandra);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ in {
|
|||||||
util-nixarr.services.bazarr = {
|
util-nixarr.services.bazarr = {
|
||||||
enable = mkEnableOption "bazarr, a subtitle manager for Sonarr and Radarr";
|
enable = mkEnableOption "bazarr, a subtitle manager for Sonarr and Radarr";
|
||||||
|
|
||||||
package = mkPackageOption pkgs "bazarr" { };
|
package = mkPackageOption pkgs "bazarr" {};
|
||||||
|
|
||||||
openFirewall = mkOption {
|
openFirewall = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ in {
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
package = mkPackageOption pkgs "bazarr" { };
|
package = mkPackageOption pkgs "bazarr" {};
|
||||||
|
|
||||||
stateDir = mkOption {
|
stateDir = mkOption {
|
||||||
type = types.path;
|
type = types.path;
|
||||||
|
|||||||
+22
-11
@@ -21,44 +21,55 @@ with lib; let
|
|||||||
fix-permissions = pkgs.writeShellApplication {
|
fix-permissions = pkgs.writeShellApplication {
|
||||||
name = "fix-permissions";
|
name = "fix-permissions";
|
||||||
runtimeInputs = with pkgs; [util-linux];
|
runtimeInputs = with pkgs; [util-linux];
|
||||||
text = ''
|
text =
|
||||||
|
''
|
||||||
if [ "$EUID" -ne 0 ]; then
|
if [ "$EUID" -ne 0 ]; then
|
||||||
echo "Please run as root"
|
echo "Please run as root"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
find "${cfg.mediaDir}" \( -type d -exec chmod 0775 {} + -true \) -o \( -exec chmod 0664 {} + \)
|
find "${cfg.mediaDir}" \( -type d -exec chmod 0775 {} + -true \) -o \( -exec chmod 0664 {} + \)
|
||||||
'' + strings.optionalString cfg.jellyfin.enable ''
|
''
|
||||||
|
+ strings.optionalString cfg.jellyfin.enable ''
|
||||||
chown -R streamer:media "${cfg.mediaDir}/library"
|
chown -R streamer:media "${cfg.mediaDir}/library"
|
||||||
chown -R streamer:root "${cfg.jellyfin.stateDir}"
|
chown -R streamer:root "${cfg.jellyfin.stateDir}"
|
||||||
find "${cfg.jellyfin.stateDir}" \( -type d -exec chmod 0700 {} + -true \) -o \( -exec chmod 0600 {} + \)
|
find "${cfg.jellyfin.stateDir}" \( -type d -exec chmod 0700 {} + -true \) -o \( -exec chmod 0600 {} + \)
|
||||||
'' + strings.optionalString cfg.transmission.enable ''
|
''
|
||||||
|
+ strings.optionalString cfg.transmission.enable ''
|
||||||
chown -R torrenter:media "${cfg.mediaDir}/torrents"
|
chown -R torrenter:media "${cfg.mediaDir}/torrents"
|
||||||
chown -R torrenter:cross-seed "${cfg.transmission.stateDir}"
|
chown -R torrenter:cross-seed "${cfg.transmission.stateDir}"
|
||||||
find "${cfg.transmission.stateDir}" \( -type d -exec chmod 0750 {} + -true \) -o \( -exec chmod 0640 {} + \)
|
find "${cfg.transmission.stateDir}" \( -type d -exec chmod 0750 {} + -true \) -o \( -exec chmod 0640 {} + \)
|
||||||
'' + strings.optionalString cfg.sabnzbd.enable ''
|
''
|
||||||
|
+ strings.optionalString cfg.sabnzbd.enable ''
|
||||||
chown -R usenet:media "${cfg.mediaDir}/usenet"
|
chown -R usenet:media "${cfg.mediaDir}/usenet"
|
||||||
chown -R usenet:root "${cfg.sabnzbd.stateDir}"
|
chown -R usenet:root "${cfg.sabnzbd.stateDir}"
|
||||||
find "${cfg.sabnzbd.stateDir}" \( -type d -exec chmod 0700 {} + -true \) -o \( -exec chmod 0600 {} + \)
|
find "${cfg.sabnzbd.stateDir}" \( -type d -exec chmod 0700 {} + -true \) -o \( -exec chmod 0600 {} + \)
|
||||||
'' + strings.optionalString cfg.transmission.privateTrackers.cross-seed.enable ''
|
''
|
||||||
|
+ strings.optionalString cfg.transmission.privateTrackers.cross-seed.enable ''
|
||||||
chown -R cross-seed:root "${cfg.transmission.privateTrackers.cross-seed.stateDir}"
|
chown -R cross-seed:root "${cfg.transmission.privateTrackers.cross-seed.stateDir}"
|
||||||
find "${cfg.transmission.privateTrackers.cross-seed.stateDir}" \( -type d -exec chmod 0700 {} + -true \) -o \( -exec chmod 0600 {} + \)
|
find "${cfg.transmission.privateTrackers.cross-seed.stateDir}" \( -type d -exec chmod 0700 {} + -true \) -o \( -exec chmod 0600 {} + \)
|
||||||
'' + strings.optionalString cfg.prowlarr.enable ''
|
''
|
||||||
|
+ strings.optionalString cfg.prowlarr.enable ''
|
||||||
chown -R prowlarr:root "${cfg.prowlarr.stateDir}"
|
chown -R prowlarr:root "${cfg.prowlarr.stateDir}"
|
||||||
find "${cfg.prowlarr.stateDir}" \( -type d -exec chmod 0700 {} + -true \) -o \( -exec chmod 0600 {} + \)
|
find "${cfg.prowlarr.stateDir}" \( -type d -exec chmod 0700 {} + -true \) -o \( -exec chmod 0600 {} + \)
|
||||||
'' + strings.optionalString cfg.sonarr.enable ''
|
''
|
||||||
|
+ strings.optionalString cfg.sonarr.enable ''
|
||||||
chown -R sonarr:root "${cfg.sonarr.stateDir}"
|
chown -R sonarr:root "${cfg.sonarr.stateDir}"
|
||||||
find "${cfg.sonarr.stateDir}" \( -type d -exec chmod 0700 {} + -true \) -o \( -exec chmod 0600 {} + \)
|
find "${cfg.sonarr.stateDir}" \( -type d -exec chmod 0700 {} + -true \) -o \( -exec chmod 0600 {} + \)
|
||||||
'' + strings.optionalString cfg.radarr.enable ''
|
''
|
||||||
|
+ strings.optionalString cfg.radarr.enable ''
|
||||||
chown -R radarr:root "${cfg.radarr.stateDir}"
|
chown -R radarr:root "${cfg.radarr.stateDir}"
|
||||||
find "${cfg.radarr.stateDir}" \( -type d -exec chmod 0700 {} + -true \) -o \( -exec chmod 0600 {} + \)
|
find "${cfg.radarr.stateDir}" \( -type d -exec chmod 0700 {} + -true \) -o \( -exec chmod 0600 {} + \)
|
||||||
'' + strings.optionalString cfg.lidarr.enable ''
|
''
|
||||||
|
+ strings.optionalString cfg.lidarr.enable ''
|
||||||
chown -R lidarr:root "${cfg.lidarr.stateDir}"
|
chown -R lidarr:root "${cfg.lidarr.stateDir}"
|
||||||
find "${cfg.lidarr.stateDir}" \( -type d -exec chmod 0700 {} + -true \) -o \( -exec chmod 0600 {} + \)
|
find "${cfg.lidarr.stateDir}" \( -type d -exec chmod 0700 {} + -true \) -o \( -exec chmod 0600 {} + \)
|
||||||
'' + strings.optionalString cfg.bazarr.enable ''
|
''
|
||||||
|
+ strings.optionalString cfg.bazarr.enable ''
|
||||||
chown -R bazarr:root "${cfg.bazarr.stateDir}"
|
chown -R bazarr:root "${cfg.bazarr.stateDir}"
|
||||||
find "${cfg.bazarr.stateDir}" \( -type d -exec chmod 0700 {} + -true \) -o \( -exec chmod 0600 {} + \)
|
find "${cfg.bazarr.stateDir}" \( -type d -exec chmod 0700 {} + -true \) -o \( -exec chmod 0600 {} + \)
|
||||||
'' + strings.optionalString cfg.readarr.enable ''
|
''
|
||||||
|
+ strings.optionalString cfg.readarr.enable ''
|
||||||
chown -R readarr:root "${cfg.readarr.stateDir}"
|
chown -R readarr:root "${cfg.readarr.stateDir}"
|
||||||
find "${cfg.readarr.stateDir}" \( -type d -exec chmod 0700 {} + -true \) -o \( -exec chmod 0600 {} + \)
|
find "${cfg.readarr.stateDir}" \( -type d -exec chmod 0700 {} + -true \) -o \( -exec chmod 0600 {} + \)
|
||||||
'';
|
'';
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ in
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
package = mkPackageOption pkgs "jellyfin" { };
|
package = mkPackageOption pkgs "jellyfin" {};
|
||||||
|
|
||||||
stateDir = mkOption {
|
stateDir = mkOption {
|
||||||
type = types.path;
|
type = types.path;
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ in {
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
package = mkPackageOption pkgs "lidarr" { };
|
package = mkPackageOption pkgs "lidarr" {};
|
||||||
|
|
||||||
stateDir = mkOption {
|
stateDir = mkOption {
|
||||||
type = types.path;
|
type = types.path;
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ in {
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
package = mkPackageOption pkgs "prowlarr" { };
|
package = mkPackageOption pkgs "prowlarr" {};
|
||||||
|
|
||||||
stateDir = mkOption {
|
stateDir = mkOption {
|
||||||
type = types.path;
|
type = types.path;
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ in {
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
package = mkPackageOption pkgs "radarr" { };
|
package = mkPackageOption pkgs "radarr" {};
|
||||||
|
|
||||||
stateDir = mkOption {
|
stateDir = mkOption {
|
||||||
type = types.path;
|
type = types.path;
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ in {
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
package = mkPackageOption pkgs "readarr" { };
|
package = mkPackageOption pkgs "readarr" {};
|
||||||
|
|
||||||
stateDir = mkOption {
|
stateDir = mkOption {
|
||||||
type = types.path;
|
type = types.path;
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ in {
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
package = mkPackageOption pkgs "sabnzbd" { };
|
package = mkPackageOption pkgs "sabnzbd" {};
|
||||||
|
|
||||||
guiPort = mkOption {
|
guiPort = mkOption {
|
||||||
type = types.port;
|
type = types.port;
|
||||||
@@ -154,7 +154,8 @@ in {
|
|||||||
user-configs
|
user-configs
|
||||||
);
|
);
|
||||||
|
|
||||||
apply-user-configs-script = pkgs.writers.writePython3Bin "sabnzbd-set-user-values" {
|
apply-user-configs-script =
|
||||||
|
pkgs.writers.writePython3Bin "sabnzbd-set-user-values" {
|
||||||
libraries = [pkgs.python3Packages.configobj];
|
libraries = [pkgs.python3Packages.configobj];
|
||||||
} ''
|
} ''
|
||||||
# flake8: noqa
|
# flake8: noqa
|
||||||
@@ -171,7 +172,8 @@ in {
|
|||||||
|
|
||||||
sab_config_map.write()
|
sab_config_map.write()
|
||||||
'';
|
'';
|
||||||
in mkIf cfg.enable {
|
in
|
||||||
|
mkIf cfg.enable {
|
||||||
users = {
|
users = {
|
||||||
groups.usenet = {};
|
groups.usenet = {};
|
||||||
users.usenet = {
|
users.usenet = {
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ in {
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
package = mkPackageOption pkgs "sonarr" { };
|
package = mkPackageOption pkgs "sonarr" {};
|
||||||
|
|
||||||
stateDir = mkOption {
|
stateDir = mkOption {
|
||||||
type = types.path;
|
type = types.path;
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ in {
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
package = mkPackageOption pkgs "transmission_4" { };
|
package = mkPackageOption pkgs "transmission_4" {};
|
||||||
|
|
||||||
stateDir = mkOption {
|
stateDir = mkOption {
|
||||||
type = types.path;
|
type = types.path;
|
||||||
@@ -108,7 +108,7 @@ in {
|
|||||||
extraAllowedIps = mkOption {
|
extraAllowedIps = mkOption {
|
||||||
type = with types; listOf str;
|
type = with types; listOf str;
|
||||||
default = [];
|
default = [];
|
||||||
example = [ "10.19.5.10" ];
|
example = ["10.19.5.10"];
|
||||||
description = ''
|
description = ''
|
||||||
Extra IP addresses allowed to access the Transmission RPC. By default
|
Extra IP addresses allowed to access the Transmission RPC. By default
|
||||||
`192.168.*` and `127.0.0.1` (localhost) are allowed, but if your
|
`192.168.*` and `127.0.0.1` (localhost) are allowed, but if your
|
||||||
@@ -388,7 +388,8 @@ in {
|
|||||||
rpc-whitelist-enabled = true;
|
rpc-whitelist-enabled = true;
|
||||||
rpc-whitelist = strings.concatStringsSep "," ([
|
rpc-whitelist = strings.concatStringsSep "," ([
|
||||||
"127.0.0.1,192.168.*,10.*" # Defaults
|
"127.0.0.1,192.168.*,10.*" # Defaults
|
||||||
] ++ cfg.extraAllowedIps);
|
]
|
||||||
|
++ cfg.extraAllowedIps);
|
||||||
rpc-authentication-required = false;
|
rpc-authentication-required = false;
|
||||||
|
|
||||||
blocklist-enabled = true;
|
blocklist-enabled = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user