Git Product home page Git Product logo

cq-flake's Introduction

CadQuery and CQ-editor flake

What is this

Concepts:

  1. nix package manager and the NixOS Linux distribution
  2. nix flakes
  3. CadQuery and CQ-editor
  4. Cachix

This repo is a nix flake that allows you to reproduce a CadQuery and CQ-editor installation anywhere that has nix. Well, a version of nix with flake support, which is currently only in unstable but should be merged soon. Also, it probably won't work outside of NixOS, because graphic drivers are super difficult to make reproducible. But anyway.

This means that you can create a model in CadQuery and note down the commit to this repo you used to build it (or fork it and take control yourself). At any point in the future you can use the same command to run CQ-editor and due to the flake describing all the sources of every package used by CQ-editor it will still work, regardless of:

  • changes to the CadQuery API breaking backwards compatibility
  • new Python versions
  • nixpkgs dropping support for Sphinx 2.4 3.0.2 or whatever other version it gets pinned to next
  • etc., you get the idea, breaking changes anywhere in the chain of packages.

While nix is a source based package manager, I publish binaries to to Cachix. This flake now includes the configuration required to automatically download binaries from my Cachix (thanks thomaslepoix and EdenEast).

Now also includes cq-kit.

Commands

To run CQ-editor:

nix run github:marcus7070/cq-flake

Note that I currently set QT_QPA_PLATFORM=xcb in the CQ-editor wrapper. I need to do this to get it to work under Wayland, and I think it should work for most X based window managers as well, but YMMV.

To create an environment with CadQuery and python-language-server (where hopefully your IDE will pick up python-language-server and supply autocomplete, docs, etc.):

nix shell github:marcus7070/cq-flake#cadquery-env

To get the most out of this flake you should specify a commit along with those commands and note it down so you are always using the same CadQuery, eg.

nix run github:marcus7070/cq-flake/14d05cee591dccf5d64fa0e502e6e381a531c718

You can also generate the docs with:

nix build github:marcus7070/cq-flake#cq-docs

which will leave a symlink called result pointing to the HTML docs.

Local dev

Should you wish to do dev work with CadQuery check out the dev branch of this repo. flake.nix shows how to reference a local copy (must be a Git repo) of CadQuery instead of a GitHub copy. Then use a command like:

nix flake update --update-input cadquery . && nix build -L .#cadquery-docs && qutebrowser ./result-doc/share/doc/index.html

I've also added some debug stuff for debugging with gdb. Debugging symbols for Python have come and gone from nixpkgs, if the debugging attributes don't have all the symbols you need look into setting overriding separateDebugInfo = true; in the Python expression. The most likely method you need for debugging is to run nix develop github:marcus7070/cq-flake#cadquery-env-debug, start python, switch to a second terminal, gdb python <PID>, continue, switch back to python, make it crash, switch back to gdb, bt. gdb can't run scripts so it's difficult to start Python (which under nix is usually a script wrapper around the actual Python binary) from within gdb, easier just to attach it to a running instance. Debugging currently removed from nixpkgs.

cq-flake's People

Contributors

marcus7070 avatar vinszent avatar sapphire-arches avatar s-ol avatar jmgao avatar rowang077 avatar thomaslepoix avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.