From 4ba5211b491a4a5f17acdc7c402612f29741bd14 Mon Sep 17 00:00:00 2001 From: greg-compass Date: Thu, 10 Nov 2022 12:21:59 -0600 Subject: [PATCH] Add Gnucash --- home/gui/default.nix | 2 +- overlays/default.nix | 7 ++++++- overlays/hms.sh | 2 +- overlays/mac/gnucash.nix | 32 ++++++++++++++++++++++++++++++++ 4 files changed, 40 insertions(+), 3 deletions(-) create mode 100644 overlays/mac/gnucash.nix diff --git a/home/gui/default.nix b/home/gui/default.nix index 2cc8ffb..adf53fa 100644 --- a/home/gui/default.nix +++ b/home/gui/default.nix @@ -14,6 +14,7 @@ bitwarden cdrtools ffmpeg + gnucash gopls jdk11 libtheora @@ -25,7 +26,6 @@ libreoffice-bin ] else [ - gnucash handbrake jellyfin-media-player nextcloud-client diff --git a/overlays/default.nix b/overlays/default.nix index 2d10d17..df09b2a 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -21,6 +21,10 @@ let ]; myPython = super.python3.withPackages myPackages; + macOver = file: og: + if super.stdenv.isDarwin then + (super.callPackage file {}) else + super."${og}"; in rec { gregpy = myPython; @@ -60,5 +64,6 @@ in rec { propagatedBuildInputs = old.propagatedBuildInputs ++ [ my-py-addons.xonsh-direnv ]; }); - bitwarden = if super.stdenv.isDarwin then (super.callPackage ./mac/bitwarden.nix {}) else super.bitwarden; + bitwarden = macOver ./mac/bitwarden.nix "bitwarden"; + gnucash = macOver ./mac/gnucash.nix "gnucash"; } diff --git a/overlays/hms.sh b/overlays/hms.sh index 0060746..7769504 100644 --- a/overlays/hms.sh +++ b/overlays/hms.sh @@ -30,7 +30,7 @@ if [ "$(uname -s)" == "Darwin" ]; then cd ~/.nix-profile/Applications for app in *.app; do echo "Updating permissions on '${app}'" - chmod -R u+w "${HOME}/Applications/${app}" + chmod -R u+w "${HOME}/Applications/${app}" || true echo "Copying new version to Applications" cp -r "${app}" "${HOME}/Applications" 2>&1 > /dev/null || true if [ "$?" != "0" ]; then diff --git a/overlays/mac/gnucash.nix b/overlays/mac/gnucash.nix new file mode 100644 index 0000000..ea4c398 --- /dev/null +++ b/overlays/mac/gnucash.nix @@ -0,0 +1,32 @@ +{ stdenv, fetchurl, + undmg, +}: + +stdenv.mkDerivation rec { + version = "4.12"; + pname = "GnuCash"; + + buildInputs = [ + undmg + ]; + sourceRoot = "."; + phases = [ + "unpackPhase" + "installPhase" + ]; + installPhase = '' + mkdir -p "$out/Applications" + cp -r Gnucash*.app "$out/Applications" + ''; + + src = fetchurl { + name = "${pname}-${version}.dmg"; + url = "https://sourceforge.net/projects/gnucash/files/gnucash%20(stable)/${version}/Gnucash-Intel-${version}-1.dmg"; + sha256 = "sha256-GXsGOk+F/QdcD19ZmZmor0upCFHa7iy3Hs4CLbiby1M="; + }; + + meta = { + description = "GnuCash is free accounting software for your local machine"; + homepage = "https://www.gnucash.org"; + }; +}