-
Notifications
You must be signed in to change notification settings - Fork 335
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
allowUnfree with flake-parts #521
Comments
You could try to add following into your flake.nix #support unfree
_module.args.pkgs = import inputs.nixpkgs {
inherit system;
config.allowUnfree = true;
}; something like following: {
description = "Description for the project";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
devenv.url = "github:cachix/devenv";
nix2container.url = "github:nlewo/nix2container";
nix2container.inputs.nixpkgs.follows = "nixpkgs";
mk-shell-bin.url = "github:rrbutani/nix-mk-shell-bin";
};
outputs = inputs@{ flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
imports = [
inputs.devenv.flakeModule
];
systems = [ "x86_64-linux" "i686-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
perSystem = { config, self', inputs', pkgs, system, ... }: {
# Per-system attributes can be defined here. The self' and inputs'
# module parameters provide easy access to attributes of the same
# system.
# support unfree
_module.args.pkgs = import inputs.nixpkgs {
inherit system;
config.allowUnfree = true;
};
# Equivalent to inputs'.nixpkgs.legacyPackages.hello;
packages.default = pkgs.hello;
devenv.shells.default = {
name = "my-project";
imports = [
# This is just like the imports in devenv.nix.
# See https:devenv.sh/guides/using-with-flake-parts/#import-a-devenv-module
# ./devenv-foo.nix
];
# https:devenv.sh/reference/options/
packages = [ config.packages.default ];
enterShell = ''
hello
'';
};
};
flake = {
# The usual flake attributes can be defined here, including system-
# agnostic ones like nixosModule and system-enumerating ones, although
# those are more easily expressed in perSystem.
};
};
} |
I've tried the |
Could you post your flake.nix? |
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs";
devenv.url = "github:cachix/devenv";
treefmt-nix.url = "github:numtide/treefmt-nix";
treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = inputs@{ nixpkgs, flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
imports = [ inputs.devenv.flakeModule ./treefmt.nix ];
systems = [ "x86_64-linux" "x86_64-darwin" ];
perSystem = { system, config, pkgs, ... }: {
_module.args.pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
config.permittedInsecurePackages = [ "nodejs-16.20.1" ];
};
devenv.shells.default = {
languages.javascript.enable = true;
languages.javascript.package = pkgs.nodejs-16_x;
};
};
};
} |
Could you also post the error? It works on my machine though. |
Interesting, it seems that it's working for me now, too, after restarting my shell. |
#383 adds allowUnfree
but new env
nix flake init --template github:cachix/devenv#flake-parts
says (inside perSystem)
devenv.allowUnfree = true; # wrong
The text was updated successfully, but these errors were encountered: