Add shell.nix

This commit is contained in:
Ryan Trinkle 2023-05-04 14:54:18 -04:00
parent ab9a40dc27
commit de4e7a02e9
7 changed files with 52 additions and 0 deletions

View File

@ -0,0 +1,2 @@
# DO NOT HAND-EDIT THIS FILE
import (import ./thunk.nix)

View File

@ -0,0 +1,7 @@
{
"url": "ssh://git@code.obsidian.systems/daml/nix-daml-sdk",
"rev": "b29698abd21bdfe1e0ab96271c0c7189e90f05dd",
"sha256": "1y9ak1vdyplqk2c6www9h75yqks58q6iwyv7py0c700vyav8wk51",
"private": true,
"fetchSubmodules": false
}

View File

@ -0,0 +1,17 @@
# DO NOT HAND-EDIT THIS FILE
let fetch = {url, rev, branch ? null, sha256 ? null, fetchSubmodules ? false, private ? false, ...}:
let realUrl = let firstChar = builtins.substring 0 1 url; in
if firstChar == "/" then /. + url
else if firstChar == "." then ./. + url
else url;
in if !fetchSubmodules && private then builtins.fetchGit {
url = realUrl; inherit rev;
${if branch == null then null else "ref"} = branch;
} else (import (builtins.fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/3aad50c30c826430b0270fcf8264c8c41b005403.tar.gz";
sha256 = "0xwqsf08sywd23x0xvw4c4ghq0l28w2ki22h0bdn766i16z9q2gr";
}) {}).fetchgit {
url = realUrl; inherit rev sha256;
};
json = builtins.fromJSON (builtins.readFile ./git.json);
in fetch json

View File

@ -0,0 +1,2 @@
# DO NOT HAND-EDIT THIS FILE
import (import ./thunk.nix)

View File

@ -0,0 +1,7 @@
{
"owner": "obsidiansystems",
"repo": "nix-thunk",
"private": false,
"rev": "0982911d78fbd9932c3ed8104a930f313f49b69b",
"sha256": "130n8mzywbvyqd6aap6yk98zynq3r3kpj2hfzdym26plwz0rr3bj"
}

12
dep/nix-thunk/thunk.nix Normal file
View File

@ -0,0 +1,12 @@
# 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 (builtins.fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/3aad50c30c826430b0270fcf8264c8c41b005403.tar.gz";
sha256 = "0xwqsf08sywd23x0xvw4c4ghq0l28w2ki22h0bdn766i16z9q2gr";
}) {}).fetchFromGitHub {
inherit owner repo rev sha256 fetchSubmodules private;
};
json = builtins.fromJSON (builtins.readFile ./github.json);
in fetch json

5
shell.nix Normal file
View File

@ -0,0 +1,5 @@
{ vimMode ? false }:
let
thunkSource = (import ./dep/nix-thunk {}).thunkSource;
in
import (thunkSource ./dep/nix-daml-sdk + "/shell.nix") { inherit vimMode; }