Run Qt Design Studio on NixOS

Has anyone managed to run Qt Design Studio on NixOS? I have been tinkering with it for a couple of days and still couldn’t get it to work.

I have been trying the patching method from this Stack’s answer. However the methods are more oriented towards Debian execs.

The steps I took:

  1. I downloaded qt-designstudio-linux-x86_64-2.3.1-community.run
  2. Then, I used steam-run to run the installer.
  3. After the successful installation I tried to patch the binary with patchelf
  4. And then, although all the libraries were linked I get the following error:

So the question is: Should I tinker with it even more, or is there a better way to run Qt Products on NixOS?

Note: I tried installing QT Creator on NixOS but it is too buggy (I get SEGFAULT while on Design Tab).

You’ll need to write a Nix package for Qt Design Studio, rather than only patching the binary, because Qt has special considerations on NixOS. In short, you need a wrapper so that the application can find Qt plugins. See Nixpkgs 23.05 manual | Nix & NixOS

Thanks for the hint.

Should I make it for the installer or for the executable?

What’s more, the installer has it’s own GUI, so is it even possible to extract it anyhow?

You should package the executable. It may be possible to bypass the GUI installer, since it seems it’s built with https://makeself.io/

1 Like

Wow, thanks a lot!

Never knew about makeself.io before, would definitely check it out!

I have created the following derivation:

flake.nix:

{
  description = "Qt Design Studio";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs";
    flake-utils.url = "github:numtide/flake-utils";
  };

  outputs = { self, nixpkgs, flake-utils }:
    flake-utils.lib.eachDefaultSystem (system: 
    let
      # Helper to provide system-specific attributes
      pname = "qtdesignstudio";
      version = "v2.3.1";

      pkgs = import nixpkgs { inherit system; };

    in { 
        #packages.default = pkgs.callPackage ./. {inherit pname version nativeBuildInputs buildInputs; };
        packages.default = pkgs.qt6Packages.callPackage ./. {inherit pname version; };
    }
  );
}

default.nix:

{ pname, version, stdenv, pkgs, qtbase, wrapQtAppsHook  }: 

stdenv.mkDerivation {
  
  inherit pname version; 

  src = ./qtdesignstudio;

  buildInputs = with pkgs; [
    qt6.qt5compat
    gcc-unwrapped
  ] ++ [ qtbase ];

  unpackPhase = ":";  # omit unpackPhase

  nativeBuildInputs = with pkgs; [ autoPatchelfHook ] ++ [ wrapQtAppsHook ]; 

  installPhase = ''
    mkdir -p $out/bin
    cp $src $out/bin
  '';
}

It works almost fine as it couldn’t locate 3 local libraries, namely libExtensionSystem.so.2, libUtils.so.2 and libAggregation.so.2:

Is there any way to link it with AutoPatchelfHook?