Skip to content

Conversation

@mhemeryck
Copy link
Contributor

@mhemeryck mhemeryck commented Jun 17, 2025

Adds a new package structurizr-cli which is a command-line tool to interact with architecture diagrams written according to the C4 model.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • Nixpkgs 25.11 Release Notes (or backporting 24.11 and 25.05 Nixpkgs Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
  • NixOS 25.11 Release Notes (or backporting 24.11 and 25.05 NixOS Release notes)
    • (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, pkgs/README.md, maintainers/README.md and other contributing documentation in corresponding paths.

Add a 👍 reaction to pull requests you find important.

@NixOSInfra NixOSInfra added the 12.first-time contribution This PR is the author's first one; please be gentle! label Jun 17, 2025
@mhemeryck mhemeryck mentioned this pull request Jun 17, 2025
13 tasks
Copy link
Contributor

@RossSmyth RossSmyth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good so far. I would recommend just running nix fmt pkgs/by-name/st/structurizr/package.nix to get formatting.

Here's some recommendations.

@RossSmyth
Copy link
Contributor

Also strictDeps = true

Copy link
Contributor

@drupol drupol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello,

Thanks for the PR, I made a few comments, let me know if this is not clear.

@github-actions github-actions bot added 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. 8.has: maintainer-list (update) This PR changes `maintainers/maintainer-list.nix` labels Jun 18, 2025
@mhemeryck
Copy link
Contributor Author

Update: I did have a look at some of the remarks, not everything yet. Thanks for all the feedback, I was first doubting to push a PR, certainly since I really don't feel that knowledgeable about nix / functional programming, but I feel I'm already learning a lot in the process!

@RossSmyth
Copy link
Contributor

Update: I did have a look at some of the remarks, not everything yet. Thanks for all the feedback, I was first doubting to push a PR, certainly since I really don't feel that knowledgeable about nix / functional programming, but I feel I'm already learning a lot in the process!

Welcome! If you want any real-time help, you can reach out to me on Matrix and I'd be happy to help out. Or just ask in the Matrix channels for general help, people are usually friendly.

@dtomvan
Copy link
Contributor

dtomvan commented Jun 18, 2025

I submitted a PR to upstream so that versionCheckHook will work and to make building from source possible (e.g. dependency resolution doesn't work yet with a mitmcache) structurizr/cli#175

@RossSmyth
Copy link
Contributor

Oh nice. If it the patch can, you could apply that PR as a patch until a release is made with it merged with fetchPatch2. Something like:

patches = [ 
  (fetchPatch2 {
    url = "https://patch-diff.githubusercontent.com/raw/structurizr/cli/pull/175.patch";
    hash = "";
  })
];

@drupol
Copy link
Contributor

drupol commented Jun 18, 2025

What do you mean ?

@mhemeryck
Copy link
Contributor Author

I submitted a PR to upstream so that versionCheckHook will work and to make building from source possible (e.g. dependency resolution doesn't work yet with a mitmcache) structurizr/cli#175

Ah, you were already working on this?

I was at some point also thinking of seeing how to build it from source, such I would have a nix flake as part of the structurizr-cli repo -- but I didn't think I'd know enough about java nor nix, never mind the combination of these two.

Would you rather wait for your PR to be merged in and then be able to build from source instead?

@mhemeryck mhemeryck marked this pull request as ready for review June 18, 2025 18:46
@mhemeryck
Copy link
Contributor Author

OK, I think at this point I did address all of the issues and the overall result definitely looks better.

Should I still squash everything myself or can that be done on merge?

@drupol
Copy link
Contributor

drupol commented Jun 18, 2025

OK, I think at this point I did address all of the issues and the overall result definitely looks better.

Should I still squash everything myself or can that be done on merge?

The package should be structurizr-cli. Please update the PR title (please read the guidelines on how to properly format the commits and the PR title), the package directory and squash the commits into one single commit. At the end there should only be 2 commits in the PR.

@mhemeryck mhemeryck changed the title structurizr: v2025.05.28 structurizr-cli: 2025.05.28 Jun 18, 2025
@drupol drupol changed the title structurizr-cli: 2025.05.28 structurizr-cli: init at 0-unstable-2025-05-28 Jun 18, 2025
@mhemeryck
Copy link
Contributor Author

Built on x86_64-linux. coreutils, findutils and gnused are there mostly to make versionCheckHook happy, because gradle-application-plugin's launch script uses xargs, tr, uname, and sed to work. This really only isn't available when sandboxed but it's here for completeness. As of now it ships the entire kotlin compiler with it automatically, taking up 57/102 MB of the realisation... don't know it that's desirable or not...

structurizr-cli/package.nix but from source

Thanks for the effort!

I'm a bit mixed about it though, since it depends on all these workarounds just be able to build from source. On the other hand, that's a bit the magic that nix offers, it's nice to see all of the features that are available (and a little over my head as well, to be fully honest).

I think however though it would be better if these sort of fixes are handled at the original source repository.

Would you mind if we;d go ahead with the MR, built from the release instead and only reconsider this later on again?

@mhemeryck
Copy link
Contributor Author

Let me know when it's ready and I'll give it another review and stuff it through nixpkgs-review

As far as I'm concerned, it's OK like this, with the caveat of my reply in #417630 (comment) i.e. it looks like it's possible to also build from source with some patches, but I don't know if that's really required / desired.

@drupol
Copy link
Contributor

drupol commented Jun 19, 2025

Building from source is always preferred indeed.

@dtomvan
Copy link
Contributor

dtomvan commented Jun 19, 2025

I think however though it would be better if these sort of fixes are handled at the original source repository.

Which is why I proposed a PR to upstream to adopt better gradle practices. Adding the patch temporarily isn't that much of a workaround IMO. Except for that I don't really see a lot of hacks.

Maybe __darwinAllowLocalNetworking = true; looks a bit hacky but it's what we usually do when we use a mitmCache for gradle.

@mhemeryck
Copy link
Contributor Author

Since consensus seemed to be to build from source with the patch (and since @dtomvan pretty much did all the work), I did switch to that version.

I did have to do some further tweaks, like generate the deps.json file and also the hash for the patch was somehow not compatible (so I just bluntly replaced it with whatever the build told me it'd be).

In that sense, I'm not completely sure what I did -- but I tend to have this feeling for anything nix-related at the moment still 😅

If this is OK, I will squash / recommit and it's ready for final review (?)

@mhemeryck mhemeryck requested a review from drupol June 23, 2025 20:00
Copy link
Contributor

@drupol drupol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're almost there, make sure this PR only contains 2 commits.

  • 1 commit for adding you in the maintainers list
  • 1 commit for adding structurizr-cli

@github-actions github-actions bot added the 12.approvals: 1 This PR was reviewed and approved by one person. label Jun 23, 2025
@mhemeryck
Copy link
Contributor Author

To merge; should I call the merge bot?

@NixOS/nixpkgs-merge-bot merge

@nixpkgs-merge-bot
Copy link
Contributor

@mhemeryck merge not permitted (#305350):
maintainers/maintainer-list.nix is not in pkgs/by-name/

@drupol
Copy link
Contributor

drupol commented Jun 24, 2025

Looks like it shouldn't be merged, it's failing on the CI.

@drupol
Copy link
Contributor

drupol commented Jun 24, 2025

Looks like the hash of the patches are wrong:

copying path '/nix/store/m47hz3hp7clyrivylfnalmchdrcl8am3-mockito-bom-4.11.0.pom' from 'https://cache.nixos.org'...
error: hash mismatch in fixed-output derivation '/nix/store/mv3cj2ppgjvnvdwd24x1dc79snkij4km-1a11940d089a8d70d6e298660c6f5db638cc8d00.patch.drv':
error: hash mismatch in fixed-output derivation '/nix/store/nqjlra15vwbmqvb5nhky1zcx8fxcnlcj-24be5eeec893df5261100913c4e51ca0bd100689.patch.drv':
         specified: sha256-9FYSZIW24esdkHDg4L0D1s+6aErISyG+/TjRmseZzmU=
            got:    sha256-tj7fNOqKLPvgTYKCRIJlGg1OGyGOmmx0Pj4H8oDPVdU=
error: hash mismatch in fixed-output derivation '/nix/store/0j5b5s5s27x5qhw4xlj90q5v3bpyzk8v-3260d8622a9cf6197d6ab5d9440087dcaac3fbb9.patch.drv':
         specified: sha256-lINtWlNCX/EtfWhC83T5pSGo5ewlBwjz5mnZb74tPPs=
            got:    sha256-0zUmg+smxQLZm9wWu3JL1pIXQJcQ1uyQ433C1pDLatQ=
error: hash mismatch in fixed-output derivation '/nix/store/l1336gxbpmqpfz8kzldd6g378liqzlvn-2cb1d86c59f210ce32211395570e8dccf138df16.patch.drv':
         specified: sha256-aPmS37Hzmce9XNsIA02vw8abhmy0cPOx/vqHeOCn8/Q=
            got:    sha256-wswvXJujyPpbvXvL2SOFC4zZLnfskYFdHvzry66vukQ=

@mhemeryck
Copy link
Contributor Author

Looks like the hash of the patches are wrong:

copying path '/nix/store/m47hz3hp7clyrivylfnalmchdrcl8am3-mockito-bom-4.11.0.pom' from 'https://cache.nixos.org'...
error: hash mismatch in fixed-output derivation '/nix/store/mv3cj2ppgjvnvdwd24x1dc79snkij4km-1a11940d089a8d70d6e298660c6f5db638cc8d00.patch.drv':
error: hash mismatch in fixed-output derivation '/nix/store/nqjlra15vwbmqvb5nhky1zcx8fxcnlcj-24be5eeec893df5261100913c4e51ca0bd100689.patch.drv':
         specified: sha256-9FYSZIW24esdkHDg4L0D1s+6aErISyG+/TjRmseZzmU=
            got:    sha256-tj7fNOqKLPvgTYKCRIJlGg1OGyGOmmx0Pj4H8oDPVdU=
error: hash mismatch in fixed-output derivation '/nix/store/0j5b5s5s27x5qhw4xlj90q5v3bpyzk8v-3260d8622a9cf6197d6ab5d9440087dcaac3fbb9.patch.drv':
         specified: sha256-lINtWlNCX/EtfWhC83T5pSGo5ewlBwjz5mnZb74tPPs=
            got:    sha256-0zUmg+smxQLZm9wWu3JL1pIXQJcQ1uyQ433C1pDLatQ=
error: hash mismatch in fixed-output derivation '/nix/store/l1336gxbpmqpfz8kzldd6g378liqzlvn-2cb1d86c59f210ce32211395570e8dccf138df16.patch.drv':
         specified: sha256-aPmS37Hzmce9XNsIA02vw8abhmy0cPOx/vqHeOCn8/Q=
            got:    sha256-wswvXJujyPpbvXvL2SOFC4zZLnfskYFdHvzry66vukQ=

I did try to get the hashes through nix store prefetch-file, like for instance

nix store prefetch-file  https://github.com/structurizr/cli/commit/1a11940d089a8d70d6e298660c6f5db638cc8d00.patch

But this doesn't look OK; is there another way to do it?

@drupol
Copy link
Contributor

drupol commented Jun 25, 2025

I think you first need to download the file, then use nix store prefetch-file. Are you trying to build scructurizr-cli before commit/push ? Because it will complain with the same issue and you can copy-paste the hashes it has found. (https://github.com/NixOS/nixpkgs/pull/417630/checks?check_run_id=44775688805)

Copy link
Contributor

@drupol drupol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please squash the commits ?

mhemeryck and others added 2 commits June 28, 2025 22:26
Adds [`structurizr-cli`], a command-line tool to interact with
architecture diagrams written according to the [C4 model].

[`structurizr-cli`]: https://docs.structurizr.com/cli
[C4 model]: https://c4model.com/

Co-authored-by: Tom van Dijk <[email protected]>
@drupol drupol merged commit 224a1e7 into NixOS:master Jun 29, 2025
25 of 27 checks passed
@drupol
Copy link
Contributor

drupol commented Jun 29, 2025

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

8.has: maintainer-list (update) This PR changes `maintainers/maintainer-list.nix` 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. 12.approvals: 1 This PR was reviewed and approved by one person. 12.first-time contribution This PR is the author's first one; please be gentle!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants