How to set nixpkgs.config options in devenv.yaml or devenv.nix?
Question: How to set nixpkgs.config options in devenv.yaml?
Description
For a project I need nrfutil, which itself depends on segger-jlink. This is a non-free package (which I can set using permittedUnfreePackages, however it further requires to set nixpkgs.config.segger-jlink.acceptLicense = true, but I'm not sure how to configure these options in devenv.yaml format.
Current Configuration
My devenv.yaml:
nixpkgs:
permittedUnfreePackages:
- nrfutil
- segger-jlink
inputs:
nixpkgs:
url: github:cachix/devenv-nixpkgs/rolling
rust-overlay:
url: github:oxalica/rust-overlay
inputs:
nixpkgs:
follows: nixpkgs
Error Message
error:
error: Use of the "SEGGER JLink Software and Documentation pack" requires the
acceptance of the following licenses:
- SEGGER Downloads Terms of Use [1]
- SEGGER Software Licensing [2]
You can express acceptance by setting acceptLicense to true in your
configuration. Note that this is not a free license so it requires allowing
unfree licenses as well.
configuration.nix:
nixpkgs.config.allowUnfree = true;
nixpkgs.config.segger-jlink.acceptLicense = true;
config.nix:
allowUnfree = true;
segger-jlink.acceptLicense = true;
[1]: https://www.segger.com/downloads/jlink/JLink_Linux_V874_x86_64.tgz
[2]: https://www.segger.com/purchase/licensing/
✖ Building shell in 3.01s
Question
How can I set arbitrary nixpkgs.config options (like segger-jlink.acceptLicense = true) in devenv.yaml? The error message provides examples for traditional NixOS configuration files, but I need to know the equivalent syntax for devenv's YAML/nix-based configuration.
Is there a general way to pass through nixpkgs config options in devenv.yaml, or do I need to use a different approach?
There isn't really a way to do that, but I find this is more of an api issue that permittedUnfreePackages should be renamed to something like accepting the license.
hmm, thanks.. do you have an idea for a workaround (as I'm both new to nix and devenv)?
@trembel
I also needed to accept the license (microsoftVisualStudioLicenseAccepted), so I solve it this way:
devenv.yaml
inputs:
nixpkgs:
url: github:cachix/devenv-nixpkgs/rolling
allowUnfree: true
devenv.nix
{ pkgs, lib, ... }@inputs:
let
pkgs = import inputs.nixpkgs {
system = inputs.pkgs.stdenv.system;
config.microsoftVisualStudioLicenseAccepted = true;
config.allowUnfree = true;
};
in {
# ...
}
Then you can use pkgs as usual. Probably it's not the best solution, but at least it works
I think the ability to set arbitrary nixpkgs.config options would be very useful