Skip to content
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

IFD error with hydra job in flake #726

Open
ahuston-0 opened this issue Jun 14, 2024 · 3 comments
Open

IFD error with hydra job in flake #726

ahuston-0 opened this issue Jun 14, 2024 · 3 comments

Comments

@ahuston-0
Copy link

I'm trying to migrate a shared repo over to using the NUR, instead of using the rycee repo directly for firefox-addons, but I am getting IFD errors with nix flake show & nix flake check when I include my hydraJobs. Please let me know if there's a better place to raise this issue, as this seems like an intersection of a few different things at once.

Details to reproduce:
The hydra jobs themselves are working fine, and when i remove them nix flake show works as expected. Adding nixConfig.allow-import-from-derivation = true to the flake config fixes nix flake check, but not nix flake show. Adding --option allow-import-from-derivation true fixes both issues.

Hydra build URL: https://hydra.alicehuston.xyz/eval/224954

IFD error

error:
       … while calling the 'head' builtin

         at /nix/store/ma9kq317xbd06aq9hr36mhmjwh7sgl8a-source/lib/attrsets.nix:1575:11:

         1574|         || pred here (elemAt values 1) (head values) then
         1575|           head values
             |           ^
         1576|         elsewhile evaluating the attribute 'value'

         at /nix/store/ma9kq317xbd06aq9hr36mhmjwh7sgl8a-source/lib/modules.nix:809:9:

          808|     in warnDeprecation opt //
          809|       { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
             |         ^
          810|         inherit (res.defsFinal') highestPrio;

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: cannot build '/nix/store/6jbf8rxsmq8bl33mk709a7ng4vilnz61-source.drv^out' during evaluation because the option 'allow-import-from-derivation' is disabled

flake.nix

      hydraJobs = import ./hydra/jobs.nix { inherit inputs outputs; };

hydra config:

{ inputs, outputs }:
let
  inherit (inputs.nixpkgs.lib) mapAttrs;

  getCfg = _: cfg: cfg.config.system.build.toplevel;
in
{
  inherit (outputs) formatter devShells;
  hosts = mapAttrs getCfg outputs.nixosConfigurations;
}

base config

  home-manager = {
    useGlobalPkgs = true;
    useUserPackages = true;
    sharedModules =
       [ inputs.sops-nix.homeManagerModules.sops 
         inputs.nur.hmModules.nur ];
    extraSpecialArgs = {
      inherit inputs;
      machineConfig = {
        inherit (machineConfig) server system;
      };
    };
  };

and the home-manager config with NUR

{
  pkgs,
  config,
  machineConfig,
  ...
}:
let
  ff-ext = config.nur.repos.rycee.firefox-addons;
in
{
  programs.firefox = {
    enable = true;
    profiles.richie = {
      extensions = with ff-ext; [
        bitwarden
        darkreader
        dearrow
        fastforwardteam
        return-youtube-dislikes
        sponsorblock
        ublock-origin
      ];
  };
}
@Mic92
Copy link
Member

Mic92 commented Jun 14, 2024

Unfortunately all the fetchers we currently using, require IFD https://github.com/nix-community/NUR/blob/0ef9c5ede0ed044be738087bedbcc161f92b1d48/lib/repoSource.nix#L34C8-L34C16
However it might be possible to use builtin fetcher and load the json here directly:

https://github.com/nix-community/NUR/blob/master/repos.json.lock

i.e. using builtins.fetchgit on a revision field

@ahuston-0
Copy link
Author

Okay yeah I had a feeling y'all would say something like that given the setup. Let me see if I can put something together and I'll get back if it's borked. If you want to close this in the meantime that's okay with me. Thanks for pointing me towards the fetcher logic!

@Mic92
Copy link
Member

Mic92 commented Jun 14, 2024

Otherwise I believe hydra has it's own nix configuration if I remember correctly? Or was this just for remote builder configuration? The component that does the eval is called hydra-eval-jobs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants