extract some varaibles
This commit is contained in:
16
flake.nix
16
flake.nix
@@ -32,10 +32,12 @@
|
||||
nixosConfigurations.server = nixpkgs.lib.nixosSystem {
|
||||
inherit system;
|
||||
modules = [
|
||||
### User specific ###
|
||||
./users/anon.nix
|
||||
./modules/static-ip-server.nix
|
||||
### System sepecific ###
|
||||
({ config, pkgs, ... }: { nixpkgs.overlays = [ overlay-unstable ]; })
|
||||
./systems/server/configuration.nix
|
||||
### Modules ###
|
||||
./modules/hdd-spindown.nix
|
||||
./modules/minecraft-server.nix
|
||||
./modules/motd.nix
|
||||
@@ -44,13 +46,9 @@
|
||||
./modules/nix-settings.nix
|
||||
./modules/adguard.nix
|
||||
./modules/git.nix
|
||||
#./modules/vmware-guest.nix
|
||||
./modules/github-runner.nix
|
||||
./modules/synapse.nix
|
||||
|
||||
./modules/nextcloud.nix
|
||||
#./modules/coturn.nix
|
||||
|
||||
./modules/acme.nix
|
||||
./modules/samba.nix
|
||||
./modules/backup.nix
|
||||
@@ -63,12 +61,14 @@
|
||||
./modules/paperless.nix
|
||||
./modules/kavita.nix
|
||||
./modules/netdata.nix
|
||||
#./modules/dyndns.nix i think ddclient is deprecated
|
||||
#./modules/home-assistant.nix idk dont like this
|
||||
home-manager.nixosModules.home-manager
|
||||
agenix.nixosModules.default
|
||||
];
|
||||
specialArgs = { inherit inputs; };
|
||||
specialArgs = {
|
||||
## Custom variables (e.g. ip, interface, etc)
|
||||
vars = (import ./systems/server/userdata.nix);
|
||||
inherit inputs ;
|
||||
};
|
||||
};
|
||||
nixosConfigurations."nix-laptop" = nixpkgs.lib.nixosSystem {
|
||||
inherit system;
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
{ config, pkgs, inputs, vars, ... }:
|
||||
let
|
||||
ip = vars.ipv4;
|
||||
in
|
||||
{
|
||||
networking.firewall.allowedTCPPorts = [ 53 ];
|
||||
networking.firewall.allowedUDPPorts = [ 53 ];
|
||||
@@ -12,7 +16,7 @@
|
||||
}
|
||||
];
|
||||
dns = {
|
||||
bind_hosts = [ "127.0.0.1" "192.168.0.6" ]; # "192.168.2.1" ];
|
||||
bind_hosts = [ "127.0.0.1" "${ip}" ]; # "192.168.2.1" ];
|
||||
port = 53;
|
||||
protection_enabled = true;
|
||||
filtering_enabled = true;
|
||||
@@ -26,23 +30,23 @@
|
||||
rewrites = [
|
||||
{
|
||||
"domain" = "kopatz.ddns.net";
|
||||
"answer" = "192.168.0.6";
|
||||
"answer" = ip;
|
||||
}
|
||||
{
|
||||
"domain" = "server.home";
|
||||
"answer" = "192.168.0.6";
|
||||
"answer" = ip;
|
||||
}
|
||||
{
|
||||
"domain" = "server.local";
|
||||
"answer" = "192.168.0.6";
|
||||
"answer" = ip;
|
||||
}
|
||||
{
|
||||
"domain" = "adguard.local";
|
||||
"answer" = "192.168.0.6";
|
||||
"answer" = ip;
|
||||
}
|
||||
{
|
||||
"domain" = "nextcloud.local";
|
||||
"answer" = "192.168.0.6";
|
||||
"answer" = ip;
|
||||
}
|
||||
{
|
||||
"domain" = "turnserver.local";
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
{ vars, ... }:
|
||||
let
|
||||
ip = vars.ipv4;
|
||||
wireguardIp = vars.wireguardIp;
|
||||
in
|
||||
{
|
||||
networking.firewall.allowedTCPPorts = [ 19999 ];
|
||||
services.netdata = {
|
||||
@@ -8,7 +13,7 @@
|
||||
|
||||
[web]
|
||||
default port = 19999
|
||||
bind to = 192.168.0.6 192.168.2.1
|
||||
bind to = ${ip} ${wireguardIp}
|
||||
allow connections from = localhost 192.168.0.* 192.168.2.*
|
||||
|
||||
[db]
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
{ config, pkgs, lib, inputs, ... }:
|
||||
{ config, pkgs, lib, inputs, vars, ... }:
|
||||
let
|
||||
wireguardIp = vars.wireguardIp;
|
||||
in
|
||||
{
|
||||
age.secrets.nextcloud-cert = {
|
||||
file = ../secrets/nextcloud-cert.age;
|
||||
@@ -26,7 +29,7 @@
|
||||
# Setup Nextcloud virtual host to listen on ports
|
||||
virtualHosts = {
|
||||
"nextcloud.local" = {
|
||||
serverAliases = [ "192.168.2.1" ];
|
||||
serverAliases = [ wireguardIp ];
|
||||
## Force HTTP redirect to HTTPS
|
||||
forceSSL = true;
|
||||
locations."~ ^\\/(?:index|remote|public|cron|core\\/ajax\\/update|status|ocs\\/v[12]|updater\\/.+|oc[s]-provider\\/.+|.+\\/richdocumentscode\\/proxy)\\.php(?:$|\\/)".extraConfig = ''
|
||||
@@ -54,9 +57,8 @@
|
||||
config.adminpassFile = config.age.secrets.nextcloud-admin.path;
|
||||
config.dbtype = "pgsql";
|
||||
database.createLocally = true;
|
||||
config.extraTrustedDomains = [ "192.168.2.1" ];
|
||||
config.extraTrustedDomains = [ wireguardIp ];
|
||||
home = "/mnt/250ssd/nextcloud";
|
||||
|
||||
extraApps = with config.services.nextcloud.package.packages.apps; {
|
||||
inherit keeweb onlyoffice calendar mail;
|
||||
spreed = pkgs.fetchNextcloudApp rec {
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
{ config, pkgs, lib, inputs, ... }:
|
||||
{ config, pkgs, lib, inputs, vars, ... }:
|
||||
let
|
||||
ip = vars.ipv4;
|
||||
wireguardIp = vars.wireguardIp;
|
||||
in
|
||||
{
|
||||
networking.firewall.allowedTCPPorts = [ 28981 ];
|
||||
age.secrets.paperless = {
|
||||
@@ -10,7 +14,7 @@
|
||||
enable = true;
|
||||
port = 28981;
|
||||
passwordFile = config.age.secrets.paperless.path;
|
||||
address = "192.168.2.1";
|
||||
address = wireguardIp;
|
||||
mediaDir = "/mnt/250ssd/paperless";
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
{ config, pkgs, lib, inputs, ... }:
|
||||
{ config, pkgs, lib, inputs, vars, ... }:
|
||||
let
|
||||
wireguardIp = vars.wireguardIp;
|
||||
in
|
||||
{
|
||||
|
||||
age.secrets.wireguard-private = {
|
||||
@@ -15,7 +18,7 @@
|
||||
autostart = true;
|
||||
listenPort = 51820;
|
||||
address = [
|
||||
"192.168.2.1/24"
|
||||
"${wireguardIp}/24"
|
||||
];
|
||||
peers = [
|
||||
{
|
||||
|
||||
@@ -12,6 +12,7 @@ in{
|
||||
imports =
|
||||
[ # Include the results of the hardware scan.
|
||||
./hardware-configuration.nix
|
||||
./static-ip.nix
|
||||
];
|
||||
|
||||
# Bootloader.
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
{ config, vars, ...}:
|
||||
let
|
||||
ip = vars.ipv4;
|
||||
interface = vars.interface;
|
||||
in
|
||||
{
|
||||
networking = {
|
||||
defaultGateway = "192.168.0.1";
|
||||
@@ -11,10 +16,10 @@
|
||||
"1.1.1.1"
|
||||
];
|
||||
interfaces = {
|
||||
"enp0s31f6" = {
|
||||
${interface} = {
|
||||
name = "eth0";
|
||||
ipv4.addresses = [{
|
||||
address = "192.168.0.6";
|
||||
address = ip;
|
||||
prefixLength = 24;
|
||||
}];
|
||||
};
|
||||
5
systems/server/userdata.nix
Normal file
5
systems/server/userdata.nix
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
interface = "enp0s31f6";
|
||||
ipv4 = "192.168.0.6";
|
||||
wireguardIp = "192.168.2.1";
|
||||
}
|
||||
Reference in New Issue
Block a user