WIP: Mirgation Flame Docker -> Homer Nix
This commit is contained in:
0
nixos/roles/frontpage/default.nix
Normal file
0
nixos/roles/frontpage/default.nix
Normal file
47
nixos/roles/frontpage/frontpage-calvin.nix
Normal file
47
nixos/roles/frontpage/frontpage-calvin.nix
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
address = config.systemd.network.networks."10-ethernet".networkConfig.Address;
|
||||||
|
ip = builtins.elemAt (lib.splitString "/" address) 0;
|
||||||
|
port = 15006;
|
||||||
|
|
||||||
|
calvinConfig = pkgs.writeText "config.yml" ''
|
||||||
|
title: "Calvin's Dashboard"
|
||||||
|
subtitle: ""
|
||||||
|
header: true
|
||||||
|
footer: false
|
||||||
|
defaults:
|
||||||
|
colorTheme: dark
|
||||||
|
services:
|
||||||
|
- name: "Services"
|
||||||
|
items: []
|
||||||
|
'';
|
||||||
|
|
||||||
|
calvinRoot = pkgs.runCommand "homer-calvin" { } ''
|
||||||
|
cp -r ${pkgs.homer}/. $out
|
||||||
|
chmod -R u+w $out
|
||||||
|
cp ${calvinConfig} $out/config.yml
|
||||||
|
'';
|
||||||
|
in
|
||||||
|
{
|
||||||
|
services.nginx.virtualHosts."homer-calvin" = {
|
||||||
|
listen = [
|
||||||
|
{
|
||||||
|
addr = "0.0.0.0";
|
||||||
|
port = port;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
root = "${calvinRoot}";
|
||||||
|
locations."/" = {
|
||||||
|
index = "index.html";
|
||||||
|
tryFiles = "$uri $uri/ /index.html";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
networking.firewall.allowedTCPPorts = [ port ];
|
||||||
|
}
|
||||||
65
nixos/roles/frontpage/frontpage.nix
Normal file
65
nixos/roles/frontpage/frontpage.nix
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
address = config.systemd.network.networks."10-ethernet".networkConfig.Address;
|
||||||
|
ip = builtins.elemAt (lib.splitString "/" address) 0;
|
||||||
|
port = 15005;
|
||||||
|
|
||||||
|
catppuccinFlavor = "mocha";
|
||||||
|
logo = if catppuccinFlavor == "latte" then "assets/light_circle.png" else "assets/dark_circle.png";
|
||||||
|
|
||||||
|
mainConfig = pkgs.writeText "config.yml" ''
|
||||||
|
title: "Dashboard"
|
||||||
|
subtitle: ""
|
||||||
|
header: true
|
||||||
|
footer: false
|
||||||
|
logo: "${logo}"
|
||||||
|
stylesheet:
|
||||||
|
- "assets/catppuccin-${catppuccinFlavor}.css"
|
||||||
|
defaults:
|
||||||
|
colorTheme: dark
|
||||||
|
services:
|
||||||
|
- name: "Services"
|
||||||
|
items:
|
||||||
|
- name: "Vaultwarden"
|
||||||
|
url: "https://${ip}:8222"
|
||||||
|
- name: "SearXNG"
|
||||||
|
url: "http://${ip}:11080"
|
||||||
|
'';
|
||||||
|
|
||||||
|
mainRoot = pkgs.runCommand "homer-main" { } ''
|
||||||
|
cp -r ${pkgs.homer}/. $out
|
||||||
|
chmod -R u+w $out
|
||||||
|
cp ${mainConfig} $out/config.yml
|
||||||
|
mkdir -p $out/assets/icons
|
||||||
|
cp ${./assets/catppuccin-${catppuccinFlavor}.css} $out/assets/catppuccin-${catppuccinFlavor}.css
|
||||||
|
cp ${./assets/dark_circle.png} $out/assets/dark_circle.png
|
||||||
|
cp ${./assets/light_circle.png} $out/assets/light_circle.png
|
||||||
|
cp -r ${./assets/icons}/. $out/assets/icons/
|
||||||
|
'';
|
||||||
|
in
|
||||||
|
{
|
||||||
|
services.nginx = {
|
||||||
|
enable = true;
|
||||||
|
virtualHosts."homer-main" = {
|
||||||
|
listen = [
|
||||||
|
{
|
||||||
|
addr = "0.0.0.0";
|
||||||
|
port = port;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
root = "${mainRoot}";
|
||||||
|
locations."/" = {
|
||||||
|
index = "index.html";
|
||||||
|
tryFiles = "$uri $uri/ /index.html";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
networking.firewall.allowedTCPPorts = [ port ];
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user