mirror of
https://github.com/Noratrieb/vps.git
synced 2026-07-12 08:17:45 +02:00
minipc
This commit is contained in:
parent
131a282338
commit
9dd5ae6698
44 changed files with 353 additions and 79 deletions
|
|
@ -2,9 +2,12 @@
|
|||
let
|
||||
pretense = import (pkgs.fetchFromGitHub my-projects-versions.pretense.fetchFromGitHub);
|
||||
quotdd = import (pkgs.fetchFromGitHub my-projects-versions.quotdd.fetchFromGitHub);
|
||||
networkConfig = networkingConfig."${name}";
|
||||
in
|
||||
{
|
||||
deployment.targetHost = "${name}.infra.noratrieb.dev";
|
||||
deployment.targetHost =
|
||||
if networkConfig.publicIPv4 == null
|
||||
then name else "${name}.infra.noratrieb.dev";
|
||||
|
||||
# TODO: ensure that the rust programs have frame pointers
|
||||
|
||||
|
|
@ -20,6 +23,8 @@ in
|
|||
nixPath = [ "nixpkgs=${nixpkgs-path}" ];
|
||||
};
|
||||
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
vim
|
||||
wget
|
||||
|
|
@ -27,10 +32,14 @@ in
|
|||
traceroute
|
||||
dnsutils
|
||||
nftables
|
||||
htop
|
||||
];
|
||||
|
||||
networking.hostName = name;
|
||||
|
||||
# Swiss german console tty keyboard layout
|
||||
console.keyMap = "sg";
|
||||
|
||||
time.timeZone = "Europe/Zurich";
|
||||
users.users.root.openssh.authorizedKeys.keys = [ ''ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIG0n1ikUG9rYqobh7WpAyXrqZqxQoQ2zNJrFPj12gTpP nilsh@PC-Nils'' ];
|
||||
|
||||
|
|
|
|||
29
nix/modules/immich/default.nix
Normal file
29
nix/modules/immich/default.nix
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
{ config, pkgs, ... }: {
|
||||
age.secrets.immich_secrets.file = ../../secrets/immich_secrets.age;
|
||||
|
||||
services.immich = {
|
||||
enable = true;
|
||||
mediaLocation = "/mnt/nas/HEY/_Nora/immich";
|
||||
secretsFile = config.age.secrets.immich_secrets.path;
|
||||
host = "0.0.0.0";
|
||||
database = {
|
||||
enableVectors = false;
|
||||
enableVectorChord = true;
|
||||
};
|
||||
openFirewall = true;
|
||||
};
|
||||
|
||||
services.postgresql = {
|
||||
ensureDatabases = [ "immich" ];
|
||||
ensureUsers = [
|
||||
{
|
||||
name = "immich";
|
||||
ensureDBOwnership = true;
|
||||
}
|
||||
];
|
||||
authentication = pkgs.lib.mkForce ''
|
||||
#type database DBuser auth-method
|
||||
local all all peer
|
||||
'';
|
||||
};
|
||||
}
|
||||
8
nix/modules/minipc/default.nix
Normal file
8
nix/modules/minipc/default.nix
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
{ ... }: {
|
||||
imports = [ ./hardware-configuration.nix ];
|
||||
|
||||
networking.networkmanager.enable = true;
|
||||
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
}
|
||||
42
nix/modules/minipc/hardware-configuration.nix
Normal file
42
nix/modules/minipc/hardware-configuration.nix
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
||||
# and may be overwritten by future invocations. Please make changes
|
||||
# to /etc/nixos/configuration.nix instead.
|
||||
{ config, lib, pkgs, modulesPath, ... }:
|
||||
|
||||
{
|
||||
imports =
|
||||
[
|
||||
(modulesPath + "/installer/scan/not-detected.nix")
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ "kvm-intel" ];
|
||||
boot.extraModulePackages = [ ];
|
||||
|
||||
fileSystems."/" =
|
||||
{
|
||||
device = "/dev/disk/by-uuid/9327fdbf-f6d2-41ae-b69f-6dbb97ab388a";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
fileSystems."/boot" =
|
||||
{
|
||||
device = "/dev/disk/by-uuid/2A59-D3C9";
|
||||
fsType = "vfat";
|
||||
options = [ "fmask=0077" "dmask=0077" ];
|
||||
};
|
||||
|
||||
swapDevices =
|
||||
[{ device = "/dev/disk/by-uuid/db30dd66-fa2a-46a4-b81a-b0fc935db5ac"; }];
|
||||
|
||||
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
||||
# (the default) this is the recommended approach. When using systemd-networkd it's
|
||||
# still possible to use this option, but it's recommended to use it in conjunction
|
||||
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
|
||||
networking.useDHCP = lib.mkDefault true;
|
||||
# networking.interfaces.enp2s0.useDHCP = lib.mkDefault true;
|
||||
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
}
|
||||
6
nix/modules/nas-mount/default.nix
Normal file
6
nix/modules/nas-mount/default.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{ ... }: {
|
||||
fileSystems."/mnt/nas" = {
|
||||
device = "nas:/volume1/homes";
|
||||
fsType = "nfs";
|
||||
};
|
||||
}
|
||||
6
nix/modules/postgres/default.nix
Normal file
6
nix/modules/postgres/default.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{ pkgs, ... }: {
|
||||
config.services.postgresql = {
|
||||
enable = true;
|
||||
package = pkgs.postgresql_18;
|
||||
};
|
||||
}
|
||||
13
nix/modules/tailscale/default.nix
Normal file
13
nix/modules/tailscale/default.nix
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
{ ... }: {
|
||||
networking.nftables.enable = true;
|
||||
|
||||
services.tailscale = {
|
||||
enable = true;
|
||||
extraUpFlags = [ "--advertise-exit-node" ];
|
||||
useRoutingFeatures = "server";
|
||||
};
|
||||
|
||||
systemd.services.tailscaled.serviceConfig.Environment = [
|
||||
"TS_DEBUG_FIREWALL_MODE=nftables"
|
||||
];
|
||||
}
|
||||
|
|
@ -35,7 +35,9 @@ in
|
|||
let peerConfig = (builtins.getAttr peer networkingConfig).wg;
|
||||
in {
|
||||
inherit (peerConfig) publicKey;
|
||||
endpoint = "${peer}.infra.noratrieb.dev:${toString listenPort}";
|
||||
endpoint =
|
||||
if !(builtins.hasAttr "noEndpoint" peerConfig) || !peerConfig.noEndpoint
|
||||
then "${peer}.infra.noratrieb.dev:${toString listenPort}" else null;
|
||||
allowedIPs = [ "${peerConfig.privateIP}/32" ];
|
||||
# sometimes there's some weirdness....??
|
||||
persistentKeepalive = 25;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue