Skip to content

Commit

Permalink
Added package options to all modules
Browse files Browse the repository at this point in the history
  • Loading branch information
rasmus-kirk committed Sep 19, 2024
1 parent 0ef85b5 commit c93ecf8
Show file tree
Hide file tree
Showing 18 changed files with 150 additions and 117 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
# Changelog

## 2024-09-19

Added:
- Options to control the package of each service
- sub-merge package to systemPkgs

Updated:
- All submodules (notably VPNConfinement)

## 2024-06-11

Updated:
- VPNConfinement submodule


## 2024-03-12

Added:
Expand Down
99 changes: 54 additions & 45 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@
treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";
};

outputs = inputs @ {
outputs = {
flake-parts,
vpnconfinement,
sub-merge,
...
}:
} @ inputs:
flake-parts.lib.mkFlake {
inherit inputs;
} {
Expand All @@ -48,9 +48,9 @@

flake = {
nixosModules = rec {
nixarr = import ./nixarr vpnconfinement;
nixarr = import ./nixarr sub-merge vpnconfinement;
imports = [ vpnconfinement.nixosModules.default ];
specialArgs = { inherit inputs; };
#specialArgs = { inherit sub-merge; };
default = nixarr;
};
};
Expand Down
2 changes: 2 additions & 0 deletions nixarr/bazarr/bazarr-module/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ in {
util-nixarr.services.bazarr = {
enable = mkEnableOption "bazarr, a subtitle manager for Sonarr and Radarr";

package = mkPackageOption pkgs "bazarr" { };

openFirewall = mkOption {
type = types.bool;
default = false;
Expand Down
10 changes: 7 additions & 3 deletions nixarr/bazarr/default.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
config,
lib,
pkgs,
...
}:
with lib; let
Expand All @@ -23,6 +24,8 @@ in {
'';
};

package = mkPackageOption pkgs "bazarr" { };

stateDir = mkOption {
type = types.path;
default = "${nixarr.stateDir}/bazarr";
Expand Down Expand Up @@ -82,21 +85,22 @@ in {

util-nixarr.services.bazarr = {
enable = cfg.enable;
package = cfg.package;
user = "bazarr";
group = "media";
openFirewall = cfg.openFirewall;
dataDir = cfg.stateDir;
};

# Enable and specify VPN namespace to confine service in.
systemd.services.bazarr.vpnconfinement = mkIf cfg.vpn.enable {
systemd.services.bazarr.vpnConfinement = mkIf cfg.vpn.enable {
enable = true;
vpnnamespace = "wg";
vpnNamespace = "wg";
};

# Port mappings
# TODO: openports
vpnnamespaces.wg = mkIf cfg.vpn.enable {
vpnNamespaces.wg = mkIf cfg.vpn.enable {
portMappings = [
{
from = config.bazarr.listenPort;
Expand Down
4 changes: 2 additions & 2 deletions nixarr/ddns/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,9 @@ in {
ddnsNjallaVpn = {
description = "Sets the Njalla DDNS records over VPN";

vpnconfinement = {
vpnConfinement = {
enable = true;
vpnnamespace = "wg";
vpnNamespace = "wg";
};

serviceConfig = {
Expand Down
4 changes: 3 additions & 1 deletion nixarr/default.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
vpnconfinement: {...}: {
sub-merge: vpnconfinement: { pkgs, ... }: {
imports = [
vpnconfinement.nixosModules.default
./nixarr.nix
];

config.environment.systemPackages = [ sub-merge.packages."${pkgs.system}".default ];
}
10 changes: 7 additions & 3 deletions nixarr/jellyfin/default.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
config,
lib,
pkgs,
...
}: let
cfg = config.nixarr.jellyfin;
Expand All @@ -20,6 +21,8 @@ in
'';
};

package = mkPackageOption pkgs "jellyfin" { };

stateDir = mkOption {
type = types.path;
default = "${nixarr.stateDir}/jellyfin";
Expand Down Expand Up @@ -224,6 +227,7 @@ in

services.jellyfin = {
enable = cfg.enable;
package = cfg.package;
user = "streamer";
group = "media";
openFirewall = cfg.openFirewall;
Expand Down Expand Up @@ -295,14 +299,14 @@ in
};

# Enable and specify VPN namespace to confine service in.
systemd.services.jellyfin.vpnconfinement = mkIf cfg.vpn.enable {
systemd.services.jellyfin.vpnConfinement = mkIf cfg.vpn.enable {
enable = true;
vpnnamespace = "wg";
vpnNamespace = "wg";
};

# Port mappings
# TODO: openports if expose.vpn
vpnnamespaces.wg = mkIf cfg.vpn.enable {
vpnNamespaces.wg = mkIf cfg.vpn.enable {
portMappings = [
{
from = defaultPort;
Expand Down
Loading

0 comments on commit c93ecf8

Please sign in to comment.