Skip to content

Commit 893f10a

Browse files
committed
Lock flake-compat in the flake and have a common entrypoint for it
1 parent 4a34728 commit 893f10a

File tree

5 files changed

+40
-15
lines changed

5 files changed

+40
-15
lines changed

flake.lock

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,13 @@
44
inputs = {
55
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
66
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
7+
78
androidPkgs.url = "github:tadfisher/android-nixpkgs/stable";
9+
10+
flake-compat.url = "github:nix-community/flake-compat";
811
};
912

10-
outputs = { self, nixpkgs, nixpkgs-unstable, androidPkgs, ... }@inputs: let
13+
outputs = { self, nixpkgs, nixpkgs-unstable, androidPkgs, flake-compat, ... }@inputs: let
1114
pkgs = import ./pkgs/default.nix { inherit inputs; };
1215
in {
1316
# robotnixSystem evaluates a robotnix configuration

flake/compat.nix

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{ system ? builtins.currentSystem }:
2+
let
3+
lock = builtins.fromJSON (builtins.readFile ./../flake.lock);
4+
flake-compat-entry = lock.nodes.root.inputs.flake-compat;
5+
6+
inherit (lock.nodes."${ flake-compat-entry }".locked) owner repo narHash;
7+
8+
flake-compat = builtins.fetchTarball {
9+
url = "https://github.com/${ owner }/${ repo }/archive/${ lock.nodes.flake-compat.locked.rev }.tar.gz";
10+
sha256 = narHash;
11+
};
12+
in
13+
import flake-compat {
14+
inherit system;
15+
16+
src = ./..;
17+
}

pkgs/default.nix

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
# SPDX-FileCopyrightText: 2020 Daniel Fullmer and robotnix contributors
22
# SPDX-License-Identifier: MIT
33

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

137
let

shell.nix

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,2 @@
1-
(import (
2-
fetchTarball {
3-
url = "https://github.com/edolstra/flake-compat/archive/12c64ca55c1014cdc1b16ed5a804aa8576601ff2.tar.gz";
4-
sha256 = "0jm6nzb83wa6ai17ly9fzpqc40wg1viib8klq8lby54agpl213w5"; }
5-
) {
6-
src = ./.;
7-
}).shellNix.default
1+
{ system ? builtins.currentSystem }:
2+
(import ./flake/compat.nix { inherit system; }).shellNix

0 commit comments

Comments
 (0)