nixpkgs

How does Nix's “callPackage” call functions defined without an ellipsis?

这一生的挚爱 提交于 2020-01-03 08:48:33
问题 To call a Nix function that uses set destructuring, you need to pass it a set with exactly the keys it requires, no more and no less: nix-repl> ({ a }: a) { a = 4; b = 5; } error: anonymous function at (string):1:2 called with unexpected argument ‘b’, at (string):1:1 The exception to this is if the function's argument list contains an ellipsis at the end: nix-repl> ({ a, ... }: a) { a = 4; b = 5; } 4 However, most of the packages in nixpkgs consist of a default.nix file containing a function

Where is `callPackage` defined in the Nixpkgs repo (or how to find Nix lambda definitions in general)?

牧云@^-^@ 提交于 2019-12-13 16:16:48
问题 Found a lot of sources describing callPackage and some of its internals, but none that refers to it's location. It's like the best kept secret of Nix, and the manuals even seem to be actively avoiding the topic. I could find it given time, but it's a huge repo. Resources: How does Nix's “callPackage” call functions defined without an ellipsis? (Stackoverlow) Nix Pills, Chapter 13. Callpackage Design Pattern Nix 回答1: nix repl can tell you the location where a lambda is defined. $ nix repl

Where should the builder script be located for a stand-alone nix expression?

江枫思渺然 提交于 2019-12-12 04:48:08
问题 I have a nix expression file ( .nix ) and a shell script builder, specified like: stdenv.mkDerivation rec { name = "my-env"; builder = './my-builder.sh'; ... ./my-builder.sh: No such file or directory when I run nix-build ./my-env.nix ; the nix expression file and builder scripts are sitting side-by-side in my home directory. My intent is to use this nix expression file to prepare an environment using nix-build and then to actually quickly run the environment whenever I want to use it (using