This commit is contained in:
mjallen18
2025-02-20 11:32:05 -06:00
parent 43ecae9920
commit 948e4b199a
22 changed files with 218 additions and 276 deletions

View File

@@ -21,7 +21,7 @@
* [nix-community.nix](./cachix/nix-community.nix)
### NAS
* [boot.nix](./hosts/desktop/boot.nix)
* [boot.nix](./hosts/nas/boot.nix)
* [configuration.nix](./hosts/nas/configuration.nix)
* [hardware-configuration.nix](./hosts/nas/hardware-configuration.nix)
* [impermenance.nix](./hosts/nas/impermenance.nix)
@@ -33,29 +33,24 @@
* [ups.nix](./hosts/desktop/ups.nix)
* [samba](./modules/samba)
* nas-apps
* [beszel](./modules/apps/beszel)
* [beszel-agent](./modules/apps/beszel-agent)
* [arrs](./hosts/nas/apps/arrs/default.nix)
* [collabora](./modules/apps/collabora)
* [deluge](./modules/apps/deluge)
* [discover-wrapped](./modules/apps/discover-wrapped)
* [free-games-claimer](./modules/apps/free-games-claimer)
* [jackett](./modules/apps/jackett)
* [jellyfin](./modules/apps/jellyfin)
* [jellyseerr](./modules/apps/jellyseerr)
* [jellyfin](./hosts/nas/apps/jellyfin/default.nix)
* [jellyseerr](./hosts/nas/apps/jellyseerr/default.nix)
* [jackett](./modules/apps/manyfold)
* [mariadb](./modules/apps/mariadb)
* [mealie](./modules/apps/mealie)
* [nextcloud](./modules/apps/nextcloud)
* [ollama](./modules/apps/ollama)
* [open-webui](./modules/apps/open-webui)
* [orca-slicer](./modules/apps/orca-slicer)
* [radarr](./modules/apps/radarr)
* [sabnzbd](./modules/apps/sabnzbd)
* [sonarr](./modules/apps/sonarr)
* [swag](./modules/apps/swag)
* [nextcloud](./hosts/nas/apps/nextcloud/default.nix)
* [ollama](./hosts/nas/apps/ollama/default.nix)
* [paperless](./hosts/nas/apps/paperless/default.nix)
* [tdarr](./modules/apps/tdarr)
* [vscode](./modules/apps/vscode)
* [wireguard](./modules/apps/wireguard)
* [traefik](./hosts/nas/apps/traefik/default.nix)
* [wireguard](./modules/apps/your-spotify)
### Raspberry Pi 4
* [configuration.nix](./hosts/pi4/configuration.nix)
* [hardware-configuration.nix](./hosts/pi4/hardware-configuration.nix)
* [docker](./hosts/pi4/docker-pi4.nix)

26
flake.lock generated
View File

@@ -827,7 +827,8 @@
"nixos-hardware": "nixos-hardware",
"nixpkgs-stable": "nixpkgs-stable_2",
"nixpkgs-unstable": "nixpkgs-unstable",
"sops-nix": "sops-nix"
"sops-nix": "sops-nix",
"steam-rom-manager": "steam-rom-manager"
}
},
"rust-analyzer-src": {
@@ -904,6 +905,29 @@
"type": "github"
}
},
"steam-rom-manager": {
"inputs": {
"home-manager": [
"home-manager"
],
"nixpkgs": [
"nixpkgs-unstable"
]
},
"locked": {
"lastModified": 1740069483,
"narHash": "sha256-AnuEZpuwFW34wQECYrtw30dHq4njDYFyBqkDazjqKCo=",
"owner": "mjallen18",
"repo": "nix-steam-rom-manager",
"rev": "76384ebbceb7d2bd82fed131d0097b0c75467538",
"type": "github"
},
"original": {
"owner": "mjallen18",
"repo": "nix-steam-rom-manager",
"type": "github"
}
},
"systems": {
"locked": {
"lastModified": 1689347949,

View File

@@ -65,6 +65,12 @@
jovian.url = "github:Jovian-Experiments/Jovian-NixOS";
steam-rom-manager = {
url = "github:mjallen18/nix-steam-rom-manager";
inputs.nixpkgs.follows = "nixpkgs-unstable";
inputs.home-manager.follows = "home-manager";
};
# cosmic = {
# url = "github:lilyinstarlight/nixos-cosmic";
# inputs.nixpkgs.follows = "nixpkgs-unstable";
@@ -91,6 +97,7 @@
crowdsec,
manyfold,
jovian,
steam-rom-manager,
}@inputs:
let
inherit (self) outputs;
@@ -110,12 +117,17 @@
lanzaboote.nixosModules.lanzaboote
./hosts/desktop/configuration.nix
./share/impermanence
# chaotic.nixosModules.default
chaotic.nixosModules.default
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.matt = import ./hosts/desktop/home.nix;
home-manager.users.matt = { pkgs, ...}: {
imports = [
./hosts/desktop/home.nix
steam-rom-manager.homeManagerModules.default
];
};
home-manager.backupFileExtension = "backup";
}
@@ -213,7 +225,12 @@
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.deck = import ./hosts/deck/home.nix;
home-manager.users.matt = { pkgs, ...}: {
imports = [
./hosts/desktop/home.nix
steam-rom-manager.homeManagerModules.default
];
};
home-manager.backupFileExtension = "backup";
}

View File

@@ -3,10 +3,9 @@ let
shellAliases = {
ll = "ls -alh";
update-boot = "sudo nixos-rebuild boot --max-jobs 10 --build-host admin@10.0.1.18";
update-switch = "sudo nixos-rebuild switch --max-jobs 10 --build-host admin@10.0.1.18";
update-flake = "sudo nix flake update ~/nix-config";
update-nas = "nixos-rebuild switch --use-remote-sudo --target-host admin@10.0.1.18 --build-host admin@10.0.1.18 --flake ~/nix-config#jallen-nas";
nas-ssh = "kitten ssh admin@10.0.1.18";
update-switch = "sudo nixos-rebuild switch --max-jobs 10";
update-flake = "nix flake update /etch/nixos";
nas-ssh = "ssh admin@10.0.1.18";
ducks = "du -cksh * | sort -hr | head -n 15";
};
@@ -22,40 +21,6 @@ let
};
in
{
imports = [
./steam-rom-manager.nix
];
programs.steam-rom-manager = {
enable = true;
steamUsername = "mjallen18";
# Optional: override default paths if needed
romsDirectory = "/home/deck/Emulation/roms";
steamDirectory = "/home/deck/.local/share/Steam";
emulators = {
ryujinx = {
enable = true;
package = pkgs.ryujinx-greemdev;
};
dolphin-gamecube = {
enable = true;
package = pkgs.dolphin-emu;
romFolder = "gc";
binaryName = "dolphin-emu";
fileTypes = [ ".iso" ".ISO" ".gcm" ".GCM" ".ciso" ".CISO" "rvz" ];
extraArgs = "-b -e \"\${filePath}\"";
};
pcsx2 = {
enable = true;
package = pkgs.pcsx2;
};
};
};
home.username = "deck";
home.homeDirectory = "/home/deck";
home.stateVersion = "23.11";
@@ -89,6 +54,31 @@ in
aliases = gitAliases;
};
programs.steam-rom-manager = {
enable = true;
steamUsername = "mjallen18";
# Optional: override default paths if needed
romsDirectory = "/home/deck/Emulation/roms";
steamDirectory = "/home/deck/.local/share/Steam";
emulators = {
ryujinx.enable = true;
dolphin-gamecube = {
enable = true;
package = pkgs.dolphin-emu;
romFolder = "gc";
binaryName = "dolphin-emu";
fileTypes = [ ".iso" ".ISO" ".gcm" ".GCM" ".ciso" ".CISO" "rvz" ];
extraArgs = "-b -e \"\${filePath}\"";
};
pcsx2.enable = true;
mgba.enable = true;
};
};
programs.command-not-found.enable = true;
home.packages = with pkgs; [

View File

@@ -6,48 +6,129 @@ with lib;
let
cfg = config.programs.steam-rom-manager;
# Function to find the main binary in a package
findMainBinary = pkg: name:
let
# First try to find a binary that matches the package name
pkgName = pkg.pname or (builtins.parseDrvName pkg.name).name;
# binPath = "${pkg}/bin/${pkgName}";
# Common binary name variations
commonVariants = [
pkgName # e.g., "citra"
"${pkgName}-qt" # e.g., "citra-qt"
"${pkgName}-gtk" # e.g., "citra-gtk"
"${pkgName}-emu" # e.g., "dolphin-emu"
];
# Check if any of the common variants exist
existingVariant = findFirst
(variant: builtins.pathExists "${pkg}/bin/${variant}")
null
commonVariants;
in
# Use the override if provided, otherwise try to find the binary
if name != ""
then name
else if existingVariant != null
then existingVariant
else pkgName; # Fallback to package name
# Common emulator configurations
commonEmulatorConfigs = {
ryujinx = {
romFolder = "switch";
binaryName = "Ryujinx";
fileTypes = [ ".nca" ".NCA" ".nro" ".NRO" ".nso" ".NSO" ".nsp" ".NSP" ".xci" ".XCI" ];
};
yuzu = {
romFolder = "switch";
binaryName = "yuzu";
fileTypes = [ ".nsp" ".NSP" ".xci" ".XCI" ];
};
pcsx2 = {
romFolder = "ps2";
binaryName = "pcsx2-qt";
fileTypes = [ ".iso" ".ISO" ".bin" ".BIN" ".chd" ".CHD" ];
};
rpcs3 = {
romFolder = "ps3";
binaryName = "rpcs3";
fileTypes = [ ".iso" ".ISO" ".bin" ".BIN" ".pkg" ".PKG" ];
};
dolphin-emu = {
romFolder = "gc";
binaryName = "dolphin-emu";
fileTypes = [ ".iso" ".ISO" ".gcm" ".GCM" ".ciso" ".CISO" ];
};
duckstation = {
romFolder = "psx";
binaryName = "duckstation-qt";
fileTypes = [ ".iso" ".ISO" ".bin" ".BIN" ".chd" ".CHD" ".pbp" ".PBP" ];
};
melonDS = {
romFolder = "nds";
binaryName = "melonDS";
fileTypes = [ ".nds" ".NDS" ];
};
cemu = {
romFolder = "wiiu";
binaryName = "cemu";
fileTypes = [ ".wud" ".WUD" ".wux" ".WUX" ".rpx" ".RPX" ];
};
# Added default configurations
xemu = {
romFolder = "xbox";
fileTypes = [ ".iso" ".ISO" ];
};
xenia = {
romFolder = "xbox360";
fileTypes = [ ".iso" ".ISO" ".xex" ".XEX" ];
};
ppsspp = {
romFolder = "psp";
fileTypes = [ ".iso" ".ISO" ".cso" ".CSO" ".pbp" ".PBP" ];
};
vita3k = {
romFolder = "psvita";
fileTypes = [ ".vpk" ".VPK" ];
};
mame = {
romFolder = "arcade";
fileTypes = [ ".zip" ".ZIP" ".7z" ".7Z" ];
};
dosbox = {
romFolder = "dos";
fileTypes = [ ".exe" ".EXE" ".bat" ".BAT" ".com" ".COM" ];
};
pcem = {
romFolder = "pcem";
fileTypes = [ ".img" ".IMG" ".ima" ".IMA" ];
};
snes9x = {
romFolder = "snes";
fileTypes = [ ".smc" ".SMC" ".sfc" ".SFC" ".fig" ".FIG" ];
};
mgba = {
romFolder = "gba";
fileTypes = [ ".gba" ".GBA" ];
};
mupen64plus = {
romFolder = "n64";
fileTypes = [ ".n64" ".N64" ".v64" ".V64" ".z64" ".Z64" ];
};
retroarch = {
romFolder = "retroarch";
fileTypes = [ ".zip" ".ZIP" ".7z" ".7Z" ".iso" ".ISO" ".bin" ".BIN" ".chd" ".CHD" ];
};
dolphin-triforce = {
romFolder = "triforce";
fileTypes = [ ".iso" ".ISO" ".gcm" ".GCM" ];
};
flycast = {
romFolder = "dreamcast";
fileTypes = [ ".gdi" ".GDI" ".cdi" ".CDI" ".chd" ".CHD" ];
};
citra = {
romFolder = "3ds";
fileTypes = [ ".3ds" ".3DS" ".cia" ".CIA" ".cxi" ".CXI" ];
};
demul = {
romFolder = "demul";
fileTypes = [ ".gdi" ".GDI" ".cdi" ".CDI" ".chd" ".CHD" ];
};
};
getFileTypes = name: emu:
@@ -57,6 +138,9 @@ let
mkParserConfig = name: emu:
let
# Get the binary name dynamically if not explicitly set
binaryName = findMainBinary emu.package emu.binaryName;
# We create an ordered list of key-value pairs that will maintain the exact order
# in the generated JSON output. Each field is documented for clarity.
orderedConfig = [
@@ -96,7 +180,7 @@ let
# Executable details
{ name = "executable"; value = {
path = "${emu.package}/bin/${if emu.binaryName != "" then emu.binaryName else commonEmulatorConfigs.${name}.binaryName}";
path = "${emu.package}/bin/${binaryName}";
shortcutPassthrough = false;
appendArgsToExecutable = true;
}; }
@@ -250,11 +334,6 @@ in {
type = types.package;
description = "Emulator package";
};
binaryName = mkOption {
type = types.str;
default = "";
description = "Name of the emulator binary (defaults to common configuration)";
};
romFolder = mkOption {
type = types.str;
default = "";

View File

@@ -141,4 +141,22 @@ in
];
};
};
# This option defines the first version of NixOS you have installed on this particular machine,
# and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions.
#
# Most users should NEVER change this value after the initial install, for any reason,
# even if you've upgraded your system to a new NixOS release.
#
# This value does NOT affect the Nixpkgs version your packages and OS are pulled from,
# so changing it will NOT upgrade your system.
#
# This value being lower than the current NixOS release does NOT mean your system is
# out of date, out of support, or vulnerable.
#
# Do NOT change this value unless you have manually inspected all the changes it would make to your configuration,
# and migrated your data accordingly.
#
# For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion .
system.stateVersion = "23.11"; # Did you read the comment?
}

View File

@@ -2,7 +2,7 @@
let
configLimit = 5;
default = "@saved";
kernel = pkgs.linuxPackages_latest;
kernel = pkgs.linuxPackages_cachyos;
in
{
# Configure bootloader with lanzaboot and secureboot

View File

@@ -106,6 +106,7 @@ in
];
apps.discover-wrapped.enable = lib.mkDefault false;
chaotic.mesa-git.enable = true;
nix.settings.trusted-users = lib.mkDefault [
"root"
@@ -182,20 +183,6 @@ in
};
};
# borgbackup.jobs.home-matt = {
# encryption.mode = "repokey";
# encryption.passCommand = "cat /root/borg";
# environment.BORG_RSH = "ssh -i /home/matt/.ssh/id_ed25519";
# repo = "/media/nas/backup/desktop-nix/borg/home";
# compression = "auto,zstd";
# inhibitsSleep = true;
# paths = "/home/matt";
# exclude = [
# "/home/matt/Games"
# "/home/matt/1TB"
# ];
# };
btrfs = {
autoScrub.enable = lib.mkDefault true;
autoScrub.fileSystems = lib.mkDefault [
@@ -313,16 +300,12 @@ in
lact
memtest86-efi
memtest86plus
unstable.mesa
unstable.driversi686Linux.mesa
nano
onlyoffice-bin
os-prober
nil
papirus-icon-theme
pciutils
# python3
# python3Packages.requests
stable.qemu_full
rclone
rclone-browser
@@ -338,7 +321,6 @@ in
vim
vulkan-tools
wget
# winetricks (all versions)
winetricks
# native wayland support (unstable)
wineWowPackages.waylandFull
@@ -415,26 +397,7 @@ in
enable = true;
brscan5.enable = true;
dsseries.enable = false;
# backends-package = pkgs.brscan5;
extraBackends = [ pkgs.brscan5 ];
};
};
# This option defines the first version of NixOS you have installed on this particular machine,
# and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions.
#
# Most users should NEVER change this value after the initial install, for any reason,
# even if you've upgraded your system to a new NixOS release.
#
# This value does NOT affect the Nixpkgs version your packages and OS are pulled from,
# so changing it will NOT upgrade your system.
#
# This value being lower than the current NixOS release does NOT mean your system is
# out of date, out of support, or vulnerable.
#
# Do NOT change this value unless you have manually inspected all the changes it would make to your configuration,
# and migrated your data accordingly.
#
# For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion .
system.stateVersion = "23.11"; # Did you read the comment?
}

View File

@@ -56,6 +56,26 @@ in
aliases = gitAliases;
};
programs.steam-rom-manager = {
enable = true;
steamUsername = "matt";
environmentVariables = {
romsDirectory = "/home/matt/Games/roms";
steamDirectory = "/home/matt/.local/share/Steam";
};
emulators = {
ryujinx = {
enable = true;
};
pcsx2 = {
enable = true;
};
# Add other emulators as needed
};
};
programs.command-not-found.enable = true;
home.packages = with pkgs; [
@@ -144,7 +164,6 @@ in
"org/gnome/tweaks".show-extensions-notice = false;
"org/gnome/shell".enabled-extensions = [
"appindicatorsupport@rgcjonas.gmail.com"
# "arcmenu@arcmenu.com"
"user-theme@gnome-shell-extensions.gcampax.github.com"
"tiling-assistant@leleat-on-github"
"dash-to-dock@micxgx.gmail.com"

View File

@@ -292,22 +292,4 @@ in
# tpm.enable = true;
# useSecureBoot = true;
};
# This option defines the first version of NixOS you have installed on this particular machine,
# and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions.
#
# Most users should NEVER change this value after the initial install, for any reason,
# even if you've upgraded your system to a new NixOS release.
#
# This value does NOT affect the Nixpkgs version your packages and OS are pulled from,
# so changing it will NOT upgrade your system.
#
# This value being lower than the current NixOS release does NOT mean your system is
# out of date, out of support, or vulnerable.
#
# Do NOT change this value unless you have manually inspected all the changes it would make to your configuration,
# and migrated your data accordingly.
#
# For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion .
system.stateVersion = "23.11"; # Did you read the comment?
}

View File

@@ -104,23 +104,4 @@ in
shell = pkgs.zsh;
};
};
# This option defines the first version of NixOS you have installed on this particular machine,
# and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions.
#
# Most users should NEVER change this value after the initial install, for any reason,
# even if you've upgraded your system to a new NixOS release.
#
# This value does NOT affect the Nixpkgs version your packages and OS are pulled from,
# so changing it will NOT upgrade your system - see https://nixos.org/manual/nixos/stable/#sec-upgrading for how
# to actually do that.
#
# This value being lower than the current NixOS release does NOT mean your system is
# out of date, out of support, or vulnerable.
#
# Do NOT change this value unless you have manually inspected all the changes it would make to your configuration,
# and migrated your data accordingly.
#
# For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion .
system.stateVersion = "24.05"; # Did you read the comment?
}

View File

@@ -1 +0,0 @@
nixos-rebuild switch --use-remote-sudo --target-host admin@jallen-nas.local --build-host localhost --flake .#jallen-nas

View File

@@ -1,12 +0,0 @@
#! /bin/sh
# fix-vscode-server-node.sh
# https://github.com/microsoft/vscode-remote-release/issues/648#issuecomment-503148523
cd ~/.vscode-server/bin/*
if ! ./node -e "require('process').exit(0)"
then
echo patching node binary $(readlink -f node)
rm node
ln -s $(which node)
else
echo node is working $(readlink -f node)
fi

View File

@@ -1,73 +0,0 @@
#!/usr/bin/env python3
import subprocess
import socket
import logging
from typing import List, Optional
def check_internet_connection(hosts_to_check: Optional[List[str]] = None) -> bool:
"""
Check internet connectivity by attempting to connect to reliable hosts.
:param hosts_to_check: Optional list of hosts to check.
:return: Boolean indicating if internet connection is available
"""
if hosts_to_check is None:
hosts_to_check = [
"8.8.8.8", # Google DNS
"1.1.1.1", # Cloudflare DNS
"9.9.9.9" # Quad9 DNS
]
for host in hosts_to_check:
try:
# Create a socket connection with a 5-second timeout
socket.create_connection((host, 53), timeout=5)
return True
except (socket.error, socket.timeout):
continue
return False
def reset_wifi_card() -> bool:
"""
Execute WiFi card reset commands.
:return: Boolean indicating if reset commands were successful
"""
reset_commands = [
"echo 1 | sudo -u root tee /sys/bus/pci/devices/0000:09:00.0/reset",
"sudo rmmod iwlwifi",
"sudo modprobe iwlwifi"
]
try:
for command in reset_commands:
result = subprocess.run(
command,
shell=True,
check=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
text=True
)
print(f"Executed: {command}")
print(f"Output: {result.stdout}")
return True
except subprocess.CalledProcessError as e:
print(f"Error resetting WiFi: {e}")
print(f"Error output: {e.stderr}")
return False
def main():
"""
Check internet connection and reset WiFi if not connected.
"""
if not check_internet_connection():
print("No internet connection detected. Attempting WiFi reset...")
reset_wifi_card()
else:
print("Internet connection is stable. No reset needed.")
if __name__ == "__main__":
main()

View File

@@ -1,2 +0,0 @@
#!/usr/bin/env bash
sudo nix-store --gc

View File

@@ -1,2 +0,0 @@
#!/bin/bash
nix run nix-darwin -- switch --flake ~/nix-config

View File

@@ -1,7 +0,0 @@
#!/usr/bin/env bash
zpool import -R /mnt -f "Main Pool"
zpool import -R /mnt -f "Safe SSD"
zpool import -R /mnt -f "Junk"
zfs load-key -L file:///root/main-pool.key "Main Pool"
zfs load-key -L file:///root/safe-ssd.key "Safe SSD"
zfs mount -a

View File

@@ -1,18 +0,0 @@
#! /usr/bin/env nix-shell
#! nix-shell --pure -i runghc -p "haskellPackages.ghcWithPackages (pkgs: [ pkgs.turtle ])"
{-# LANGUAGE OverloadedStrings #-}
import Turtle
main = sh $ do
homedir <- home
subdir <- ls $ homedir </> ".vscode-server/bin/"
let nodepath = subdir </> "node"
badnode <- isNotSymbolicLink nodepath
if badnode
then do
mv nodepath (subdir </> "node_backup")
symlink "/run/current-system/sw/bin/node" nodepath
echo ("Fixed " <> repr subdir)
else do
echo ("Already fixed " <> repr subdir)

View File

@@ -1 +0,0 @@
/run/current-system/sw/bin/node

View File

@@ -1,3 +0,0 @@
#!/usr/bin/env bash
sudo su - root
echo 293000000 > /sys/class/drm/card0/device/hwmon/hwmon0/power1_cap

View File

@@ -1,5 +0,0 @@
#!/usr/bin/env bash
echo 1 | sudo -u root tee /sys/bus/pci/devices/0000\:09\:00.0/reset
sudo rmmod iwlwifi
sudo modprobe iwlwifi

View File

@@ -1,2 +0,0 @@
#!/usr/bin/env bash
sudo nix flake update