Add Ansible configuration and remove NixOS
All checks were successful
Nix Format Check / check-format (pull_request) Successful in 39s

This commit is contained in:
2025-01-20 09:18:58 +01:00
parent 4e28e5cbb0
commit e1aa41d1d3
107 changed files with 368 additions and 2902 deletions

View File

@@ -1,57 +0,0 @@
{
config,
lib,
pkgs,
modulesPath,
...
}:
{
imports = [ /etc/nixos/hardware-configuration.nix ];
networking.hostName = "mennos-gamingpc";
fileSystems."/" = {
device = "/dev/disk/by-uuid/ac5a70cf-4b12-4d02-b5b4-a6eddf4c40b5";
fsType = "ext4";
options = [ "noatime" ];
};
networking.interfaces.enp8s0.wakeOnLan = {
enable = true;
};
# Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
# Enable Vulkan support for AMD graphics cards
hardware.graphics.extraPackages32 = with pkgs.pkgsi686Linux; [ amdvlk ];
# Swap file (Desktop PC has 48GB of RAM so 8GB swap should be enough)
swapDevices = [
{
device = "/swapfile";
size = 8192;
}
];
# Enable graphics
hardware.graphics = {
enable = true;
# Enable the latest AMDGPU drivers
extraPackages = with pkgs; [
amdvlk
rocmPackages.clr
];
};
# Add ROCm packages and nvtop
environment.systemPackages = with pkgs; [
rocmPackages.rocm-smi
rocmPackages.clr
rocmPackages.rocm-core
rocmPackages.hipcc
rocmPackages.rocm-device-libs
nvtopPackages.amd
];
}

View File

@@ -1,84 +0,0 @@
{
config,
lib,
pkgs,
modulesPath,
...
}:
{
imports = [ /etc/nixos/hardware-configuration.nix ];
networking.hostName = "mennos-laptop";
fileSystems."/" = {
device = "/dev/disk/by-uuid/1356cd09-5c55-45b5-8b06-6aadc84cee37";
fsType = "ext4";
options = [ "noatime" ];
};
# Bootloader
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
# Enable graphics
hardware.graphics = {
enable = true;
extraPackages = with pkgs; [
amdvlk
rocmPackages.clr
];
};
# Swap file (Laptop has 32GB of RAM so 8GB swap should be enough)
swapDevices = [
{
device = "/swapfile";
size = 8192;
}
];
# Load AMD and NVIDIA drivers for Xorg and Wayland
services.xserver.videoDrivers = [
"nvidia"
"amdgpu"
];
# Monitoring tools
environment.systemPackages = with pkgs; [
nvtopPackages.nvidia
nvtopPackages.amd
glxinfo
vulkan-tools
];
hardware.nvidia = {
# Enable modesetting
modesetting.enable = true;
# Power management configuration
powerManagement = {
enable = true;
finegrained = false; # Disabled as it requires offload mode
};
# Prime configuration for hybrid graphics
prime = {
offload = {
enable = true;
enableOffloadCmd = true;
};
# AMD GPU as primary
amdgpuBusId = "PCI:5:0:0";
nvidiaBusId = "PCI:1:0:0";
};
open = false;
nvidiaSettings = true;
package = config.boot.kernelPackages.nvidiaPackages.stable;
};
boot.kernelParams = [
"amdgpu.sg_display=0"
"nvidia-drm.modeset=1"
];
}

View File

@@ -1,64 +0,0 @@
{
config,
lib,
pkgs,
modulesPath,
...
}:
{
imports = [
/etc/nixos/hardware-configuration.nix
./mennos-server/zfs.nix
];
fileSystems."/" = {
device = "/dev/disk/by-uuid/dd3fa13c-a1bd-4dc9-bcb4-aee17c7f12d1";
fsType = "ext4";
options = [ "noatime" ];
};
networking.hostName = "mennos-server";
networking.hostId = "64519940";
# Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
# Load nvidia driver for Xorg and Wayland
services.xserver.videoDrivers = [ "nvidia" ];
# Enable graphics
hardware.graphics.enable = true;
# nvtop, a system monitor for GPUs
environment.systemPackages = with pkgs; [ nvtopPackages.nvidia ];
# Enable NVIDIA Docker support
# test with: $ docker run --rm -it --device=nvidia.com/gpu=all ubuntu:latest nvidia-smi
hardware.nvidia-container-toolkit.enable = true;
virtualisation.docker = {
enable = true;
};
# Swap file (Laptop has 64GB of RAM so 16GB swap should be enough)
swapDevices = [
{
device = "/swapfile";
size = 16384;
}
];
hardware.nvidia = {
modesetting.enable = true;
powerManagement.enable = false;
powerManagement.finegrained = false;
open = false;
nvidiaSettings = true;
# Use the latest driver from the unstable channel
package = config.boot.kernelPackages.nvidiaPackages.stable;
};
}

View File

@@ -1,147 +0,0 @@
{ config, pkgs, ... }:
let
# Create a script to set permissions
permissionsScript = pkgs.writeShellScriptBin "set-zfs-permissions" ''
# Set default permissions for all service directories
find /mnt/services -mindepth 1 -maxdepth 1 -type d \
-exec chmod 775 {} \; \
-exec chown menno:users {} \;
# Special cases
chmod 774 /mnt/services/golink
chown 65532:users /mnt/services/golink
chmod 754 /mnt/services/torrent
chown menno:users /mnt/services/torrent
chmod 755 /mnt/services/proxy
chmod 755 /mnt/services/static-websites
chown menno:users /mnt/backups
chown menno:users /mnt/backups/photos
chown menno:users /mnt/backups/services
chmod 775 /mnt/backups
chmod 775 /mnt/backups/photos
chmod 775 /mnt/backups/services
# Set permissions for other mount points
for dir in /mnt/{ai,astrophotography,audiobooks,downloads,ISOs,movies,music,old_backups,photos,stash,tvshows,VMs}; do
chmod 755 "$dir"
chown menno:users "$dir"
done
'';
in
{
environment.systemPackages = with pkgs; [
zfs
zfstools
permissionsScript
smartmontools
];
# Add the permissions service
systemd.services.zfs-permissions = {
description = "Set ZFS mount permissions";
# Run after ZFS mounts are available
after = [ "zfs.target" ];
requires = [ "zfs.target" ];
# Run on boot and every 6 hours
startAt = "*-*-* */6:00:00";
serviceConfig = {
Type = "oneshot";
ExecStart = "${permissionsScript}/bin/set-zfs-permissions";
User = "root";
Group = "root";
};
};
# Enable ZFS support
boot.supportedFilesystems = [
"ntfs"
"zfs"
];
# ZFS system services
services.zfs = {
autoScrub = {
enable = true;
interval = "weekly";
};
};
# If you want to keep compression settings
boot.kernelParams = [
"zfs.zfs_compressed_arc_enabled=1" # Enable compressed ARC
"zfs.zfs_arc_max=21474836480" # 20 GiB
];
fileSystems = {
# backup ZFS mount points
"/mnt/backups/photos" = {
device = "backup/photos-duplicati";
fsType = "zfs";
};
"/mnt/backups/services" = {
device = "backup/services-duplicati";
fsType = "zfs";
};
# datapool ZFS mount points
"/mnt/ai" = {
device = "datapool/ai";
fsType = "zfs";
};
"/mnt/astrophotography" = {
device = "datapool/astro";
fsType = "zfs";
};
"/mnt/audiobooks" = {
device = "datapool/audiobooks";
fsType = "zfs";
};
"/mnt/downloads" = {
device = "datapool/downloads";
fsType = "zfs";
};
"/mnt/ISOs" = {
device = "datapool/isos";
fsType = "zfs";
};
"/mnt/movies" = {
device = "datapool/movies";
fsType = "zfs";
};
"/mnt/music" = {
device = "datapool/music";
fsType = "zfs";
};
"/mnt/old_backups" = {
device = "datapool/old_backups";
fsType = "zfs";
};
"/mnt/photos" = {
device = "datapool/photos";
fsType = "zfs";
};
"/mnt/services" = {
device = "datapool/services";
fsType = "zfs";
};
"/mnt/stash" = {
device = "datapool/stash";
fsType = "zfs";
};
"/mnt/tvshows" = {
device = "datapool/tv_shows";
fsType = "zfs";
};
"/mnt/VMs" = {
device = "datapool/vms";
fsType = "zfs";
};
};
}