hercules-ci / arion

Run docker-compose with help from Nix/NixOS
Apache License 2.0
631 stars 47 forks source link

easyOverlay: stdenv missing #180

Closed sweenu closed 1 year ago

sweenu commented 1 year ago

Thanks for the previous fix! I have another error and a warning: Here's my flake.nix: https://github.com/sweenu/nixfiles/blob/main/flake.nix

❯ nix flake check
trace: warning: When invoking flake-parts, it is recommended to pass all the flake output
arguments in the `inputs` parameter. If you only pass `self`, it's not
possible to use the `inputs` module argument in the module `imports`.

Please pass the output function arguments. For example:

    outputs = inputs@{ flake-parts, ... }:
      flake-parts.lib.mkFlake { inherit inputs; } { /* module */ };

To avoid an infinite recursion, *DO NOT* pass `self.inputs` and
*DO NOT* pass `inherit (self) inputs`, but pass the output function
arguments as `inputs` like above.

warning: unknown flake output 'deploy'
error: attribute 'stdenv' missing

       at /nix/store/f6aw7qrir7bqjgi3czi1dr709cj5z2ap-source/extras/easyOverlay.nix:47:18:

           46|       let
           47|         system = prev.stdenv.hostPlatform.system;
             |                  ^
           48|         perSys = (getSystem system).extendModules {
roberth commented 1 year ago

The warning was another easy fix, and I'm looking into the missing stdenv error now.

roberth commented 1 year ago

I can load the overlay without much trouble as follows:

# test.nix
let 
flake = builtins.getFlake ("git+file://" + toString ./.); # the arion flake
in
{
  pkgsRaw = import flake.inputs.nixpkgs { };
  pkgs = import flake.inputs.nixpkgs { overlays = [ flake.overlays.default ]; };
}
$ nix repl test.nix
warning: future versions of Nix will require using `--file` to load a file
Welcome to Nix 2.11.1. Type :? for help.

Loading installable ''...
Added 2 variables.
nix-repl> pkgsRaw.arion
«derivation /nix/store/kr76qzng600r22wwwc7b0d0dhwqqf8pn-arion-0.1.3.0.drv»

nix-repl> pkgs.arion
«derivation /nix/store/0m7ndbw5kk5cg4n0148y3am3w275719d-arion-0.2.0.0.drv»

nix-repl>

So I wonder how it's loaded and what's in prev. If you can't share your code, perhaps the attributes of prev might give a clue as to what went wrong.

If you nix doesn't have a debugger yet, here's how to a load the latest nix repl with the Nix debugger enabled:

nix run --extra-experimental-features 'nix-command flakes' nix repl -- --debugger
roberth commented 1 year ago

Oh you did share your flake, nvm :) I'll have a look

roberth commented 1 year ago

Looks like digga is trying to do something clever

I'll support pkgs.system as a fallback just to get you going again.

sweenu commented 1 year ago

You're awesome, thanks for looking into it and the quick fixes! Everything works, I just have a new warning: trace: using non-memoized system fake-system, would you know if it's related?

roberth commented 1 year ago

new warning: trace: using non-memoized system fake-system,

It's performance related, but not useful around overlays, which are always a bit expensive anyway. Nothing to optimize here. I'll change it so that the warning doesn't occur here.