Compare commits
5 Commits
d43c8112ff
...
feature/ho
| Author | SHA1 | Date | |
|---|---|---|---|
|
b3ca6dbac3
|
|||
|
83bfc367f6
|
|||
|
042a3c5a71
|
|||
|
74f9b65585
|
|||
|
80b743816c
|
12
flake.lock
generated
12
flake.lock
generated
@@ -23,11 +23,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1736730523,
|
||||
"narHash": "sha256-mvTZ7fLKA6ggGnA8GZwcXV57EvVReRTCfi26xc08Q3g=",
|
||||
"lastModified": 1737057290,
|
||||
"narHash": "sha256-3Pe0yKlCc7EOeq1X/aJVDH0CtNL+tIBm49vpepwL1MQ=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nixos-generators",
|
||||
"rev": "74b8e31dd709760c86eed16b6c1d0b88d7360937",
|
||||
"rev": "d002ce9b6e7eb467cd1c6bb9aef9c35d191b5453",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -38,11 +38,11 @@
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1736701207,
|
||||
"narHash": "sha256-jG/+MvjVY7SlTakzZ2fJ5dC3V1PrKKrUEOEE30jrOKA=",
|
||||
"lastModified": 1738142207,
|
||||
"narHash": "sha256-NGqpVVxNAHwIicXpgaVqJEJWeyqzoQJ9oc8lnK9+WC4=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "ed4a395ea001367c1f13d34b1e01aa10290f67d6",
|
||||
"rev": "9d3ae807ebd2981d593cddd0080856873139aa40",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
||||
16
flake.nix
16
flake.nix
@@ -9,9 +9,13 @@
|
||||
url = "github:nix-community/nixos-generators";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
home-manager = {
|
||||
url = "github:nix-community/home-manager";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, nixos-generators }: {
|
||||
outputs = { self, nixpkgs, nixos-generators, home-manager }: {
|
||||
nixosConfigurations = {
|
||||
Yura-PC = nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
@@ -27,6 +31,16 @@
|
||||
./modules
|
||||
./hosts/common.nix
|
||||
./hosts/vm
|
||||
|
||||
home-manager.nixosModules.home-manager
|
||||
{
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
home-manager.users.jdoe = import ./home.nix;
|
||||
|
||||
# Optionally, use home-manager.extraSpecialArgs to pass
|
||||
# arguments to home.nix
|
||||
}
|
||||
];
|
||||
};
|
||||
router = nixpkgs.lib.nixosSystem {
|
||||
|
||||
@@ -23,10 +23,16 @@
|
||||
"sysrq_always_enabled=1"
|
||||
];
|
||||
|
||||
# https://nixos.wiki/wiki/OSX-KVM
|
||||
boot.extraModprobeConfig = ''
|
||||
options kvm_amd nested=1
|
||||
options kvm_amd emulate_invalid_guest_state=0
|
||||
options kvm ignore_msrs=1
|
||||
'';
|
||||
|
||||
boot.loader.timeout = 3;
|
||||
boot.loader.systemd-boot.configurationLimit = 5;
|
||||
boot.kernelPackages = pkgs.linuxKernel.packages.linux_6_12;
|
||||
boot.extraModulePackages = with config.boot.kernelPackages; [ zfs ];
|
||||
|
||||
# https://nixos.wiki/wiki/Accelerated_Video_Playback
|
||||
hardware.graphics = {
|
||||
@@ -104,6 +110,7 @@
|
||||
group = "cazzzer";
|
||||
extraGroups = [ "networkmanager" "wheel" "docker" "wireshark" "geoclue" ];
|
||||
packages = with pkgs; [
|
||||
# Python
|
||||
python3
|
||||
poetry
|
||||
|
||||
@@ -115,6 +122,9 @@
|
||||
nodejs_22
|
||||
pnpm
|
||||
bun
|
||||
|
||||
# Nix
|
||||
nixd
|
||||
];
|
||||
};
|
||||
|
||||
@@ -143,7 +153,6 @@
|
||||
virtualisation.docker.enableOnBoot = false;
|
||||
virtualisation.docker.package = pkgs.docker_27;
|
||||
virtualisation.docker.storageDriver = "zfs";
|
||||
|
||||
|
||||
# https://discourse.nixos.org/t/firefox-does-not-use-kde-window-decorations-and-cursor/32132/3
|
||||
# programs.dconf.enable = true;
|
||||
@@ -171,31 +180,6 @@
|
||||
|
||||
# For JetBrains stuff
|
||||
# https://github.com/NixOS/nixpkgs/issues/240444
|
||||
curl
|
||||
expat
|
||||
fontconfig
|
||||
freetype
|
||||
fuse
|
||||
fuse3
|
||||
glib
|
||||
icu
|
||||
libclang.lib
|
||||
libdbusmenu
|
||||
libsecret
|
||||
libxcrypt-legacy
|
||||
libxml2
|
||||
nss
|
||||
openssl
|
||||
python3
|
||||
stdenv.cc.cc
|
||||
xorg.libX11
|
||||
xorg.libXcursor
|
||||
xorg.libXext
|
||||
xorg.libXi
|
||||
xorg.libXrender
|
||||
xorg.libXtst
|
||||
xz
|
||||
zlib
|
||||
];
|
||||
|
||||
# attempt to fix flatpak firefox cjk fonts
|
||||
|
||||
@@ -1,4 +1,11 @@
|
||||
{ config, pkgs, ... }: {
|
||||
{ config, pkgs, inputs, ... }: {
|
||||
imports = [
|
||||
inputs.home-manager.nixosModules.home-manager
|
||||
];
|
||||
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
|
||||
# Allow unfree packages
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
|
||||
|
||||
@@ -21,9 +21,12 @@ let
|
||||
lan20_p6 = "${pd_from_wan}2"; # ::/64
|
||||
|
||||
ula_p = "fdab:07d3:581d"; # ::/48
|
||||
ula_p_lan = "${ula_p}:0001"; # ::/64
|
||||
ula_p_lan10 = "${ula_p}:0010"; # ::/64
|
||||
ula_p_lan20 = "${ula_p}:0020"; # ::/64
|
||||
lan_ula_p = "${ula_p}:0001"; # ::/64
|
||||
lan10_ula_p = "${ula_p}:0010"; # ::/64
|
||||
lan20_ula_p = "${ula_p}:0020"; # ::/64
|
||||
lan_ula_addr = "${lan_ula_p}::1";
|
||||
lan10_ula_addr = "${lan10_ula_p}::1";
|
||||
lan20_ula_addr = "${lan20_ula_p}::1";
|
||||
in
|
||||
{
|
||||
imports =
|
||||
@@ -152,19 +155,20 @@ in
|
||||
# AddressAutoconfiguration = false;
|
||||
Prefix = "${lan_p6}::/64";
|
||||
Assign = true;
|
||||
Token = [ "static:::1" "eui64" ];
|
||||
# Token = [ "static:::1" "eui64" ];
|
||||
Token = [ "static:::1" ];
|
||||
}
|
||||
{
|
||||
Prefix = "${ula_p_lan}::/64";
|
||||
Prefix = "${lan_ula_p}::/64";
|
||||
Assign = true;
|
||||
Token = [ "static:::1" "eui64" ];
|
||||
Token = [ "static:::1" ];
|
||||
}
|
||||
];
|
||||
ipv6SendRAConfig = {
|
||||
Managed = true;
|
||||
OtherInformation = true;
|
||||
EmitDNS = true;
|
||||
DNS = [ "${lan_p6}::1" ];
|
||||
DNS = [ lan_ula_addr ];
|
||||
};
|
||||
};
|
||||
"30-vlan10" = {
|
||||
@@ -177,12 +181,12 @@ in
|
||||
{
|
||||
Prefix = "${lan10_p6}::/64";
|
||||
Assign = true;
|
||||
Token = [ "static:::1" "eui64" ];
|
||||
Token = [ "static:::1" ];
|
||||
}
|
||||
{
|
||||
Prefix = "${ula_p_lan10}::/64";
|
||||
Prefix = "${lan10_ula_p}::/64";
|
||||
Assign = true;
|
||||
Token = [ "static:::1" "eui64" ];
|
||||
Token = [ "static:::1" ];
|
||||
}
|
||||
];
|
||||
};
|
||||
@@ -196,12 +200,12 @@ in
|
||||
{
|
||||
Prefix = "${lan20_p6}::/64";
|
||||
Assign = true;
|
||||
Token = [ "static:::1" "eui64" ];
|
||||
Token = [ "static:::1" ];
|
||||
}
|
||||
{
|
||||
Prefix = "${ula_p_lan20}::/64";
|
||||
Prefix = "${lan20_ula_p}::/64";
|
||||
Assign = true;
|
||||
Token = [ "static:::1" "eui64" ];
|
||||
Token = [ "static:::1" ];
|
||||
}
|
||||
];
|
||||
};
|
||||
@@ -217,15 +221,15 @@ in
|
||||
define LAN_IF = "${if_lan}"
|
||||
define LAN_IPV4_SUBNET = ${lan_p4}.0/24
|
||||
define LAN_IPV6_SUBNET = ${lan_p6}::/64
|
||||
define LAN_IPV6_ULA = ${lan_ula_p}::/64
|
||||
define LAN_IPV4_HOST = ${lan_p4}.100
|
||||
define LAN_IPV6_HOST = ${lan_p6}::1:1000
|
||||
|
||||
define ALLOWED_TCP_PORTS = { ssh, 19999 }
|
||||
define ALLOWED_UDP_PORTS = { 53 }
|
||||
define ALLOWED_TCP_PORTS = { ssh, https, 19999 }
|
||||
define ALLOWED_UDP_PORTS = { domain }
|
||||
|
||||
chain input {
|
||||
type filter hook input priority filter; policy drop;
|
||||
# type filter hook input priority filter; policy accept;
|
||||
|
||||
# Allow established and related connections
|
||||
ct state established,related accept
|
||||
@@ -238,7 +242,7 @@ in
|
||||
ip6 nexthdr icmpv6 ip6 daddr fe80::/10 accept # TODO: not sure if necessary
|
||||
|
||||
# Allow all ICMPv6 from LAN
|
||||
iifname $LAN_IF ip6 saddr $LAN_IPV6_SUBNET ip6 nexthdr icmpv6 accept
|
||||
iifname $LAN_IF ip6 saddr { $LAN_IPV6_SUBNET, $LAN_IPV6_ULA } ip6 nexthdr icmpv6 accept
|
||||
# Allow DHCPv6 client traffic
|
||||
ip6 daddr { fe80::/10, ff02::/16 } udp dport dhcpv6-server accept
|
||||
|
||||
@@ -247,9 +251,9 @@ in
|
||||
|
||||
# Allow specific services from LAN
|
||||
iifname $LAN_IF ip saddr $LAN_IPV4_SUBNET tcp dport $ALLOWED_TCP_PORTS accept
|
||||
iifname $LAN_IF ip6 saddr $LAN_IPV6_SUBNET tcp dport $ALLOWED_TCP_PORTS accept
|
||||
iifname $LAN_IF ip6 saddr { $LAN_IPV6_SUBNET, $LAN_IPV6_ULA } tcp dport $ALLOWED_TCP_PORTS accept
|
||||
iifname $LAN_IF ip saddr $LAN_IPV4_SUBNET udp dport $ALLOWED_UDP_PORTS accept
|
||||
iifname $LAN_IF ip6 saddr $LAN_IPV6_SUBNET udp dport $ALLOWED_UDP_PORTS accept
|
||||
iifname $LAN_IF ip6 saddr { $LAN_IPV6_SUBNET, $LAN_IPV6_ULA } udp dport $ALLOWED_UDP_PORTS accept
|
||||
|
||||
# Allow SSH from WAN (if needed)
|
||||
iifname $WAN_IF tcp dport ssh accept
|
||||
@@ -257,7 +261,6 @@ in
|
||||
|
||||
chain forward {
|
||||
type filter hook forward priority filter; policy drop;
|
||||
# type filter hook forward priority filter; policy accept;
|
||||
|
||||
# Allow established and related connections
|
||||
ct state established,related accept
|
||||
@@ -296,7 +299,7 @@ in
|
||||
oifname $WAN_IF ip saddr $LAN_IPV4_SUBNET masquerade
|
||||
|
||||
# Optional IPv6 masquerading (big L if enabled)
|
||||
# oifname $WAN_IF ip6 saddr $LAN_IPV6_SUBNET masquerade
|
||||
# oifname $WAN_IF ip6 saddr $LAN_IPV6_ULA masquerade
|
||||
}
|
||||
'';
|
||||
};
|
||||
@@ -341,20 +344,21 @@ in
|
||||
if_lan
|
||||
];
|
||||
# TODO: https://kea.readthedocs.io/en/latest/arm/ddns.html#dual-stack-environments
|
||||
dhcp-ddns.enable-updates = false;
|
||||
ddns-qualifying-suffix = "default.${ldomain}";
|
||||
dhcp-ddns.enable-updates = true;
|
||||
ddns-qualifying-suffix = "default6.${ldomain}";
|
||||
subnet6 = [
|
||||
{
|
||||
id = 1;
|
||||
interface = if_lan;
|
||||
subnet = "${lan_p6}::/64";
|
||||
ddns-qualifying-suffix = "lan.${ldomain}";
|
||||
ddns-qualifying-suffix = "lan6.${ldomain}";
|
||||
rapid-commit = true;
|
||||
pools = [ { pool = "${lan_p6}::1:1000/116"; } ];
|
||||
option-data = [
|
||||
reservations = [
|
||||
{
|
||||
name = "dns-servers";
|
||||
data = "${lan_p6}::1";
|
||||
duid = "00:04:59:c3:ce:9a:08:cf:fb:b7:fe:74:9c:e3:b7:44:bf:01";
|
||||
hostname = "archy";
|
||||
ip-addresses = [ "${lan_p6}::69" ];
|
||||
}
|
||||
];
|
||||
}
|
||||
@@ -381,34 +385,26 @@ in
|
||||
services.resolved.enable = false;
|
||||
networking.resolvconf.enable = true;
|
||||
networking.resolvconf.useLocalResolver = true;
|
||||
services.coredns.enable = true;
|
||||
services.coredns.config = ''
|
||||
. {
|
||||
cache {
|
||||
prefetch 100
|
||||
}
|
||||
# Static aliases
|
||||
hosts /etc/coredns.hosts {
|
||||
fallthrough
|
||||
}
|
||||
# Local domains to knot (ddns)
|
||||
forward ${ldomain}. [::1]:1053
|
||||
|
||||
# Quad9
|
||||
# forward . tls://[2620:fe::fe]:53 tls://9.9.9.9 tls://[2620:fe::9]:53 tls://149.112.112.112 {
|
||||
# tls_servername dns.quad9.net
|
||||
services.adguardhome.enable = true;
|
||||
services.adguardhome.mutableSettings = false;
|
||||
services.adguardhome.settings = {
|
||||
dns = {
|
||||
bootstrap_dns = [ "1.1.1.1" "9.9.9.9" ];
|
||||
upstream_dns = [
|
||||
"quic://p0.freedns.controld.com" # Default upstream
|
||||
"[/${ldomain}/][::1]:1053" # Local domains to Knot (ddns)
|
||||
];
|
||||
};
|
||||
# https://adguard-dns.io/kb/general/dns-filtering-syntax/
|
||||
user_rules = [
|
||||
# DNS rewrites
|
||||
"|grouter.${domain}^$dnsrewrite=${lan_ula_addr}"
|
||||
|
||||
# Cloudflare (seems to be faster)
|
||||
forward . tls://[2606:4700:4700::1112]:53 tls://1.1.1.2 tls://[2606:4700:4700::1002]:53 tls://1.0.0.2 {
|
||||
tls_servername security.cloudflare-dns.com
|
||||
health_check 5s
|
||||
}
|
||||
}
|
||||
'';
|
||||
|
||||
environment.etc."coredns.hosts".text = ''
|
||||
::1 wow.${domain} hi.${domain}
|
||||
'';
|
||||
# Allowed exceptions
|
||||
"@@||googleads.g.doubleclick.net"
|
||||
];
|
||||
};
|
||||
|
||||
services.knot.enable = true;
|
||||
services.knot.settings = {
|
||||
@@ -456,7 +452,51 @@ in
|
||||
chmod 644 "$ZONE_FILE"
|
||||
'';
|
||||
|
||||
services.netdata.enable = true;
|
||||
# https://wiki.nixos.org/wiki/Prometheus
|
||||
services.prometheus = {
|
||||
enable = true;
|
||||
exporters = {
|
||||
# TODO: DNS, Kea, Knot, other exporters
|
||||
node = {
|
||||
enable = true;
|
||||
enabledCollectors = [ "systemd" ];
|
||||
};
|
||||
};
|
||||
scrapeConfigs = [
|
||||
{
|
||||
job_name = "node";
|
||||
static_configs = [{
|
||||
targets = [ "localhost:${toString config.services.prometheus.exporters.node.port}" ];
|
||||
}];
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
# https://wiki.nixos.org/wiki/Grafana#Declarative_configuration
|
||||
services.grafana = {
|
||||
enable = true;
|
||||
settings.server.http_port = 3001;
|
||||
provision = {
|
||||
enable = true;
|
||||
datasources.settings.datasources = [
|
||||
{
|
||||
name = "Prometheus";
|
||||
type = "prometheus";
|
||||
url = "http://localhost:${toString config.services.prometheus.port}";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
services.caddy = {
|
||||
enable = true;
|
||||
virtualHosts."grouter.${domain}".extraConfig = ''
|
||||
reverse_proxy localhost:${toString config.services.grafana.settings.server.http_port}
|
||||
tls internal
|
||||
'';
|
||||
};
|
||||
|
||||
# services.netdata.enable = true;
|
||||
|
||||
# Enable the X11 windowing system.
|
||||
# You can disable this if you're only using the Wayland session.
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
|
||||
boot.loader.systemd-boot.configurationLimit = 5;
|
||||
boot.kernelPackages = pkgs.linuxKernel.packages.linux_6_12;
|
||||
boot.extraModulePackages = with config.boot.kernelPackages; [ zfs ];
|
||||
|
||||
environment.etc.hosts.mode = "0644";
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ in {
|
||||
aggregated = pkgs.buildEnv {
|
||||
name = "system-fonts-and-icons";
|
||||
paths = builtins.attrValues {
|
||||
inherit (pkgs.libsForQt5) breeze-qt5;
|
||||
inherit (pkgs.kdePackages) breeze;
|
||||
inherit
|
||||
(pkgs)
|
||||
noto-fonts
|
||||
|
||||
Reference in New Issue
Block a user