From 182d1f67cb3aebc4889fa65ae4ce07313be26b20 Mon Sep 17 00:00:00 2001
From: Jean-Paul Calderone <exarkun@twistedmatrix.com>
Date: Fri, 5 Jun 2020 13:53:19 -0400
Subject: [PATCH] Fix the nixpkgs.rev/shell.nix split for nixpkgs definition

---
 .circleci/config.yml |  8 ++++----
 nixpkgs.json         |  3 +++
 nixpkgs.rev          |  1 -
 shell.nix            | 10 +++-------
 4 files changed, 10 insertions(+), 12 deletions(-)
 create mode 100644 nixpkgs.json
 delete mode 100644 nixpkgs.rev

diff --git a/.circleci/config.yml b/.circleci/config.yml
index b2128b76..1be9adc7 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -53,7 +53,7 @@ jobs:
             # If nixpkgs changes then potentially a lot of cached packages for
             # the base system will be invalidated so we may as well drop them
             # and make a new cache with the new packages.
-            - privatestorageio-nix-store-v2-{{ checksum "nixpkgs.rev" }}
+            - privatestorageio-nix-store-v2-{{ checksum "nixpkgs.json" }}
             - privatestorageio-nix-store-v2-
 
       - run:
@@ -67,7 +67,7 @@ jobs:
 
       - save_cache:
           name: "Cache Nix Store Paths"
-          key: privatestorageio-nix-store-v2-{{ checksum "nixpkgs.rev" }}
+          key: privatestorageio-nix-store-v2-{{ checksum "nixpkgs.json" }}
           paths:
             - "/nix"
 
@@ -81,7 +81,7 @@ jobs:
           # See comments for nix store caching in `build` job.
           name: "Restore Nix Store Paths"
           keys:
-            - privatestorageio-docs-nix-store-v1-{{ checksum "nixpkgs.rev" }}
+            - privatestorageio-docs-nix-store-v1-{{ checksum "nixpkgs.json" }}
             - privatestorageio-docs-nix-store-v1-
 
       - run:
@@ -91,7 +91,7 @@ jobs:
 
       - save_cache:
           name: "Cache Nix Store Paths"
-          key: privatestorageio-docs-nix-store-v1-{{ checksum "nixpkgs.rev" }}
+          key: privatestorageio-docs-nix-store-v1-{{ checksum "nixpkgs.json" }}
           paths:
             - "/nix"
 
diff --git a/nixpkgs.json b/nixpkgs.json
new file mode 100644
index 00000000..25e71e44
--- /dev/null
+++ b/nixpkgs.json
@@ -0,0 +1,3 @@
+{ "url": "https://github.com/NixOS/nixpkgs-channels/archive/353333ef340952c05332e3c271dff953264cb017.tar.gz"
+, "sha256": "sha256:0bv34yz892yxhx2kb8a1yr5pm0g8ck5w021yj87r7kfnp416apdh"
+}
diff --git a/nixpkgs.rev b/nixpkgs.rev
deleted file mode 100644
index 339195d5..00000000
--- a/nixpkgs.rev
+++ /dev/null
@@ -1 +0,0 @@
-353333ef340952c05332e3c271dff953264cb017
\ No newline at end of file
diff --git a/shell.nix b/shell.nix
index f13af40c..26aaad60 100644
--- a/shell.nix
+++ b/shell.nix
@@ -1,10 +1,6 @@
 let
-  nixpkgs-rev = builtins.readFile ./nixpkgs.rev;
-  nixpkgs-url = "https://github.com/NixOS/nixpkgs-channels/archive/${nixpkgs-rev}.tar.gz";
-  nixpkgs-src = builtins.fetchTarball {
-    url = nixpkgs-url;
-    sha256 = "sha256:0bv34yz892yxhx2kb8a1yr5pm0g8ck5w021yj87r7kfnp416apdh";
-  };
+  nixpkgs-pin = builtins.fromJSON (builtins.readFile ./nixpkgs.json);
+  nixpkgs-src = builtins.fetchTarball nixpkgs-pin;
   nixpkgs = import nixpkgs-src { };
 in
 { pkgs ? nixpkgs }:
@@ -19,7 +15,7 @@ let
   morph = pkgs.callPackage (morph-src + "/nix-packaging") { };
 in
 pkgs.mkShell {
-  NIX_PATH = "nixpkgs=${nixpkgs-src}";
+  NIX_PATH = "nixpkgs=${nixpkgs-pin.url}";
   buildInputs = [
     morph
   ];
-- 
GitLab