From 6519f06f397448c3f1677e87e385012e2507164b Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 6 May 2015 14:54:31 +0200 Subject: nix-env/nix-instantiate/nix-build: Support URIs For instance, you can install Firefox from a specific Nixpkgs revision like this: $ nix-env -f https://github.com/NixOS/nixpkgs/archive/63def04891a0abc328b1b0b3a78ec02c58f48583.tar.gz -iA firefox Or build a package from the latest nixpkgs-unstable channel: $ nix-build https://nixos.org/channels/nixpkgs-unstable/nixexprs.tar.xz -A hello --- src/libexpr/download.cc | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/libexpr/download.cc') diff --git a/src/libexpr/download.cc b/src/libexpr/download.cc index e3c6c505c543..18ab6fbcda73 100644 --- a/src/libexpr/download.cc +++ b/src/libexpr/download.cc @@ -223,4 +223,13 @@ Path downloadFileCached(const string & url, bool unpack) } +bool isUri(const string & s) +{ + size_t pos = s.find("://"); + if (pos == string::npos) return false; + string scheme(s, 0, pos); + return scheme == "http" || scheme == "https"; +} + + } -- cgit 1.4.1