explicitcad icon indicating copy to clipboard operation
explicitcad copied to clipboard

Nix package PoC

Open sorki opened this issue 5 years ago • 6 comments

Allows to build explicitcad with Nix using nix-build. Afterwards it can be launched using ./result/bin/explicitcad wrapper, which also sets PATH correctly to contain extopenscad binary so stuff just works^TM.

Creating a draft PR so I don't forget about this - let me know when you feel like it's a good time to submit this as a NixOS package, ideally some releases/tags would be cool so I don't have to pick arbitrary commits from master.

sorki avatar Oct 24 '20 13:10 sorki

I like the the idea of Nix-ifying the build, however I'm quite new to Nix.

A couple of things though:

  1. Can you use CMake instead of qmake? I prefer CMake over qmake because it tells me when depedendencies are missing instead of just failing at build (what qmake does). Maybe I'm using qmake wrong, though.
  2. Can you write a flakes.nix? 😬 It is my understanding that this way you dont need to PR to upstream Nix anymore? Do you know how they differ from a "normal" nix file?

I feel like there was a '3.' but I cant think of it now ;)

As for releases: I want to be able to build distributable packages for at least two OSs before doing that and then have CI create a package with each release. I have a PoC to build a *.dmg or macOS and I've set up a Windows and Linux test machine … releases coming "soon"-ish :)

hannesweisbach avatar Oct 26 '20 08:10 hannesweisbach

Oh, I rembered 3: adding nix-build to the CI ;) Doesn't mean you have to do it, specifically, but if the feature "builds under Nix" is in the software I want it at least tested.

hannesweisbach avatar Oct 26 '20 08:10 hannesweisbach

  • Ad 1 - Looks like cmake build works (you can try s/qmake/cmake/g) but it misses install target and the executable is called explicitCAD.
  • Ad 2 - I think for now it's better to just submit a PR to nixpkgs as that makes the package instantly available for all nixpkgs users. It's not quite clear how to split nixpkgs currently and it will probably remain in monorepo state with some parts (like autogenerated Haskell package set and similar split into flakes). Flake for a package is relatively straightforward - just define an overlay like
(self: super: { 
  explicitcad = self.libsForQt5.callPackage ./explicitcad.nix {}; 
}) 

and expose it via flake.nix

sorki avatar Oct 27 '20 14:10 sorki

it misses install target

so did qmake …

and the executable is called explicitCAD.

which is imo the correct capitalization. Or "ExplicitCAD" … idk.

  • Ad 2 - I think for now it's better to just submit a PR to nixpkgs as that makes the package instantly available for all nixpkgs users. It's not quite clear how to split nixpkgs currently and it will probably remain in monorepo state with some parts (like autogenerated Haskell package set and similar split into flakes). Flake for a package is relatively straightforward - just define an overlay like

Ok, good to know.

hannesweisbach avatar Oct 28 '20 12:10 hannesweisbach

I took the liberty of rebasing the changes in this PR on top of the current master. I hope I did it right and didn't break anything.

hannesweisbach avatar Oct 30 '20 09:10 hannesweisbach

LGTM! :+1: I've marked it is ready, feel free to squash / merge / reword my XXX commit.

sorki avatar Dec 03 '20 15:12 sorki