Compare commits

...

3 Commits

Author SHA1 Message Date
Tom Alexander
ba81687d42
Add duckstation to the steam deck. 2025-04-15 21:44:53 -04:00
Tom Alexander
144f83982d
Copy over some networking sysctls from my ansible playbook. 2025-04-11 19:38:14 -04:00
Tom Alexander
a97a03f642
Sort imports. 2025-04-11 17:41:55 -04:00
6 changed files with 528 additions and 47 deletions

View File

@ -8,64 +8,64 @@
{
imports = [
./roles/reset
./roles/global_options
./util/unfree_polyfill
./roles/iso
./roles/boot
./roles/zfs
./roles/network
./roles/firewall
./roles/zsh
./roles/zrepl
./roles/graphics
./roles/sound
./roles/sway
./roles/kanshi
./roles/2ship2harkinian
./roles/alacritty
./roles/firefox
./roles/chromium
./roles/emacs
./roles/git
./roles/fonts
./roles/gpg
./roles/waybar
./roles/qemu
./roles/wireguard
./roles/ansible
./roles/ares
./roles/ssh
./roles/python
./roles/bluetooth
./roles/boot
./roles/chromecast
./roles/chromium
./roles/docker
./roles/emacs
./roles/firefox
./roles/firewall
./roles/flux
./roles/fonts
./roles/gcloud
./roles/git
./roles/global_options
./roles/gnuplot
./roles/gpg
./roles/graphics
./roles/hydra
./roles/iso
./roles/kanshi
./roles/kodi
./roles/kubernetes
./roles/rust
./roles/media
./roles/steam
./roles/latex
./roles/launch_keyboard
./roles/lvfs
./roles/media
./roles/memtest86
./roles/network
./roles/nix_index
./roles/nvme
./roles/pcsx2
./roles/python
./roles/qemu
./roles/reset
./roles/rust
./roles/shikane
./roles/shipwright
./roles/sm64ex
./roles/sops
./roles/sound
./roles/ssh
./roles/steam
./roles/steam_run_free
./roles/sway
./roles/tekton
./roles/terraform
./roles/vnc_client
./roles/vscode
./roles/wasm
./roles/vnc_client
./roles/chromecast
./roles/memtest86
./roles/kodi
./roles/ansible
./roles/bluetooth
./roles/sm64ex
./roles/shipwright
./roles/2ship2harkinian
./roles/nix_index
./roles/flux
./roles/tekton
./roles/gnuplot
./roles/sops
./roles/gcloud
./roles/steam_run_free
./roles/pcsx2
./roles/hydra
./roles/shikane
./roles/waybar
./roles/wireguard
./roles/zfs
./roles/zrepl
./roles/zsh
./util/unfree_polyfill
];
nix.settings.experimental-features = [

View File

@ -68,4 +68,25 @@
# Set wifi to US
options cfg80211 ieee80211_regdom=US
'';
boot.kernel.sysctl = {
# Enable TCP packetization-layer PMTUD when an ICMP black hole is detected.
"net.ipv4.tcp_mtu_probing" = 1;
# Switch to bbr tcp congestion control which should be better on lossy connections like bad wifi.
# We set this in the kernel config, but include this here for unoptimized builds.
"net.ipv4.tcp_congestion_control" = "bbr";
# Don't do a slow start after a connection has been idle for a single RTO.
"net.ipv4.tcp_slow_start_after_idle" = 0;
# 3x time to accumulate filesystem changes before flushing to disk.
"vm.dirty_writeback_centisecs" = 1500;
# Adjust ttl
"net.ipv4.ip_default_ttl" = 65;
"net.ipv6.conf.all.hop_limit" = 65;
"net.ipv6.conf.default.hop_limit" = 65;
# Enable IPv6 Privacy Extensions
"net.ipv6.conf.all.use_tempaddr" = 2;
# Enable IPv6 Privacy Extensions
# This is enabled by default in nixos.
# "net.ipv6.conf.default.use_tempaddr" = 2;
};
}

View File

@ -10,6 +10,7 @@
./roles/2ship2harkinian
./roles/ares
./roles/dolphin
./roles/duckstation
./roles/global_options
./roles/graphics
./roles/pcsx2

View File

@ -11,6 +11,7 @@
config = {
me.ares.enable = true;
me.dolphin.enable = true;
me.duckstation.enable = true;
me.graphical = true;
me.optimizations.enable = true;
me.pcsx2.enable = true;

View File

@ -0,0 +1,90 @@
{
config,
lib,
pkgs,
...
}:
let
steam_duckstation = pkgs.writeScriptBin "steam_duckstation" ''
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${pkgs.libglvnd}/lib"
exec ${pkgs.duckstation}/bin/duckstation-qt "''${@}"
'';
in
{
imports = [ ];
options.me = {
duckstation.enable = lib.mkOption {
type = lib.types.bool;
default = false;
example = true;
description = "Whether we want to install duckstation.";
};
};
config = lib.mkIf config.me.duckstation.enable (
lib.mkMerge [
(lib.mkIf config.me.graphical {
home.packages = with pkgs; [
duckstation
steam_duckstation
];
home.file.".local/share/duckstation/settings.ini" = {
source = ./files/settings.ini;
};
me.persist.directories = [
".local/share/duckstation/memcards"
".local/share/duckstation/savestates"
];
me.state.directories = [
".local/share/duckstation/cache"
".local/share/duckstation/shaders"
".local/share/duckstation/screenshots"
".local/share/duckstation/videos"
".local/share/duckstation/covers"
];
nixpkgs.overlays = [
(
final: prev:
let
optimizeWithFlags =
pkg: flags:
pkg.overrideAttrs (old: {
env.CXXFLAGS = (old.env.CXXFLAGS or "") + (lib.strings.concatStringsSep " " flags);
});
original_package =
if config.me.optimizations.enable then
(optimizeWithFlags prev.duckstation [
"-march=znver2"
"-mtune=znver2"
])
else
prev.duckstation;
in
{
duckstation = pkgs.buildEnv {
name = prev.duckstation.name;
paths = [
(config.lib.nixGL.wrap original_package)
];
extraOutputsToInstall = [
"man"
"doc"
"info"
];
# We have to use 555 instead of the normal 444 here because the .desktop file ends up inside $HOME on steam deck and desktop files must be either not in $HOME or must be executable, otherwise KDE Plasma refuses to execute them.
postBuild = ''
chmod 0555 $out/share/applications/org.duckstation.DuckStation.desktop
'';
};
}
)
];
})
]
);
}

View File

@ -0,0 +1,368 @@
[Main]
SettingsVersion = 3
EmulationSpeed = 1
FastForwardSpeed = 0
TurboSpeed = 0
SyncToHostRefreshRate = false
IncreaseTimerResolution = true
InhibitScreensaver = true
StartPaused = false
StartFullscreen = false
PauseOnFocusLoss = true
PauseOnControllerDisconnection = false
SaveStateOnExit = true
CreateSaveStateBackups = true
SaveStateCompression = ZstDefault
ConfirmPowerOff = false
EnableDiscordPresence = false
LoadDevicesFromSaveStates = false
DisableAllEnhancements = false
RewindEnable = false
RewindFrequency = 10
RewindSaveSlots = 10
RunaheadFrameCount = 0
SetupWizardIncomplete = false
[Console]
Region = Auto
Enable8MBRAM = false
EnableCheats = false
[PINE]
Enabled = false
Slot = 28011
[CPU]
ExecutionMode = Recompiler
OverclockEnable = false
OverclockNumerator = 1
OverclockDenominator = 1
RecompilerMemoryExceptions = false
RecompilerBlockLinking = true
RecompilerICache = false
FastmemMode = MMap
[GPU]
Renderer = Automatic
Adapter =
ResolutionScale = 3
Multisamples = 1
UseDebugDevice = false
DisableShaderCache = false
DisableDualSourceBlend = false
DisableFramebufferFetch = false
DisableTextureBuffers = false
DisableTextureCopyToSelf = false
DisableMemoryImport = false
DisableRasterOrderViews = false
PerSampleShading = false
UseThread = true
ThreadedPresentation = false
UseSoftwareRendererForReadbacks = false
TrueColor = true
Debanding = false
ScaledDithering = true
ForceRoundTextureCoordinates = false
AccurateBlending = false
TextureFilter = Nearest
SpriteTextureFilter =
LineDetectMode = Disabled
DownsampleMode = Disabled
DownsampleScale = 1
WireframeMode = Disabled
DisableInterlacing = true
ForceNTSCTimings = false
WidescreenHack = false
ChromaSmoothing24Bit = false
PGXPEnable = false
PGXPCulling = true
PGXPTextureCorrection = true
PGXPColorCorrection = false
PGXPVertexCache = false
PGXPCPU = false
PGXPPreserveProjFP = false
PGXPTolerance = -1
PGXPDepthBuffer = false
PGXPDisableOn2DPolygons = false
PGXPDepthClearThreshold = 300
[Display]
DeinterlacingMode = Adaptive
CropMode = Overscan
ActiveStartOffset = 0
ActiveEndOffset = 0
LineStartOffset = 0
LineEndOffset = 0
Force4_3For24Bit = false
AspectRatio = Auto (Game Native)
Alignment = Center
Rotation = Normal
Scaling = BilinearSmooth
OptimalFramePacing = false
PreFrameSleep = false
SkipPresentingDuplicateFrames = false
PreFrameSleepBuffer = 2
VSync = true
DisableMailboxPresentation = true
ExclusiveFullscreenControl = Automatic
ScreenshotMode = InternalResolution
ScreenshotFormat = PNG
ScreenshotQuality = 85
CustomAspectRatioNumerator = 0
ShowOSDMessages = true
ShowFPS = false
ShowSpeed = false
ShowResolution = false
ShowLatencyStatistics = false
ShowGPUStatistics = false
ShowCPU = false
ShowGPU = false
ShowFrameTimes = false
ShowStatusIndicators = true
ShowInputs = false
ShowEnhancements = false
OSDScale = 100
StretchVertically = false
[CDROM]
ReadaheadSectors = 8
MechaconVersion = VC1A
RegionCheck = false
LoadImageToRAM = false
LoadImagePatches = false
MuteCDAudio = false
ReadSpeedup = 1
SeekSpeedup = 1
[Audio]
Backend = Cubeb
Driver =
OutputDevice =
StretchMode = TimeStretch
BufferMS = 50
OutputLatencyMS = 20
OutputLatencyMinimal = false
StretchSequenceLengthMS = 30
StretchSeekWindowMS = 20
StretchOverlapMS = 10
StretchUseQuickSeek = false
StretchUseAAFilter = false
OutputVolume = 100
FastForwardVolume = 100
OutputMuted = false
[Hacks]
UseOldMDECRoutines = false
ExportSharedMemory = false
DMAMaxSliceTicks = 1000
DMAHaltTicks = 100
GPUFIFOSize = 16
GPUMaxRunAhead = 128
[PCDrv]
Enabled = false
EnableWrites = false
Root =
[BIOS]
TTYLogging = false
PatchFastBoot = false
SearchDirectory = ../../../.persist/manual/games/sony_ps2/bios
[MemoryCards]
Card1Type = PerGameTitle
Card2Type = None
UsePlaylistTitle = true
Directory = memcards
[ControllerPorts]
MultitapMode = Disabled
PointerXScale = 8
PointerYScale = 8
PointerXInvert = false
PointerYInvert = false
[Cheevos]
Enabled = false
ChallengeMode = false
Notifications = true
LeaderboardNotifications = true
SoundEffects = true
Overlays = true
EncoreMode = false
SpectatorMode = false
UnofficialTestMode = false
UseFirstDiscFromPlaylist = true
UseRAIntegration = false
NotificationsDuration = 5
LeaderboardsDuration = 10
[Logging]
LogLevel = Info
LogFilter =
LogTimestamps = true
LogToConsole = true
LogToDebug = false
LogToWindow = false
LogToFile = false
[Debug]
ShowVRAM = false
DumpCPUToVRAMCopies = false
DumpVRAMToCPUCopies = false
ShowGPUState = false
ShowCDROMState = false
ShowSPUState = false
ShowTimersState = false
ShowMDECState = false
ShowDMAState = false
[TextureReplacements]
EnableVRAMWriteReplacements = false
PreloadTextures = false
DumpVRAMWrites = false
DumpVRAMWriteForceAlphaChannel = true
DumpVRAMWriteWidthThreshold = 128
DumpVRAMWriteHeightThreshold = 128
[MediaCapture]
Backend = FFmpeg
Container = mp4
VideoCapture = true
VideoWidth = 640
VideoHeight = 480
VideoAutoSize = false
VideoBitrate = 6000
VideoCodec =
VideoCodecUseArgs = false
AudioCodecArgs =
AudioCapture = true
AudioBitrate = 128
AudioCodec =
AudioCodecUseArgs = false
[Folders]
Cache = cache
Cheats = cheats
Covers = covers
Dumps = dump
GameIcons = gameicons
GameSettings = gamesettings
InputProfiles = inputprofiles
SaveStates = savestates
Screenshots = screenshots
Shaders = shaders
Textures = textures
UserResources = resources
Videos = videos
[InputSources]
SDL = true
SDLControllerEnhancedMode = false
SDLPS5PlayerLED = false
XInput = false
RawInput = false
[Pad1]
Type = AnalogController
Up = SDL-0/DPadUp
Right = SDL-0/DPadRight
Down = SDL-0/DPadDown
Left = SDL-0/DPadLeft
Triangle = SDL-0/Y
Circle = SDL-0/B
Cross = SDL-0/A
Square = SDL-0/X
Select = SDL-0/Back
Start = SDL-0/Start
L1 = SDL-0/LeftShoulder
R1 = SDL-0/RightShoulder
L2 = SDL-0/+LeftTrigger
R2 = SDL-0/+RightTrigger
L3 = SDL-0/LeftStick
R3 = SDL-0/RightStick
LLeft = SDL-0/-LeftX
LRight = SDL-0/+LeftX
LDown = SDL-0/+LeftY
LUp = SDL-0/-LeftY
RLeft = SDL-0/-RightX
RRight = SDL-0/+RightX
RDown = SDL-0/+RightY
RUp = SDL-0/-RightY
Analog = SDL-0/Guide
SmallMotor = SDL-0/SmallMotor
LargeMotor = SDL-0/LargeMotor
[Pad2]
Type = None
[Pad3]
Type = None
[Pad4]
Type = None
[Pad5]
Type = None
[Pad6]
Type = None
[Pad7]
Type = None
[Pad8]
Type = None
[Hotkeys]
FastForward = Keyboard/Tab
TogglePause = Keyboard/Space
Screenshot = Keyboard/F10
ToggleFullscreen = Keyboard/F11
OpenPauseMenu = Keyboard/Escape
LoadSelectedSaveState = Keyboard/F1
SaveSelectedSaveState = Keyboard/F2
SelectPreviousSaveStateSlot = Keyboard/F3
SelectNextSaveStateSlot = Keyboard/F4
[UI]
UnofficialBuildWarningConfirmed = true
MainWindowGeometry = AdnQywADAAAAAAAAAAAAAAAAAx8AAAKOAAAAAAAAAAAAAAMfAAACjgAAAAAAAAAABQAAAAAAAAAAAAAAAx8AAAKO
MainWindowState = AAAA/wAAAAD9AAAAAAAAAyAAAAJjAAAABAAAAAQAAAAIAAAACPwAAAABAAAAAgAAAAEAAAAOAHQAbwBvAGwAQgBhAHIAAAAAAP////8AAAAAAAAAAA==
[AutoUpdater]
CheckAtStartup = false
[GameList]
RecursivePaths = /home/deck/.persist/manual/games/sony_ps1/roms