diff --git a/pkgs/by-name/fr/freecad/package.nix b/pkgs/by-name/fr/freecad/package.nix index a6c61d1c4bd2..3511cebc57e5 100644 --- a/pkgs/by-name/fr/freecad/package.nix +++ b/pkgs/by-name/fr/freecad/package.nix @@ -32,6 +32,8 @@ which, gtk3, gsettings-desktop-schemas, + versionCheckHook, + writeShellScript, }: let pythonDeps = with python3Packages; [ @@ -58,13 +60,13 @@ in freecad-utils.makeCustomizable ( stdenv.mkDerivation (finalAttrs: { pname = "freecad"; - version = "1.1.1"; + version = "1.1.3"; src = fetchFromGitHub { owner = "FreeCAD"; repo = "FreeCAD"; tag = finalAttrs.version; - hash = "sha256-7/VEbs8YDM1Xwc819ab6av5fgRSIbbB6LeCM0V08vRU="; + hash = "sha256-RP68rd19wX4gDD5PuRQ1J4Z9Qmp5HpEg6sC94RRMEdI="; fetchSubmodules = true; }; @@ -150,6 +152,28 @@ freecad-utils.makeCustomizable ( }; }; + nativeInstallCheckInputs = [ versionCheckHook ]; + doInstallCheck = true; + + versionCheckProgram = writeShellScript "version-check.sh" '' + # As of 2026-07-26, the way FreeCAD handles `--version` is awful. + # - The main program, `freecad`, opens a GUI prompt for `--version`, + # unless `--console` is also given. + # - Even with `--version --console`, `freecad` crashes if there is no + # display server, so we need to use `freecadcmd` instead, which is a + # separate binary, for unknown reasons. + # - `freecadcmd --version` crashes if it cannot create a directory under + # `$HOME/.local/share/FreeCAD/` + # Adding `--safe-mode` appears to fix this, but `versionCheckProgramArg` + # only allows for a single argument (as a list gets concaternated), + # so we need this script. + + # The path to `freecadcmd` gets passed in via $1, to allow the `out` + # placeholder to function properly + exec "$1" --version --safe-mode + ''; + versionCheckProgramArg = "${placeholder "out"}/bin/freecadcmd"; + # 6.9k object files, cuts down build time from 2-3 hours to 15 minutes requiredSystemFeatures = [ "big-parallel" ]; @@ -176,8 +200,10 @@ freecad-utils.makeCustomizable ( maintainers = with lib.maintainers; [ srounce grimmauld + acuteaangle ]; platforms = lib.platforms.linux; + mainProgram = "freecad"; }; }) )