From f26588204b93accb9821155ab54a0de3c85cb97d Mon Sep 17 00:00:00 2001 From: willemml Date: Mon, 6 Feb 2023 00:13:43 -0800 Subject: [PATCH] add freecad, other touchups --- home/default.nix | 13 +++++++------ home/emacs.nix | 1 - home/packages.nix | 1 + overlays/default.nix | 1 + overlays/freecad-mac.nix | 41 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 50 insertions(+), 7 deletions(-) create mode 100644 overlays/freecad-mac.nix diff --git a/home/default.nix b/home/default.nix index fd077be..84b9068 100644 --- a/home/default.nix +++ b/home/default.nix @@ -14,13 +14,14 @@ rec { ".config/nixpkgs/config.nix".text = '' # -*-nix-*- { - packageOverrides = pkgs: { - nur = import (builtins.fetchTarball "https://github.com/nix-community/NUR/archive/master.tar.gz") { - inherit pkgs; - }; - }; - allowUnfree = true; + packageOverrides = pkgs: { + nur = import (builtins.fetchTarball "https://github.com/nix-community/NUR/archive/master.tar.gz") { + inherit pkgs; + }; + }; + allowUnfree = true; } + ''; }; keyboard = { diff --git a/home/emacs.nix b/home/emacs.nix index 03776f2..c30ae7a 100644 --- a/home/emacs.nix +++ b/home/emacs.nix @@ -438,7 +438,6 @@ in { (setq nix-nixfmt-bin "${pkgs.nixfmt}/bin/nixfmt") (setq nix-executable "/nix/var/nix/profiles/default/bin/nix") ''; - bindLocal.nix-mode-map = { "C-c C-y" = "nix-mode-format"; }; }; ob-calc = { diff --git a/home/packages.nix b/home/packages.nix index 36dd7c5..e8201b8 100644 --- a/home/packages.nix +++ b/home/packages.nix @@ -4,6 +4,7 @@ let darwin = with pkgs; [ colima coreutils + freecad-mac gnused iterm2 karabiner-elements diff --git a/overlays/default.nix b/overlays/default.nix index f5289d9..9af41ba 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -1,6 +1,7 @@ self: super: { chromium-mac = super.callPackage ./chromium-mac.nix { pkgs = super; }; firefox-mac = super.callPackage ./firefox-mac.nix { pkgs = super; }; + freecad-mac = super.callPackage ./freecad-mac.nix { pkgs = super; }; pinentry-touchid = super.callPackage ./pinentry-touchid.nix { pkgs = super; }; qbittorrent-mac = super.callPackage ./qbittorrent-mac.nix { pkgs = super; }; spotify-mac = super.callPackage ./spotify-mac.nix { pkgs = super; }; diff --git a/overlays/freecad-mac.nix b/overlays/freecad-mac.nix new file mode 100644 index 0000000..799ec71 --- /dev/null +++ b/overlays/freecad-mac.nix @@ -0,0 +1,41 @@ +{ pkgs, fetchurl, ... }: + +let + version = "31483"; + date = "2022-12-31"; + appName = "FreeCAD"; + pname = "freecad"; + + src = fetchurl { + url = + "https://github.com/FreeCAD/FreeCAD-Bundle/releases/download/weekly-builds/FreeCAD_weekly-builds-${version}-${date}-conda-macOS-arm-py311.dmg"; + sha256 = "sha256-dm6QbAazx1vFrkakkCsfCqyGzRED9guI7yFMQ24mU9o="; + }; +in +pkgs.stdenv.mkDerivation { + inherit version src; + + name = pname; + + nativeBuildInputs = [ pkgs.makeWrapper ]; + + dontUnpack = true; + + installPhase = '' + export tempdir=$(mktemp -d -p /tmp) + + cp $src freecad.dmg + /usr/bin/hdiutil attach -mountpoint "$tempdir" freecad.dmg + + mkdir -p $out/Applications + + cp -r "$tempdir/${appName}.app" $out/Applications + + /usr/bin/hdiutil detach "$tempdir" + + mkdir -p $out/bin + makeWrapper "$out/Applications/${appName}.app/Contents/MacOS/${appName}" "$out/bin/${pname}" + + runHook postInstall + ''; +}