Skip to content

Conversation

@WeetHet
Copy link
Contributor

@WeetHet WeetHet commented Mar 11, 2025

This allows non-flake users to pass their own instances of rust-overlay/pkgs/crane and avoid duplication

Release Notes:

  • N/A

cc @P1n3appl3

This allows non-flake users to pass their own instances
of rust-overlay/pkgs/crane and avoid duplication
@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Mar 11, 2025
@P1n3appl3 P1n3appl3 added the nix label Mar 11, 2025
@rrbutani
Copy link
Contributor

Can you share some details about your use case?

I appreciate that flake-compat makes it difficult to override inputs but I think the tack this PR takes is undesirable from a maintenance standpoint:

  • flake inputs + follows need to be duplicated in {default,shell}.nix
  • transitive inputs need to be handled manually
  • in order to support inputs that don't expose a default.nix we'd need to reinvent the bulk of flake-compat

Ideally, this is functionality that flake-compat would provide directly (see: NixOS/flake-compat#49 and nix-community/flake-compat#4).


In the interim, does manually pulling in one of the flake-compat forks linked above let you achieve what you're trying to do?

For example:

let
  fetchGh = { owner, repo, rev, sha256 }: import (builtins.fetchTarball {
    url = "https://github.com/${owner}/{repo}/archive/${rev}.tar.gz";
    inherit sha256;
  });
  zedSrc = fetchGh {
    owner = "zed-industries"; repo = "zed";
    rev = "da61a2883914557777257daa735d87f801829d27";
    sha256 = "0ff3fqmjviska858igh23p2ykc57lc4cvyysly4afybdv68sc68q";
  };
  # https://github.com/nix-community/flake-compat/pull/4
  flake-compat-custom = fetchGh {
    owner = "nix-community"; repo = "flake-compat";
    rev = "ad8d6af6aa8a14851a60bd00927f42b9798544ea";
    sha256 = "08nyw5g93qlw35nwnh19yynvbni2c3licf6xzhjiw0318dybbxs0";
  };

  zed = (flake-compat-custom { src = zedSrc; }).defaultNix;
  zedWithOverrides = zed.overrideInputs { nixpkgs = <nixpkgs>; }; # !!!
in {
  upstreamZed = zed.outputs.packages.x86_64-linux.default;
  customZed = zedWithOverrides.outputs.packages.x86_64-linux.default; # uses `<nixpkgs>` (channel)
}

@WeetHet
Copy link
Contributor Author

WeetHet commented Mar 11, 2025

In the interim, does manually pulling in one of the flake-compat forks linked above let you achieve what you're trying to do?

Thanks, that works for me. I prefer using npins and don't wanna duplicate nixpkgs

@WeetHet WeetHet closed this Mar 11, 2025
@WeetHet WeetHet deleted the nix-no-flake-compat branch March 11, 2025 23:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants