Adds nginx server.

This commit is contained in:
Bailey Stevens 2023-09-24 16:16:02 -04:00
parent aed82f77ec
commit 22fa6bb68c
5 changed files with 139 additions and 7 deletions

View File

@ -1,5 +1,8 @@
{pkgs, ... }:
{
imports = [
./melodies.nix
];
system.stateVersion = "23.05";
boot.kernelModules = [ "snd-aloop" ];
@ -49,7 +52,7 @@
extraGroups = [ "jackaudio" ];
password = "";
packages = with pkgs; [
puredata websocat
puredata websocat (ffmpeg-headless.override {withJack = true;})
];
};
};

View File

@ -70,6 +70,83 @@
"type": "github"
}
},
"flake-utils_3": {
"inputs": {
"systems": "systems_2"
},
"locked": {
"lastModified": 1694529238,
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_4": {
"locked": {
"lastModified": 1659877975,
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"mmelodies": {
"inputs": {
"flake-utils": "flake-utils_3",
"napalm": "napalm",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1695576082,
"narHash": "sha256-0Ymv+QvXBfypM5+O52spaNzErBDnEsuiMYAKRyaVxFc=",
"ref": "refs/heads/main",
"rev": "3d8c6bbe52fa5350ef611b412c46f94ffe2e1102",
"revCount": 9,
"type": "git",
"url": "https://fem.mint.lgbt/theotheroracle/andisco.git"
},
"original": {
"type": "git",
"url": "https://fem.mint.lgbt/theotheroracle/andisco.git"
}
},
"napalm": {
"inputs": {
"flake-utils": "flake-utils_4",
"nixpkgs": [
"mmelodies",
"nixpkgs"
]
},
"locked": {
"lastModified": 1693989153,
"narHash": "sha256-gx39Y3opGB25+44OjM+h1bdJyzgLD963va8ULGYlbhM=",
"owner": "nix-community",
"repo": "napalm",
"rev": "a8215ccf1c80070f51a92771f3bc637dd9b9f7ee",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "napalm",
"type": "github"
}
},
"nixos-hardware": {
"locked": {
"lastModified": 1695109627,
@ -122,6 +199,7 @@
"inputs": {
"colmena": "colmena",
"flake-utils": "flake-utils_2",
"mmelodies": "mmelodies",
"nixos-hardware": "nixos-hardware",
"nixpkgs": "nixpkgs_2"
}
@ -156,6 +234,21 @@
"repo": "default",
"type": "github"
}
},
"systems_2": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",

View File

@ -4,20 +4,31 @@
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05";
flake-utils.url = "github:numtide/flake-utils";
colmena.url = "github:zhaofengli/colmena";
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
colmena.url = "github:zhaofengli/colmena";
mmelodies.url = "git+https://fem.mint.lgbt/theotheroracle/andisco.git";
mmelodies.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = inputs@{self, nixpkgs, flake-utils, ...}:
flake-utils.lib.eachDefaultSystem (system:
let
# nixpkgs for native system.
pkgs = import nixpkgs { inherit system; };
colmena = inputs.colmena.packages."${system}".colmena;
pkgs = import nixpkgs {
inherit system;
overlays = [
inputs.colmena.overlay
];
};
# Native VM config.
riversong = nixpkgs.lib.nixosSystem {
inherit pkgs;
pkgs = import nixpkgs {
inherit system;
overlays = [
inputs.mmelodies.overlay
];
};
modules = (builtins.attrValues self.nixosModules) ++ [
./platforms/riversong.nix
];
@ -25,7 +36,7 @@
in rec {
# Install colmena in dev shell for deployment.
devShell = pkgs.mkShell {
packages = [ colmena ];
packages = with pkgs; [ colmena ];
};
# Run testing VM using `nix run`
packages.default = riversong.config.system.build.vm;
@ -34,10 +45,12 @@
pkgs = import nixpkgs {
system = "aarch64-linux";
overlays = [
# https://github.com/NixOS/nixpkgs/issues/154163#issuecomment-1350599022
(final: super: {
makeModulesClosure = x:
super.makeModulesClosure (x // { allowMissing = true; });
})
inputs.mmelodies.overlay
];
};
# Modules for colmena and sd card image are the same.

22
melodies.nix Normal file
View File

@ -0,0 +1,22 @@
{pkgs, config, ...}:
{
services.nginx.enable = true;
services.nginx.virtualHosts."${config.networking.hostName}" = {
root = pkgs.mmelodies.frontend;
locations."/hls/" = {
alias = "/var/cache/hls/";
extraConfig = ''
types {
application/vnd.apple.mpegurl m3u8;
video/mp2t ts;
}
'';
};
};
networking.firewall.allowedTCPPorts = [ 80 443 ];
systemd.tmpfiles.rules = [
"d /dev/shm/hls 0755 appuser users 12h -"
"L /var/cache/hls - - - - /dev/shm/hls"
];
}

View File

@ -7,6 +7,7 @@
virtualisation = {
forwardPorts = [
{ from = "host"; host.port = 2222; guest.port = 22; }
{ from = "host"; host.port = 8888; guest.port = 80; }
];
graphics = true;
qemu.options = [