MercuryTechnologies / nix-your-shell

A `nix` and `nix-shell` wrapper for shells other than `bash`
MIT License
85 stars 12 forks source link

Fix GitHub actions & rework Flake #63

Closed 9999years closed 3 months ago

spikespaz commented 3 months ago

I have a few questions:

  1. Why did you export non-standard outputs pkgs and localPkgs?

  2. Why do you export two different derivations, one as nix-your-shell-from-overlay and another from localPkgs?

  3. Why do you apply the overlay for the former through pkgs.appendOverlays? Doesn't this cause a double-evaluation of nixpkgs?

  4. Why did you remove passthru.generate-config?

If you want to change anything due to these questions, don't; I am carefully preparing another PR similar to (but better than) #40, as I have learned more since.

9999years commented 3 months ago

Why did you export non-standard outputs pkgs and localPkgs?

This the package sets be cached by the Nix eval cache, which only works on Flake outputs.

If I used localPkgs as the packages output directly, nix flake check would break because localPkgs contains non-derivation values:

error:
       … while checking flake output 'packages'
         at /nix/store/ddk4plqjcdxhrpgg02kims5cvcx0p07d-source/flake.nix:38:5:
           37|
           38|     packages = eachSystem (system: let
             |     ^
           39|       localPkgs = self.pkgs.${system}.callPackage ./nix/makePackages.nix {inherit inputs;};

       … while checking the derivation 'packages.aarch64-darwin.inputs'
         at /nix/store/ddk4plqjcdxhrpgg02kims5cvcx0p07d-source/nix/makePackages.nix:8:14:
            7|   self:
            8|     {inherit inputs;}
             |              ^
            9|     // (lib.packagesFromDirectoryRecursive {

       error: flake attribute 'packages.aarch64-darwin.inputs' is not a derivation

Why do you export two different derivations, one as nix-your-shell-from-overlay and another from localPkgs?

Just so I can check that the overlay builds correctly in CI.

Why do you apply the overlay for the former through pkgs.appendOverlays?

So the alternative here is to use the overlay when computing pkgs, like this:

makePkgs = system:
  import nixpkgs {
    localSystem = system;
    overlays = [ self.overlays.default ];
  };

...but then I can't set the packages output to the local packages, because the resulting package set doesn't distinguish between overlayed and base packages, and setting packages to the entire package set is non-viable (this is why nixpkgs uses `legacyPackages).

Why did you remove passthru.generate-config?

Accident, I'll fix that.