Add Framework 16 components
This commit is contained in:
parent
f59309f3cd
commit
52c7cf2a77
8 changed files with 304 additions and 0 deletions
|
@ -31,6 +31,7 @@ nix develop -c /etc/nixos/git/docs/setup.sh
|
|||
| nuc-server | Server | Server at my brothers house | ✔️ | ✔️ |
|
||||
| nixos-desktop | Personal | My main desktop | ✔️ | ❌ |
|
||||
| nixos-framework | Personal | My AMD Framework 13 laptop | ✔️ | ❌ |
|
||||
| framework16 | Personal | My AMD Framework 16 laptop | ✔️ | ❌ |
|
||||
| steamdeck | Personal | Valve Steam Deck gaming console | ✔️ | ✔️ |
|
||||
| piaware-rpi4 | Raspberry Pi | Raspberry Pi for FlightAware flight tracking software | ✔️ | ✔️ |
|
||||
| backups-rpi4 | Raspberry Pi | Raspberry Pi for rsync backups | ✔️ | ✔️ |
|
||||
|
|
|
@ -64,6 +64,7 @@
|
|||
# User Machines
|
||||
nixos-desktop = libx.mkHost { hostname = "nixos-desktop"; unfree = true; desktop = "plasma6"; };
|
||||
nixos-framework = libx.mkHost { hostname = "nixos-framework"; unfree = true; desktop = "plasma6"; };
|
||||
framework16 = libx.mkHost { hostname = "framework16"; unfree = true; desktop = "plasma6"; };
|
||||
steamdeck = libx.mkDeck { hostname = "steamdeck"; desktop = "plasma6"; };
|
||||
|
||||
# Raspberry Pi's
|
||||
|
@ -86,6 +87,7 @@
|
|||
# User Machines
|
||||
"albert@nixos-desktop" = libx.mkHome { hostname = "nixos-desktop"; desktop = "plasma6"; theme = "gruvbox"; };
|
||||
"albert@nixos-framework" = libx.mkHome { hostname = "nixos-framework"; desktop = "plasma6"; };
|
||||
"albert@framework16" = libx.mkHome { hostname = "framework16"; desktop = "plasma6"; };
|
||||
"albert@steamdeck" = libx.mkHome { hostname = "steamdeck"; desktop = "plasma6"; };
|
||||
|
||||
# Raspberry Pi's
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
|
||||
}
|
63
home-manager/hosts/framework16/desktops/hyprland/default.nix
Normal file
63
home-manager/hosts/framework16/desktops/hyprland/default.nix
Normal file
|
@ -0,0 +1,63 @@
|
|||
{ theme, ... }: {
|
||||
wayland.windowManager.hyprland = {
|
||||
settings = {
|
||||
monitor = ",highrr,auto,1.175";
|
||||
bind = [
|
||||
'', XF86AudioMute, exec, swayosd --output-volume=mute-toggle''
|
||||
'', XF86AudioPrev, exec, playerctl previous''
|
||||
'', XF86AudioNext, exec, playerctl next''
|
||||
];
|
||||
binde = [
|
||||
'', XF86AudioPlay, exec, playerctl play-pause''
|
||||
'', XF86AudioNext, exec, playerctl next''
|
||||
'', XF86MonBrightnessDown, exec, swayosd-client --brightness=lower''
|
||||
'', XF86MonBrightnessUp, exec, swayosd-client --brightness=raise''
|
||||
'', XF86AudioMute, exec, swayosd-client --output-volume=mute-toggle''
|
||||
'', XF86AudioLowerVolume, exec, swayosd-client --output-volume=lower''
|
||||
'', XF86AudioRaiseVolume, exec, swayosd-client --output-volume=raise''
|
||||
];
|
||||
bindl = [
|
||||
'',switch:on:1241ec0,exec,hyprctl keyword monitor "eDP-1, 2560x1600, 0x0, 1"''
|
||||
'',switch:off:1241ec0,exec,hyprctl keyword monitor "eDP-1, disable"''
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
home.file = {
|
||||
# Set the custom launcher script
|
||||
".config/hypr/start.sh" = {
|
||||
enable = true;
|
||||
executable = true;
|
||||
text = ''
|
||||
#!/usr/bin/env bash
|
||||
# https://wiki.hyprland.org/FAQ/#some-of-my-apps-take-a-really-long-time-to-open
|
||||
dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP &
|
||||
|
||||
# Set the wallpaper
|
||||
swww init
|
||||
|
||||
# Waybar
|
||||
waybar &
|
||||
|
||||
# Set up the idle management daemon
|
||||
swayidle -w \
|
||||
timeout 120 'swaylock -f && playerctl pause' \
|
||||
timeout 180 'hyprctl dispatch dpms off' \
|
||||
timeout 300 'systemctl suspend-then-hibernate' \
|
||||
resume 'hyprctl dispatch dpms on' \
|
||||
before-sleep 'swaylock -f' \
|
||||
before-sleep 'playerctl pause' &
|
||||
|
||||
# Automatic device mounting
|
||||
udiskie &
|
||||
|
||||
DIR=/etc/nixos/git/wallpapers/${theme}
|
||||
IMG=`ls $DIR | shuf -n 1`
|
||||
swww img $DIR/$IMG -t random &
|
||||
|
||||
# Notification listener
|
||||
mako
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
11
home-manager/hosts/framework16/desktops/plasma6/default.nix
Normal file
11
home-manager/hosts/framework16/desktops/plasma6/default.nix
Normal file
|
@ -0,0 +1,11 @@
|
|||
{ ... }: {
|
||||
programs.plasma = {
|
||||
configFile = {
|
||||
# TODO May need to fix this for the new laptop
|
||||
"kcminputrc"."Libinput/2362/628/PIXA3854:00 093A:0274 Touchpad" = {
|
||||
"NaturalScroll" = true;
|
||||
"TapDragLock" = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
91
nixos/hosts/framework16/default.nix
Normal file
91
nixos/hosts/framework16/default.nix
Normal file
|
@ -0,0 +1,91 @@
|
|||
{ inputs, config, lib, pkgs, modulesPath, ... }: {
|
||||
imports = [
|
||||
inputs.nixos-hardware.nixosModules.framework-16-7040-amd
|
||||
(modulesPath + "/installer/scan/not-detected.nix")
|
||||
./disks.nix
|
||||
../../common/services/tailscale-autoconnect.nix
|
||||
# ../../common/modules/secureboot.nix
|
||||
../../common/modules/boot.nix
|
||||
../../common/modules/udev-rules.nix
|
||||
# ../../common/modules/yubikey-auth.nix
|
||||
../../common/modules/builder.nix
|
||||
../../common/services/podman.nix
|
||||
../../common/services/geoclue.nix
|
||||
../../common/services/syncthing.nix
|
||||
../../common/services/ollama.nix
|
||||
];
|
||||
|
||||
services.ollama.acceleration = "rocm";
|
||||
services.ollama.package = pkgs.ollama-rocm;
|
||||
|
||||
hardware.bluetooth.enable = true; # enables support for Bluetooth
|
||||
hardware.bluetooth.powerOnBoot = true; # powers up the default Bluetooth controller on boot
|
||||
|
||||
services.fwupd.enable = true;
|
||||
# we need fwupd 1.9.7 to downgrade the fingerprint sensor firmware
|
||||
services.fwupd.package = (import (builtins.fetchTarball {
|
||||
url = "https://github.com/NixOS/nixpkgs/archive/bb2009ca185d97813e75736c2b8d1d8bb81bde05.tar.gz";
|
||||
sha256 = "sha256:003qcrsq5g5lggfrpq31gcvj82lb065xvr7bpfa8ddsw8x4dnysk";
|
||||
}) { inherit (pkgs) system;}).fwupd;
|
||||
|
||||
boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "thunderbolt" "usb_storage" "uas" "sd_mod" ];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ "kvm-amd" ];
|
||||
boot.extraModulePackages = [ ];
|
||||
# boot.kernelPackages = pkgs.linuxPackages_latest;
|
||||
boot.kernelParams = [ "boot.shell_on_fail" ];
|
||||
# boot.extraModulePackages = with config.boot.kernelPackages; [ acpi_call ];
|
||||
boot.kernelPackages = pkgs.linuxPackages_latest;
|
||||
|
||||
networking.useDHCP = lib.mkDefault true;
|
||||
powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand";
|
||||
hardware.keyboard.zsa.enable = true;
|
||||
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
# Set your time zone.
|
||||
# time.timeZone = "Europe/Warsaw";
|
||||
|
||||
|
||||
# Set the networking hostname:
|
||||
networking.hostName = "framework16";
|
||||
hardware = {
|
||||
graphics.enable = true;
|
||||
amdgpu.opencl.enable = true;
|
||||
};
|
||||
|
||||
|
||||
programs.gamemode = {
|
||||
enable = true;
|
||||
enableRenice = true;
|
||||
settings = {
|
||||
general = {
|
||||
renice = 10;
|
||||
};
|
||||
# Warning: GPU optimisations have the potential to damage hardware
|
||||
gpu = {
|
||||
# apply_gpu_optimisations = "accept-responsibility";
|
||||
gpu_device = 0;
|
||||
amd_performance_level = "high";
|
||||
};
|
||||
custom = {
|
||||
start = "${pkgs.libnotify}/bin/notify-send 'GameMode started'";
|
||||
end = "${pkgs.libnotify}/bin/notify-send 'GameMode ended'";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
# Game related things
|
||||
gamemode
|
||||
# WINE
|
||||
wineWowPackages.stable
|
||||
winetricks
|
||||
wineWowPackages.waylandFull
|
||||
nvtopPackages.amd
|
||||
# RGB stuff
|
||||
openrgb-with-all-plugins
|
||||
rivalcfg
|
||||
|
||||
# Other
|
||||
distrobox
|
||||
];
|
||||
}
|
87
nixos/hosts/framework16/disks.nix
Normal file
87
nixos/hosts/framework16/disks.nix
Normal file
|
@ -0,0 +1,87 @@
|
|||
{
|
||||
imports = [ ../../common/services/snapper.nix ];
|
||||
|
||||
services.cron = {
|
||||
systemCronJobs = [
|
||||
"0 17 * * * root sudo btrfs-backup root"
|
||||
"0 17 * * * root sudo btrfs-backup nix"
|
||||
# "0 17 * * * root sudo btrfs-backup home"
|
||||
];
|
||||
};
|
||||
|
||||
services.btrfs.autoScrub.enable = true;
|
||||
services.btrfs.autoScrub.interval = "weekly";
|
||||
|
||||
boot.resumeDevice = "/dev/mapper/ROOT";
|
||||
# https://sawyershepherd.org/post/hibernating-to-an-encrypted-swapfile-on-btrfs-with-nixos/
|
||||
boot.kernelParams = [ "resume_offset=533760" ];
|
||||
|
||||
disko.devices.disk.nvme0n1 = {
|
||||
type = "disk";
|
||||
device = "/dev/nvme0n1";
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
BOOT = {
|
||||
priority = 1;
|
||||
name = "BOOT";
|
||||
start = "0%";
|
||||
end = "550MiB";
|
||||
type = "EF00";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
# https://github.com/nix-community/disko/issues/527
|
||||
mountOptions = [ "umask=0077" ];
|
||||
mountpoint = "/boot";
|
||||
};
|
||||
}; # partition 1 (ESP)
|
||||
LUKS-ROOT = {
|
||||
start = "550MiB";
|
||||
end = "100%";
|
||||
content = {
|
||||
type = "luks";
|
||||
name = "ROOT";
|
||||
extraOpenArgs = [ "--allow-discards" ];
|
||||
content = {
|
||||
type = "btrfs";
|
||||
extraArgs = [ "-f" ];
|
||||
subvolumes = {
|
||||
"/root" = {
|
||||
mountpoint = "/";
|
||||
mountOptions = [ "compress=zstd" "noatime" ];
|
||||
}; # root
|
||||
"/home" = {
|
||||
mountpoint = "/home";
|
||||
mountOptions = [ "compress=zstd" "noatime" ];
|
||||
}; # home
|
||||
"/nix" = {
|
||||
mountpoint = "/nix";
|
||||
mountOptions = [ "compress=zstd" "noatime" ];
|
||||
}; # nix
|
||||
# SNAPSHOT SUBVOLS
|
||||
"/root/.snapshots" = {
|
||||
mountpoint = "/.snapshots";
|
||||
mountOptions = [ "compress=zstd" "noatime" ];
|
||||
}; # root
|
||||
"/home/.snapshots" = {
|
||||
mountpoint = "/home/.snapshots";
|
||||
mountOptions = [ "compress=zstd" "noatime" ];
|
||||
}; # home
|
||||
"/nix/.snapshots" = {
|
||||
mountpoint = "/nix/.snapshots";
|
||||
mountOptions = [ "compress=zstd" "noatime" ];
|
||||
}; # nix
|
||||
# Swap partition
|
||||
"/swap" = {
|
||||
mountpoint = "/swap";
|
||||
swap.swapfile.size = "64G";
|
||||
}; # swap
|
||||
}; # subvolumes
|
||||
}; # content.content
|
||||
}; # content
|
||||
}; # partition 2 (/ BTRFS)
|
||||
}; # partitions
|
||||
}; # content
|
||||
}; # disko.devices.disk.nvme0
|
||||
} # nix
|
46
nixos/hosts/framework16/hibernate.nix
Normal file
46
nixos/hosts/framework16/hibernate.nix
Normal file
|
@ -0,0 +1,46 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
let
|
||||
hibernateEnvironment = {
|
||||
HIBERNATE_SECONDS = "10";
|
||||
HIBERNATE_LOCK = "/var/run/autohibernate.lock";
|
||||
};
|
||||
in {
|
||||
|
||||
systemd.services."awake-after-suspend-for-a-time" = {
|
||||
description = "Sets up the suspend so that it'll wake for hibernation only if not on AC power";
|
||||
wantedBy = [ "suspend.target" ];
|
||||
before = [ "systemd-suspend.service" ];
|
||||
environment = hibernateEnvironment;
|
||||
script = ''
|
||||
if [ $(cat /sys/class/power_supply/ACAD/online) -eq 0 ]; then
|
||||
curtime=$(date +%s)
|
||||
echo "$curtime $1" >> /tmp/autohibernate.log
|
||||
echo "$curtime" > $HIBERNATE_LOCK
|
||||
${pkgs.utillinux}/bin/rtcwake -m no -s $HIBERNATE_SECONDS
|
||||
else
|
||||
echo "System is on AC power, skipping wake-up scheduling for hibernation." >> /tmp/autohibernate.log
|
||||
fi
|
||||
'';
|
||||
serviceConfig.Type = "simple";
|
||||
};
|
||||
|
||||
systemd.services."hibernate-after-recovery" = {
|
||||
description = "Hibernates after a suspend recovery due to timeout";
|
||||
wantedBy = [ "suspend.target" ];
|
||||
after = [ "systemd-suspend.service" ];
|
||||
environment = hibernateEnvironment;
|
||||
script = ''
|
||||
curtime=$(date +%s)
|
||||
sustime=$(cat $HIBERNATE_LOCK)
|
||||
rm $HIBERNATE_LOCK
|
||||
if [ $(($curtime - $sustime)) -ge $HIBERNATE_SECONDS ] ; then
|
||||
systemctl hibernate
|
||||
else
|
||||
${pkgs.utillinux}/bin/rtcwake -m no -s 1
|
||||
fi
|
||||
'';
|
||||
serviceConfig.Type = "simple";
|
||||
};
|
||||
|
||||
}
|
Loading…
Reference in a new issue