From 850f73045f7d34c51bfd1cddfd2c4c0c61e15a36 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 6 Nov 2019 14:48:35 +0100 Subject: [PATCH] Fix GitHub test --- flake.lock | 4 ++-- tests/github-flakes.nix | 40 +++++++++++++++++----------------------- 2 files changed, 19 insertions(+), 25 deletions(-) diff --git a/flake.lock b/flake.lock index 10c9921bf..5fe239aa0 100644 --- a/flake.lock +++ b/flake.lock @@ -2,9 +2,9 @@ "inputs": { "nixpkgs": { "inputs": {}, - "narHash": "sha256-D1YSQzR6Xo2cNZ4sf+WCak2fqE/CIbwpZbPKd2B2Syc=", + "narHash": "sha256-ZzR2l1dovxeZ555KXxz7SAXrC72BfaR4BeqvJzRdmwQ=", "originalUrl": "nixpkgs/release-19.09", - "url": "github:edolstra/nixpkgs/e3d44c4fc62c99b850c792429cb61b946b66a704" + "url": "github:edolstra/nixpkgs/d37927a77e70a2b3408ceaa2e763b6df1f4d941a" } }, "version": 3 diff --git a/tests/github-flakes.nix b/tests/github-flakes.nix index 7211360cd..d9f7d71cd 100644 --- a/tests/github-flakes.nix +++ b/tests/github-flakes.nix @@ -37,15 +37,18 @@ let destination = "/flake-registry.json"; }; - tarball = pkgs.runCommand "nixpkgs-flake" {} + api = pkgs.runCommand "nixpkgs-flake" {} '' - mkdir $out + mkdir -p $out/tarball + dir=NixOS-nixpkgs-${nixpkgs.shortRev} cp -prd ${nixpkgs} $dir # Set the correct timestamp in the tarball. find $dir -print0 | xargs -0 touch -t ${builtins.substring 0 12 nixpkgs.lastModified}.${builtins.substring 12 2 nixpkgs.lastModified} -- - tar cfz $out/${nixpkgs.rev} $dir - ln -s ${nixpkgs.rev} $out/master + tar cfz $out/tarball/${nixpkgs.rev} $dir + + mkdir -p $out/commits + echo '{"sha": "${nixpkgs.rev}"}' > $out/commits/master ''; in @@ -70,6 +73,11 @@ makeTest ( enableSSL = true; sslServerKey = "${cert}/server.key"; sslServerCert = "${cert}/server.crt"; + servedDirs = + [ { urlPath = "/NixOS/flake-registry/raw/master"; + dir = registry; + } + ]; } { hostName = "api.github.com"; @@ -77,23 +85,8 @@ makeTest ( sslServerKey = "${cert}/server.key"; sslServerCert = "${cert}/server.crt"; servedDirs = - [ { urlPath = "/repos/NixOS/nixpkgs/tarball"; - dir = tarball; - } - ]; - extraConfig = - '' - Header set ETag "\"${nixpkgs.rev}\"" - ''; - } - - { hostName = "raw.githubusercontent.com"; - enableSSL = true; - sslServerKey = "${cert}/server.key"; - sslServerCert = "${cert}/server.crt"; - servedDirs = - [ { urlPath = "/NixOS/flake-registry/master"; - dir = registry; + [ { urlPath = "/repos/NixOS/nixpkgs"; + dir = api; } ]; } @@ -101,10 +94,11 @@ makeTest ( }; client = - { config, pkgs, nodes, ... }: + { config, lib, pkgs, nodes, ... }: { virtualisation.writableStore = true; virtualisation.pathsInNixDB = [ pkgs.hello pkgs.fuse ]; - nix.binaryCaches = [ ]; + nix.binaryCaches = lib.mkForce [ ]; + nix.extraOptions = "experimental-features = nix-command flakes"; environment.systemPackages = [ pkgs.jq ]; networking.hosts.${(builtins.head nodes.github.config.networking.interfaces.eth1.ipv4.addresses).address} = [ "github.com" "api.github.com" "raw.githubusercontent.com" ];