modifications to steamdeck hardware, allow for hp printing and switched up v4lloopback module. included cachix in again, along with devenv support

This commit is contained in:
jeirmeister 2024-11-07 11:05:45 -08:00
parent d475f895a0
commit 82a02d7257
8 changed files with 201 additions and 90 deletions

18
hosts/common.nix Normal file
View File

@ -0,0 +1,18 @@
{ config, pkgs, ... }:
{
# Enable CUPS printing service
services.printing.enable = true;
# Enable network printer discovery
services.avahi = {
enable = true;
nssmdns4 = true;
openFirewall = true;
};
# Install HP printer drivers
services.printing.drivers = [
pkgs.hplip
pkgs.hplipWithPlugin # For printers requiring proprietary plugins
];
}

View File

@ -0,0 +1,13 @@
# WARN: this file will get overwritten by $ cachix use <name>
{ pkgs, lib, ... }:
let
folder = ./cachix;
toImport = name: value: folder + ("/" + name);
filterCaches = key: value: value == "regular" && lib.hasSuffix ".nix" key;
imports = lib.mapAttrsToList toImport (lib.filterAttrs filterCaches (builtins.readDir folder));
in
{
inherit imports;
nix.settings.substituters = [ "https://cache.nixos.org/" ];
}

View File

@ -0,0 +1,13 @@
{
nix = {
settings = {
substituters = [
"https://devenv.cachix.org"
];
trusted-public-keys = [
"devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw="
];
};
};
}

View File

@ -1,4 +1,4 @@
{ pkgs, lib, ... }:
{ config, pkgs, lib, ... }:
let
jovianNixosRev = "f6423d86bec22c25a576b23262495c5536b0d069";
@ -18,29 +18,23 @@ in
{
imports = [
./hardware-configuration.nix
(fetchTarball "https://github.com/nix-community/nixos-vscode-server/tarball/master")
(jovianNixos + "/modules")
./cachix.nix
];
# Basic System Configuration
system.stateVersion = "24.05";
networking = {
hostName = "steamnix";
networkmanager.enable = true;
# Printing Configuration
services.printing = {
enable = true;
drivers = [ pkgs.hplipWithPlugin ];
};
time.timeZone = "America/Los_Angeles";
i18n = {
defaultLocale = "en_US.UTF-8";
extraLocaleSettings = {
LC_ADDRESS = "en_US.UTF-8";
LC_IDENTIFICATION = "en_US.UTF-8";
LC_MEASUREMENT = "en_US.UTF-8";
LC_MONETARY = "en_US.UTF-8";
LC_NAME = "en_US.UTF-8";
LC_NUMERIC = "en_US.UTF-8";
LC_PAPER = "en_US.UTF-8";
LC_TELEPHONE = "en_US.UTF-8";
LC_TIME = "en_US.UTF-8";
};
services.avahi = {
enable = true;
nssmdns = true;
};
# Nix Package Manager Configuration
@ -53,12 +47,18 @@ in
nix.settings = {
experimental-features = [ "nix-command" "flakes" ];
substituters = [ "cache.nixos.org" ];
substituters = [ "https://cache.nixos.org" ];
allowed-users = [ "@wheel" "jeirmeister" ];
auto-optimise-store = true;
};
# Steam Deck Specific Configuration
nix.extraOptions = ''
trusted-users = root jeirmeister
extra-substituters = https://nixpkgs-python.cachix.org https://devenv.cachix.org
extra-trusted-public-keys = nixpkgs-python.cachix.org-1:hxjI7pFxTyuTHn2NkvWCrAUcNZLNS3ZAvfYNuYifcEU= devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw=
'';
# Steam Deck Configuration
jovian = {
hardware.has.amd.gpu = true;
devices.steamdeck = {
@ -77,11 +77,6 @@ in
workarounds.ignoreMissingKernelModules = true;
};
# Hardware and Display Configuration
hardware.video = {
displaylink.enable = true;
};
# Desktop Environment and Display Configuration
services.xserver = {
enable = true;
@ -89,14 +84,15 @@ in
videoDrivers = [ "displaylink" "modesetting" ];
desktopManager.plasma6 = {
enable = true;
extraSessionCommands = ''
${pkgs.xorg.xrandr}/bin/xrandr --setprovideroutputsource 2 0;
'';
};
displayManager = {
sddm = {
enable = true;
wayland = true;
settings = {
Wayland = {
EnableHiDPI = true;
};
};
};
sessionCommands = ''
${lib.getBin pkgs.xorg.xrandr}/bin/xrandr --setprovideroutputsource 2 0
@ -104,6 +100,17 @@ in
};
};
# VS Code Server Configuration
services.vscode-server = {
enable = true;
enableFHS = true;
};
programs.nix-ld = {
enable = true;
package = pkgs.nix-ld-rs;
};
# System Services Configuration
services = {
# Audio Configuration
@ -139,6 +146,21 @@ in
};
};
# Uncomment when ready to use Immersed
# immersed-video = {
# description = "Load v4l2loopback module for Immersed";
# wantedBy = [ "multi-user.target" ];
# after = [ "systemd-modules-load.service" ];
# requires = [ "systemd-modules-load.service" ];
# serviceConfig = {
# Type = "oneshot";
# RemainAfterExit = true;
# ExecStartPre = "${pkgs.kmod}/bin/modprobe -r v4l2loopback || true";
# ExecStart = "${pkgs.kmod}/bin/modprobe v4l2loopback exclusive_caps=1 video_nr=0 card_label='Immersed Virtual Camera'";
# ExecStop = "${pkgs.kmod}/bin/rmmod v4l2loopback || true";
# };
# };
"systemd-modules-load" = {
wantedBy = [ "multi-user.target" ];
restartIfChanged = true;
@ -147,10 +169,17 @@ in
# UDev Rules
services.udev.extraRules = ''
# Steam Deck Fan Control
SUBSYSTEM=="hwmon*", KERNEL=="hwmon*", ACTION=="add", RUN+="${pkgs.coreutils}/bin/chmod a+rw /sys/%p/pwm1"
SUBSYSTEM=="hwmon*", KERNEL=="hwmon*", ACTION=="add", RUN+="${pkgs.coreutils}/bin/chmod a+rw /sys/%p/fan1_input"
'';
# Network Configuration
networking = {
hostName = "steamnix";
networkmanager.enable = true;
};
# User Configuration
users = {
users.jeirmeister = {
@ -174,8 +203,8 @@ in
groups = {
steamos.gid = 1000;
gamepad = {};
render = {};
gamepad = { };
render = { };
};
};
@ -192,6 +221,9 @@ in
dmidecode
binutils
# Scanner & Printers
epsonscan2
# Virtual Display
linuxPackages.v4l2loopback
v4l-utils
@ -207,19 +239,21 @@ in
# Utilities
tree
];
# Locale and Time
time.timeZone = "America/Los_Angeles";
i18n = {
defaultLocale = "en_US.UTF-8";
extraLocaleSettings = {
LC_ADDRESS = "en_US.UTF-8";
LC_IDENTIFICATION = "en_US.UTF-8";
LC_MEASUREMENT = "en_US.UTF-8";
LC_MONETARY = "en_US.UTF-8";
LC_NAME = "en_US.UTF-8";
LC_NUMERIC = "en_US.UTF-8";
LC_PAPER = "en_US.UTF-8";
LC_TELEPHONE = "en_US.UTF-8";
LC_TIME = "en_US.UTF-8";
};
};
}
# TODO: Incorporate this part later
# Immersed Video Service
# immersed-video = {
# description = "Load v4l2loopback module for Immersed";
# wantedBy = [ "multi-user.target" ];
# after = [ "systemd-modules-load.service" ];
# requires = [ "systemd-modules-load.service" ];
# serviceConfig = {
# Type = "oneshot";
# RemainAfterExit = true;
# ExecStartPre = "${pkgs.kmod}/bin/modprobe -r v4l2loopback || true";
# ExecStart = "${pkgs.kmod}/bin/modprobe v4l2loopback exclusive_caps=1 video_nr=0 card_label='Immersed Virtual Camera'";
# ExecStop = "${pkgs.kmod}/bin/rmmod v4l2loopback || true";
# };
# };

View File

@ -1,39 +1,84 @@
# Do not modify this file! It was generated by nixos-generate-config
# Do not modify this file! It was generated by 'nixos-generate-config'
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, modulesPath, ... }:
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
[
(modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "usb_storage" "usbhid" "sd_mod" "sdhci_pci" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
# Hardware Configuration
hardware = {
enableRedistributableFirmware = lib.mkForce true;
firmware = lib.mkForce [ pkgs.linux-firmware ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/f3cc4aae-428e-435d-b9f7-333f7dad06b2";
fsType = "ext4";
graphics = {
enable = true;
enable32Bit = true;
extraPackages = with pkgs; [
libva
vaapiVdpau
v4l-utils
];
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/580E-5E90";
fsType = "vfat";
options = [ "fmask=0077" "dmask=0077" ];
cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
};
# Boot Configuration
boot = {
loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
};
swapDevices = [ ];
initrd = {
availableKernelModules = [
"nvme"
"xhci_pci"
"usbhid"
"usb_storage"
"sd_mod"
"sdhci_pci"
];
kernelModules = [ "amdgpu" "kvm-amd" ];
};
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
kernelModules = [ "amdgpu" "v4l2loopback" "snd-aloop" "kvm-amd" ];
extraModulePackages = [ pkgs.linuxPackages_latest.v4l2loopback ];
};
# Filesystem Configuration
fileSystems."/" = {
device = "/dev/disk/by-uuid/f3cc4aae-428e-435d-b9f7-333f7dad06b2";
fsType = "ext4";
};
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/580E-5E90";
fsType = "vfat";
options = [ "fmask=0077" "dmask=0077" ];
};
# Optional SteamOS games mount (commented out)
# fileSystems."/mnt/steamos" = {
# device = "/dev/disk/by-uuid/5261b393-9b3e-4334-9ddf-4a1eb9865905";
# fsType = "ext4";
# };
# Swap Configuration
swapDevices = [ ]; #TODO: consider releasing the zram swapfile and utilizing the one already on steamos
# Network Configuration
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.enp4s0f3u1u4u3.useDHCP = lib.mkDefault true;
# networking.interfaces.enp4s0f3u1u4u4.useDHCP = lib.mkDefault true;
# networking.interfaces.wlo1.useDHCP = lib.mkDefault true;
# Platform Configuration
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
# System State Version
system.stateVersion = "24.05";
}

View File

@ -1,13 +0,0 @@
{ config, pkgs, ... }:
{
home.packages = with pkgs; [
# Required for AppImage support
appimage-run
# Optional but useful tools for AppImage management
zlib
fuse
fuse3
];
}

View File

@ -1,8 +1,16 @@
{ config, pkgs, ... }:
{
imports = [
./appimage.nix
./tailscale.nix
home.packages = with pkgs; [
# Required for AppImage support
appimage-run
# Optional but useful tools for AppImage management
zlib
fuse
fuse3
tailscale
];
}

View File

@ -1,7 +0,0 @@
{ config, pkgs, ... }:
{
home.packages = with pkgs; [
tailscale
];
}