Skip to content

Commit

Permalink
Regression test: local_repository nix_file_deps
Browse files Browse the repository at this point in the history
  • Loading branch information
aherrmann committed Oct 28, 2019
1 parent 06fc832 commit cbedf6d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
3 changes: 3 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ nixpkgs_git_repository(
nixpkgs_local_repository(
name = "nixpkgs",
nix_file = "//:nixpkgs.nix",
nix_file_deps = ["//:nixpkgs.json"],
)

nixpkgs_package(
Expand All @@ -39,6 +40,7 @@ nixpkgs_package(
nix_file_content = "let pkgs = import <nixpkgs> { 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(
Expand Down Expand Up @@ -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",
],
Expand Down
8 changes: 8 additions & 0 deletions nixpkgs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"owner": "NixOS",
"repo": "nixpkgs-channels",
"branch": "nixpkgs-unstable",
"rev": "0620e0fdbf4d79df771afd28f741b2159f381d2b",
"sha256": "046l2c83s568c306hnm8nfdpdhmgnbzgid354hr7p0khq3jx3lhf"
}

7 changes: 3 additions & 4 deletions nixpkgs.nix
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit cbedf6d

Please sign in to comment.