From 6167781189b481f1a771aa832df021012cccea5a Mon Sep 17 00:00:00 2001 From: Martin Benonisen Date: Sun, 12 Jan 2025 14:40:40 +0100 Subject: [PATCH] lol --- flake.lock | 34 +++++----- flake.nix | 14 ++-- hosts/zedd/configuration.nix | 10 +-- system/hardware.nix | 19 ------ system/programs.nix | 24 ++++--- system/services/audio.nix | 10 ++- user/packages/default.nix | 4 +- user/packages/vintagestory.nix | 108 +++++++++++++++++++++++++++++++ user/programs/neovim/plugins.lua | 14 ---- user/programs/vscode/default.nix | 8 +++ 10 files changed, 167 insertions(+), 78 deletions(-) create mode 100644 user/packages/vintagestory.nix diff --git a/flake.lock b/flake.lock index 20643db..44b28bb 100644 --- a/flake.lock +++ b/flake.lock @@ -7,27 +7,26 @@ ] }, "locked": { - "lastModified": 1733317578, - "narHash": "sha256-anN/LcP5IuqEARvhPETg1vnbyG3IQ0wdvSAYEJfIQzA=", + "lastModified": 1736508663, + "narHash": "sha256-ZOaGwa+WnB7Zn3YXimqjmIugAnHePdXCmNu+AHkq808=", "owner": "nix-community", "repo": "home-manager", - "rev": "ad48eb25cd0b00ce730da00fa1f8e6e6c27b397d", + "rev": "2532b500c3ed2b8940e831039dcec5a5ea093afc", "type": "github" }, "original": { "owner": "nix-community", - "ref": "master", "repo": "home-manager", "type": "github" } }, "nixpkgs": { "locked": { - "lastModified": 1733212471, - "narHash": "sha256-M1+uCoV5igihRfcUKrr1riygbe73/dzNnzPsmaLCmpo=", + "lastModified": 1736523798, + "narHash": "sha256-Xb8mke6UCYjge9kPR9o4P1nVrhk7QBbKv3xQ9cj7h2s=", "owner": "nixos", "repo": "nixpkgs", - "rev": "55d15ad12a74eb7d4646254e13638ad0c4128776", + "rev": "130595eba61081acde9001f43de3248d8888ac4a", "type": "github" }, "original": { @@ -52,20 +51,19 @@ }, "locked": { "dir": "packaging/nix", - "lastModified": 1733037609, - "narHash": "sha256-HkS24indfMaQbVZ+9GY5BHc+rqPvh8htF0rWYhvgPKI=", - "ref": "refs/heads/main", - "rev": "e559e2e50999093c3e837d33886f9e14e34ead0a", - "revCount": 863, - "submodules": true, - "type": "git", - "url": "https://github.com/Open-Wine-Components/umu-launcher/?dir=packaging/nix" + "lastModified": 1735507919, + "narHash": "sha256-4cR4mk1660p3y8wnX0XbHSQh4KX0mbMn6/2YnALNt8o=", + "owner": "Open-Wine-Components", + "repo": "umu-launcher", + "rev": "59a82ea8cd284c7535bc06b8f6156abb7da96f6a", + "type": "github" }, "original": { "dir": "packaging/nix", - "submodules": true, - "type": "git", - "url": "https://github.com/Open-Wine-Components/umu-launcher/?dir=packaging/nix" + "owner": "Open-Wine-Components", + "repo": "umu-launcher", + "rev": "59a82ea8cd284c7535bc06b8f6156abb7da96f6a", + "type": "github" } } }, diff --git a/flake.nix b/flake.nix index 0b411bf..138855b 100644 --- a/flake.nix +++ b/flake.nix @@ -5,25 +5,23 @@ # nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; home-manager = { - url = "github:nix-community/home-manager/master"; + url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; }; umu = { - url = "git+https://github.com/Open-Wine-Components/umu-launcher/?dir=packaging\/nix&submodules=1"; + url = "github:Open-Wine-Components/umu-launcher/59a82ea8cd284c7535bc06b8f6156abb7da96f6a?dir=packaging/nix"; inputs.nixpkgs.follows = "nixpkgs"; }; - # ... # Optional - updates underlying without waiting for nix-citizen to update }; outputs = - { - self, - nixpkgs, - home-manager, - ... + { self + , nixpkgs + , home-manager + , ... }@inputs: let system = "x86_64-linux"; diff --git a/hosts/zedd/configuration.nix b/hosts/zedd/configuration.nix index ee14b12..a653734 100644 --- a/hosts/zedd/configuration.nix +++ b/hosts/zedd/configuration.nix @@ -1,8 +1,8 @@ -{ - config, - pkgs, - lib, - ... +{ config +, pkgs +, lib +, inputs +, ... }: { # Enable OpenGL diff --git a/system/hardware.nix b/system/hardware.nix index 903fabd..e6b403b 100644 --- a/system/hardware.nix +++ b/system/hardware.nix @@ -1,31 +1,12 @@ { config, pkgs, ... }: { - environment.sessionVariables = { - LIBVA_DRIVER_NAME = "nvidia"; - }; - nixpkgs.config.packageOverrides = pkgs: { - intel-vaapi-driver = pkgs.intel-vaapi-driver.override { enableHybridCodec = true; }; - }; hardware = { enableRedistributableFirmware = true; cpu.intel.updateMicrocode = true; graphics = { enable = true; enable32Bit = true; - extraPackages = with pkgs; [ - vaapiVdpau - mangohud - nvidia-vaapi-driver - intel-media-driver - intel-vaapi-driver - libvdpau-va-gl - ]; - extraPackages32 = with pkgs.pkgsi686Linux; [ - mangohud - intel-media-driver - intel-vaapi-driver - ]; }; nvidia = { diff --git a/system/programs.nix b/system/programs.nix index d4cb1de..07b0d05 100644 --- a/system/programs.nix +++ b/system/programs.nix @@ -1,9 +1,15 @@ -{ - config, - pkgs, - inputs, - ... +{ config +, pkgs +, inputs +, ... }: +let + inherit (pkgs.stdenv.hostPlatform) system; + umu = inputs.umu.packages.${system}.umu.override { + version = inputs.umu.shortRev; + truststore = true; + }; +in { services.flatpak.enable = true; programs.nix-ld.enable = true; @@ -42,11 +48,11 @@ magicOrExtension = ''\x7fELF....AI\x02''; }; environment.systemPackages = with pkgs; [ - (inputs.umu.packages.${pkgs.system}.umu.override { version = "${inputs.umu.shortRev}"; }) gfxreconstruct glslang (opera.override { proprietaryCodecs = true; }) spirv-cross + lsof spirv-headers spirv-tools vulkan-extension-layer @@ -58,7 +64,6 @@ vulkan-validation-layers vkdisplayinfo vkd3d - bottles vkd3d-proton vk-bootstrap lutris @@ -72,8 +77,6 @@ xdg-desktop-portal-gtk google-chrome zoom-us - # icu - # icu.dev neovim git gnupg @@ -81,6 +84,7 @@ pinentry rofi-rbw-x11 rbw + protontricks nil nixpkgs-fmt curl @@ -89,6 +93,8 @@ usbutils vim wget + spotify + protonup v4l-utils nmap wineWowPackages.stable diff --git a/system/services/audio.nix b/system/services/audio.nix index df0b5d8..6ec55c0 100644 --- a/system/services/audio.nix +++ b/system/services/audio.nix @@ -1,12 +1,18 @@ { config, pkgs, ... }: { + environment.systemPackages = with pkgs; [ + pulseaudio + alsa-utils + ]; security.rtkit.enable = true; services.pipewire = { enable = true; alsa.enable = true; alsa.support32Bit = true; pulse.enable = true; - # If you want to use JACK applications, uncomment this - #jack.enable = true; + wireplumber = { + enable = true; + package = pkgs.wireplumber; + }; }; } diff --git a/user/packages/default.nix b/user/packages/default.nix index 0cf6cb5..95d7db5 100644 --- a/user/packages/default.nix +++ b/user/packages/default.nix @@ -38,8 +38,6 @@ mumble pavucontrol unrar - protonup-qt - protonup-ng mpv pamixer pinentry @@ -47,7 +45,6 @@ restic ripgrep sops - spotify sshfs expect # k8s tools @@ -99,6 +96,7 @@ rustup gcc gnumake + (pkgs.callPackage ./vintagestory.nix { }) ]; } diff --git a/user/packages/vintagestory.nix b/user/packages/vintagestory.nix new file mode 100644 index 0000000..e5ea0e3 --- /dev/null +++ b/user/packages/vintagestory.nix @@ -0,0 +1,108 @@ +{ + lib, + stdenv, + fetchurl, + makeWrapper, + makeDesktopItem, + copyDesktopItems, + xorg, + gtk2, + sqlite, + openal, + cairo, + libGLU, + SDL2, + freealut, + libglvnd, + pipewire, + libpulseaudio, + dotnet-runtime_8, +}: + +stdenv.mkDerivation rec { + pname = "vintagestory"; + version = "1.20.0-rc.6"; + + src = fetchurl { + url = "https://cdn.vintagestory.at/gamefiles/unstable/vs_client_linux-x64_${version}.tar.gz"; + hash = "sha256-JxyQrZrAmMkUy28JUak0BHHpuGEb2fbxNrtOGVKGhOQ="; + }; + + nativeBuildInputs = [ + makeWrapper + copyDesktopItems + ]; + + buildInputs = [ dotnet-runtime_8 ]; + + runtimeLibs = lib.makeLibraryPath ( + [ + gtk2 + sqlite + openal + cairo + libGLU + SDL2 + freealut + libglvnd + pipewire + libpulseaudio + ] + ++ (with xorg; [ + libX11 + libXi + libXcursor + ]) + ); + + desktopItems = [ + (makeDesktopItem { + name = "vintagestory"; + desktopName = "Vintage Story"; + exec = "vintagestory"; + icon = "vintagestory"; + comment = "Innovate and explore in a sandbox world"; + categories = [ "Game" ]; + }) + ]; + + 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 = + '' + sed -i 's/net7.0/net8.0/' $out/share/vintagestory/Vintagestory.runtimeconfig.json + sed -i 's/7.0.0/8.0.11/' $out/share/vintagestory/Vintagestory.runtimeconfig.json + + makeWrapper ${dotnet-runtime_8}/bin/dotnet $out/bin/vintagestory \ + --prefix LD_LIBRARY_PATH : "${runtimeLibs}" \ + --add-flags $out/share/vintagestory/Vintagestory.dll + makeWrapper ${dotnet-runtime_8}/bin/dotnet $out/bin/vintagestory-server \ + --prefix LD_LIBRARY_PATH : "${runtimeLibs}" \ + --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 + ''; + + meta = with lib; { + description = "In-development indie sandbox game about innovation and exploration"; + homepage = "https://www.vintagestory.at/"; + license = licenses.unfree; + maintainers = with maintainers; [ + artturin + gigglesquid + ]; + }; +} diff --git a/user/programs/neovim/plugins.lua b/user/programs/neovim/plugins.lua index 73112fb..0de9204 100644 --- a/user/programs/neovim/plugins.lua +++ b/user/programs/neovim/plugins.lua @@ -54,20 +54,6 @@ vim.api.nvim_create_autocmd("BufWritePre", { end }) --- LSP: expect -if executable('expect-language-server') - augroup lsp - autocmd! - autocmd User lsp_setup call lsp#register_server({ - \ 'name': 'expect', - \ 'cmd': {server_info->['expect-language-server']}, - \ 'whitelist': ['expect'], - \ 'initialization_options': { - \ 'method': 'builtin', - \ }, - \ }) - augroup END -endif -- LSP: nix lspconfig.nil_ls.setup({ diff --git a/user/programs/vscode/default.nix b/user/programs/vscode/default.nix index de54ff0..5d38b37 100644 --- a/user/programs/vscode/default.nix +++ b/user/programs/vscode/default.nix @@ -24,6 +24,14 @@ "editor.formatOnSave" = true; "nix.enableLanguageServer" = true; "nix.serverPath" = "nil"; + "nix.formatterPath" = "nixfmt"; + "nix.serverSettings" = { + "nil" = { + "formatting" = { + "command"= ["nixpkgs-fmt"]; + }; + }; + }; }; }; }