This repository has been archived on 2025-03-05. You can view files and clone it, but cannot push or open issues or pull requests.

155 lines
4.7 KiB
Nix
Raw Normal View History

2023-04-09 11:12:23 +02:00
{ config, inputs, pkgs, lib, ... }:
2022-12-31 13:07:15 +01:00
with pkgs;
2022-12-30 13:05:46 +01:00
let
2022-12-31 13:07:15 +01:00
nvidia-offload = writeShellScriptBin "nvidia-offload" ''
2022-12-30 13:05:46 +01:00
#!/bin/bash
export __NV_PRIME_RENDER_OFFLOAD=1
export __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0
export __GLX_VENDOR_LIBRARY_NAME=nvidia
export __VK_LAYER_NV_optimus=NVIDIA_only
exec "$@"
'';
in {
2022-12-31 13:07:15 +01:00
imports = [
./hardware.nix
./hardware-configuration.nix # Include the results of the hardware scan.
2023-06-27 12:35:30 +02:00
./vfio.nix
2022-12-31 13:07:15 +01:00
../common/users/m3tam3re
../common/base
./services
2022-12-30 13:05:46 +01:00
];
2023-06-27 12:35:30 +02:00
2022-12-30 13:05:46 +01:00
specialisation = {
2023-06-27 12:35:30 +02:00
"EX-Display".configuration = {
2022-12-31 13:07:15 +01:00
system.nixos.tags = [ "Externer-Monitor" ];
2023-04-14 06:23:31 +02:00
services.xserver.videoDrivers = [ "nvidia" ];
2022-12-30 13:05:46 +01:00
hardware.nvidia.prime.offload.enable = lib.mkForce false;
hardware.nvidia.powerManagement.finegrained = lib.mkForce false;
};
};
specialisation = {
2023-06-27 12:35:30 +02:00
"DUAL-Display".configuration = {
2022-12-31 13:07:15 +01:00
system.nixos.tags = [ "Dual-Monitor" ];
2023-04-14 06:23:31 +02:00
services.xserver.videoDrivers = [ "nvidia" ];
2022-12-30 13:05:46 +01:00
hardware.nvidia.prime.offload.enable = lib.mkForce false;
hardware.nvidia.prime.sync.enable = lib.mkForce true;
hardware.nvidia.powerManagement.finegrained = lib.mkForce false;
};
};
2023-06-27 12:35:30 +02:00
specialisation = {
"VFIO".configuration = {
system.nixos.tags = [ "GPU-passthrough" ];
vfio.enable = true;
};
};
2022-12-30 13:05:46 +01:00
# Bootloader.
# boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
boot.loader.efi.efiSysMountPoint = "/boot/efi";
boot.loader.grub.enable = true;
boot.loader.grub.efiSupport = true;
boot.loader.grub.device = "nodev";
boot.loader.grub.useOSProber = true;
2023-04-06 17:12:19 +02:00
hardware.tuxedo-keyboard.enable = true;
boot.extraModulePackages = with config.boot.kernelPackages; [ v4l2loopback ];
boot.kernelModules = [ "v4l2loopback" ];
2023-04-09 11:12:23 +02:00
2022-12-30 13:05:46 +01:00
boot.kernelParams = [
"tuxedo_keyboard.mode=0" # https://github.com/tuxedocomputers/tuxedo-keyboard#kernelparam
"tuxedo_keyboard.brightness=255"
"tuxedo_keyboard.color_left=0xff0a0a"
];
# Setup keyfile
boot.initrd.secrets = { "/crypto_keyfile.bin" = null; };
boot.extraModprobeConfig = ''
options kvm_intel nested=1
options kvm_intel emulate_invalid_guest_state=0
options kvm ignore_msrs=1
2023-04-06 17:12:19 +02:00
options v4l2loopback exclusive_caps=1 max_buffers=2
2022-12-30 13:05:46 +01:00
'';
boot.initrd.luks.devices."luks-a7b1ba69-0951-4347-886e-4c0c24c2b871".keyFile =
"/crypto_keyfile.bin";
networking.hostName = "m3-nix"; # Define your hostname.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
networking.firewall.extraCommands =
"iptables -t raw -A OUTPUT -p udp -m udp --dport 137 -j CT --helper netbios-ns";
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Enable networking
networking.networkmanager.enable = true;
2023-04-06 17:12:19 +02:00
services.avahi = {
enable = true;
nssmdns = true;
publish = {
addresses = true;
workstation = true;
userServices = true;
};
};
2023-06-13 06:20:48 +02:00
2023-04-09 11:12:23 +02:00
# xdg.portal = {
# enable = true;
# wlr.enable = true;
# extraPortals = [ pkgs.xdg-desktop-portal-gtk pkgs.xdg-desktop-portal-wlr ];
# };
programs.hyprland = {
enable = true;
nvidiaPatches = true;
};
2023-04-06 17:12:19 +02:00
programs.steam = {
enable = true;
remotePlay.openFirewall = true;
dedicatedServer.openFirewall = true;
};
2023-04-12 19:30:43 +02:00
programs.fish.enable = true;
2023-06-13 06:20:48 +02:00
programs.thunar = {
enable = true;
plugins = with pkgs.xfce; [ thunar-archive-plugin thunar-volman ];
};
2023-04-14 07:24:45 +02:00
age = {
secrets = {
tailscale-key.file = ../../secrets/tailscale-key.age;
2023-05-30 11:50:34 +02:00
wg-key.file = ../../secrets/wg-key.age;
2023-04-14 07:24:45 +02:00
};
2023-04-21 05:18:13 +02:00
identityPaths = [ "/root/.ssh/lkk-nix-1" ];
2023-04-14 07:24:45 +02:00
};
2023-06-13 06:20:48 +02:00
2022-12-31 13:07:15 +01:00
time.timeZone = "Europe/Berlin";
2022-12-30 13:05:46 +01:00
i18n.defaultLocale = "de_DE.utf8";
console.keyMap = "de";
2023-05-06 15:30:50 +02:00
environment.systemPackages = [ nvidia-offload neovim wally-cli ];
2023-04-06 17:12:19 +02:00
nix.extraOptions = ''
experimental-features = nix-command
'';
2022-12-31 13:07:15 +01:00
nix = {
settings = { experimental-features = "nix-command flakes"; };
gc = {
automatic = true;
options = "--delete-older-than 30d";
};
optimise.automatic = true;
2022-12-30 13:05:46 +01:00
};
2023-06-17 17:03:03 +02:00
systemd.extraConfig = ''
DefaultTimeoutStopSec=10s
'';
2022-12-30 13:05:46 +01:00
nixpkgs.config.allowUnfree = true;
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leavecatenate(variables, "bootdev", bootdev)
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
2023-06-12 06:18:54 +02:00
system.stateVersion = "23.11"; # Did you read the comment?
2022-12-30 13:05:46 +01:00
}