Compare commits

..

3 Commits

Author SHA1 Message Date
Noah Masur
1865f6985e
automatically fetch notes 2024-04-14 04:21:59 +00:00
Noah Masur
c338ff5579
color update and decrypt git zfs dataset 2024-04-14 04:07:04 +00:00
Noah Masur
bf58cf62d3
fix dns issues with ipv6 and local bind 2024-04-14 03:43:58 +00:00
3 changed files with 50 additions and 11 deletions

View File

@ -74,6 +74,7 @@ inputs.nixpkgs.lib.nixosSystem {
"tank/archive" "tank/archive"
"tank/generic" "tank/generic"
"tank/nextcloud" "tank/nextcloud"
"tank/generic/git"
]; ];
# If password is requested and fails, continue to boot eventually # If password is requested and fails, continue to boot eventually
passwordTimeout = 300; passwordTimeout = 300;
@ -86,7 +87,7 @@ inputs.nixpkgs.lib.nixosSystem {
# Still require colors for programs like Neovim, K9S # Still require colors for programs like Neovim, K9S
theme = { theme = {
colors = (import ../../colorscheme/gruvbox).dark; colors = (import ../../colorscheme/gruvbox-dark).dark;
}; };
# Programs and services # Programs and services

View File

@ -1,4 +1,10 @@
{ config, ... }: { {
config,
pkgs,
lib,
...
}:
{
# This is just a placeholder as I expect to interact with my notes in a # This is just a placeholder as I expect to interact with my notes in a
# certain location # certain location
@ -9,6 +15,22 @@
NOTES_PATH = "${config.homePath}/dev/personal/notes/content"; NOTES_PATH = "${config.homePath}/dev/personal/notes/content";
}; };
# Sync notes for Nextcloud automatically
systemd.user.timers.refresh-notes = lib.mkIf config.services.nextcloud.enable {
Timer = {
OnCalendar = "*-*-* *:0/10:50"; # Every 10 minutes
Unit = "refresh-notes.service";
};
};
systemd.user.services.refresh-notes = {
Unit.Description = "Get latest notes.";
Service = {
Type = "oneshot";
ExecStartPre = "${pkgs.git}/bin/git -C /data/git/notes reset --hard master";
ExecStart = "${pkgs.git}/bin/git -C /data/git/notes pull";
WorkingDirectory = config.homePath;
Environment = "PATH=${pkgs.openssh}/bin";
};
};
}; };
} }

View File

@ -5,7 +5,12 @@
# To set this on all home machines, I point my router's DNS resolver to the # To set this on all home machines, I point my router's DNS resolver to the
# local IP address of the machine running this service (swan). # local IP address of the machine running this service (swan).
{ config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
let let
@ -18,8 +23,8 @@ let
]; ];
mkRecord = service: "${service} A ${localIp}"; mkRecord = service: "${service} A ${localIp}";
localRecords = lib.concatLines (map mkRecord localServices); localRecords = lib.concatLines (map mkRecord localServices);
in
in { {
config = lib.mkIf config.services.bind.enable { config = lib.mkIf config.services.bind.enable {
@ -31,12 +36,20 @@ in {
# Allow requests coming from these IPs. This way I don't somehow get # Allow requests coming from these IPs. This way I don't somehow get
# spammed with DNS requests coming from the Internet. # spammed with DNS requests coming from the Internet.
cacheNetworks = [ "127.0.0.0/24" "192.168.0.0/16" ]; cacheNetworks = [
"127.0.0.0/24"
"192.168.0.0/16"
"::1/128" # Required because IPv6 loopback now added to resolv.conf
# (see: https://github.com/NixOS/nixpkgs/pull/302228)
];
# When making normal DNS requests, forward them to Cloudflare to resolve. # When making normal DNS requests, forward them to Cloudflare to resolve.
forwarders = [ "1.1.1.1" "1.0.0.1" ]; forwarders = [
"1.1.1.1"
"1.0.0.1"
];
ipv4Only = true; ipv4Only = false;
# Use rpz zone as an override # Use rpz zone as an override
extraOptions = ''response-policy { zone "rpz"; };''; extraOptions = ''response-policy { zone "rpz"; };'';
@ -59,13 +72,16 @@ in {
''; '';
}; };
}; };
}; };
# We must allow DNS traffic to hit our machine as well # We must allow DNS traffic to hit our machine as well
networking.firewall.allowedTCPPorts = [ 53 ]; networking.firewall.allowedTCPPorts = [ 53 ];
networking.firewall.allowedUDPPorts = [ 53 ]; networking.firewall.allowedUDPPorts = [ 53 ];
# Set our own nameservers to ourselves
networking.nameservers = [
"127.0.0.1"
"::1"
];
}; };
} }