haskell.nix icon indicating copy to clipboard operation
haskell.nix copied to clipboard

Nix flake check IFD issue using nixbuild.net with haskell.nix to generate build artifacts

Open ParetoOptimalDev opened this issue 2 years ago • 3 comments

I plan to update this issue with more context, but basically my goal was to use the nixbuild.net remote builder to generate and backup build artifacts to cachix for aarch64-linux and aarch64-darwin daily.

The issue is that nixbuild.net runs nix flake check and my first roadblock was because of IFD's and nix flake check not working well (related: https://github.com/input-output-hk/haskell.nix/issues/1097 and https://github.com/NixOS/nix/issues/4265).

I tried to disable checks since they aren't explicitly necessary for this here, but perhaps I just did that wrong and need to explore more here.

Ideally I'd be able to get the checks to work though, since in my future projects soon I will want to use nix flake check and have a working nix flake show.

Perhaps this comment about makign IFDs compatible with nix-flake check haskell.nix can generally fix nix flake show with the information posted recently in this comment. Here's a snippet from that comment:

This is not entirely true. nix flake show only evaluates a few attributes of the derivation (name, type) in order to list it. Therefore the issue can be fixed by constructing a derivation which does not draw name and type from an IFD operation.

Finally here is my repo attempting this:

https://github.com/ParetoOptimalDev/test-haskell-nix-template/

Here are the github actions failures which have the commits linked showing changes I tried from workarounds in linked issues:

https://github.com/ParetoOptimalDev/test-haskell-nix-template/actions

ParetoOptimalDev avatar Sep 26 '22 16:09 ParetoOptimalDev

A cheap trick is to create a wrapper flake essentially:

let
  oldFlake = ...;
   
   supportedSystems = [ "x86_64-linux" "aarch64-linux" ];
   perSystem = nixpkgs.lib.genAttrs supportedSystems;
in {
  packages = perSystem (system: {
    default = oldFlake.packages.${system}.default;
    "mylib:lib:mylib" = oldFlake.packages.${system}."mylib:lib:mylib";
  });
  
  # ...
}

L-as avatar Sep 27 '22 17:09 L-as

Finally here is my repo attempting this:

https://github.com/ParetoOptimalDev/test-haskell-nix-template/

Is that repo public? I get a 404 error.

hamishmack avatar Sep 28 '22 04:09 hamishmack

@hamishmack Doh! It was private, just made it public.

ParetoOptimalDev avatar Sep 29 '22 16:09 ParetoOptimalDev