Skip to content
This repository has been archived by the owner on Jan 11, 2024. It is now read-only.

Commit

Permalink
fix: airsonic
Browse files Browse the repository at this point in the history
  • Loading branch information
Skarlett authored and Skarlett committed Jul 23, 2023
1 parent dfb54c1 commit 433b3f6
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 10 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/airsonic-advanced-war.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
VERSION: 5
env: {}
jobs:
airsonic-advanced-war:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/install-nix-action@v20
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
nix_path: nixpkgs=channel:nixos-unstable
- run: nix build .#airsonic-advanced-war
name: airsonic-advanced-war
on:
pull_request:
branches:
- master
push:
branches:
- master
9 changes: 5 additions & 4 deletions machines/charmander.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
{
remote-access.lunarix = true;
nixpkgs.config.allowUnfree = true;

services.airsonic-advanced.enable = true;
services.airsonic-advanced.openFirewall = true;


# boot.kernelPackages = pkgs.linuxPackages_4_19;
boot.loader.grub.enable = true;
boot.loader.grub.device = "/dev/sde";
Expand All @@ -24,10 +29,6 @@
# '';
};



self.packages.${pkgs.system}.airsonic-advanced-war;

boot.kernel.sysctl."net.ipv6.conf.luna.ip_forward" = 1;
boot.kernel.sysctl."net.ipv4.conf.luna.ip_forward" = 1;

Expand Down
29 changes: 24 additions & 5 deletions modules/airsonic-advanced.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,38 @@ let
cfg = config.services.airsonic-advanced;
in
{
options.services.airsonic-advanced.enable = mkEnableOption "Enable airsonic-advanced";
options.services.airsonic-advanced = {
enable = mkEnableOption "Enable airsonic-advanced";
port = mkOption {
type = types.int;
default = 4040;
description = "Port to listen on";
};

openFirewall = mkOption {
type = types.bool;
default = true;
description = "Open port in firewall";
};

war = mkOption {
default =
"${pkgs.self.airsonic-advanced-war.outPath}/webapps/airsonic.war";
};
};

config = mkIf cfg.enable {
services.airsonic = {
enable = true;
jre = pkgs.openjdk11;
maxMemory = 4096;
war = "${pkgs.self.airsonic-advanced-war.outPath}/webapps/airsonic.war";
jveOptions = [
war = cfg.war;
port = cfg.port;
jvmOptions = [
"-server"
];
listenAddress = "0.0.0.0";
};

networking.firewall.allowedTCPPorts = [ config.services.airsonic.port ];
networking.firewall.allowedTCPPorts = [ cfg.port ];
};
}
2 changes: 1 addition & 1 deletion packages/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ self-lib.withSystem (system:
REDIRECT="https://github.com/skarlett";
};

packages.airsonic-advanced = pkgs.callPackage ./airsonic-advanced.nix {};
packages.airsonic-advanced-war = pkgs.callPackage ./airsonic-advanced.nix {};
}

{ packages = builtins.removeAttrs (pkgs.callPackage ./pzserver {})
Expand Down

0 comments on commit 433b3f6

Please sign in to comment.