Fix voyager; zfs, docker, metrics

This commit is contained in:
Felix Albrigtsen 2023-04-16 16:49:08 +02:00
parent 9ce4b138cd
commit afc4b9f4bb
8 changed files with 63 additions and 57 deletions

View File

@ -43,6 +43,15 @@
nixPath = [ "nixpkgs=${inputs.nixpkgs}" ]; nixPath = [ "nixpkgs=${inputs.nixpkgs}" ];
}; };
environment.systemPackages = with pkgs; [
wget
git
tree
rsync
bottom
ripgrep
];
services.openssh = { services.openssh = {
enable = true; enable = true;
permitRootLogin = "no"; permitRootLogin = "no";
@ -52,6 +61,7 @@
users.users.felixalb = { users.users.felixalb = {
isNormalUser = true; isNormalUser = true;
extraGroups = [ "wheel" ]; extraGroups = [ "wheel" ];
uid = 1000;
openssh.authorizedKeys.keys = [ openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDKzPICGew7uN0cmvRmbwkwTCodTBUgEhkoftQnZuO4Q felixalbrigtsen@gmail.com" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDKzPICGew7uN0cmvRmbwkwTCodTBUgEhkoftQnZuO4Q felixalbrigtsen@gmail.com"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHkLmJIkBM6AMbYM/hYm27Flgya81UiGqh9/owYWmrbZ home.feal.no" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHkLmJIkBM6AMbYM/hYm27Flgya81UiGqh9/owYWmrbZ home.feal.no"

View File

@ -2,11 +2,11 @@
"nodes": { "nodes": {
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1674091526, "lastModified": 1681570648,
"narHash": "sha256-eLhLKOpF1ix5xZeFF9g8uE1stdyxuBLJvWQ20gLbDto=", "narHash": "sha256-ATsDh8cEXqx+gGIIpEPf5twAStM9INIbwmVgS4WcjYQ=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "fc5b90fd72177d9bcf435b10c12bb943549748c6", "rev": "745a6200bf74c4dbec8f94dd731ab3769c0e9df3",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -18,11 +18,11 @@
}, },
"nixpkgs-stable": { "nixpkgs-stable": {
"locked": { "locked": {
"lastModified": 1673740915, "lastModified": 1681613598,
"narHash": "sha256-MMH8zONfqahgHly3K8/A++X34800rajA/XgZ2DzNL/M=", "narHash": "sha256-Ogkoma0ytYcDoMR2N7CZFABPo+i0NNo26dPngru9tPc=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "7c65528c3f8462b902e09d1ccca23bb9034665c2", "rev": "1040ce5f652b586da95dfd80d48a745e107b9eac",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -47,11 +47,11 @@
"nixpkgs-stable": "nixpkgs-stable" "nixpkgs-stable": "nixpkgs-stable"
}, },
"locked": { "locked": {
"lastModified": 1681209176, "lastModified": 1681613729,
"narHash": "sha256-wyQokPpkNZnsl/bVf8m1428tfA0hJ0w/qexq4EizhTc=", "narHash": "sha256-9Qb0tHW8l1hgFkuB76n4VT9UNUaR7QL3CgmJ5hcVYEg=",
"owner": "Mic92", "owner": "Mic92",
"repo": "sops-nix", "repo": "sops-nix",
"rev": "00d5fd73756d424de5263b92235563bc06f2c6e1", "rev": "b7a6670a28b01cd1f62879921e36be2c69c4137a",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -62,11 +62,11 @@
}, },
"unstable": { "unstable": {
"locked": { "locked": {
"lastModified": 1674101896, "lastModified": 1681618194,
"narHash": "sha256-xWLaexT6IHhOJru54wrOMeBbkKeJzOZ4Pqrxctf82q0=", "narHash": "sha256-UR4OobzFHFyIVHXmanJLfm5o2DVufbFeP1Dn7C5Xqn0=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "a841e262264e48722dccc8469f066068146e406b", "rev": "f2654e378dfc8153a141a8fcb854b423fe259a27",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@ -62,11 +62,6 @@
''; '';
} }
) )
wget
git
tree
rsync
bottom
]; ];
networking.firewall.allowedTCPPorts = [ 80 22 3100 ]; networking.firewall.allowedTCPPorts = [ 80 22 3100 ];

View File

@ -8,34 +8,34 @@
./hardware-configuration.nix ./hardware-configuration.nix
./containers.nix ./containers.nix
./services/nginx
./services/metrics ./services/metrics
# TODO: # TODO:
# - Boots # x Boot
# x Mount ZFS
# x Monitoring server
# x Podman
# x Flame
# - Transmission # - Transmission
# - Jellyfin # - Jellyfin
# - NFS exports # - NFS exports
# x Monitoring server # - FreeBSD VM
# - Kali VM # - Kali VM
# - Kerberos / IPA # - Kerberos / IPA
]; ];
boot = { boot = {
kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages; zfs.extraPools = [ "tank" ];
kernelParams = [ "nohibernate" ]; # No swap, no hibernate
supportedFilesystems = [ "zfs" ]; supportedFilesystems = [ "zfs" ];
kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages;
}; };
# filesystems."/tank" = {
# device = "tank";
# fsType = "zfs";
# };
networking = { networking = {
hostName = "voyager"; hostName = "voyager";
defaultGateway = "192.168.10.1"; defaultGateway = "192.168.10.1";
nameservers = [ "192.168.10.1" "1.1.1.1" ]; nameservers = [ "192.168.10.1" "1.1.1.1" ];
interfaces.eth0.ipv4 = { interfaces.eno1.ipv4 = {
addresses = [ addresses = [
{ address = "192.168.10.165"; prefixLength = 24; } { address = "192.168.10.165"; prefixLength = 24; }
]; ];
@ -81,16 +81,11 @@
''; '';
} }
) )
wget zfs
git
tree
rsync
bottom
]; ];
networking.firewall.allowedTCPPorts = [ 22 ]; networking.firewall.allowedTCPPorts = [ 22 ];
system.stateVersion = "22.11"; system.stateVersion = "22.11";
} }

View File

@ -1,13 +1,19 @@
{ config, pkgs, values, ... }: { config, pkgs, lib, ... }:
{ {
config.virtualisation.oci-containers.containers = { # Flame - Homelab dashboard/linktree
virtualisation.oci-containers.containers = {
flame = { flame = {
image = "pawelmalak/flame"; image = "pawelmalak/flame";
ports = [ "5005:5005" ]; ports = [ "127.0.0.1:5005:5005" ];
volumes = [ volumes = [
"/var/lib/flame/data:/app/data/" "/var/lib/flame/data:/app/data/"
]; ];
}; };
}; };
services.nginx.virtualHosts."flame.home.feal.no" = {
locations."/" = {
proxyPass = "http://127.0.0.1:5005";
};
};
} }

View File

@ -8,33 +8,18 @@
[ (modulesPath + "/installer/scan/not-detected.nix") [ (modulesPath + "/installer/scan/not-detected.nix")
]; ];
boot.initrd.availableKernelModules = [ "ehci_pci" "ahci" "mpt3sas" "usb_storage" "usbhid" "sd_mod" "sr_mod" ]; boot.initrd.availableKernelModules = [ "ehci_pci" "ahci" "mpt3sas" "usbhid" "usb_storage" "sd_mod" "sr_mod" ];
boot.initrd.kernelModules = [ ]; boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ]; boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ]; boot.extraModulePackages = [ ];
fileSystems."/" = fileSystems."/" =
{ device = "rpool/nixos/root"; { device = "/dev/disk/by-uuid/5e292e89-d68c-4b45-9166-142de8b6ff5e";
fsType = "zfs"; fsType = "ext4";
}; };
fileSystems."/home" = fileSystems."/boot" =
{ device = "rpool/nixos/home"; { device = "/dev/disk/by-uuid/7EA9-3E3A";
fsType = "zfs";
};
fileSystems."/var/lib" =
{ device = "rpool/nixos/var/lib";
fsType = "zfs";
};
fileSystems."/boot/efis/usb-USB_SanDisk_3.2Gen1_0101b10101c61e14737f7ba5d4debafb705fb5bb1082a0be6e8a84f5eb4ae02393df000000000000000000009940bff9ff01740081558107b5ad5d4a-0:0-part1" =
{ device = "/dev/sdb1";
fsType = "vfat";
};
fileSystems."/boot/efis/usb-USB_SanDisk_3.2Gen1_0101aa2faa7599e5f2afc0dde60a5f61a62999cc479fbf61706afe2f115d19735f550000000000000000000026304b1f0094160081558107b5ac9a2a-0:0-part1" =
{ device = "/dev/sdc1";
fsType = "vfat"; fsType = "vfat";
}; };

View File

@ -5,6 +5,6 @@
./prometheus.nix ./prometheus.nix
./grafana.nix ./grafana.nix
./loki.nix ./loki.nix
./snmp-exporter.nix #./snmp-exporter.nix
]; ];
} }

View File

@ -0,0 +1,15 @@
{ config, values, ... }:
{
services.nginx = {
enable = true;
enableReload = true;
recommendedProxySettings = true;
recommendedTlsSettings = true;
recommendedGzipSettings = true;
recommendedOptimisation = true;
};
networking.firewall.allowedTCPPorts = [ 80 443 ];
}