From b858c2fadf2f6ba313004279d7dd1fa764fd5bb0 Mon Sep 17 00:00:00 2001 From: Sridhar Ratnakumar Date: Tue, 6 Apr 2021 13:27:53 -0400 Subject: [PATCH] use rust nix --- default.nix | 9 +++++++++ dep/nixpkgs/default.nix | 2 ++ dep/nixpkgs/github.json | 7 +++++++ dep/nixpkgs/thunk.nix | 9 +++++++++ dep/rust-overlay/default.nix | 2 ++ dep/rust-overlay/github.json | 7 +++++++ dep/rust-overlay/thunk.nix | 9 +++++++++ 7 files changed, 45 insertions(+) create mode 100644 default.nix create mode 100644 dep/nixpkgs/default.nix create mode 100644 dep/nixpkgs/github.json create mode 100644 dep/nixpkgs/thunk.nix create mode 100644 dep/rust-overlay/default.nix create mode 100644 dep/rust-overlay/github.json create mode 100644 dep/rust-overlay/thunk.nix diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..750988e --- /dev/null +++ b/default.nix @@ -0,0 +1,9 @@ +let + pkgs = import ./dep/nixpkgs { overlays = [ (import ./dep/rust-overlay) ]; }; + rust = pkgs.rust-bin.stable.latest.rust; +in + pkgs.mkShell { + buildInputs = [ + rust + ]; + } diff --git a/dep/nixpkgs/default.nix b/dep/nixpkgs/default.nix new file mode 100644 index 0000000..2b4d4ab --- /dev/null +++ b/dep/nixpkgs/default.nix @@ -0,0 +1,2 @@ +# DO NOT HAND-EDIT THIS FILE +import (import ./thunk.nix) \ No newline at end of file diff --git a/dep/nixpkgs/github.json b/dep/nixpkgs/github.json new file mode 100644 index 0000000..b66adf6 --- /dev/null +++ b/dep/nixpkgs/github.json @@ -0,0 +1,7 @@ +{ + "owner": "NixOS", + "repo": "nixpkgs", + "private": false, + "rev": "bc0144e5c9bad2e26ce15b6b75c6efc50a920889", + "sha256": "1q75vfjnypgvkxb4cg41kchjihpb4y122z7gqm6858088k6pdji5" +} diff --git a/dep/nixpkgs/thunk.nix b/dep/nixpkgs/thunk.nix new file mode 100644 index 0000000..bbf2dc1 --- /dev/null +++ b/dep/nixpkgs/thunk.nix @@ -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 {}).fetchFromGitHub { + inherit owner repo rev sha256 fetchSubmodules private; + }; + json = builtins.fromJSON (builtins.readFile ./github.json); +in fetch json \ No newline at end of file diff --git a/dep/rust-overlay/default.nix b/dep/rust-overlay/default.nix new file mode 100644 index 0000000..2b4d4ab --- /dev/null +++ b/dep/rust-overlay/default.nix @@ -0,0 +1,2 @@ +# DO NOT HAND-EDIT THIS FILE +import (import ./thunk.nix) \ No newline at end of file diff --git a/dep/rust-overlay/github.json b/dep/rust-overlay/github.json new file mode 100644 index 0000000..a2bcf2d --- /dev/null +++ b/dep/rust-overlay/github.json @@ -0,0 +1,7 @@ +{ + "owner": "oxalica", + "repo": "rust-overlay", + "private": false, + "rev": "611e6213c5563a3f46a57c600c70e0f0fd2811f3", + "sha256": "1z9yv2wcxpzf7y4lsv21lrvzwcvsfpgfjqsg53m5z3h5pdvap26g" +} diff --git a/dep/rust-overlay/thunk.nix b/dep/rust-overlay/thunk.nix new file mode 100644 index 0000000..bbf2dc1 --- /dev/null +++ b/dep/rust-overlay/thunk.nix @@ -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 {}).fetchFromGitHub { + inherit owner repo rev sha256 fetchSubmodules private; + }; + json = builtins.fromJSON (builtins.readFile ./github.json); +in fetch json \ No newline at end of file