Skip to content

cambalache: init at 0.8.0#138940

Merged
jtojnar merged 2 commits intoNixOS:masterfrom
jtojnar:cambalache
Mar 27, 2022
Merged

cambalache: init at 0.8.0#138940
jtojnar merged 2 commits intoNixOS:masterfrom
jtojnar:cambalache

Conversation

@jtojnar
Copy link
Member

@jtojnar jtojnar commented Sep 22, 2021

Motivation for this change

UI designer for GTK 3 & 4 (sort of like Glade):

https://gitlab.gnome.org/jpu/cambalache

Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • 21.11 Release Notes (or backporting 21.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

@ofborg ofborg bot added the 8.has: package (new) This PR adds a new package label Sep 22, 2021
@ofborg ofborg bot requested review from amaxine, dasj19 and hedning September 22, 2021 12:34
@ofborg ofborg bot added 11.by: package-maintainer This PR was created by a maintainer of all the package it changes. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. labels Sep 22, 2021
@r-rmcgibbo
Copy link

r-rmcgibbo commented Sep 22, 2021

Result of nixpkgs-review pr 138940 at a9001915 run on x86_64-linux 1

1 package built successfully:
  • cambalache
1 suggestion:
  • warning: unused-argument

    Unused argument: stdenv.
    Near pkgs/development/tools/cambalache/default.nix:1:3:

      |
    1 | { stdenv
      |   ^
    

Result of nixpkgs-review pr 138940 at a9001915 run on aarch64-linux 1

1 package built successfully:
  • cambalache
1 suggestion:
  • warning: unused-argument

    Unused argument: stdenv.
    Near pkgs/development/tools/cambalache/default.nix:1:3:

      |
    1 | { stdenv
      |   ^
    

@jtojnar jtojnar marked this pull request as draft September 23, 2021 10:08
@psydvl
Copy link
Member

psydvl commented Dec 11, 2021

Newbie questions:

  1. Why python3.pkgs instead of python3Packages?
  2. Why unstableGitUpdater, nor stable?
  3. And why is it still draft? I successfully built v0.8.0 (latest) with similar build file...

@jtojnar
Copy link
Member Author

jtojnar commented Dec 11, 2021

  • Why python3.pkgs instead of python3Packages?

It is shorter. And these days, the latter is alias of the former.

  • Why unstableGitUpdater, nor stable?

I had to switch to git revision because 0.7.4 was broken. Now that 0.8.0 has been released, that probably will no longer be necessary.

  • And why is it still draft? I successfully built v0.8.0 (latest) with similar build file...

See the checkboxes in the OP.

@psydvl
Copy link
Member

psydvl commented Dec 13, 2021

Idea:
Since gtk4-broadwayd not necessary dependency and for now not separable from gtk4.dev, it can be brought out as option like useGTK4Broadwayd

-{ stdenv
+{ stdenv, lib
---
---
+, useGTK3Broadwayd ? false
+, useGTK4Broadwayd ? false
}:
  preFixup = ''
    # Let python wrapper use GNOME flags.
    makeWrapperArgs+=(
+      # For gtk3 broadwayd
+      ${ lib.optionalString useGTK3Broadwayd ''--prefix PATH : "${gtk3.dev}/bin"''}
      # For gtk4-broadwayd
-      --prefix PATH : "${gtk4.dev}/bin"
+      ${ lib.optionalString useGTK3Broadwayd ''--prefix PATH : "${gtk4.dev}/bin"''}
      "''${gappsWrapperArgs[@]}"
    )
  '';

Then app can be used as pkgs.cambalache or

pkgs.cambalache.override {
  # useGTK3Broadwayd = true;
  useGTK4Broadwayd = true;
}

Also, there are can be cambalache-dev added to all-packages.nix or dev (cambalache.dev) output created

@jtojnar
Copy link
Member Author

jtojnar commented Dec 13, 2021

Broadway is necessary dependency – it is used for rendering the designed interface. And I think it should not be that hard – just move broadwayd (only on GTK 4 by the way, GTK3 does not have a separate binary) to a new output in postInstall. I just have not gotten to doing it yet.

The path to the gtk4.dev is baked into the program using a wrapper so adding cambalache.dev output would do nothing.

@psydvl
Copy link
Member

psydvl commented Dec 13, 2021

GTK3 has separate binary
It's lay on ${gtk3}/bin/broadwayd
And it required since we have next warning on launch without any

WARNING:cambalache.cmb_view broadwayd not found, Gtk 3 workspace wont work.
WARNING:cambalache.cmb_view gtk4-broadwayd not found, Gtk 4 workspace wont work.

So next code works for me, and since I launch using nix-shell with --pure option, I think all essential included?

$ nix-shell -I nixpkgs=$NIXPKGS_GIT -p cambalache --pure --run cambalache

Same as

$ nix-shell -I nixpkgs=$NIXPKGS_GIT -p "cambalache.override{ useGTK4Broadwayd=true; }" --pure --run cambalache
My default.nix
{ lib, stdenv, fetchFromGitLab
, meson, pkg-config, ninja
, python3
, appstream-glib , desktop-file-utils, shared-mime-info
, gobject-introspection, gtk3, gtk4
, wrapGAppsHook
, webkitgtk
, gnome, dconf
, useGTK3Broadwayd ? false
, useGTK4Broadwayd ? false
}:

python3.pkgs.buildPythonApplication rec {
  pname = "cambalache";
  version = "0.8.0";
  format = "other";
  strictDeps = false; # https://github.com/NixOS/nixpkgs/issues/56943

  src = fetchFromGitLab {
    domain = "gitlab.gnome.org";
    owner = "jpu";
    repo = pname;
    rev = version;
    sha256 = "05hf45v24l73fwv36bf90h6ksf6axvi8f4mddyq24x63w1yndhg9";
  };

  nativeBuildInputs = [
    meson
    ninja
    pkg-config
    appstream-glib
    desktop-file-utils
    gobject-introspection
    wrapGAppsHook
    shared-mime-info
  ];

  buildInputs = [
    gtk3
    gtk4
    webkitgtk
    gnome.adwaita-icon-theme
  ];

  propagatedBuildInputs = with python3.pkgs; [
    pygobject3
    lxml
  ];
  
  # Prevent double wrapping.
  dontWrapGApps = true;
  
  preFixup = ''
    # Let python wrapper use GNOME flags.
    makeWrapperArgs+=(
      # For gtk3 broadwayd
      ${ lib.optionalString useGTK3Broadwayd ''--prefix PATH : "${gtk3}/bin"''}
      # For gtk4-broadwayd
      ${ lib.optionalString useGTK4Broadwayd ''--prefix PATH : "${gtk4.dev}/bin"''}
      "''${gappsWrapperArgs[@]}"
    )
  '';

  postPatch = ''
    patchShebangs postinstall.py
    mkdir -p $out/bin
    ${ lib.optionalString (!useGTK3Broadwayd) "install ${gtk3}/bin/broadwayd $out/bin/"}
    ${ lib.optionalString (!useGTK4Broadwayd) "install ${gtk4.dev}/bin/gtk4-broadwayd $out/bin/"}
  '';

  meta = with lib; {
    description = "Cambalache is a new RAD tool for Gtk 4 and 3 with a clear MVC design and data model first philosophy.";
    homepage = "https://gitlab.gnome.org/jpu/cambalache";
    license = with licenses; [
      lgpl21Only # Cambalache
      gpl2Only # tools
    ];
    #platforms = stdenv.lib.platforms.linux;
    #maintainers = with maintainers; [ psydvl ];
  };
}

@jtojnar jtojnar changed the title cambalache: init at 0.7.4 cambalache: init at 0.8.0 Dec 13, 2021
@jtojnar jtojnar marked this pull request as ready for review December 13, 2021 19:28
@jtojnar
Copy link
Member Author

jtojnar commented Dec 13, 2021

Thanks, I did not realize we did #116053 so I thought GTK 3 did not use the daemon. I decided to do the same in GTK 4 since it is quite small.

@jtojnar
Copy link
Member Author

jtojnar commented Dec 13, 2021

Not sure if it is makes sense to merge this since it is still not very usable at the moment.

@ofborg ofborg bot requested a review from 7c6f434c December 13, 2021 19:40
@ofborg ofborg bot added 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages to rebuild on Linux. and removed 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. labels Dec 13, 2021
@ofborg ofborg bot removed the 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. label Dec 13, 2021
@psydvl
Copy link
Member

psydvl commented Dec 18, 2021

Since pythonPath is deprecated

# DEPRECATED: use propagatedBuildInputs
, pythonPath ? []

Shouldn't it be replaced with propagatedBuildInputs?

@jtojnar
Copy link
Member Author

jtojnar commented Dec 18, 2021

Hopefully it will not be deprecated for much longer, albeit under a different name: #102613

@psydvl
Copy link
Member

psydvl commented Mar 5, 2022

There are 0.8.2 already published
https://gitlab.gnome.org/jpu/cambalache/-/tags
And it's so usable, so glade is
Why not to merge?

version = "0.8.2";
sha256 = "1+IoBoaNHwvN8W+KRyV5cTFkFG+pTHJBehQ2VosCEfs=";

@noonien
Copy link

noonien commented Mar 26, 2022

Any update on this?

jtojnar added 2 commits March 27, 2022 13:52
It is convenient to have it in PATH by default and does not seem to increase the output size much (+0.2M).

Just as was done to GTK 3 in NixOS#116053
@ofborg ofborg bot added 10.rebuild-darwin: 11-100 This PR causes between 11 and 100 packages to rebuild on Darwin. 10.rebuild-linux: 101-500 This PR causes between 101 and 500 packages to rebuild on Linux. and removed 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages to rebuild on Linux. labels Mar 27, 2022
@jtojnar jtojnar merged commit 4e42a18 into NixOS:master Mar 27, 2022
@jtojnar jtojnar deleted the cambalache branch March 27, 2022 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

8.has: package (new) This PR adds a new package 10.rebuild-darwin: 11-100 This PR causes between 11 and 100 packages to rebuild on Darwin. 10.rebuild-linux: 101-500 This PR causes between 101 and 500 packages to rebuild on Linux. 11.by: package-maintainer This PR was created by a maintainer of all the package it changes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants