From 56b5f099fc44b1ea8a49abf4f61aeac8263f760c Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Fri, 9 May 2025 22:33:23 +0100 Subject: [PATCH] Refactor to only download `displayselect`, not the ...whole repository --- pkgs/displayselect/default.nix | 22 ++++++++++++---------- pkgs/displayselect/scaling.patch | 4 ++-- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/pkgs/displayselect/default.nix b/pkgs/displayselect/default.nix index 04f6d790..f81f217e 100644 --- a/pkgs/displayselect/default.nix +++ b/pkgs/displayselect/default.nix @@ -1,28 +1,30 @@ { pkgs, ... }: -with pkgs; - -stdenv.mkDerivation { +pkgs.stdenv.mkDerivation { pname = "displayselect"; version = "unstable-2024-05-11"; - src = fetchFromGitHub { - owner = "lukesmithxyz"; - repo = "voidrice"; - rev = "97687287bdfd332398b82a196b5f1feaec73f1d7"; - sha256 = "sha256-9U1Do0w2oT5E6uZxSKoHAzbGbSLQRQlT65KcPGzwhW8="; + src = builtins.fetchurl { + url = "https://raw.githubusercontent.com/lukesmithxyz/voidrice/97687287bdfd332398b82a196b5f1feaec73f1d7/.local/bin/displayselect"; + sha256 = "sha256:11r561pfhb48a3xmi42zzvpljahnwlfad9rz8qmmp64dhz1f2vp0"; }; - buildInputs = [ + dontUnpack = true; + + buildInputs = with pkgs; [ bash xorg.xrandr ]; + prePatch = '' + cp $src displayselect + ''; + patches = [ ./scaling.patch ]; installPhase = '' mkdir -p $out/bin - cp .local/bin/displayselect $out/bin + cp displayselect $out/bin chmod +x $out/bin/displayselect ''; diff --git a/pkgs/displayselect/scaling.patch b/pkgs/displayselect/scaling.patch index 914a19a4..248b7bee 100644 --- a/pkgs/displayselect/scaling.patch +++ b/pkgs/displayselect/scaling.patch @@ -1,7 +1,7 @@ diff --git a/.local/bin/displayselect b/.local/bin/displayselect index 51dd468..c132b7a 100755 ---- a/.local/bin/displayselect -+++ b/.local/bin/displayselect +--- a/displayselect ++++ b/displayselect @@ -15,20 +15,13 @@ twoscreen() { # If multi-monitor is selected and there are two screens. res_external=$(xrandr --query | sed -n "/^$external/,/\+/p" | \