Sun Aug 14 06:35:44 PM CEST 2022
This commit is contained in:
@ -1,152 +0,0 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
let
|
||||
secrets = import ../configs/secrets.nix;
|
||||
secrets-desktop = import ../configs/secrets-desktop.nix;
|
||||
be = import ../configs/borg-exclude.nix;
|
||||
in
|
||||
{
|
||||
imports =
|
||||
[
|
||||
/etc/nixos/hardware-configuration.nix
|
||||
../configs/gui.nix
|
||||
../configs/docker.nix
|
||||
../configs/libvirt.nix
|
||||
../configs/common.nix
|
||||
../configs/user-gui-applications.nix
|
||||
../configs/user-gui.nix
|
||||
../configs/user.nix
|
||||
../configs/bspwm.nix
|
||||
#../configs/pantheon.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" ];
|
||||
};
|
||||
|
||||
boot = {
|
||||
loader = {
|
||||
grub = {
|
||||
enable = true;
|
||||
version = 2;
|
||||
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;
|
||||
};
|
||||
|
||||
networking = {
|
||||
hostName = "desktop";
|
||||
useDHCP = false;
|
||||
wireguard.interfaces = {
|
||||
wg0 = {
|
||||
ips = [ "10.100.0.2/24" ];
|
||||
privateKey = secrets-desktop.wireguard-private;
|
||||
|
||||
peers = [
|
||||
{
|
||||
publicKey = secrets.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-desktop.borg-key;
|
||||
};
|
||||
extraCreateArgs = "--checkpoint-interval 600 --exclude-caches";
|
||||
environment.BORG_RSH = "ssh -i ~/.ssh/id_borg_rsa";
|
||||
paths = "/home/alex";
|
||||
repo = secrets-desktop.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;
|
||||
};
|
||||
};
|
||||
|
||||
system.stateVersion = "21.11";
|
||||
}
|
@ -17,13 +17,12 @@ in
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
boot.extraModulePackages = with pkgs.linuxPackages; [ rtl88x2bu ];
|
||||
|
||||
time.timeZone = "Europe/Berlin";
|
||||
networking = {
|
||||
hostName = "mini";
|
||||
useDHCP = false;
|
||||
# interfaces.enp3s0.useDHCP = true;
|
||||
firewall = {
|
||||
enable = false;
|
||||
# allowedTCPPorts = [ 6443 ];
|
||||
};
|
||||
networkmanager.enable = true;
|
||||
wireguard.interfaces = {
|
||||
@ -44,8 +43,28 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
services.k3s.enable = true;
|
||||
services.k3s.role = "server";
|
||||
services = {
|
||||
k3s = {
|
||||
enable = true;
|
||||
role = "server";
|
||||
};
|
||||
|
||||
system.stateVersion = "21.05";
|
||||
nextdns = {
|
||||
arguments = pkgs.lib.mkForce [
|
||||
"-config"
|
||||
secrets.nextdnshash
|
||||
"-cache-size"
|
||||
"10MB"
|
||||
"-listen"
|
||||
"0.0.0.0:53"
|
||||
"-listen"
|
||||
":::53"
|
||||
"-forwarder"
|
||||
secrets.nextdnsforwarder
|
||||
"-report-client-info"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
system.stateVersion = "22.05";
|
||||
}
|
||||
|
@ -1,224 +0,0 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
let
|
||||
nvidia-offload = pkgs.writeShellScriptBin "nvidia-offload" ''
|
||||
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 -a "$0" "$@"
|
||||
'';
|
||||
secrets-thinkpad = import ../configs/secrets-thinkpad.nix;
|
||||
be = import ../configs/borg-exclude.nix;
|
||||
in
|
||||
{
|
||||
imports =
|
||||
[
|
||||
<nixos-hardware/lenovo/thinkpad/x1-extreme>
|
||||
/etc/nixos/hardware-configuration.nix
|
||||
../configs/gui.nix
|
||||
../configs/docker.nix
|
||||
../configs/libvirt.nix
|
||||
../configs/common.nix
|
||||
../configs/user.nix
|
||||
../configs/user-gui.nix
|
||||
../configs/user-gui-applications.nix
|
||||
../configs/bspwm.nix
|
||||
# ../configs/pantheon.nix
|
||||
<home-manager/nixos>
|
||||
];
|
||||
|
||||
boot = {
|
||||
loader = {
|
||||
grub = {
|
||||
enable = true;
|
||||
device = "nodev";
|
||||
version = 2;
|
||||
efiSupport = true;
|
||||
enableCryptodisk = true;
|
||||
gfxmodeEfi = "1024x768";
|
||||
};
|
||||
efi = {
|
||||
canTouchEfiVariables = true;
|
||||
efiSysMountPoint = "/boot/efi";
|
||||
};
|
||||
};
|
||||
kernelPackages = pkgs.linuxPackages_lqx;
|
||||
plymouth.enable = true;
|
||||
initrd = {
|
||||
luks.devices."root" = {
|
||||
device = "/dev/disk/by-uuid/9e93feb7-8134-4b62-a05b-1aeade759880";
|
||||
keyFile = "/keyfile0.bin";
|
||||
allowDiscards = true;
|
||||
};
|
||||
secrets = {
|
||||
"keyfile0.bin" = "/etc/secrets/initrd/keyfile0.bin";
|
||||
"keyfile1.bin" = "/etc/secrets/initrd/keyfile1.bin";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# Data mount
|
||||
fileSystems."/data" = {
|
||||
device = "/dev/disk/by-uuid/33693f43-076d-41fc-a612-f49ab6870ccb"; # UUID for /dev/mapper/crypted-data
|
||||
encrypted = {
|
||||
enable = true;
|
||||
label = "crypted-data";
|
||||
blkDev = "/dev/disk/by-uuid/9bf1d00e-1edc-4de3-9d5e-71a6722ef193"; # UUID for /dev/sda1
|
||||
keyFile = "/keyfile1.bin";
|
||||
};
|
||||
};
|
||||
|
||||
networking.hostName = "thinkpad"; # Define your hostname.
|
||||
time.timeZone = "Europe/Berlin";
|
||||
|
||||
# The global useDHCP flag is deprecated, therefore explicitly set to false here.
|
||||
# Per-interface useDHCP will be mandatory in the future, so this generated config
|
||||
# replicates the default behaviour.
|
||||
networking.useDHCP = false;
|
||||
|
||||
# Select internationalisation properties.
|
||||
# i18n.defaultLocale = "en_US.UTF-8";
|
||||
console = {
|
||||
font = "latarcyrheb-sun32";
|
||||
keyMap = "us";
|
||||
};
|
||||
|
||||
hardware.nvidia.prime = {
|
||||
offload.enable = true;
|
||||
|
||||
# Bus ID of the Intel GPU. You can find it using lspci, either under 3D or VGA
|
||||
intelBusId = "PCI:0:2:0";
|
||||
|
||||
# Bus ID of the NVIDIA GPU. You can find it using lspci, either under 3D or VGA
|
||||
nvidiaBusId = "PCI:1:0:0";
|
||||
};
|
||||
|
||||
# hardware.bumblebee = {
|
||||
# enable = true;
|
||||
# connectDisplay = true;
|
||||
# };
|
||||
|
||||
hardware.opengl = {
|
||||
enable = true;
|
||||
driSupport32Bit = true;
|
||||
extraPackages = with pkgs; [
|
||||
intel-media-driver # LIBVA_DRIVER_NAME=iHD
|
||||
vaapiIntel # LIBVA_DRIVER_NAME=i965 (older but works better for Firefox/Chromium)
|
||||
vaapiVdpau
|
||||
libvdpau-va-gl
|
||||
];
|
||||
};
|
||||
|
||||
nixpkgs.config.packageOverrides = pkgs: rec {
|
||||
# bumblebee = pkgs.bumblebee.override {
|
||||
# extraNvidiaDeviceOptions = ''
|
||||
# Option "ProbeAllGpus" "false"
|
||||
# Option "AllowEmptyInitialConfiguration"
|
||||
# EndSection#
|
||||
|
||||
# Section "ServerLayout"
|
||||
# Identifier "Layout0"
|
||||
# Option "AutoAddDevices" "true" # Bumblebee defaults to false
|
||||
# Option "AutoAddGPU" "false"
|
||||
# EndSection
|
||||
|
||||
# Section "Screen" # Add this section
|
||||
# Identifier "Screen0"
|
||||
# Device "DiscreteNvidia"
|
||||
# '';
|
||||
# };
|
||||
vaapiIntel = pkgs.vaapiIntel.override { enableHybridCodec = true; };
|
||||
};
|
||||
|
||||
# Enable sound.
|
||||
sound.enable = true;
|
||||
hardware.pulseaudio = {
|
||||
enable = true;
|
||||
support32Bit = true;
|
||||
daemon = {
|
||||
config = {
|
||||
avoid-resampling = "yes";
|
||||
};
|
||||
};
|
||||
configFile = pkgs.runCommand "default.pa" { } ''
|
||||
sed 's/module-udev-detect$/module-udev-detect tsched=0/' \
|
||||
${pkgs.pulseaudio}/etc/pulse/default.pa > $out
|
||||
'';
|
||||
};
|
||||
hardware.sane.enable = true;
|
||||
|
||||
services = {
|
||||
thinkfan = {
|
||||
enable = true;
|
||||
levels = [
|
||||
[ 0 0 67 ]
|
||||
[ 1 65 75 ]
|
||||
[ 2 73 80 ]
|
||||
[ 3 78 85 ]
|
||||
[ 4 83 90 ]
|
||||
[ 6 88 95 ]
|
||||
[ 7 93 32767 ]
|
||||
];
|
||||
};
|
||||
xserver = {
|
||||
videoDrivers = [ "nvidia" ];
|
||||
# deviceSection = ''BusID "PCI:0:2:0"'';
|
||||
# deviceSection = ''
|
||||
# Option "TearFree" "true"
|
||||
# '';
|
||||
};
|
||||
power-profiles-daemon.enable = false;
|
||||
auto-cpufreq.enable = true;
|
||||
tlp.enable = false;
|
||||
# tlp = {
|
||||
# enable = true;
|
||||
# settings = {
|
||||
# START_CHARGE_THRESH_BAT0 = 80;
|
||||
# STOP_CHARGE_THRESH_BAT0 = 90;
|
||||
# };
|
||||
# };
|
||||
borgbackup.jobs.home = rec {
|
||||
compression = "auto,zstd";
|
||||
encryption = {
|
||||
mode = "repokey-blake2";
|
||||
passphrase = secrets-thinkpad.borg-key;
|
||||
};
|
||||
extraCreateArgs = "--list --stats --verbose --checkpoint-interval 600 --exclude-caches";
|
||||
environment.BORG_RSH = "ssh -i ~/.ssh/id_borg_rsa";
|
||||
paths = "/home/alex";
|
||||
repo = secrets-thinkpad.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 = "thinkpad";
|
||||
# server = "192.168.0.150:24800";
|
||||
# };
|
||||
|
||||
systemd.extraConfig = ''
|
||||
DefaultTimeoutStopSec=10s
|
||||
'';
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
nvidia-offload
|
||||
# xorg.xf86videointel
|
||||
intel-gpu-tools
|
||||
];
|
||||
|
||||
networking.firewall.enable = false;
|
||||
|
||||
powerManagement.powertop.enable = true;
|
||||
|
||||
system.stateVersion = "21.05";
|
||||
}
|
Reference in New Issue
Block a user