From b8ed6439008b9d634aa44c10a79c258eb2e09f33 Mon Sep 17 00:00:00 2001 From: Alexander Szczepanski Date: Mon, 11 Sep 2023 15:37:25 +0200 Subject: [PATCH] desktop-2023-09-11-15-37-25 --- configs/user.nix | 8 +- configs/wireguard.nix | 4 +- machine/desktop.nix | 173 ++++++++++++++++++++++++++++++++++++++++++ machine/framework.nix | 16 ++-- 4 files changed, 187 insertions(+), 14 deletions(-) create mode 100644 machine/desktop.nix diff --git a/configs/user.nix b/configs/user.nix index 4d7c326..5310615 100644 --- a/configs/user.nix +++ b/configs/user.nix @@ -55,7 +55,7 @@ in btop broot dfc - exa + eza ffmpeg git-secret glances @@ -169,9 +169,9 @@ in brightness-power-save = "echo 2300 | sudo tee /sys/class/backlight/intel_backlight/brightness"; ff = "find . -type f -iname"; - l = "exa --group-directories-first -l -g"; - ll = "exa --group-directories-first -l -g"; - la = "exa --group-directories-first -l -g -a"; + l = "eza --group-directories-first -l -g"; + ll = "eza --group-directories-first -l -g"; + la = "eza --group-directories-first -l -g -a"; }; }; diff --git a/configs/wireguard.nix b/configs/wireguard.nix index 824247c..72f21ed 100644 --- a/configs/wireguard.nix +++ b/configs/wireguard.nix @@ -1,10 +1,10 @@ { - wireguard-vps-public = "gXG2XaFJZq3/MDva1vbaicRs9z9XfAR2wPLHmg4hRlI="; wireguard-desktop-public = "yQH91i1Kqxet5iGi3nFMgu7h68Oie6eHOQJHMkhLmWs="; wireguard-framework-public = "plnKdyh11Z3779LpHQmfU69z7LfCfDATLSxphhcj/3U="; - wireguard-mini-public = "C9dfZUwmKLVpjeXVNkoVyMSXfogdqEK3yMgClpeYzHg="; wireguard-mbp-public = "GQZ + lfEFQxTl5K5O623tlvWjTzBEeG0gSdvVA61H1z4="; + wireguard-mini-public = "C9dfZUwmKLVpjeXVNkoVyMSXfogdqEK3yMgClpeYzHg="; wireguard-raspberrypi-public = "AB0k5pgI0fsnncNN3GkexWWbA8q/is9JaKY3x8jw4kY="; + wireguard-vps-public = "gXG2XaFJZq3/MDva1vbaicRs9z9XfAR2wPLHmg4hRlI="; wireguard-vps2-public = "fzWLlrK4RqbgBpjQLLwKxGI92aidpZUksjZ6FIrFmEE="; wireguard-vps3-public = "qfE7vQ+XavOMKgSYxa/me40auoEV3ip/vbiSzjMKgXc="; } diff --git a/machine/desktop.nix b/machine/desktop.nix new file mode 100644 index 0000000..f9be001 --- /dev/null +++ b/machine/desktop.nix @@ -0,0 +1,173 @@ +{ config, pkgs, lib, ... }: + +let + secrets = import ../configs/secrets.nix; + wireguard = import ../configs/wireguard.nix; +in +{ + imports = [ + /etc/nixos/hardware-configuration.nix + ../configs/browser.nix + ../configs/common.nix + ../configs/docker.nix + ../configs/games.nix + ../configs/gui.nix + ../configs/libvirt.nix + ../configs/pantheon.nix + ../configs/user-gui.nix + ../configs/user.nix + ]; + + # fileSystems."/".options = [ "noatime" "discard" ]; + # fileSystems."/boot".options = [ "noatime" "discard" ]; + # fileSystems."/mnt/second" = { + # device = "/dev/disk/by-uuid/49c04c91-752d-4dff-b4d9-40a0b9a7bf7c"; + # fsType = "ext4"; + # options = [ "noatime" "discard" ]; + # }; + + # nixpkgs.localSystem = { + # gcc.arch = "znver2"; + # gcc.tune = "znver2"; + # system = "x86_64-linux"; + # }; + + nix.settings.system-features = [ "nixos-test" "benchmark" "big-parallel" "kvm" "gccarch-znver2" ]; + + boot = { + initrd.systemd.enable = true; + loader = { + systemd-boot.enable = true; + efi = { + canTouchEfiVariables = true; + }; + }; + + + loader = { + grub = { + enable = true; + device = "nodev"; + efiSupport = true; + gfxmodeEfi = "1024x768"; + configurationLimit = 5; + }; + + efi.canTouchEfiVariables = true; + }; + + initrd.kernelModules = [ "amdgpu" ]; + plymouth.enable = true; + + extraModulePackages = with pkgs.linuxPackages_lqx; [ it87 ]; + kernelModules = [ "it87" "v4l2loopback" ]; + kernelPackages = pkgs.linuxPackages_lqx; + supportedFilesystems = [ "ntfs" ]; + }; + + networking = { + hostName = "desktop"; + useDHCP = false; + wireguard.interfaces = { + wg0 = { + ips = [ "10.100.0.2/24" ]; + privateKey = secrets.wireguard-desktop-private; + peers = [{ + publicKey = wireguard.wireguard-vps-public; + presharedKey = secrets.wireguard-preshared; + allowedIPs = [ "10.100.0.0/24" ]; + endpoint = "szczepan.ski:51820"; + persistentKeepalive = 25; + }]; + }; + }; + }; + + time.timeZone = "Europe/Berlin"; + + console = { + font = "latarcyrheb-sun32"; + keyMap = "us"; + }; + + hardware = { + cpu.amd.updateMicrocode = true; + + opengl = { + driSupport = true; + driSupport32Bit = true; + extraPackages = with pkgs; [ + rocm-opencl-icd + rocm-opencl-runtime + # amdvlk + ]; + # extraPackages32 = with pkgs; [ + # driversi686Linux.amdvlk + # ]; + }; + + fancontrol = { + enable = true; + config = '' + INTERVAL=10 + DEVPATH=hwmon2=devices/platform/it87.656 + DEVNAME=hwmon2=it8665 + FCTEMPS=hwmon2/pwm3=hwmon2/temp1_input hwmon2/pwm2=hwmon2/temp1_input hwmon2/pwm1=hwmon2/temp1_input + FCFANS=hwmon2/pwm3=hwmon2/fan2_input hwmon2/pwm2=hwmon2/fan1_input hwmon2/pwm1= + MINTEMP=hwmon2/pwm3=60 hwmon2/pwm2=60 hwmon2/pwm1=60 + MAXTEMP=hwmon2/pwm3=75 hwmon2/pwm2=75 hwmon2/pwm1=75 + MINSTART=hwmon2/pwm3=51 hwmon2/pwm2=51 hwmon2/pwm1=51 + MINSTOP=hwmon2/pwm3=51 hwmon2/pwm2=51 hwmon2/pwm1=51 + MINPWM=hwmon2/pwm1=51 hwmon2/pwm2=51 hwmon2/pwm3=51 + MAXPWM=hwmon2/pwm3=127 hwmon2/pwm2=204 + ''; + }; + + pulseaudio = { + enable = true; + support32Bit = true; + }; + }; + + sound.enable = true; + + services = { + netdata.enable = true; + printing.enable = true; + xserver.videoDrivers = [ "amdgpu" ]; + # xserver.deviceSection = '' + # Option "TearFree" "true" + # ''; + # hardware.xow.enable = true; + # borgbackup.jobs.home = rec { + # compression = "auto,zstd"; + # encryption = { + # mode = "repokey-blake2"; + # passphrase = secrets.borg-key; + # }; + # extraCreateArgs = "--checkpoint-interval 600 --exclude-caches"; + # environment.BORG_RSH = "ssh -i ~/.ssh/id_borg_rsa"; + # paths = "/home/alex"; + # repo = secrets.borg-repo; + # startAt = "daily"; + # user = "alex"; + # prune.keep = { + # daily = 7; + # weekly = 4; + # monthly = 6; + # }; + # extraPruneArgs = "--save-space --list --stats"; + # exclude = map (x: paths + "/" + x) be.borg-exclude; + # }; + }; + + home-manager.users.alex.services.barrier.client = { + enable = true; + enableCrypto = false; + name = "desktop"; + server = "192.168.0.168:24800"; + }; + + + system.stateVersion = "23.05"; +} diff --git a/machine/framework.nix b/machine/framework.nix index 1ed04c9..0f766a3 100644 --- a/machine/framework.nix +++ b/machine/framework.nix @@ -9,15 +9,15 @@ in /etc/nixos/hardware-configuration.nix - ../configs/gui.nix - ../configs/docker.nix - ../configs/libvirt.nix - ../configs/common.nix - ../configs/games.nix ../configs/browser.nix - ../configs/user.nix - ../configs/user-gui.nix + ../configs/common.nix + ../configs/docker.nix + ../configs/games.nix + ../configs/gui.nix + ../configs/libvirt.nix ../configs/pantheon.nix + ../configs/user-gui.nix + ../configs/user.nix /home/alex/Workspace/fw-fanctrl-nix/service.nix ]; @@ -66,7 +66,7 @@ in time.timeZone = "Europe/Berlin"; hardware = { - enableAllFirmware = true; + enableAllFirmware = true; cpu.intel.updateMicrocode = true; opengl = {