Skip to content

Commit 9fcf786

Browse files
Use the new flake-compat api
Signed-off-by: Brian McGillion <bmg.avoin@gmail.com>
1 parent 0d6b6b1 commit 9fcf786

File tree

2 files changed

+24
-48
lines changed

2 files changed

+24
-48
lines changed

default.nix

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,15 @@
55
# This file originates from:
66
# https://github.com/nix-community/flake-compat
77
# This file provides backward compatibility to nix < 2.4 clients
8-
{
9-
system ? builtins.currentSystem,
10-
}:
11-
let
12-
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
13-
14-
inherit (lock.nodes.flake-compat.locked)
15-
owner
16-
repo
17-
rev
18-
narHash
19-
;
20-
21-
flake-compat = fetchTarball {
22-
url = "https://github.com/${owner}/${repo}/archive/${rev}.tar.gz";
23-
sha256 = narHash;
24-
};
25-
26-
flake = import flake-compat {
27-
inherit system;
28-
src = ./.;
29-
};
30-
in
31-
flake.defaultNix
8+
(import (
9+
let
10+
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
11+
nodeName = lock.nodes.root.inputs.flake-compat;
12+
in
13+
fetchTarball {
14+
url =
15+
lock.nodes.${nodeName}.locked.url
16+
or "https://github.com/edolstra/flake-compat/archive/${lock.nodes.${nodeName}.locked.rev}.tar.gz";
17+
sha256 = lock.nodes.${nodeName}.locked.narHash;
18+
}
19+
) { src = ./.; }).defaultNix

shell.nix

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,15 @@
55
# This file originates from:
66
# https://github.com/nix-community/flake-compat
77
# This file provides backward compatibility to nix < 2.4 clients
8-
{
9-
system ? builtins.currentSystem,
10-
}:
11-
let
12-
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
13-
14-
inherit (lock.nodes.flake-compat.locked)
15-
owner
16-
repo
17-
rev
18-
narHash
19-
;
20-
21-
flake-compat = fetchTarball {
22-
url = "https://github.com/${owner}/${repo}/archive/${rev}.tar.gz";
23-
sha256 = narHash;
24-
};
25-
26-
flake = import flake-compat {
27-
inherit system;
28-
src = ./.;
29-
};
30-
in
31-
flake.shellNix
8+
(import (
9+
let
10+
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
11+
nodeName = lock.nodes.root.inputs.flake-compat;
12+
in
13+
fetchTarball {
14+
url =
15+
lock.nodes.${nodeName}.locked.url
16+
or "https://github.com/edolstra/flake-compat/archive/${lock.nodes.${nodeName}.locked.rev}.tar.gz";
17+
sha256 = lock.nodes.${nodeName}.locked.narHash;
18+
}
19+
) { src = ./.; }).shellNix

0 commit comments

Comments
 (0)