Closed azuwis closed 2 years ago
I implemented a hacky fix and confirmed that my M1 system builds using the fix, I'll take the weekend to clean it up and issue a PR.
@bbuscarino If you track the latest from the master
branch in your flake-utils-plus
input, do you get different results?
utils.url = "github:gytis-ivaskevicius/flake-utils-plus";
Also, I recall running into some issue recently with Nix 2.6.x on a MBP. Not sure if that's been fixed – I'm still running 2.5.1 at the moment. But I may give the latest version another shot soon.
And, FWIW, I've been using this library with nix-darwin for a while without issue – I don't think https://github.com/LnL7/nix-darwin/issues/319 as mentioned in this project's readme is applicable any longer – see also https://github.com/LnL7/nix-darwin/pull/317.
I've been using the darwin-support
branch from https://github.com/divnix/digga for a few weeks now, but that uses this library behind the scenes. But even prior to that, I had been using FUP on darwin without issue.
I was able to use darwin.lib.darwinSystem
as a direct input to the builder
option using the latest version of flake-utils-plus
:
https://github.com/montchr/dotfield/blob/c6bbf0ab1ac38621f67e9bb37ef96e272cf2df3b/flake.nix#L165
What happens if you try something like this:
hosts.demo.builder = darwin.lib.darwinSystem;
@montchr The latest master flake-utils-plus
and nix-darwin
is where this pops up.
Looking through the histories of each repository, it's not clear to me why this didn't break earlier. I recently upgraded to M1 and hit this bug when migrating. flake-utils-plus
and nix-darwin
both add pkgs
and inputs
to the module args:
My fix opts to pass inputs
and pkgs
via the builder function if the output is darwinConfigurations
, which solves the problem.
The fix in question.
Can any of you test it with the latest version of FUP? I've added a little example which seems to evaluate https://github.com/gytis-ivaskevicius/flake-utils-plus/tree/master/examples/darwin
Can any of you test it with the latest version of FUP? I've added a little example which seems to evaluate https://github.com/gytis-ivaskevicius/flake-utils-plus/tree/master/examples/darwin
The example builds fine with:
nixpkgs.url = github:nixos/nixpkgs/release-21.05;
but not with:
nixpkgs.url = github:nixos/nixpkgs/nixpkgs-unstable;
error message:
$ nix build .#darwinConfigurations.Hostname1.system
warning: Git tree '/private/tmp/flake-utils-plus' is dirty
trace: lib.crossLists is deprecated, use lib.cartesianProductOfSets instead
trace: warning: literalExample is deprecated, use literalExpression instead, or use literalDocBook for a non-Nix description.
trace: warning: lib.mkFixStrictness has no effect and will be removed. It returns its argument unmodified, so you can just remove any calls.
trace: `lib.nixpkgsVersion` is deprecated, use `lib.version` instead!
trace: warning: lib.readPathsFromFile is deprecated, use a list instead
trace: Warning: `showVal` is deprecated and will be removed in the next release, please use `traceSeqN`
trace: lib.zip is deprecated, use lib.zipAttrsWith instead
error: The option `_module.args.inputs' is defined multiple times.
Definition values:
- In `/nix/store/fl382jvr5cjyv0za2nlanz8n5ic52czp-source/eval-config.nix'
- In `<unknown-file>'
(use '--show-trace' to show detailed location information)
Randomly stumbling upon this. https://github.com/NixOS/nixpkgs/pull/160489 is causing this to fail now when it didn't before. The reason it's failing is as the error says, the inputs
argument is defined twice, the first of which points to https://github.com/LnL7/nix-darwin/blob/17fbc68a6110edbff67e55f7450230a697ecb17e/eval-config.nix#L17, while the second one is not as clear, but it should point to https://github.com/gytis-ivaskevicius/flake-utils-plus/blob/06dba5f3b4fa2cc0bfc98ce9cd6f9a4d8db11d46/lib/mkFlake.nix#L181. The error message could be improved by adding a _file
attribute to the module there.
For anyone interested, you can use:
utils.url = "github:gytis-ivaskevicius/flake-utils-plus/pull/117/head";
as a temporary workaround.
Any plans for the fix to get merged?
@ForsakenHarmony both PRs adding it (#117 and #119) fail the tests. We can't merge the fix before making sure tests work as well.
@gytis-ivaskevicius planning to fix that PR?
Fixed in master
That's great, thanks
Demo
flake.nix
https://gist.github.com/azuwis/47a67c40f61afaa02362b79a0496afeb:Error log: