From e16a12daf6b4d54e199a194b12f4fa9928ed9b16 Mon Sep 17 00:00:00 2001
From: Tom Prince <tom.prince@private.storage>
Date: Tue, 11 Jan 2022 10:27:21 -0700
Subject: [PATCH] Use a non-versioned filename for our nixpkgs pin.

---
 default.nix                       | 2 +-
 morph/lib/default.nix             | 2 +-
 nixos/modules/update-deployment   | 6 +++---
 nixpkgs-2105.json => nixpkgs.json | 4 ++--
 nixpkgs-2105.nix => nixpkgs.nix   | 2 +-
 shell.nix                         | 6 +++---
 tools/update-nixpkgs              | 2 +-
 7 files changed, 12 insertions(+), 12 deletions(-)
 rename nixpkgs-2105.json => nixpkgs.json (86%)
 rename nixpkgs-2105.nix => nixpkgs.nix (70%)

diff --git a/default.nix b/default.nix
index 6441675a..8b605281 100644
--- a/default.nix
+++ b/default.nix
@@ -1,4 +1,4 @@
-{ pkgs ? import ./nixpkgs-2105.nix { } }:
+{ pkgs ? import ./nixpkgs.nix { } }:
 {
   # Render the project documentation source to some presentation format (ie,
   # html) with Sphinx.
diff --git a/morph/lib/default.nix b/morph/lib/default.nix
index 88c83bc2..c43fa6ea 100644
--- a/morph/lib/default.nix
+++ b/morph/lib/default.nix
@@ -17,7 +17,7 @@
   # installed, as well as the NixOS module set that is used.
   # This is intended to be used in a grid definition like:
   #     network = { ... ; inherit (gridlib) pkgs; ... }
-  pkgs = import ../../nixpkgs-2105.nix {
+  pkgs = import ../../nixpkgs.nix {
     # Ensure that configuration of the system where this runs
     # doesn't leak into what we build.
     # See https://github.com/NixOS/nixpkgs/issues/62513
diff --git a/nixos/modules/update-deployment b/nixos/modules/update-deployment
index 1c896058..a8efffa0 100755
--- a/nixos/modules/update-deployment
+++ b/nixos/modules/update-deployment
@@ -72,14 +72,14 @@ EOF
 ssh -o StrictHostKeyChecking=no "$(hostname).$(domainname)" ":"
 
 # Set nixpkgs to our preferred version for the morph build.  Annoyingly, we
-# can't just use nixpkgs-2105.nix as our nixpkgs because some code (in morph,
+# can't just use nixpkgs.nix as our nixpkgs because some code (in morph,
 # at least) wants <nixpkgs> to be a fully-resolved path to a nixpkgs tree.
 # For example, morph evaluated `import <nixpkgs/lib>` which would turn into
-# something like `import nixpkgs-2105.nix/lib` which is nonsense.
+# something like `import nixpkgs.nix/lib` which is nonsense.
 #
 # So instead, import our nixpkgs which forces it to be instantiated in the
 # store, then ask for its path, then set NIX_PATH to that.
-export NIX_PATH="nixpkgs=$(nix eval "(import ${CHECKOUT}/nixpkgs-2105.nix { }).path")"
+export NIX_PATH="nixpkgs=$(nix eval "(import ${CHECKOUT}/nixpkgs.nix { }).path")"
 
 # Attempt to update just this host.  Choose the morph grid definition matching
 # the grid we belong to and limit the morph deployment update to the host
diff --git a/nixpkgs-2105.json b/nixpkgs.json
similarity index 86%
rename from nixpkgs-2105.json
rename to nixpkgs.json
index f7d74ca4..d516cb97 100644
--- a/nixpkgs-2105.json
+++ b/nixpkgs.json
@@ -1,5 +1,5 @@
 {
-  "name": "release2105",
+  "name": "source",
   "url": "https://releases.nixos.org/nixos/21.05/nixos-21.05.4717.df123677560/nixexprs.tar.xz",
   "sha256": "02zkhiwl3lwhk9fkmcbcfr927w135xdrgp6z7g804symbd1jcwal"
-}
\ No newline at end of file
+}
diff --git a/nixpkgs-2105.nix b/nixpkgs.nix
similarity index 70%
rename from nixpkgs-2105.nix
rename to nixpkgs.nix
index 536d913b..a49c4478 100644
--- a/nixpkgs-2105.nix
+++ b/nixpkgs.nix
@@ -1 +1 @@
-import (builtins.fetchTarball (builtins.fromJSON (builtins.readFile ./nixpkgs-2105.json)))
+import (builtins.fetchTarball (builtins.fromJSON (builtins.readFile ./nixpkgs.json)))
diff --git a/shell.nix b/shell.nix
index a5741377..b8be3a3a 100644
--- a/shell.nix
+++ b/shell.nix
@@ -1,7 +1,7 @@
 let
-  release2105 = import ./nixpkgs-2105.nix { };
+  pinned-pkgs = import ./nixpkgs.nix { };
 in
-{ pkgs ? release2105, lib ? pkgs.lib, python ? pkgs.python3 }:
+{ pkgs ? pinned-pkgs, lib ? pkgs.lib, python ? pkgs.python3 }:
 let
   tools = pkgs.callPackage ./tools {};
 in
@@ -10,7 +10,7 @@ pkgs.mkShell {
   # first adds that path to the store, and then interpolates the store path
   # into the string.  We use `builtins.toString` to convert the path to a
   # string without copying it to the store before interpolating. Either the
-  # path is already in the store (e.g. when `pkgs` is `release2105`) so we
+  # path is already in the store (e.g. when `pkgs` is `pinned-pkgs`) so we
   # avoid making a second copy with a longer name, or the user passed in local
   # path (e.g. a checkout of nixpkgs) and we point at it directly, rather than
   # a snapshot of it.
diff --git a/tools/update-nixpkgs b/tools/update-nixpkgs
index 09c823b0..2c4376ac 100755
--- a/tools/update-nixpkgs
+++ b/tools/update-nixpkgs
@@ -37,7 +37,7 @@ def main():
         "repo_file",
         metavar="repo-file",
         nargs="?",
-        default=Path(__file__).parent.with_name("nixpkgs-2105.json"),
+        default=Path(__file__).parent.with_name("nixpkgs.json"),
         type=Path,
         help="JSON file with pinned configuration.",
     )
-- 
GitLab