gitea repo

This commit is contained in:
fred 2025-06-20 11:59:24 -07:00
commit f610209aff
66 changed files with 2439 additions and 0 deletions

12
hosts/desk/boot.nix Normal file
View file

@ -0,0 +1,12 @@
{
boot.initrd.luks.devices = {
"luks-c14a978c-5752-4d1b-beb9-57fb710cd409" = {
device = "/dev/disk/by-uuid/c14a978c-5752-4d1b-beb9-57fb710cd409";
allowDiscards = true;
keyFileSize = 4096;
keyFile = "/dev//disk/by-id/usb-Generic_Flash_Disk_C94D5655-0:0";
fallbackToPassword = true;
preLVM = false;
};
};
}

97
hosts/desk/default.nix Normal file
View file

@ -0,0 +1,97 @@
{ pkgs, inputs, config, lib, ... }:
let
nfs_opts = [ "x-systemd.automount" "noauto" "x-systemd.idle-timeout=600" ];
hdd_opts = [ "nosuid" "nodev" "nofail" ];
in
{
imports =
[
./boot.nix
./hardware.nix
./kvm.nix
./desk_apps.nix
../../modules/common/default.nix
../../modules/common/system-d_boot.nix
../../modules/networking/ssh.nix
../../modules/networking/hosts.nix
../../modules/user
../../modules/apps/99_i3_config.nix
../../modules/dev/docker.nix
../../modules/dev/ruby.nix
../../modules/misc/polkit.nix
inputs.home-manager.nixosModules.default
inputs.sops-nix.nixosModules.sops
];
config = {
user = "fred";
host = "desk";
sops_file = "home.yaml";
time.timeZone = "America/Los_Angeles";
i18n.defaultLocale = "en_US.UTF-8";
environment.systemPackages = with pkgs; [ nfs-utils ddcutil input-remapper ];
#### NFS's ###
services.autofs = {
enable = true;
timeout = 60;
autoMaster = ''
/- /etc/autofs/auto.nfs_server --timeout=60
'';
};
environment.etc."autofs/auto.nfs_server" = {
text = ''
/nfs -rw,soft,rsize=8192,wsize=8192 nfs:/nfs
/solid -rw,soft,rsize=8192,wsize=8192 nfs:/solid
/docker -rw,soft,rsize=8192,wsize=8192 nfs:/docker
'';
mode = "0644";
};
### HDD's ###
fileSystems."/run/media/fred/2tb" =
{ device = "/dev/disk/by-uuid/2967e82b-a83c-4357-9939-1fbcc2618a9a";
fsType = "ext4";
options = hdd_opts;
};
fileSystems."/run/media/fred/arch_home" =
{ device = "/dev/disk/by-uuid/122e2d4f-3512-4077-a5ee-f80ac6e32300";
fsType = "ext4";
options = hdd_opts;
};
fileSystems."/run/media/fred/arch_root" =
{ device = "/dev/disk/by-uuid/56a64ba1-5ffa-426d-bca2-ede62c7b2498";
fsType = "ext4";
options = hdd_opts;
};
# ddcutil detect # get I2C bus #
# ddcutil capabilities --bus=7
# ddcutil --bus=7 setvcp 60 0x0f
hardware.i2c.enable = true;
users.users.${config.user} = {
extraGroups = [ "i2c" ];
};
services.tcsd.enable = false; # prevent sysinit-reactiviation.target hang when rebuilding flake
services.xserver.displayManager.lightdm.extraSeatDefaults = "display-setup-script = ${pkgs.ddcutil}/bin/ddcutil --bus=7 setvcp 60 0x0f";
networking.firewall.allowedUDPPorts = [ 11357 ]; # ollama-docker
networking.firewall.allowedTCPPorts = [ 11357 ]; # ollama-docker
networking.enableIPv6 = false;
security.pki.certificates = [ (builtins.readFile ../../dotfiles/certs/mfCA.crt) ];
hardware.bluetooth.enable = true;
hardware.bluetooth.powerOnBoot = true;
services.blueman.enable = true;
system.stateVersion = "25.05";
};
}

11
hosts/desk/desk_apps.nix Normal file
View file

@ -0,0 +1,11 @@
{ config, pkgs, ... }: {
config = {
home-manager.users.${config.user} = { pkgs, ... }: {
home.packages = with pkgs; [
yt-dlp
freetube
];
};
};
}

47
hosts/desk/hardware.nix Normal file
View file

@ -0,0 +1,47 @@
# 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")
];
config = {
boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" "amdgpu" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/aa4561b3-a61d-4ed9-8847-b88c6fc06525";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/6FD4-7839";
fsType = "vfat";
options = [ "fmask=0077" "dmask=0077" ];
};
swapDevices = [{
device = "/var/lib/swapfile";
size = 8*1024;
}];
networking.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
hardware = {
graphics = {
enable = true;
enable32Bit = true;
extraPackages = with pkgs; [ amdvlk ];
extraPackages32 = with pkgs; [ driversi686Linux.amdvlk ];
};
};
};
}

43
hosts/desk/kvm.nix Normal file
View file

@ -0,0 +1,43 @@
{ config, lib, pkgs, ... }: {
environment.systemPackages = with pkgs; [ virt-manager ];
virtualisation.libvirtd = {
enable = true;
qemu.ovmf.enable = true;
qemu.runAsRoot = false;
onBoot = "ignore";
onShutdown = "shutdown";
qemu.vhostUserPackages = with pkgs; [ virtiofsd ];
hooks.qemu."qemu-hooks" = pkgs.writeShellScript "qemu-hooks" ''
export PATH="${lib.makeBinPath [
pkgs.bash
pkgs.xorg.xset
pkgs.coreutils
pkgs.util-linux
pkgs.i3
pkgs.xorg.xrandr
pkgs.ddcutil
]}:''$PATH"
${builtins.readFile ../../dotfiles/qemu/qemu-hooks }
'';
};
virtualisation.spiceUSBRedirection.enable = true;
programs.virt-manager.enable = true;
users.groups.libvirtd.members = [ "${config.user}" ];
boot.kernelPackages = pkgs.linuxPackages_latest;
boot.kernelParams = [ "amd_iommu=on" "pcie_aspm=off" ];
boot.kernelModules = [ "kvm-amd" ];
boot.initrd.availableKernelModules = [ "amdgpu" "vfio-pci" ];
boot.initrd.preDeviceCommands = ''
DEVS="0000:06:00.0 0000:06:00.1"
for DEV in $DEVS; do
echo "vfio-pci" > /sys/bus/pci/devices/$DEV/driver_override
done
modprobe -i vfio-pci
'';
}

1
hosts/htpc/default.nix Normal file
View file

@ -0,0 +1 @@
# TODO

1
hosts/laptop/default.nix Normal file
View file

@ -0,0 +1 @@
# TODO

4
hosts/vm_ollama/boot.nix Normal file
View file

@ -0,0 +1,4 @@
{
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
}

View file

@ -0,0 +1,28 @@
{ pkgs, inputs, config, lib, ... }:
{
imports =
[
./boot.nix
./hardware.nix
./ollama.nix
../../modules/common/default.nix
../../modules/common/system-d_boot.nix
../../modules/networking/ssh.nix
../../modules/networking/hosts.nix
../../modules/user
../../modules/apps/00_tui_base.nix
inputs.home-manager.nixosModules.default
inputs.sops-nix.nixosModules.sops
];
config = {
user = "ollama";
host = "vm_ollama";
sops_file = "home.yaml";
system.stateVersion = "25.05";
security.pki.certificates = [ (builtins.readFile ../../dotfiles/certs/mfCA.crt) ];
};
}

View file

@ -0,0 +1,38 @@
# 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 + "/profiles/qemu-guest.nix")
];
boot.initrd.availableKernelModules = [ "ahci" "virtio_pci" "xhci_pci" "virtio_scsi" "sr_mod" "virtio_blk" "amdgpu" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
services.qemuGuest.enable = true;
fileSystems."/" =
{ device = "/dev/disk/by-uuid/a1324d7d-aa2d-4fc8-9ec7-797ef1537c30";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/69C2-3355";
fsType = "vfat";
options = [ "fmask=0077" "dmask=0077" ];
};
swapDevices = [ ];
# 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";
}

View file

@ -0,0 +1,39 @@
{ config, lib, pkgs, ... }: {
config = {
fileSystems."/mnt/ollama_models" =
{ device = "ollama_models";
fsType = "virtiofs";
options = [ "nosuid" "nodev" "nofail" ];
};
hardware.enableRedistributableFirmware = true;
environment.systemPackages = with pkgs; [
rocmPackages_6.clr.icd
rocmPackages_6.rocminfo
rocmPackages_6.rocm-smi
rocmPackages_6.rocm-device-libs
radeontop
clinfo
amdvlk
];
users.users.ollama.extraGroups = [ "render" "video" ];
services.ollama = {
enable = true;
acceleration = "rocm";
host = "0.0.0.0";
port = 11357;
openFirewall = true;
models = "/mnt/ollama_models/";
rocmOverrideGfx = "10.3.0";
environmentVariables = {
OLLAMA_KEEP_ALIVE="15m";
};
};
environment.variables.OLLAMA_HOST = "0.0.0.0:11357";
};
}

18
hosts/vps_fz/boot.nix Normal file
View file

@ -0,0 +1,18 @@
{
boot.loader.grub.enable = true;
boot.loader.grub.device = "/dev/vda";
boot.loader.grub.useOSProber = false;
boot.initrd.luks.devices."luks-c2ab1085-f8ec-49df-a26b-ece597abc3b7".device = "/dev/disk/by-uuid/c2ab1085-f8ec-49df-a26b-ece597abc3b7";
# Setup keyfile
boot.initrd.secrets = {
"/boot/crypto_keyfile.bin" = null;
};
boot.loader.grub.enableCryptodisk = true;
boot.initrd.luks.devices."luks-938c9dc1-9c55-4152-bc69-4d8770518c90".keyFile = "/boot/crypto_keyfile.bin";
boot.initrd.luks.devices."luks-c2ab1085-f8ec-49df-a26b-ece597abc3b7".keyFile = "/boot/crypto_keyfile.bin";
# boot.loader.systemd-boot.enable = true;
# boot.loader.efi.canTouchEfiVariables = true;
}

35
hosts/vps_fz/default.nix Normal file
View file

@ -0,0 +1,35 @@
{ pkgs, inputs, config, lib, ... }:
{
imports =
[
./boot.nix
./hardware.nix
./server_config.nix
../../modules/common
../../modules/networking/ssh.nix
../../modules/user
../../modules/apps/00_tui_base.nix
inputs.home-manager.nixosModules.default
inputs.sops-nix.nixosModules.sops
];
config = {
### USER ###
user = "vps_fz";
host = "vps_fz";
sops_file = "vps_fz.yaml";
### NETWORKING ###
networking.enableIPv6 = false;
networking.firewall = {
enable = true;
allowedTCPPorts = [ 80 443 ];
};
system.stateVersion = "25.05";
};
}

35
hosts/vps_fz/hardware.nix Normal file
View file

@ -0,0 +1,35 @@
# 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 + "/profiles/qemu-guest.nix")
];
boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "sr_mod" "virtio_blk" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/0b1c3bc9-4332-4950-bc20-20e7eb8aa003";
fsType = "ext4";
};
boot.initrd.luks.devices."luks-938c9dc1-9c55-4152-bc69-4d8770518c90".device = "/dev/disk/by-uuid/938c9dc1-9c55-4152-bc69-4d8770518c90";
swapDevices =
[ { device = "/dev/disk/by-uuid/7961b651-0b10-4fbf-a429-8e53a2b67b34"; }
];
# 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.ens3.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
}

View file

@ -0,0 +1,40 @@
{ pkgs, inputs, config, lib, ... }: {
config = {
# fail2ban
services.fail2ban.enable = true;
services.openssh.settings.LogLevel = "VERBOSE";
# caddy
services.caddy = {
enable = true;
configFile = ../../dotfiles/caddy/Caddyfile;
};
networking.firewall.allowedTCPPorts = [ 80 443 ];
# gitea
sops.secrets."gitea_dbpass" = {
owner = "gitea";
group = "gitea";
};
services.gitea = {
enable = true;
database = {
type = "postgres";
passwordFile = config.sops.secrets."gitea_dbpass".path;
};
settings = {
server = {
DOMAIN = "gitea.fredzernia.com";
ROOT_URL = "https://gitea.fredzernia.com";
HTTP_PORT = 7904;
};
service.DISABLE_REGISTRATION = true;
};
};
};
}