diff --git a/WORKSPACE b/WORKSPACE index 0470bc042..9a3a1c138 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -20,6 +20,7 @@ nixpkgs_git_repository( nixpkgs_local_repository( name = "nixpkgs", nix_file = "//:nixpkgs.nix", + nix_file_deps = ["//:nixpkgs.json"], ) nixpkgs_package( @@ -39,6 +40,7 @@ nixpkgs_package( nix_file_content = "let pkgs = import { config = {}; overlays = []; }; in pkgs.hello", # Deliberately not @nixpkgs, to test whether explict file works. repositories = {"nixpkgs": "//:nixpkgs.nix"}, + nix_file_deps = ["//:nixpkgs.json"], ) nixpkgs_package( @@ -101,6 +103,7 @@ nixpkgs_package( attribute_path = "hello", nix_file = "//tests:relative_imports.nix", nix_file_deps = [ + "//:nixpkgs.json", "//:nixpkgs.nix", "//tests:relative_imports/nixpkgs.nix", ], diff --git a/nixpkgs.json b/nixpkgs.json new file mode 100644 index 000000000..8716771ac --- /dev/null +++ b/nixpkgs.json @@ -0,0 +1,8 @@ +{ + "owner": "NixOS", + "repo": "nixpkgs-channels", + "branch": "nixpkgs-unstable", + "rev": "0620e0fdbf4d79df771afd28f741b2159f381d2b", + "sha256": "046l2c83s568c306hnm8nfdpdhmgnbzgid354hr7p0khq3jx3lhf" +} + diff --git a/nixpkgs.nix b/nixpkgs.nix index 2b7d682d5..3425ec91b 100644 --- a/nixpkgs.nix +++ b/nixpkgs.nix @@ -1,10 +1,9 @@ let # nixpkgs-unstable as of 2019-04-25 - nixpkgsRev = "0620e0fdbf4"; - nixpkgsSha256 = "046l2c83s568c306hnm8nfdpdhmgnbzgid354hr7p0khq3jx3lhf"; + spec = builtins.fromJSON (builtins.readFile ./nixpkgs.json); nixpkgs = fetchTarball { - url = "https://github.com/nixos/nixpkgs/archive/${nixpkgsRev}.tar.gz"; - sha256 = nixpkgsSha256; + url = "https://github.com/${spec.owner}/${spec.repo}/archive/${spec.rev}.tar.gz"; + sha256 = spec.sha256; }; in import nixpkgs