Skip to content

Commit

Permalink
temprorary homepage nixos container init
Browse files Browse the repository at this point in the history
  • Loading branch information
yomaq committed Apr 23, 2024
1 parent 355498f commit 28b6415
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 6 deletions.
5 changes: 1 addition & 4 deletions hosts/azure/azure.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,9 @@
tailscale = {
enable = true;
extraUpFlags = ["--ssh=true" "--reset=true" ];
# setting this appears to break docker's dns
# useRoutingFeatures = "server";
};
docker.enable = true;
pods = {
nextcloud.enable = true;
teslamate.enable = true;
dufs.enable = true;
semaphore.enable = true;
Expand All @@ -38,6 +35,7 @@
enable = true;
storage = config.yomaq.impermanence.backupStorage;
};
homepage.enable = true;
};
syncoid = {
isBackupServer = true;
Expand All @@ -47,7 +45,6 @@
useBr0 = true;
physicalInterfaceName = "eno1";
};
homepage-dashboard.enable = true;
timezone.central= true;
suites = {
basics.enable = true;
Expand Down
80 changes: 80 additions & 0 deletions modules/containers/nixos-containers/homepage/nixos.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
{ config, lib, pkgs, inputs, modulesPath, ... }:
let

NAME = "homepage";

cfg = config.yomaq.nixos-containers."${NAME}";

inherit (config.networking) hostName;
inherit (config.yomaq.impermanence) backup;
inherit (config.yomaq.impermanence) dontBackup;
inherit (config.yomaq.impermanence) backupStorage;
inherit (config.yomaq.tailscale) tailnetName;
inherit (config.system) stateVersion;

in
{
options.yomaq.nixos-containers."${NAME}" = {
enable = lib.mkEnableOption (lib.mdDoc "${NAME} Server");
storage = lib.mkOption {
description = "persistent file location";
type = lib.types.str;
default = dontBackup;
};
};

config = lib.mkIf cfg.enable {

yomaq.homepage.enable = true;

systemd.tmpfiles.rules = [
"d ${cfg.storage}/nixos-containers/${NAME}/tailscale"
];

#will still need to set the network device name manually
yomaq.network.useBr0 = true;

containers."${hostName}-${NAME}" = {
autoStart = true;
privateNetwork = true;
hostBridge = "br0"; # Specify the bridge name
specialArgs = { inherit inputs; };
bindMounts = {
"/etc/ssh/${hostName}" = {
hostPath = "/etc/ssh/${hostName}";
isReadOnly = true;
};
"/var/lib/tailscale" = {
hostPath = "${cfg.storage}/nixos-containers/${NAME}/tailscale";
isReadOnly = false;
};
};
enableTun = true;
ephemeral = true;
config = {
imports = [
inputs.self.nixosModules.yomaq
(inputs.self + /users/admin)
];
system.stateVersion = stateVersion;
age.identityPaths = ["/etc/ssh/${hostName}"];

yomaq = {
tailscale.extraUpFlags = ["--ssh=true" "--reset=true"];
suites.container.enable = true;
homepage-dashboard.enable = true;
homepage.enable = true;
};
systemd.tmpfiles.rules = [
"d /etc/homepage-dashboard/logs"
];
services.caddy = {
enable = true;
virtualHosts."${hostName}-${NAME}.${tailnetName}.ts.net".extraConfig = ''
reverse_proxy 127.0.0.1:8082
'';
};
};
};
};
}
2 changes: 1 addition & 1 deletion modules/hosts/glances/nixos.nix
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ in
};

yomaq.homepage.services =
(lib.optional (config.yomaq.homepage-dashboard.enable) {"Flake" = [
(lib.optional (config.yomaq.homepage.enable) {"Flake" = [
{"flake.lock last update"={
widget = {
type = "customapi";
Expand Down
4 changes: 3 additions & 1 deletion modules/hosts/homepage/ImportFromFlake/nixos.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ let
in
{
options.yomaq.homepage = {
enable = lib.mkEnableOption (lib.mdDoc "Homepage Dashboard");

bookmarks = lib.mkOption {
inherit (settingsFormat) type;
default = [ ];
Expand Down Expand Up @@ -51,7 +53,7 @@ in
};
};
};
config = lib.mkIf config.yomaq.homepage-dashboard.enable {
config = lib.mkIf cfg.enable {
yomaq.homepage-dashboard = {
settings = mergeConfig "settings";
widgets = mergeConfig "widgets";
Expand Down

0 comments on commit 28b6415

Please sign in to comment.