Skip to content

Commit

Permalink
Lock flake-compat in the flake and have a common entrypoint for it
Browse files Browse the repository at this point in the history
  • Loading branch information
jaen committed May 26, 2024
1 parent 2f807df commit c21880a
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 15 deletions.
16 changes: 16 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";

androidPkgs.url = "github:tadfisher/android-nixpkgs/stable";

flake-compat.url = "github:nix-community/flake-compat";
};

outputs = { self, nixpkgs, nixpkgs-unstable, androidPkgs, ... }@inputs: let
outputs = { self, nixpkgs, nixpkgs-unstable, androidPkgs, flake-compat, ... }@inputs: let
pkgs = import ./pkgs/default.nix { inherit inputs; };
in {
# robotnixSystem evaluates a robotnix configuration
Expand Down
17 changes: 17 additions & 0 deletions flake/compat.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{ system ? builtins.currentSystem }:
let
lock = builtins.fromJSON (builtins.readFile ./../flake.lock);
flake-compat-entry = lock.nodes.root.inputs.flake-compat;

inherit (lock.nodes."${ flake-compat-entry }".locked) owner repo narHash;

flake-compat = builtins.fetchTarball {
url = "https://github.com/${ owner }/${ repo }/archive/${ lock.nodes.flake-compat.locked.rev }.tar.gz";
sha256 = narHash;
};
in
import flake-compat {
inherit system;

src = ./..;
}
8 changes: 1 addition & 7 deletions pkgs/default.nix
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
# SPDX-FileCopyrightText: 2020 Daniel Fullmer and robotnix contributors
# SPDX-License-Identifier: MIT

{ inputs ? (import (
fetchTarball {
url = "https://github.com/nix-community/flake-compat/archive/8bf105319d44f6b9f0d764efa4fdef9f1cc9ba1c.tar.gz";
sha256 = "sha256:0b1vcbficjcrdyqzn4pbb63xwjch1056nmjyyhk4p7kdskhl3nlj"; }
) {
src = ../.;
}).defaultNix.inputs,
{ inputs ? (import ../flake/compat.nix).defaultNix.inputs,
... }@args:

let
Expand Down
9 changes: 2 additions & 7 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,2 @@
(import (
fetchTarball {
url = "https://github.com/edolstra/flake-compat/archive/12c64ca55c1014cdc1b16ed5a804aa8576601ff2.tar.gz";
sha256 = "0jm6nzb83wa6ai17ly9fzpqc40wg1viib8klq8lby54agpl213w5"; }
) {
src = ./.;
}).shellNix.default
{ system ? builtins.currentSystem }:
(import ./flake/compat.nix { inherit system; }).shellNix

0 comments on commit c21880a

Please sign in to comment.