Skip to content

Commit

Permalink
Formatted
Browse files Browse the repository at this point in the history
  • Loading branch information
rasmus-kirk committed Mar 12, 2024
1 parent 54cfc9f commit 712dc37
Show file tree
Hide file tree
Showing 18 changed files with 510 additions and 547 deletions.
128 changes: 0 additions & 128 deletions CODE_OF_CONDUCT.md

This file was deleted.

9 changes: 6 additions & 3 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@
};
};

outputs = inputs @ {flake-parts, vpnconfinement, nixpkgs, ...}:
outputs = inputs @ {
flake-parts,
vpnconfinement,
...
}:
flake-parts.lib.mkFlake {
inherit inputs;
} {
Expand All @@ -44,15 +48,14 @@

flake = {
nixosModules = rec {
nixarr = (import ./nixarr vpnconfinement);
nixarr = import ./nixarr vpnconfinement;
default = nixarr;
};
};

perSystem = {
config,
pkgs,
lib,
...
}: {
treefmt.config = {
Expand Down
23 changes: 12 additions & 11 deletions nixarr/bazarr/bazarr-module/default.nix
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
{ config, pkgs, lib, ... }:

with lib;

let
cfg = config.util-nixarr.services.bazarr;
in
{
config,
pkgs,
lib,
...
}:
with lib; let
cfg = config.util-nixarr.services.bazarr;
in {
options = {
util-nixarr.services.bazarr = {
enable = mkEnableOption ("bazarr, a subtitle manager for Sonarr and Radarr");
enable = mkEnableOption "bazarr, a subtitle manager for Sonarr and Radarr";

openFirewall = mkOption {
type = types.bool;
Expand Down Expand Up @@ -49,8 +50,8 @@ in

systemd.services.bazarr = {
description = "bazarr";
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
after = ["network.target"];
wantedBy = ["multi-user.target"];

serviceConfig = {
Type = "simple";
Expand All @@ -68,7 +69,7 @@ in
};

networking.firewall = mkIf cfg.openFirewall {
allowedTCPPorts = [ cfg.listenPort ];
allowedTCPPorts = [cfg.listenPort];
};

users.users = mkIf (cfg.user == "bazarr") {
Expand Down
11 changes: 8 additions & 3 deletions nixarr/bazarr/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ in {
imports = [
./bazarr-module
];

options.nixarr.bazarr = {
enable = mkEnableOption "the bazarr service.";

Expand All @@ -24,7 +24,7 @@ in {
**Warning:** Setting this to any path, where the subpath is not
owned by root, will fail! For example:
```nix
stateDir = /home/user/nixarr/.state/bazarr
```
Expand Down Expand Up @@ -81,7 +81,12 @@ in {
# Port mappings
# TODO: openports
vpnnamespaces.wg = mkIf cfg.vpn.enable {
portMappings = [{ from = config.bazarr.listenPort; to = config.bazarr.listenPort; }];
portMappings = [
{
from = config.bazarr.listenPort;
to = config.bazarr.listenPort;
}
];
};

services.nginx = mkIf cfg.vpn.enable {
Expand Down
13 changes: 8 additions & 5 deletions nixarr/ddns/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ with lib; let
ddns-njalla = pkgs.writeShellApplication {
name = "ddns-njalla";

runtimeInputs = with pkgs; [ curl jq ];
runtimeInputs = with pkgs; [curl jq];

# Thanks chatgpt...
text = ''
Expand Down Expand Up @@ -118,10 +118,13 @@ in {
'';
}
{
assertion = cfg.njalla.vpn.enable -> (
cfg.njalla.vpn.keysFile != null &&
config.nixarr.vpn.enable
);
assertion =
cfg.njalla.vpn.enable
-> (
cfg.njalla.vpn.keysFile
!= null
&& config.nixarr.vpn.enable
);
message = ''
The nixarr.ddns.njalla.enable option requires the
nixarr.vpn.enable option to be set, but it was not.
Expand Down
4 changes: 1 addition & 3 deletions nixarr/default.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
vpnconfinement:
{ ... }:
{
vpnconfinement: {...}: {
imports = [
vpnconfinement.nixosModules.default
./nixarr.nix
Expand Down
Loading

0 comments on commit 712dc37

Please sign in to comment.