fix(nix/darwin): Create custom overlay for inkscape in macOS

The one fetched from brew-api is using arm64 by default.

REF: ceaca2359e/overlay.nix
This commit is contained in:
Ahmad Ansori Palembani 2024-11-02 11:19:38 +07:00
parent 5af9716b94
commit 96590a271e
Signed by: null2264
GPG key ID: BA64F8B60AF3EFB6
3 changed files with 48 additions and 1 deletions

View file

@ -8,7 +8,7 @@ let
py.dnspython
]));
};
custom.inkscape = if pkgs.stdenv.isDarwin then pkgs.brewCasks.inkscape else (pkgs.inkscape.override { python3 = custom.python; });
custom.inkscape = if pkgs.stdenv.isDarwin then pkgs.inkscape-bin else (pkgs.inkscape.override { python3 = custom.python; });
in {
inherit custom;
packages = [

View file

@ -0,0 +1,45 @@
# REF: https://github.com/bandithedoge/nixpkgs-firefox-darwin/blob/ceaca2359e5371ccef3f92a36baf7c438b354afb/overlay.nix
final: prev:
let
inkscapePackage = version:
final.stdenv.mkDerivation rec {
pname = "Inkscape";
inherit version;
buildInputs = [ final.pkgs.undmg ];
sourceRoot = ".";
phases = [ "unpackPhase" "installPhase" ];
installPhase = ''
runHook preInstall
mkdir -p $out/Applications
cp -r Inkscape*.app "$out/Applications/"
runHook postInstall
'';
src = final.fetchurl {
name = "Inkscape-${version}.dmg";
url = "https://media.inkscape.org/dl/resources/file/Inkscape-${version}_${if final.stdenv.isAarch64 then "arm64" else "x86_64"}.dmg";
sha256 = if final.stdenv.isAarch64 then "c2d89809ad8d85021e7784e72e28aee2231b0b8675ec3ede3e6fb9f1ffedb4b3" else "e3f968e131e5c3577ee21809da487eafe2a9b42370e2bf408e5811b6f965912e";
};
meta = with final.lib; {
description = "Vector graphics editor";
homepage = "https://www.inkscape.org";
license = licenses.gpl3Plus;
maintainers = [ maintainers.jtojnar ];
platforms = platforms.all;
mainProgram = "inkscape";
longDescription = ''
Inkscape is a feature-rich vector graphics editor that edits
files in the W3C SVG (Scalable Vector Graphics) file format.
If you want to import .eps files install ps2edit.
'';
};
};
in {
inkscape-bin = inkscapePackage "1.4.028868";
}

View file

@ -21,6 +21,7 @@ in
extraOverlays = [
inputs.firefox-darwin.overlay
inputs.brew-nix.overlays.default
(import ../../overlays/darwin/inkscape.nix)
];
}
) system pkgs pkgs-unstable;
@ -45,6 +46,7 @@ in
extraOverlays = [
inputs.firefox-darwin.overlay
inputs.brew-nix.overlays.default
(import ../../overlays/darwin/inkscape.nix)
];
}
) system pkgs pkgs-unstable;