This commit is contained in:
nora 2024-07-26 21:11:18 +02:00
parent 7fdbf50900
commit ddd851ae6e
4 changed files with 106 additions and 14 deletions

View file

@ -5,8 +5,7 @@
# - A path to a Nixpkgs checkout
# - The Nixpkgs lambda (e.g., import <nixpkgs>)
# - An initialized Nixpkgs attribute set
# TODO: Pin
nixpkgs = import <nixpkgs>;
nixpkgs = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/a1cc729dcbc31d9b0d11d86dc7436163548a9665.tar.gz"); # nixos-24.05 2024-07-26
# If your Colmena host has nix configured to allow for remote builds
# (for nix-daemon, your user being included in trusted-users)

View file

@ -6,6 +6,17 @@
{ from = 53; to = 53; }
];
nixpkgs.overlays = [
(final: prev: {
nix-dns = import (pkgs.fetchFromGitHub {
owner = "nix-community";
repo = "dns.nix";
rev = "v1.1.2";
hash = "sha256-EHiDP2jEa7Ai5ZwIf5uld9RVFcV77+2SUxjQXwJsJa0=";
});
})
];
services.knot = {
enable = true;
settingsFile = pkgs.writeTextFile {
@ -19,6 +30,9 @@
- domain: noratrieb.dev
storage: /var/lib/knot/zones/
file: ${import ./noratrieb.dev.nix { inherit pkgs; }}
- domain: nilstrieb.dev
storage: /var/lib/knot/zones/
file: ${import ./nilstrieb.dev.nix { inherit pkgs; }}
log:
- target: syslog
any: info

View file

@ -0,0 +1,88 @@
# https://github.com/nix-community/dns.nix
{ pkgs, ... }:
let
data = with pkgs.nix-dns.lib.combinators;
let
dns1 = host "154.38.163.74" null;
dns2 = host "128.140.3.7" "2a01:4f8:c2c:d616::";
vps1 = host "184.174.32.252" null;
vps2 = host "161.97.165.1" null;
in
{
SOA = {
nameServer = "ns1.noratrieb.dev";
adminEmail = "void@noratrieb.dev";
serial = 2024072601;
};
TXT = [
"protonmail-verification=86964dcc4994261eab23dbc53dad613b10bab6de"
"v=spf1 include:_spf.protonmail.ch ~all"
];
NS = [
"ns1.noratrieb.dev"
"ns2.noratrieb.dev"
];
A = [
# GH Pages
(a "185.199.108.153")
(a "185.199.109.153")
(a "185.199.110.153")
(a "185.199.111.153")
];
AAAA = [
# GH Pages
(aaaa "2606:50c0:8002:0:0:0:0:153")
(aaaa "2606:50c0:8003:0:0:0:0:153")
(aaaa "2606:50c0:8000:0:0:0:0:153")
(aaaa "2606:50c0:8001:0:0:0:0:153")
];
MX = with mx; [
(mx 10 "mail.protonmail.ch")
(mx 20 "mailsec.protonmail.ch")
];
subdomains = {
www = vps1;
blog.CNAME = [ (cname "nilstrieb.github.io") ];
# apps
bisect-rustc = vps1;
cors-school = vps1 // {
subdomains.api = vps1;
};
docker = vps1;
hugo-chat = vps1 // {
subdomains.api = vps1;
};
olat = vps1;
uptime = vps1;
localhost.A = [ (a "127.0.0.1") ];
# infra (legacy)
inherit vps1;
inherit vps2;
inherit dns1;
inherit dns2;
pronouns.TXT = [
"TODO"
];
ns1 = dns1;
ns2 = dns2;
newtest.TXT = [ "uwu it works" ];
bsky.subdomains.atproto.TXT = [ "did=did:plc:pqyzoyxk7gfcbxk65mjyncyl" ];
};
};
in
pkgs.writeTextFile {
name = "noratrieb.dev.zone";
text = pkgs.nix-dns.lib.toString "noratrieb.dev" data;
}

View file

@ -1,15 +1,7 @@
# https://github.com/nix-community/dns.nix
{ pkgs, ... }:
let
# TODO: do this in a central place
dns = import (pkgs.fetchFromGitHub {
owner = "nix-community";
repo = "dns.nix";
rev = "v1.1.2";
hash = "sha256-EHiDP2jEa7Ai5ZwIf5uld9RVFcV77+2SUxjQXwJsJa0=";
});
data = with dns.lib.combinators;
data = with pkgs.nix-dns.lib.combinators;
let
dns1 = host "154.38.163.74" null;
dns2 = host "128.140.3.7" "2a01:4f8:c2c:d616::";
@ -35,8 +27,7 @@ let
"she/her"
];
# ns1 = dns1;
# ns2 = dns2;
newtest.TXT = [ "uwu it works" ];
infra.subdomains = {
inherit dns1;
@ -47,5 +38,5 @@ let
in
pkgs.writeTextFile {
name = "noratrieb.dev.zone";
text = dns.lib.toString "noratrieb.dev" data;
text = pkgs.nix-dns.lib.toString "noratrieb.dev" data;
}