New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
kicad: add srcs parameter to allow configuring kicad versions #100066
Conversation
@matthuszagh this change is somewhat simple enough so it's easy for me to press the button, but I think it would be nice if it was possible to use a different fork of a library / kicad itself, not only a different revision. P.S the eval errors have nothing to do with you. |
I didn't consider that but I agree with you. Let me dig into this a little more. |
332d1ea
to
0465a38
Compare
0465a38
to
c63ff9d
Compare
c63ff9d
to
475cc05
Compare
@doronbehar this now allows overriding with a full final: prev:
{
kicad-unstable = (prev.kicad-unstable.override {
srcs = {
kicadVersion = "2020-10-08";
kicad = prev.fetchFromGitLab {
group = "kicad";
owner = "code";
repo = "kicad";
rev = "fd22fe8e374ce71d57e9f683ba996651aa69fa4e";
sha256 = "sha256-F8qugru/jU3DgZSpQXQhRGNFSk0ybFRkpyWb7HAGBdc=";
};
};
});
} Let me know what you think. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Besides these, here are general comments:
- It'd be easier to review this if the indentation settings will be in a separate commit.
- More comments to how the logic is going on inside
default.nix
regardingsrcs
. - Since there's no way to query a package's override options, it'd be nice to put a big comment at the start of
default.nix
with all the possible ways one can overridesrcs
.
Oh and 1 more thing: I'm rather sure this change shouldn't trigger rebuilds - ofborg detects it this way and in the "eval" check of the PR, there's a link to the list of changed outputs. Also the PR's labels ofborg sets reflects that. |
475cc05
to
8be221d
Compare
@doronbehar thanks for the review. I've applied the changes. Let me know. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The review is a bit messy sorry, but the expression is getting better and better :). Some suggestions are better of in separate commits.
8be221d
to
edb81b7
Compare
@doronbehar I hope I got everything (I think I did), but sorry in advance if I messed something up (got into a little trouble with all the rebasing :)). Also let me know about those other two points. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not many more to go. The commit messages look good overall. Only commit 239d16c should mention the rename of the *Support
arguments to with*
.
edb81b7
to
173a122
Compare
I've implemented the changes. Let me know if there's anything else. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your cooperation. Only issues I see are in the assertions commit. It's almost perfect.
173a122
to
72caaed
Compare
72caaed
to
4c2306b
Compare
I've made the changes, let me know what you think @doronbehar. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, to be nice to everyone else, we should add release notes to rl-2103.xml (ideally in seperate commit from this one).
The commit message of this "rename options commit" should mention also the fact that the defaults are not needed in base.nix
, although it doesn't affect users directly.
1 last round I promise!
4c2306b
to
aa9478e
Compare
I know it ruins the Also, we'll definitely need a commit that mentions these api changes in |
Also: Use assertions instead of silently ignoring arguments that don't cooperate (occ+oce) / won't compile (aarch64 + oce). base.nix no longer provides default argument values since these are provided by default.nix.
This also exposes the full src and version parameters for each derivation, allowing them to overrideable by srcs.
aa9478e
to
b90776c
Compare
Changes in. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry for such a late review
i missed it because i confused its mails for #85456
and it being merged just 3 days after being opened did not leave a lot of time to discover that mistake
|
||
# oce on aarch64 fails a test | ||
withOCE = oceSupport && !stdenv.isAarch64; | ||
withOCC = (withOCCT && !withOCE) || (oceSupport && stdenv.isAarch64); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it took me quite a long time figuring this out
can you prove that what you used instead is equivalent?
}: | ||
|
||
assert ngspiceSupport -> libngspice != null; | ||
# The `srcs` parameter can be used to override the kicad source code |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
having never used overlays, i did not write this package with them in mind
my original intent was for the versions.nix being the single reference for all version info
i don't entirely get your changes, that's ok (but because of that i'd like you to be added to meta.maintainers)
but would it not be simpler to just provide kicad with a different versions.nix (with which i mean the nix content of that file) (or for example a way to merge updates to it so one does not have to provide a full replacement)?
right now i'm assuming that's not possible
or that i am missing a benefit to this more complicated approach
let | ||
mkLib = name: | ||
stdenv.mkDerivation { | ||
pname = "kicad-${name}"; | ||
# Use the revision instead of `version` (which is an ISO 8601 date) | ||
# to prevent duplicating the library when just the date changed | ||
version = "${builtins.substring 0 10 libSources.${name}.rev}"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was a rev substring for a very good reason
with it being the date (for kicad-unstable), the 3D models get downloaded and "built" again when only the date, but nothing else, changed
since this is a ~6gb download, i strongly believe it is worth avoiding if at all possible (which it is)
(i suspect this PR causes this to now be the date, but i can't actually tell...)
|
||
versions = import ./versions.nix; | ||
versionConfig = versions.${baseName}; | ||
libSrcFetch = name: fetchFromGitLab { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one of the goals of my rewrite was to simplify default.nix to be as much as possible just the wrapper
code related to building the components that get tied together here should be in base.nix or libraries.nix respectively
@@ -42,30 +28,4 @@ in | |||
templates = mkLib "templates"; | |||
footprints = mkLib "footprints"; | |||
packages3d = mkLib "packages3d"; | |||
|
|||
# i18n is a special case, not actually a library |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think this description of i18n being optional, separate and only found via a relative path should have been retained
Motivation for this change
Allows overriding kicad versions which are otherwise inaccessible.
Things done
Added srcs parameter that can be used to customize kicad or kicad-unstable versions, including libraries. For instance, you could do something like:
I've also reformatted the existing code. Let me know if the reformatting is too invasive and I'll revert.
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)