163 lines
		
	
	
		
			5.2 KiB
		
	
	
	
		
			Nix
		
	
	
	
			
		
		
	
	
			163 lines
		
	
	
		
			5.2 KiB
		
	
	
	
		
			Nix
		
	
	
	
{ lib, inputs, config, pkgs, ... }:
 | 
						|
let
 | 
						|
    serverIP = "192.168.1.2";
 | 
						|
in {
 | 
						|
    imports = [
 | 
						|
        (import ../Common/default.nix { inherit inputs pkgs; })
 | 
						|
        # (import ../Common/nvidia.nix { inherit inputs pkgs config; })
 | 
						|
        (import ../Common/desktop.nix { inherit inputs pkgs config; })
 | 
						|
        (import ../Common/nfs.nix { inherit pkgs serverIP; })
 | 
						|
        (import ../Common/android.nix { inherit pkgs; })
 | 
						|
    ];
 | 
						|
 | 
						|
    # Kernel
 | 
						|
    boot.kernelPackages = pkgs.linuxPackages_latest;
 | 
						|
 | 
						|
    # AMD CPU
 | 
						|
    boot.extraModulePackages = [ config.boot.kernelPackages.zenpower ];
 | 
						|
    boot.kernelModules = [ "zenpower amd_pstate=active" ];
 | 
						|
    boot.kernelParams = ["amd_pstate=active"];
 | 
						|
    boot.initrd.kernelModules = [ "amdgpu" ];
 | 
						|
 | 
						|
    hardware.graphics.extraPackages = with pkgs; [
 | 
						|
        rocmPackages.clr.icd
 | 
						|
    ];
 | 
						|
    systemd.tmpfiles.rules = [
 | 
						|
        "L+    /opt/rocm/hip   -    -    -     -    ${pkgs.rocmPackages.clr}"
 | 
						|
    ];
 | 
						|
    environment.systemPackages = with pkgs; [
 | 
						|
        clinfo
 | 
						|
        rocmPackages.rpp
 | 
						|
        rocmPackages.clr
 | 
						|
        rocmPackages.hipcc
 | 
						|
        rocmPackages.rocm-smi
 | 
						|
    ];
 | 
						|
    nixpkgs.config.rocmSupport = true;
 | 
						|
    services.ollama = {
 | 
						|
        enable = true;
 | 
						|
        acceleration = "rocm";
 | 
						|
    };
 | 
						|
    # nixpkgs.config.cudaSupport = true;
 | 
						|
    services.logind.settings.Login = {
 | 
						|
        HandlePowerKey = "suspend";
 | 
						|
    };
 | 
						|
 | 
						|
    # Virtualization
 | 
						|
    virtualisation.libvirtd.enable = true;
 | 
						|
    virtualisation.spiceUSBRedirection.enable = true;
 | 
						|
    programs.virt-manager.enable = true;
 | 
						|
    users.users.user.extraGroups = [ "libvirtd" ];
 | 
						|
 | 
						|
    networking.wg-quick.interfaces = {
 | 
						|
        wg0 = {
 | 
						|
            address = [ "10.0.0.10/24" "	2a02:a03f:83ad:2101::2/128" ];
 | 
						|
            dns = [ "10.0.0.1" "fdc9:281f:04d7:9ee9::1" ];
 | 
						|
            privateKeyFile = "/home/user/.secrets/Wireguard/Kell.key";
 | 
						|
            listenPort = 51820;
 | 
						|
            peers = [{
 | 
						|
                publicKey = "/9ppjm3yeD0duDvxrqgcHscHmftXko+0s2RbivNEy2c=";
 | 
						|
                allowedIPs = [ "10.0.0.1/8" ];
 | 
						|
                endpoint = "192.168.1.1:13231";
 | 
						|
            }];
 | 
						|
        };
 | 
						|
    };
 | 
						|
 | 
						|
    networking.bridges = {
 | 
						|
        "br0" = {
 | 
						|
            interfaces = [ "enp5s0" ];
 | 
						|
        };
 | 
						|
    };
 | 
						|
    networking.interfaces.br0.useDHCP = lib.mkDefault true;
 | 
						|
    # networking.interfaces.wlan0.useDHCP = lib.mkDefault true;
 | 
						|
    boot.kernel.sysctl."net.ipv6.conf.enp5s0.disable_ipv6" = true;
 | 
						|
 | 
						|
    # networking.wireless.iwd.enable = true;
 | 
						|
    # networking.wireless.iwd.settings = {
 | 
						|
    #     IPv6 = {
 | 
						|
    #         Enabled = true;
 | 
						|
    #     };
 | 
						|
    #     Settings = {
 | 
						|
    #         AutoConnect = true;
 | 
						|
    #     };
 | 
						|
    # };
 | 
						|
 | 
						|
 | 
						|
    # Programs & Services
 | 
						|
    programs.gnupg.agent.enable = true;
 | 
						|
    services.sunshine = {
 | 
						|
        enable = true;
 | 
						|
        autoStart = false;
 | 
						|
        capSysAdmin = true;
 | 
						|
        openFirewall = true;
 | 
						|
    };
 | 
						|
    programs.steam = {
 | 
						|
        enable = true;
 | 
						|
        gamescopeSession.enable = true;
 | 
						|
    };
 | 
						|
 | 
						|
    specialisation = {
 | 
						|
        vfio.configuration = {
 | 
						|
            boot.blacklistedKernelModules = [ "k10temp" "nvidia" "nouveau" "radeon" "amdgpu"];
 | 
						|
            boot = {
 | 
						|
                initrd.kernelModules = [
 | 
						|
                    "kvm-amd"
 | 
						|
                    "vfio_pci"
 | 
						|
                    "vfio"
 | 
						|
                    "vfio_iommu_type1"
 | 
						|
                    # "amdgpu"
 | 
						|
                    # "nvidia_modeset"
 | 
						|
                    # "nvidia"
 | 
						|
                    # "nvidia_uvm"
 | 
						|
                    # "nvidia_drm"
 | 
						|
                ];
 | 
						|
                kernelParams = [
 | 
						|
                    "amd_pstate=active"
 | 
						|
                    "amd_iommu=on"
 | 
						|
                    "vfio-pci.ids=10de:1b80,10de:10f0,1002:67df,1002:aaf0,1002:687f,1002:aaf8"
 | 
						|
                ];
 | 
						|
                postBootCommands = ''
 | 
						|
                    DEVS="0000:0b:00.0 0000:0b:00.1 0000:05:00.0 0000:05:00.1
 | 
						|
                    for DEV in $DEVS; do
 | 
						|
                    echo "vfio-pci" > /sys/bus/pci/devices/$DEV/driver_override
 | 
						|
                    done
 | 
						|
                    modprobe -i vfio-pci
 | 
						|
                    '';
 | 
						|
            };
 | 
						|
            boot.extraModprobeConfig = "options vfio-pci ids=10de:1b80,10de:10f0,1002:67df,1002:aaf0,1002:687f,1002:aaf8";
 | 
						|
            services.greetd.enable = lib.mkForce false;
 | 
						|
        };
 | 
						|
        vfio-nvidia.configuration = {
 | 
						|
            boot.blacklistedKernelModules = [ "k10temp" "nvidia" "nouveau" ];
 | 
						|
            boot = {
 | 
						|
                initrd.kernelModules = [
 | 
						|
                    "kvm-amd"
 | 
						|
                    "vfio_pci"
 | 
						|
                    "vfio"
 | 
						|
                    "vfio_iommu_type1"
 | 
						|
                    "amdgpu"
 | 
						|
                ];
 | 
						|
                kernelParams = [
 | 
						|
                    "amd_pstate=active"
 | 
						|
                    "amd_iommu=on"
 | 
						|
                    "vfio-pci.ids=10de:1b80,10de:10f0"
 | 
						|
                ];
 | 
						|
                postBootCommands = ''
 | 
						|
                    DEVS="0000:0b:00.0 0000:0b:00.1
 | 
						|
                    for DEV in $DEVS; do
 | 
						|
                    echo "vfio-pci" > /sys/bus/pci/devices/$DEV/driver_override
 | 
						|
                    done
 | 
						|
                    modprobe -i vfio-pci
 | 
						|
                    '';
 | 
						|
            };
 | 
						|
            boot.extraModprobeConfig = "options vfio-pci ids=10de:1b80,10de:10f0";
 | 
						|
        };
 | 
						|
    };
 | 
						|
    fonts.fontDir.enable = true;
 | 
						|
    hardware.sane = {
 | 
						|
        enable = true;
 | 
						|
        extraBackends = [
 | 
						|
            (pkgs.epsonscan2.override { withNonFreePlugins = true; withGui = true; } )
 | 
						|
        ];
 | 
						|
    };
 | 
						|
}
 |