Merge branch 'dev'

This commit is contained in:
alsaiduq-lab 2025-04-05 00:54:33 -06:00
commit 505fbf5905
24 changed files with 364 additions and 132 deletions

2
.gitignore vendored
View file

@ -9,6 +9,8 @@ result
*.nix.bak
*.nix~
/nix/store/
file.txt
*~
*.swp

37
flake.lock generated
View file

@ -25,11 +25,11 @@
]
},
"locked": {
"lastModified": 1743295846,
"narHash": "sha256-hKKz07d4RV9gzxzE5Qu3RQWX8a7XpzRrP5timoxoGRQ=",
"lastModified": 1743717835,
"narHash": "sha256-LJm6FoIcUoBw3w25ty12/sBfut4zZuNGdN0phYj/ekU=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "717030011980e9eb31eb8ce011261dd532bce92c",
"rev": "66a6ec65f84255b3defb67ff45af86c844dd451b",
"type": "github"
},
"original": {
@ -44,11 +44,11 @@
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1743299372,
"narHash": "sha256-vFuxkHPd+Xpi5Bx1VCyZwYl/BbF83C+KmlbPBNVJvNU=",
"lastModified": 1743644846,
"narHash": "sha256-I217zRnDlSdWzoZi4sHaRKdY+x60tLOo8TyRshkyUBM=",
"owner": "fufexan",
"repo": "nix-gaming",
"rev": "2ab0a37308559926bddb0009dfcf16a2a5b34e2b",
"rev": "a6fac721ece856f5dd4690b41b92e7ba3a71d033",
"type": "github"
},
"original": {
@ -90,11 +90,11 @@
},
"nixpkgs_2": {
"locked": {
"lastModified": 1743231893,
"narHash": "sha256-tpJsHMUPEhEnzySoQxx7+kA+KUtgWqvlcUBqROYNNt0=",
"lastModified": 1743576891,
"narHash": "sha256-vXiKURtntURybE6FMNFAVpRPr8+e8KoLPrYs9TGuAKc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "c570c1f5304493cafe133b8d843c7c1c4a10d3a6",
"rev": "44a69ed688786e98a101f02b712c313f1ade37ab",
"type": "github"
},
"original": {
@ -108,7 +108,24 @@
"inputs": {
"home-manager": "home-manager",
"nix-gaming": "nix-gaming",
"nixpkgs": "nixpkgs_2"
"nixpkgs": "nixpkgs_2",
"rpcs3-latest": "rpcs3-latest"
}
},
"rpcs3-latest": {
"flake": false,
"locked": {
"lastModified": 1743659989,
"narHash": "sha256-qrzu2BGzaaCnUMjpqe4O/amr3fPzASUiyc8wYU5pnQQ=",
"owner": "RPCS3",
"repo": "rpcs3",
"rev": "37dbd77628f44cdef3228bdfc03127365ec7383b",
"type": "github"
},
"original": {
"owner": "RPCS3",
"repo": "rpcs3",
"type": "github"
}
}
},

156
flake.nix
View file

@ -10,6 +10,10 @@
nix-gaming = {
url = "github:fufexan/nix-gaming";
};
rpcs3-latest = {
url = "github:RPCS3/rpcs3";
flake = false;
};
};
outputs = {
@ -17,36 +21,178 @@
nixpkgs,
home-manager,
nix-gaming,
rpcs3-latest,
...
} @ inputs: let
system = "x86_64-linux";
customPkgsOverlay = final: prev:
import ./pkgs {
customPkgsOverlay = final: prev: let
customPkgs = import ./pkgs {
pkgs = prev;
lib = prev.lib;
};
in
customPkgs
// {
pugixml = prev.pugixml.overrideAttrs (oldAttrs: rec {
version = "1.15";
src = prev.fetchurl {
url = "https://github.com/zeux/pugixml/releases/download/v${version}/pugixml-${version}.tar.gz";
sha256 = "sha256-ZVreV/pwP7QhwuuaARO1BkvdsUXUFd0fiMeTU9kNURo=";
};
});
SDL3 = prev.stdenv.mkDerivation rec {
pname = "SDL3";
version = "3.1.3";
src = prev.fetchFromGitHub {
owner = "libsdl-org";
repo = "SDL";
rev = "preview-${version}";
sha256 = "sha256-S7yRcLHMPgq6+gec8l+ESxp2dJ+6Po/UNsBUXptQzMQ=";
};
nativeBuildInputs = [prev.cmake];
buildInputs = [
prev.libGL
prev.xorg.libX11
prev.xorg.libXext
prev.alsa-lib
];
cmakeFlags = [
"-DSDL_STATIC=OFF"
"-DSDL_SHARED=ON"
"-DSDL_CMAKE_DEBUG_POSTFIX="
"-DSDL_INSTALL_CMAKEDIR=${placeholder "out"}/lib/cmake/SDL3"
];
postInstall = ''
echo "SDL3 contents:" >&2
ls -lR $out >&2
if [ -f "$out/lib/cmake/SDL3/SDL3Config.cmake" ]; then
echo "SDL3Config.cmake:" >&2
cat $out/lib/cmake/SDL3/SDL3Config.cmake >&2
else
echo "ERROR: SDL3Config.cmake not found" >&2
exit 1
fi
'';
};
rpcs3 = prev.rpcs3.overrideAttrs (oldAttrs: {
nativeBuildInputs =
(oldAttrs.nativeBuildInputs or [])
++ [
prev.llvmPackages_18.llvm.dev
prev.llvmPackages_18.clang
prev.pkg-config
prev.qt6.qmake
prev.qt6.full
prev.xxd
prev.wayland-scanner
];
buildInputs =
(oldAttrs.buildInputs or [])
++ [
prev.llvmPackages_18.llvm
prev.llvmPackages_18.libclang
final.SDL3
prev.qt6.full
prev.vulkan-loader
prev.vulkan-tools
prev.wayland
prev.wayland-protocols
prev.libxkbcommon
prev.libpulseaudio
prev.libevdev
prev.udev
prev.glew
prev.libpng
prev.zstd
];
cmakeFlags =
(oldAttrs.cmakeFlags or [])
++ [
"-DCMAKE_PREFIX_PATH=${final.SDL3};${prev.qt6.full};${prev.wayland}"
"-DSDL3_DIR=${final.SDL3}/lib/cmake/SDL3"
"-DSDL3_INCLUDE_DIR=${final.SDL3}/include/SDL3"
"-DSDL3_LIBRARY=${final.SDL3}/lib/libSDL3.so"
"-DQt6_DIR=${prev.qt6.full}/lib/cmake/Qt6"
"-DWAYLAND_SCANNER=${prev.wayland-scanner}/bin/wayland-scanner"
"-DUSE_SYSTEM_FFMPEG=ON"
"-DUSE_SYSTEM_CURL=ON"
"-DUSE_SYSTEM_WOLFSSL=ON"
"-DUSE_QT=ON"
"-DUSE_VULKAN=ON"
"-DUSE_WAYLAND=ON"
"-DUSE_PULSEAUDIO=ON"
"-DUSE_LIBEVDEV=ON"
"-DUSE_SYSTEM_ZSTD=ON"
"-DUSE_DISCORD_RPC=ON"
"-DCMAKE_VERBOSE_MAKEFILE=ON"
"-DCMAKE_MESSAGE_LOG_LEVEL=TRACE"
];
preConfigure = ''
echo "Verifying submodule directories:" >&2
ls -l 3rdparty/hidapi/hidapi 3rdparty/glslang/glslang 3rdparty/yaml-cpp/yaml-cpp 3rdparty/zstd/zstd 3rdparty/discord-rpc >&2
if [ ! -f 3rdparty/hidapi/hidapi/CMakeLists.txt ] || [ ! -f 3rdparty/discord-rpc/CMakeLists.txt ]; then
echo "ERROR: Submodules (hidapi or discord-rpc) not fetched correctly" >&2
exit 1
fi
echo "Original 3rdparty/CMakeLists.txt:" >&2
cat 3rdparty/CMakeLists.txt >&2
sed -i '/find_package(SDL3/ {
s/find_package(SDL3.*)/set(SDL3_FOUND TRUE)/
a set(SDL3_INCLUDE_DIRS "${final.SDL3}/include/SDL3")
a set(SDL3_LIBRARIES "${final.SDL3}/lib/libSDL3.so")
}' 3rdparty/CMakeLists.txt
sed -i 's/message(FATAL_ERROR "SDL3 is not available on this system")/# Patched: SDL3 assumed available/' 3rdparty/CMakeLists.txt
echo "Patched 3rdparty/CMakeLists.txt:" >&2
cat 3rdparty/CMakeLists.txt >&2
echo "Checking submodules:" >&2
ls -lR 3rdparty/hidapi 3rdparty/glslang 3rdparty/yaml-cpp 3rdparty/cubeb 3rdparty/zstd 3rdparty/discord-rpc >&2
'';
});
};
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
overlays = [customPkgsOverlay];
};
lib = nixpkgs.lib;
rpcs3_latest = pkgs.rpcs3.overrideAttrs (oldAttrs: {
src = pkgs.fetchgit {
url = "https://github.com/RPCS3/rpcs3.git";
rev = inputs.rpcs3-latest.rev;
sha256 = "Yx0Qsc0r+5C0BqqsbJCv47QPeaNbaIut8s6Hcysy2mo=";
fetchSubmodules = true;
};
nativeBuildInputs = oldAttrs.nativeBuildInputs;
buildInputs = oldAttrs.buildInputs;
cmakeFlags =
oldAttrs.cmakeFlags
++ [
"-DUSE_DISCORD_RPC=ON"
];
preUnpack = ''
echo "Source rev: ${inputs.rpcs3-latest.rev}" >&2
echo "Expected rev: 37dbd77628f44cdef3228bdfc03127365ec7383b" >&2
'';
});
in {
packages.${system} = {
rpcs3_latest = rpcs3_latest;
};
nixosConfigurations = {
nixos = lib.nixosSystem {
inherit system;
specialArgs = {inherit inputs;};
specialArgs = {inherit inputs rpcs3_latest;};
modules = [
{nixpkgs.overlays = [customPkgsOverlay];}
./hosts/configuration.nix
];
};
};
homeConfigurations = {
"cobray" = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
extraSpecialArgs = {inherit inputs;};
extraSpecialArgs = {inherit inputs rpcs3_latest;};
modules = [./home-manager/cobray.nix];
};
};

View file

@ -1,5 +1,6 @@
{
pkgs,
rpcs3_latest,
...
}: {
imports = [
@ -13,6 +14,8 @@
./modules/rofi.nix
./modules/starship.nix
./modules/zellij.nix
./modules/ffmpeg.nix
./modules/emulators.nix
];
home.username = "cobray";
@ -31,5 +34,6 @@
btop
nvtopPackages.full
arandr
rpcs3_latest
];
}

View file

@ -0,0 +1,14 @@
{pkgs, ...}: {
home.packages = with pkgs; [
mgba
desmume
duckstation
pcsx2
ryujinx
mupen64plus
dolphin-emu
retroarch
mednafen
joycond
];
}

View file

@ -0,0 +1,8 @@
{pkgs, ...}: {
home.packages = with pkgs; [
(ffmpeg.override {
withXcb = true;
withXlib = true;
})
];
}

View file

@ -1,9 +1,7 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running 'nixos-help').
{
...
}: {
{...}: {
imports = [
# Include the results of the hardware scan.
./hardware-configuration.nix

View file

@ -7,98 +7,73 @@
in {
imports = [
../modules/python.nix
../modules/npm.nix
];
python.enable = true;
npm.enable = true;
environment.systemPackages = with pkgs; [
brave # TODO: make a module to save browser stuff
vesktop
git
nodejs
wget
curl
tree
gnumake
gcc
socat
ffmpeg
gnused
gdb
stdenv.cc.cc.lib
nix-prefetch-git
binutils
hashcat
cmake
ninja
pkg-config
autoconf
automake
libtool
gawk
discord
obs-studio
spotify
flameshot
mpv
udiskie
git
git-lfs
gitAndTools.gh
gitAndTools.diff-so-fancy
lazygit
lazydocker
jdk17
mercurial
nodejs
nodePackages.pnpm
nodePackages.typescript
yarn
bun
maven
gradle
visualvm
jdt-language-server
htop
btop
nvtopPackages.full
fd
fzf
jq
bash
customPkgs.fish-rust
go
ollama
sqls
deno
redis
cloudflared
go
go-tools
gopls
rustc
rustup
cargo-edit
cargo-watch
cargo-outdated
cargo-audit
openssl
openssl.dev
rust-analyzer
python3Packages.debugpy
customPkgs.python-ngx-lsp
gcc
stdenv.cc.cc.lib
gnumake
cmake
ninja
binutils
gdb
pkg-config
libxml2
zlib
autoconf
automake
libtool
nasm
elixir
swift
zig
ghc
cabal-install
stack
haskell-language-server
postgresql
sqlite
spotify
git-lfs
gitAndTools.gh
gitAndTools.diff-so-fancy
ani-cli
yt-dlp
nmap
psmisc
ugrep
unzip
starship
flameshot
yarn
mpv
httpie
wrk
nodePackages.pnpm
zlib.dev
udiskie
rust-analyzer
jdk17
maven
gradle
visualvm
jdt-language-server
clang-tools
vscode-langservers-extracted
nodePackages.eslint
gopls
lua-language-server
marksman
nil
@ -120,15 +95,55 @@ in {
hadolint
shellcheck
cppcheck
go-tools
rubocop
phpPackages.php-codesniffer
phpPackages.phpstan
checkstyle
tflint
sqlfluff
rustc
python3Packages.debugpy
customPkgs.python-ngx-lsp
wget
curl
tree
socat
gnused
gawk
nmap
psmisc
ugrep
unzip
starship
htop
btop
nvtopPackages.full
fd
fzf
jq
bash
customPkgs.fish-rust
xorg.xdpyinfo
slop
dunst
pulseaudio
ani-cli
yt-dlp
httpie
wrk
cloudflared
hashcat
nix-prefetch-git
openssl
openssl.dev
libxml2
zlib
zlib.dev
postgresql
sqlite
redis
sqls
ollama
tree-sitter
luajitPackages.jsregexp
tailscale
cachix
];
}

View file

@ -15,6 +15,5 @@
environment.systemPackages = with pkgs; [
cava
pulseaudio
ffmpeg
];
}

View file

@ -1,7 +1,4 @@
{
pkgs,
...
}: {
{pkgs, ...}: {
hardware.bluetooth = {
enable = true;
powerOnBoot = true;

View file

@ -1,7 +1,4 @@
{
pkgs,
...
}: {
{pkgs, ...}: {
# Bootloader
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
@ -13,9 +10,13 @@
deps = [];
text = ''
mkdir -p /bin
ln -sf ${pkgs.bash}/bin/bash /bin/bash
if [ ! -e /bin/bash ]; then
ln -sf ${pkgs.bash}/bin/bash /bin/bash
fi
mkdir -p /usr/bin
ln -sf ${pkgs.coreutils}/bin/env /usr/bin/env
if [ ! -e /usr/bin/env ]; then
ln -sf ${pkgs.coreutils}/bin/env /usr/bin/env
fi
'';
};
}

View file

@ -18,6 +18,7 @@
./timezone.nix
./user.nix
./python.nix
./tailscale.nix
];
# Enable CUPS to print documents.

View file

@ -1,7 +1,4 @@
{
pkgs,
...
}: {
{pkgs, ...}: {
virtualisation.docker = {
enable = true;
enableOnBoot = true;

View file

@ -13,7 +13,6 @@
EDITOR = "nvim";
VISUAL = "nvim";
TERM = "ghostty";
GTK_THEME = lib.mkDefault "Adwaita:dark";
CC = "${pkgs.gcc}/bin/gcc";
PKG_CONFIG_PATH = lib.makeSearchPath "lib/pkgconfig" [
pkgs.openssl.dev
@ -27,7 +26,6 @@
"/bin"
];
# Enable direnv with nix integration
programs.direnv = {
enable = true;
nix-direnv.enable = true;

View file

@ -1,7 +1,4 @@
{
pkgs,
...
}: let
{pkgs, ...}: let
clear-sans = pkgs.stdenv.mkDerivation {
name = "clear-sans";
src = pkgs.fetchurl {

View file

@ -1,5 +1,6 @@
{
inputs,
rpcs3_latest,
...
}: {
imports = [
@ -9,7 +10,7 @@
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs = {
inherit inputs;
inherit inputs rpcs3_latest;
};
users.cobray = import ../home-manager/cobray.nix;
};

View file

@ -1,7 +1,4 @@
{
pkgs,
...
}: let
{pkgs, ...}: let
wallpapers = [
"${pkgs.nixos-artwork.wallpapers.simple-dark-gray}/share/backgrounds/nixos/nixos-wallpaper.png"
"${pkgs.nixos-artwork.wallpapers.gnome-dark}/share/backgrounds/gnome/gnome-dark.png"

View file

@ -1,14 +1,11 @@
{
pkgs,
...
}: {
{pkgs, ...}: {
environment.systemPackages = with pkgs; [
networkmanager_dmenu
networkmanagerapplet
];
networking.firewall.allowedTCPPorts = [ 57621 ];
networking.firewall.allowedUDPPorts = [ 5353 ];
networking.firewall.allowedTCPPorts = [57621];
networking.firewall.allowedUDPPorts = [5353];
networking.wireless.enable = false; # Enables wireless support via wpa_supplicant.
networking.hostName = "nixos";

View file

@ -1,6 +1,4 @@
{
...
}: {
{...}: {
nixpkgs.config.allowUnfree = true;
programs.nix-index.enable = true;
programs.command-not-found.enable = false;

39
modules/npm.nix Normal file
View file

@ -0,0 +1,39 @@
{
config,
pkgs,
lib,
...
}: let
npmGlobalDir = "$HOME/.npm-global";
npmConf = pkgs.writeText "npmrc" ''
prefix=${npmGlobalDir}
cache=$HOME/.npm
init-module=$HOME/.npm-init.js
node-linker=hoisted
'';
in {
options.npm = {
enable = lib.mkEnableOption "System NPM Environment";
};
config = lib.mkIf config.npm.enable {
environment.systemPackages = with pkgs; [
nodejs
nodePackages.npm
];
environment.variables = {
NPM_CONFIG_PREFIX = npmGlobalDir;
PATH = ["${npmGlobalDir}/bin"];
NPM_CONFIG_USERCONFIG = "${npmConf}";
};
system.userActivationScripts.setupNpm = ''
mkdir -p ${npmGlobalDir}/bin
mkdir -p $HOME/.npm
if [ ! -f "$HOME/.npmrc" ]; then
cp ${npmConf} $HOME/.npmrc
fi
if [ -d "${npmGlobalDir}" ]; then
chmod -R +rw ${npmGlobalDir}
fi
'';
};
}

View file

@ -1,11 +1,9 @@
{
pkgs,
...
}: {
{pkgs, ...}: {
programs.steam = {
enable = true;
remotePlay.openFirewall = true;
dedicatedServer.openFirewall = true;
# apparently enabling this makes big picture boot up, does not work on nvidia however
# gamescopeSession.enable = true;
extraCompatPackages = [
pkgs.proton-ge-bin

10
modules/tailscale.nix Normal file
View file

@ -0,0 +1,10 @@
{...}: {
services.tailscale = {
enable = true;
};
networking.firewall = {
allowedUDPPorts = [41641];
trustedInterfaces = ["tailscale0"];
};
}

View file

@ -1,6 +1,4 @@
{
...
}: {
{...}: {
time.timeZone = "America/Edmonton";
i18n.defaultLocale = "en_CA.UTF-8";
}

View file

@ -8,7 +8,7 @@
}:
rustPlatform.buildRustPackage rec {
pname = "fish";
version = "4.1-2025-03-16-rust-${builtins.substring 0 7 "642ec399ca17bbde973dc20461335396fe922e4c"}";
version = "4.0.1-2025-03-16-rust-${builtins.substring 0 7 "642ec399ca17bbde973dc20461335396fe922e4c"}";
src = fetchgit {
url = "https://github.com/fish-shell/fish-shell.git";