Skip to content

Commit

Permalink
Use thunk for reflex-project-skeleton
Browse files Browse the repository at this point in the history
  • Loading branch information
Ericson2314 committed Sep 24, 2021
1 parent deb3d9b commit 34755f5
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
3 changes: 2 additions & 1 deletion examples/project/reflex-project-skeleton/default.nix
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
import ((import <nixpkgs> {}).fetchFromGitHub (builtins.fromJSON (builtins.readFile ./github.json)))
# DO NOT HAND-EDIT THIS FILE
import (import ./thunk.nix)
2 changes: 2 additions & 0 deletions examples/project/reflex-project-skeleton/github.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"owner": "obsidiansystems",
"repo": "reflex-project-skeleton",
"private": false,
"fetchSubmodules": false,
"rev": "30d29322d74e98d189b755c3d25fffecfee32fe1",
"sha256": "14vcmi3bdmlcj228wj0hzjyqmixyfrd0ch8qzp2655kzik7dbgga"
}
9 changes: 9 additions & 0 deletions examples/project/reflex-project-skeleton/thunk.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# DO NOT HAND-EDIT THIS FILE
let fetch = { private ? false, fetchSubmodules ? false, owner, repo, rev, sha256, ... }:
if !fetchSubmodules && !private then builtins.fetchTarball {
url = "https://github.com/${owner}/${repo}/archive/${rev}.tar.gz"; inherit sha256;
} else (import <nixpkgs> {}).fetchFromGitHub {
inherit owner repo rev sha256 fetchSubmodules private;
};
json = builtins.fromJSON (builtins.readFile ./github.json);
in fetch json
5 changes: 1 addition & 4 deletions tests/skeleton.nix
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
{ reflex-platform }:

let
skeletonSrc = reflex-platform.nixpkgs.fetchFromGitHub (builtins.fromJSON (builtins.readFile ../examples/project/reflex-project-skeleton/github.json))
// {
fetchSubmodules = false; # Not interested in its reflex-platform checkout
};
skeletonSrc = reflex-platform.hackGet ../examples/project/reflex-project-skeleton;

skeleton = import skeletonSrc { inherit reflex-platform; };

Expand Down

0 comments on commit 34755f5

Please sign in to comment.