From 9138d6dbfef66500a9ab53accfb84203bf5b7048 Mon Sep 17 00:00:00 2001 From: xenia Date: Tue, 19 Nov 2024 13:10:06 +0100 Subject: [PATCH] Patch kicad so it works with fallback rendering --- nixos/graphical.nix | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/nixos/graphical.nix b/nixos/graphical.nix index 719251c0..7bb72a2e 100644 --- a/nixos/graphical.nix +++ b/nixos/graphical.nix @@ -6,8 +6,34 @@ ... }: let start-plasma-shortcut = pkgs.writeScriptBin "desktop" '' - ${pkgs.plasma-workspace}/libexec/plasma-dbus-run-session-if-needed ${pkgs.plasma-workspace}/bin/startplasma-wayland -''; + ${pkgs.plasma-workspace}/libexec/plasma-dbus-run-session-if-needed ${pkgs.plasma-workspace}/bin/startplasma-wayland + ''; + # kicad is broken in 2411 + # TODO: update to 2411 + pkgs_2405 = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/e8c38b73aeb218e27163376a2d617e61a2ad9b59.tar.gz") {}; + + kicad-patch = pkgs.stdenv.mkDerivation { + name = "kicad-patch"; + version = pkgs_2405.kicad-small.version; + src = pkgs_2405.kicad-small; + + buildInputs = [ pkgs.makeWrapper ]; + buildPhase = '' + mkdir $out + cp -r $src/* $out + chmod -R u+w $out + # don't want the individual kicad things to show up as applications + mv $out/share/applications $out/share/applications.0 + mkdir $out/share/applications + cp $out/share/applications.0/org.kicad.kicad.desktop $out/share/applications/ + + # https://github.com/NixOS/nixpkgs/issues/338062#issuecomment-2430847477 + for prog in $out/bin/* ; do + wrapProgram $prog \ + --set GDK_BACKEND x11 + done + ''; + }; in { services.xserver = { @@ -62,8 +88,8 @@ in start-plasma-shortcut remmina libreoffice - kicad-small - ]) ++ (with pkgs-unstable; [ + kicad-patch + ]) ++ (with pkgs_2405; [ firefox ]); }