Skip to content

Commit

Permalink
nix/common.nix: use pattern from nix-community/flake-compat
Browse files Browse the repository at this point in the history
This is still a bit confusing, as normally the flake.defaultNix attrset
gets exposed via a top-level default.nix, but at least it brings us
closer to that.
  • Loading branch information
flokli committed Jul 16, 2023
1 parent 1bbf604 commit 79ca8e7
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions nix/common.nix
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
let
lock = builtins.fromJSON (builtins.readFile ../flake.lock);
flakeCompatRev = lock.nodes.flake-compat.locked.rev;
flakeCompat = fetchTarball {
url =
"https://github.com/edolstra/flake-compat/archive/${flakeCompatRev}.tar.gz";
sha256 = lock.nodes.flake-compat.locked.narHash;

inherit (lock.nodes.flake-compat.locked) owner repo rev narHash;

flake-compat = fetchTarball {
url = "https://github.com/${owner}/${repo}/archive/${rev}.tar.gz";
sha256 = narHash;
};
flake = ((import flakeCompat) { src = ../.; }).defaultNix;
in rec {
pkgsSrc = flake.inputs.nixpkgs;
cargo2nix = flake.inputs.cargo2nix;

flake = (import flake-compat { system = builtins.currentSystem; src = ../.; });
in
rec {
pkgsSrc = flake.defaultNix.inputs.nixpkgs;
cargo2nix = flake.defaultNix.inputs.cargo2nix;
cargo2nixOverlay = cargo2nix.overlays.default;
}

0 comments on commit 79ca8e7

Please sign in to comment.