From a2430c57d74d15ea8fa932c40279462a25cf9054 Mon Sep 17 00:00:00 2001 From: Weijia Wang <9713184+wegank@users.noreply.github.com> Date: Wed, 27 Nov 2024 00:35:26 +0100 Subject: [PATCH 1/3] discrete-scroll: rename from darwin.discrete-scroll --- .../default.nix => by-name/di/discrete-scroll/package.nix} | 4 +--- pkgs/top-level/darwin-aliases.nix | 4 ++++ pkgs/top-level/darwin-packages.nix | 2 -- 3 files changed, 5 insertions(+), 5 deletions(-) rename pkgs/{os-specific/darwin/discrete-scroll/default.nix => by-name/di/discrete-scroll/package.nix} (92%) diff --git a/pkgs/os-specific/darwin/discrete-scroll/default.nix b/pkgs/by-name/di/discrete-scroll/package.nix similarity index 92% rename from pkgs/os-specific/darwin/discrete-scroll/default.nix rename to pkgs/by-name/di/discrete-scroll/package.nix index f38bf8d813229..abcde8ad9cb68 100644 --- a/pkgs/os-specific/darwin/discrete-scroll/default.nix +++ b/pkgs/by-name/di/discrete-scroll/package.nix @@ -1,4 +1,4 @@ -{ stdenv, lib, fetchFromGitHub, Cocoa }: +{ stdenv, lib, fetchFromGitHub }: ## after launching for the first time, grant access for parent application (e.g. Terminal.app) ## from 'system preferences >> security & privacy >> accessibility' @@ -15,8 +15,6 @@ stdenv.mkDerivation rec { sha256 = "0aqkp4kkwjlkll91xbqwf8asjww8ylsdgqvdk8d06bwdvg2cgvhg"; }; - buildInputs = [ Cocoa ]; - buildPhase = '' cc -std=c99 -O3 -Wall -framework Cocoa -o dc DiscreteScroll/main.m ''; diff --git a/pkgs/top-level/darwin-aliases.nix b/pkgs/top-level/darwin-aliases.nix index 6fafa5f487c45..768e908a361c9 100644 --- a/pkgs/top-level/darwin-aliases.nix +++ b/pkgs/top-level/darwin-aliases.nix @@ -59,6 +59,10 @@ mapAliases ({ cctools-llvm = pkgs.cctools; # added 2024-07-01 cctools-port = pkgs.cctools; # added 2024-07-17 + ### D ### + + discrete-scroll = pkgs.discrete-scroll; # added 2024-11-27 + ### I ### insert_dylib = throw "'darwin.insert_dylib' has been renamed to 'insert-dylib'"; # added 2024-04-04 diff --git a/pkgs/top-level/darwin-packages.nix b/pkgs/top-level/darwin-packages.nix index ab8d9c387b407..9c9cb90435910 100644 --- a/pkgs/top-level/darwin-packages.nix +++ b/pkgs/top-level/darwin-packages.nix @@ -239,8 +239,6 @@ impure-cmds // apple-source-packages // apple-source-headers // stubs // { ios-deploy = callPackage ../os-specific/darwin/ios-deploy {}; - discrete-scroll = callPackage ../os-specific/darwin/discrete-scroll { }; - # See doc/packages/darwin-builder.section.md linux-builder = lib.makeOverridable ({ modules }: let From ad50df3384809cc6d733542cb4df649ff1d2d627 Mon Sep 17 00:00:00 2001 From: Weijia Wang <9713184+wegank@users.noreply.github.com> Date: Thu, 28 Nov 2024 00:43:41 +0100 Subject: [PATCH 2/3] discrete-scroll: refactor --- pkgs/by-name/di/discrete-scroll/package.nix | 33 +++++++++++---------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/pkgs/by-name/di/discrete-scroll/package.nix b/pkgs/by-name/di/discrete-scroll/package.nix index abcde8ad9cb68..e6ceb4f72b8cd 100644 --- a/pkgs/by-name/di/discrete-scroll/package.nix +++ b/pkgs/by-name/di/discrete-scroll/package.nix @@ -1,34 +1,37 @@ -{ stdenv, lib, fetchFromGitHub }: +{ + lib, + stdenv, + fetchFromGitHub, +}: -## after launching for the first time, grant access for parent application (e.g. Terminal.app) -## from 'system preferences >> security & privacy >> accessibility' -## and then launch again - -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "discrete-scroll"; version = "0.1.1"; src = fetchFromGitHub { owner = "emreyolcu"; repo = "discrete-scroll"; - rev = "v${version}"; - sha256 = "0aqkp4kkwjlkll91xbqwf8asjww8ylsdgqvdk8d06bwdvg2cgvhg"; + rev = "v${finalAttrs.version}"; + hash = "sha256-D+7HxNuNLwMamm3j1zT1iHOpFXIcrx4SpZNKPie5Eys="; }; buildPhase = '' - cc -std=c99 -O3 -Wall -framework Cocoa -o dc DiscreteScroll/main.m + runHook preBuild + $CC -O3 -framework Cocoa DiscreteScroll/main.m + runHook postBuild ''; installPhase = '' - mkdir -p $out/bin - cp ./dc $out/bin/discretescroll + runHook preInstall + install -Dm755 a.out $out/bin/discretescroll + runHook postInstall ''; - meta = with lib; { + meta = { description = "Fix for OS X's scroll wheel problem"; homepage = "https://github.com/emreyolcu/discrete-scroll"; - platforms = platforms.darwin; - license = licenses.mit; + license = lib.licenses.mit; maintainers = with lib.maintainers; [ bb2020 ]; + platforms = lib.platforms.darwin; }; -} +}) From e58e1161de26151338265b3830f83c157a05b011 Mon Sep 17 00:00:00 2001 From: Weijia Wang <9713184+wegank@users.noreply.github.com> Date: Thu, 28 Nov 2024 00:45:24 +0100 Subject: [PATCH 3/3] discrete-scroll: 0.1.1 -> 1.2.1 --- pkgs/by-name/di/discrete-scroll/package.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/by-name/di/discrete-scroll/package.nix b/pkgs/by-name/di/discrete-scroll/package.nix index e6ceb4f72b8cd..f3b0f1c981091 100644 --- a/pkgs/by-name/di/discrete-scroll/package.nix +++ b/pkgs/by-name/di/discrete-scroll/package.nix @@ -6,18 +6,18 @@ stdenv.mkDerivation (finalAttrs: { pname = "discrete-scroll"; - version = "0.1.1"; + version = "1.2.1"; src = fetchFromGitHub { owner = "emreyolcu"; repo = "discrete-scroll"; rev = "v${finalAttrs.version}"; - hash = "sha256-D+7HxNuNLwMamm3j1zT1iHOpFXIcrx4SpZNKPie5Eys="; + hash = "sha256-FYYtJUl1tvMu9yMK5VpHmMeM6otDIpoOvSGTjYNPBr0="; }; buildPhase = '' runHook preBuild - $CC -O3 -framework Cocoa DiscreteScroll/main.m + $CC -O3 -framework ApplicationServices DiscreteScroll/main.c runHook postBuild '';