commit 148fed1aade38dc94ba2cdd0a2e93627b6ee7180 Author: Wyatt J. Miller Date: Thu May 21 08:41:07 2026 -0400 initial commit diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..9c21e85 --- /dev/null +++ b/flake.nix @@ -0,0 +1,50 @@ +{ + description = "Miller Nix User Repository"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + home-manager.url = "github:nix-community/home-manager"; + darwin.url = "github:LnL7/nix-darwin"; + darwin.inputs.nixpkgs.follows = "nixpkgs"; + }; + + outputs = inputs@{ self, nixpkgs, flake-utils, home-manager, darwin, ... }: + let + systems = [ + "x86_64-linux" + "aarch64-linux" + # "x86_64-darwin" + "aarch64-darwin" + ]; + forAllSystems = f: nixpkgs.lib.genAttrs systems f; + in + { + packages = forAllSystems (system: + let + pkgs = import nixpkgs { + inherit system; + overlays = [ self.overlays.default ]; + }; + in + import ./pkgs { inherit pkgs; } + ); + + devShells = forAllSystems (system: + let pkgs = import nixpkgs { inherit system; }; in + { + default = pkgs.mkShell { + packages = with pkgs; [ + nixfmt-rfc-style + ]; + }; + } + ); + + overlays.default = import ./overlays; + + homeManagerModules.default = import ./modules/home-manager; + nixosModules.default = import ./modules/nixos; + darwinModules.default = import ./modules/darwin; + }; +} diff --git a/modules/darwin/default.nix b/modules/darwin/default.nix new file mode 100644 index 0000000..e69de29 diff --git a/modules/home-manager/default.nix b/modules/home-manager/default.nix new file mode 100644 index 0000000..e69de29 diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix new file mode 100644 index 0000000..e69de29 diff --git a/overlays/default.nix b/overlays/default.nix new file mode 100644 index 0000000..e69de29 diff --git a/pkgs/common/sable.nix b/pkgs/common/sable.nix new file mode 100644 index 0000000..8f86f2f --- /dev/null +++ b/pkgs/common/sable.nix @@ -0,0 +1,60 @@ +{ + lib, + buildNpmPackage, + pnpm_10, + fetchPnpmDeps, + pnpmConfigHook, + nodejs_24, + fetchFromGitHub, +}: +buildNpmPackage (finalAttrs: +let + pnpm = pnpm_10.override { + nodejs = nodejs_24; + }; +in { + pname = "sable-unwrapped"; + version = "1.14.0"; + + src = fetchFromGitHub { + owner = "SableClient"; + repo = "Sable"; + tag = "v${finalAttrs.version}"; + hash = "sha256-zoGKs0pm9m42JrTNAdU33LP139JlVz3RZnkTyY0aiqY="; + }; + + nodejs = nodejs_24; + + nativeBuildInputs = [ pnpm ]; + npmConfigHook = pnpmConfigHook; + + npmDeps = finalAttrs.pnpmDeps; + pnpmDeps = fetchPnpmDeps { + inherit (finalAttrs) pname version src; + inherit pnpm; + fetcherVersion = 3; + hash = "sha256-2GwUz0jsuVKQZyeidM0F4rDzijm9AFcAxN7x/m/b3Is="; + }; + + npmInstallFlags = [ + "--ignore-scripts" + ]; + + installPhase = '' + runHook preInstall + + cp -r dist $out + + runHook postInstall + ''; + + meta = { + description = "An almost stable Matrix client"; + homepage = "https://app.sable.moe/"; + maintainers = with lib.maintainers; [ + wymillerlinux + ]; + license = lib.licenses.agpl3Only; + platforms = lib.platforms.all; + }; +}) diff --git a/pkgs/default.nix b/pkgs/default.nix new file mode 100644 index 0000000..3929150 --- /dev/null +++ b/pkgs/default.nix @@ -0,0 +1,5 @@ +{ pkgs }: { + sable-web = pkgs.callPackage ./common/sable.nix {}; + music-presense = pkgs.callPackage ./linux/music-presence.nix {}; + vintage-story = pkgs.callPackage ./linux/vintage-story.nix {}; +} diff --git a/pkgs/linux/music-presence.nix b/pkgs/linux/music-presence.nix new file mode 100644 index 0000000..e3c2ebb --- /dev/null +++ b/pkgs/linux/music-presence.nix @@ -0,0 +1,28 @@ +{ pkgs }: +{ + default = + let + pname = "musicpresence"; + version = "2.3.5"; + + src = pkgs.fetchurl { + url = "https://github.com/ungive/discord-music-presence/releases/download/v${version}/${pname}-${version}-linux-x86_64.AppImage"; + hash = "sha256-M7oDxVevspA3SGuHktS8ChQAYopgIqypiVlzyE4uyqI="; + }; + + appimageContents = pkgs.appimageTools.extract { inherit pname version src; }; + in + pkgs.appimageTools.wrapType2 { + inherit pname version src; + + nativeBuildInputs = with pkgs; [ makeWrapper ]; + extraInstallCommands = '' + wrapProgram $out/bin/${pname} \ + --set QT_QPA_PLATFORM xcb \ + --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}" + install -Dm444 ${appimageContents}/musicpresence.desktop -t $out/share/applications + ''; + + passthru.updateScript = pkgs.nix-update-script { }; + }; +} diff --git a/pkgs/linux/vintage-story.nix b/pkgs/linux/vintage-story.nix new file mode 100644 index 0000000..b6f1fed --- /dev/null +++ b/pkgs/linux/vintage-story.nix @@ -0,0 +1,101 @@ +{ pkgs }: +let + x11Support = true; + waylandSupport = true; +in { + default = pkgs.stdenv.mkDerivation (finalAttrs: + let + inherit (pkgs) lib; + in { + pname = "vintagestory"; + version = "1.21.6"; + + src = pkgs.fetchurl { + url = "https://cdn.vintagestory.at/gamefiles/stable/vs_client_linux-x64_${finalAttrs.version}.tar.gz"; + hash = "sha256-LkiL/8W9MKpmJxtK+s5JvqhOza0BLap1SsaDvbLYR0c="; + }; + + nativeBuildInputs = with pkgs; [ + makeWrapper + copyDesktopItems + ]; + + runtimeLibs = with pkgs; [ + gtk2 + sqlite + openal + cairo + libGLU + SDL2 + freealut + libglvnd + pipewire + libpulseaudio + ] + ++ lib.optionals x11Support (with pkgs.xorg; [ + libX11 + libXi + libXcursor + ]) + ++ lib.optionals waylandSupport (with pkgs; [ + wayland + libxkbcommon + ]); + + desktopItems = [ + (pkgs.makeDesktopItem { + name = "vintagestory"; + desktopName = "Vintage Story"; + exec = "vintagestory"; + icon = "vintagestory"; + comment = "Innovate and explore in a sandbox world"; + categories = [ "Game" ]; + }) + + (pkgs.makeDesktopItem { + name = "vsmodinstall-handler"; + desktopName = "Vintage Story 1-click Mod Install Handler"; + comment = "Handler for vintagestorymodinstall:// URI scheme"; + exec = "vintagestory -i %u"; + mimeTypes = [ "x-scheme-handler/vintagestorymodinstall" ]; + noDisplay = true; + terminal = false; + }) + ]; + + installPhase = '' + runHook preInstall + + mkdir -p $out/share/vintagestory $out/bin $out/share/pixmaps $out/share/fonts/truetype + cp -r * $out/share/vintagestory + cp $out/share/vintagestory/assets/gameicon.xpm $out/share/pixmaps/vintagestory.xpm + cp $out/share/vintagestory/assets/game/fonts/*.ttf $out/share/fonts/truetype + + runHook postInstall + ''; + + preFixup = + let + runtimeLibs' = lib.strings.makeLibraryPath finalAttrs.runtimeLibs; + in + '' + makeWrapper ${lib.meta.getExe pkgs.dotnet-runtime_8} $out/bin/vintagestory \ + --prefix LD_LIBRARY_PATH : "${runtimeLibs'}" \ + --set-default mesa_glthread true \ + ${lib.strings.optionalString waylandSupport '' + --set-default OPENTK_4_USE_WAYLAND 1 \ + ''} \ + --add-flags $out/share/vintagestory/Vintagestory.dll + + makeWrapper ${lib.meta.getExe pkgs.dotnet-runtime_8} $out/bin/vintagestory-server \ + --prefix LD_LIBRARY_PATH : "${runtimeLibs'}" \ + --set-default mesa_glthread true \ + --add-flags $out/share/vintagestory/VintagestoryServer.dll + + find "$out/share/vintagestory/assets/" -not -path "*/fonts/*" -regex ".*/.*[A-Z].*" | while read -r file; do + local filename="$(basename -- "$file")" + ln -sf "$filename" "''${file%/*}"/"''${filename,,}" + done + ''; + }); +}