Skip to content

kikit and kicad package set#249464

Merged
fricklerhandwerk merged 8 commits intoNixOS:masterfrom
ngi-nix:kikit
Nov 16, 2023
Merged

kikit and kicad package set#249464
fricklerhandwerk merged 8 commits intoNixOS:masterfrom
ngi-nix:kikit

Conversation

@jfly
Copy link
Contributor

@jfly jfly commented Aug 16, 2023

kicad: Add support for 3rd party packages

kikit (init at 1.3.0)
kicadAddons.kikit (init at 1.3.0)
kicadAddons.kikit-library (init at 1.3.0)
python310Packages.euclid3 (init at 0.01)
python310Packages.pcbnew-transition (init at 0.3.4)
python310Packages.pybars3 (init at 0.9.7)
python310Packages.pymeta3 (init at 0.5.1)
python311Packages.euclid3 (init at 0.01)
python311Packages.pcbnew-transition (init at 0.3.4)
python311Packages.pybars3 (init at 0.9.7)
python311Packages.pymeta3 (init at 0.5.1)

Co-authored-by: Rohit [email protected]
Co-authored-by: Jeremy Fleischman [email protected]
Co-authored-by: Shahar "Dawn" Or [email protected]
Co-authored-by: Alejandro Sanchez Medina [email protected]
Co-authored-by: Matúš Ferech [email protected]

Description of changes

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, 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/)
  • 23.11 Release Notes (or backporting 23.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.

@github-actions github-actions bot added the 6.topic: python Python is a high-level, general-purpose programming language. label Aug 16, 2023
@alejandrosame
Copy link
Member

@ofborg build kicadPackages.kikit kicadPackages.kikit-library python310Packages.euclid3 python310Packages.kikit python310Packages.pcbnew-transition python310Packages.pybars3 python310Packages.pymeta3 python311Packages.euclid3 python311Packages.kikit python311Packages.pcbnew-transition python311Packages.pybars3 python311Packages.pymeta3

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/make-a-derivation-for-a-kicad-plugin/7317/19

@ofborg ofborg bot added 8.has: package (new) This PR adds a new package 11.by: package-maintainer This PR was created by a maintainer of all the package it changes. 10.rebuild-darwin: 11-100 This PR causes between 11 and 100 packages to rebuild on Darwin. 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages to rebuild on Linux. labels Aug 16, 2023
@alejandrosame alejandrosame requested review from Kiwi and evils August 16, 2023 08:09
@evils
Copy link
Member

evils commented Aug 16, 2023

wow, that's a lot of work, awesome

i'll do a review later

for now,
please separate the changes into a commit per package
especially separate commits for the maintainer-list changes

@matusf
Copy link
Member

matusf commented Aug 22, 2023

@evils hey friendly reminder. We've just unbroken installing packages via PCM.

@evils
Copy link
Member

evils commented Aug 22, 2023

nice

i've been a bit busier than expected, and don't immediately foresee a moment i'll have time

don't hesitate to poke me again in a week if i haven't gotten around to it then

@jfly
Copy link
Contributor Author

jfly commented Aug 28, 2023

@SuperSandro2000, we've pushed a commit addressing most of your feedback. Would appreciate if you could take another look!

@jfly jfly requested a review from SuperSandro2000 August 28, 2023 07:15
@ofborg ofborg bot requested a review from matusf August 28, 2023 07:35
@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/2023-summer-of-nix-program-goals/30376/12

@mightyiam
Copy link

@evils have a moment to review?

Copy link
Member

@evils evils left a comment

Choose a reason for hiding this comment

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

the changes in applications/science/electronics/kicad look ok to me
i'm unfamiliar with KiKit and don't know how to use these changes
but it builds and is a fairly clean addition to the KiCad wrapper package (default.nix)

the closest thing to a blocking issue would be calling the third party packages kicadPackages
(it seems like one could expect the KiCad project's packages3d there)

@ofborg ofborg bot requested a review from evils September 4, 2023 07:19
@mightyiam
Copy link

Just rebased on nixpkgs-unstable and tested locally again. Here's how to test locally:

nix-build -E 'let pkgs = (import ./. {}); in pkgs.kicad.override {addons=[pkgs.kicadAddons.kikit pkgs.kicadAddons.kikit-library];}'

Then create a project and look for the KiKit button in the toolbar. Click it. And if you happen to know how to use it, go ahead. We don't.

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/prs-ready-for-review/3032/2824

@ofborg ofborg bot requested a review from matusf October 27, 2023 12:00
@mightyiam
Copy link

I contacted @yaqwsx, the author of KiKit for help with verification.

@yaqwsx
Copy link

yaqwsx commented Nov 14, 2023

Hi, I tried building the package, but I am unsure if I use Nix correctly. I run into two problems:

  • when I run ./result/bin/pcbnew I get Could not determine wxPython version. Python plugins will not be available.
  • I also struggle to find the kikit executable.

Once I build the package, how can I install it to test it properly? I also noticed that this package builds KiKit 1.3.0, however, 1.4.0 is the most recent release.

@mightyiam
Copy link

@yaqwsx thank you for trying! Funny. I don't get that wxPython related error.

The kikit executable on this branch can be obtained this way:

nix-build -E 'let pkgs = (import ./. {}); in pkgs.kikit'

And then look in result/

Regarding the version of KiKit, that is just a matter of bumping, I suppose. I'll try doing that.

@mightyiam
Copy link

@yaqwsx would you mind going on a call with me so that I could debug the wxPython error?

@yaqwsx
Copy link

yaqwsx commented Nov 14, 2023

No problem with the call; I am busy for the rest of the week. What timezone are you in so I can suggest a time slot that would suit us both?

@evils
Copy link
Member

evils commented Nov 14, 2023

weird, our pcbnew is a wrapper that explicitly sets PYTHONPATH to include our wxPython and then calls the actual binary
i'm assuming you're not on NixOS and have an ambient wxPython installed, and that that's causing an issue

try nix-shell --pure -I nixpkgs=/path/to/your/nixpkgs/clone/with/these/changes -p kicad, this should at least clear env vars that may be pointing to another wxPython
(though it's entirely possible pcbnew finds wxPython in an FHS path, dunno what to do about that)
also try launching pcbnew via the kicad main window

@mightyiam
Copy link

@yaqwsx would you mind scheduling here?

@yaqwsx
Copy link

yaqwsx commented Nov 16, 2023

@evils Even when I run KiCAD and open Pcbnew from it I get the same error message. When open the pure nix shell, I no longer get the error, but also the KiCAD doesn't see KiKit backend.

@mightyiam
Copy link

try nix-shell --pure -I nixpkgs=/path/to/your/nixpkgs/clone/with/these/changes -p kicad

That would result in a default kicad. Default kicad comes with no addons. Try this to obtain a pure nix shell with kicad and kikit:

nix-shell --pure -p 'let pkgs = (import ./. {}); in pkgs.kicad.override {addons=[pkgs.kicadAddons.kikit pkgs.kicadAddons.kikit-library];}'

To be clear, when that succeeds, you'd have a ./result/bin/kicad that should have kikit included. You should also have a ./result/bin/pcbnew that should work just fine, because of the magic of Nix.

Let us know, please.

jfly and others added 8 commits November 16, 2023 21:24
Co-authored-by: Rohit <[email protected]>
Co-authored-by: Jeremy Fleischman <[email protected]>
Co-authored-by: Shahar "Dawn" Or <[email protected]>
Co-authored-by: Alejandro Sanchez Medina <[email protected]>
Co-authored-by: Matúš Ferech <[email protected]>
Co-authored-by: Rohit <[email protected]>
Co-authored-by: Jeremy Fleischman <[email protected]>
Co-authored-by: Shahar "Dawn" Or <[email protected]>
Co-authored-by: Alejandro Sanchez Medina <[email protected]>
Co-authored-by: Matúš Ferech <[email protected]>
Co-authored-by: Rohit <[email protected]>
Co-authored-by: Jeremy Fleischman <[email protected]>
Co-authored-by: Shahar "Dawn" Or <[email protected]>
Co-authored-by: Alejandro Sanchez Medina <[email protected]>
Co-authored-by: Matúš Ferech <[email protected]>
…on: init at 0.3.4

Co-authored-by: Rohit <[email protected]>
Co-authored-by: Jeremy Fleischman <[email protected]>
Co-authored-by: Shahar "Dawn" Or <[email protected]>
Co-authored-by: Alejandro Sanchez Medina <[email protected]>
Co-authored-by: Matúš Ferech <[email protected]>
Co-authored-by: Rohit <[email protected]>
Co-authored-by: Jeremy Fleischman <[email protected]>
Co-authored-by: Shahar "Dawn" Or <[email protected]>
Co-authored-by: Alejandro Sanchez Medina <[email protected]>
Co-authored-by: Matúš Ferech <[email protected]>
Co-authored-by: Rohit <[email protected]>
Co-authored-by: Jeremy Fleischman <[email protected]>
Co-authored-by: Shahar "Dawn" Or <[email protected]>
Co-authored-by: Alejandro Sanchez Medina <[email protected]>
Co-authored-by: Matúš Ferech <[email protected]>
Co-authored-by: Rohit <[email protected]>
Co-authored-by: Jeremy Fleischman <[email protected]>
Co-authored-by: Shahar "Dawn" Or <[email protected]>
Co-authored-by: Alejandro Sanchez Medina <[email protected]>
Co-authored-by: Matúš Ferech <[email protected]>
Create a new kicadAddons package set, and a mechanism to override
kicad to bundle addons.

Co-authored-by: Rohit <[email protected]>
Co-authored-by: Jeremy Fleischman <[email protected]>
Co-authored-by: Shahar "Dawn" Or <[email protected]>
Co-authored-by: Alejandro Sanchez Medina <[email protected]>
Co-authored-by: Matúš Ferech <[email protected]>
@yaqwsx
Copy link

yaqwsx commented Nov 16, 2023

Ok, with shell specififed as above, it seems to work just from KiCAD & Pcbnew. However, what I cannot get working is to invoke KiKit as a command line utility; the following should work: kikit --help. I just get Command not found.

@matusf
Copy link
Member

matusf commented Nov 16, 2023

Hi, yes, the last expression introduced kikit as only a kicad addon. You can use the following expresion to add kikit itself as well.

nix-shell --pure -p '
let pkgs = (import ./. {}); in 
[ 
  (pkgs.kicad.override { addons=[pkgs.kicadAddons.kikit pkgs.kicadAddons.kikit-library]; })
  pkgs.kikit
]'

@mightyiam
Copy link

nix-shell --pure -p 'let pkgs = (import ./. {}); in pkgs.kicad.override {addons=[pkgs.kicadAddons.kikit pkgs.kicadAddons.kikit-library];}'

To be clear, when that succeeds, you'd have a ./result/bin/kicad that should have kikit included. You should also have a ./result/bin/pcbnew that should work just fine, because of the magic of Nix.

Sorry, @yaqwsx. I mislead you with the paragraph above. nix-build produces a result directory. nix-shell, however, places you in a shell where the executables of the built packages are in the PATH. So, after running a nix-shell, don't execute ./result/bin/kicad. Instead, execute kicad.

@yaqwsx
Copy link

yaqwsx commented Nov 16, 2023

With the last instructions, I was able to run both, KiKit from GUI and KiKit from CLI. The basic functionality works as expected.

The last thing is that if you want to build 3D-printed stencil (KiKit's command kikit stencil createprinted) it requires OpenSCAD to be installed. Which is not the case for the Nix package. However, we declare OpenSCAD as an optional dependency (mainly because of Windows). What do you think - should it or shouldn't it be included in the package?

@mightyiam
Copy link

Awesome feedback! OpenSCAD should not be a blocker for this PR. I suggest this can be merged.
@fricklerhandwerk

@fricklerhandwerk fricklerhandwerk merged commit 1bafe69 into NixOS:master Nov 16, 2023
@mightyiam mightyiam deleted the kikit branch November 17, 2023 00:19
@matusf matusf mentioned this pull request Feb 28, 2024
13 tasks
@Axler1 Axler1 mentioned this pull request Apr 17, 2025
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: python Python is a high-level, general-purpose programming language. 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: 11-100 This PR causes between 11 and 100 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.

10 participants