From 5f7af10bae7297e1879b6cd243003b92fbb4a274 Mon Sep 17 00:00:00 2001 From: Timothy DeHerrera Date: Sun, 27 Dec 2020 00:40:12 -0700 Subject: [PATCH] shell: add a nixpkgs-compat file We are now able to pull in the same revision of nixpkgs as listed in the lock file. --- configuration.nix | 4 +++- nixpkgs-compat.nix | 13 +++++++++++++ shell.nix | 5 +---- 3 files changed, 17 insertions(+), 5 deletions(-) create mode 100644 nixpkgs-compat.nix diff --git a/configuration.nix b/configuration.nix index 11624b0b..60010479 100644 --- a/configuration.nix +++ b/configuration.nix @@ -5,6 +5,8 @@ let inherit (builtins) attrNames readDir; + nixpkgs = toString (import ./nixpkgs-compat.nix); + hostname = lib.fileContents /etc/hostname; host = "/etc/nixos/hosts/${hostname}.nix"; config = @@ -24,7 +26,7 @@ in networking.hostName = hostname; nix.nixPath = [ - "nixpkgs=${}" + "nixpkgs=${nixpkgs}" "nixos-config=/etc/nixos/configuration.nix" "nixpkgs-overlays=/etc/nixos/overlays" ]; diff --git a/nixpkgs-compat.nix b/nixpkgs-compat.nix new file mode 100644 index 00000000..08b07372 --- /dev/null +++ b/nixpkgs-compat.nix @@ -0,0 +1,13 @@ +let + inherit (builtins) + fetchTarball + fromJSON + readFile + ; + nixos = (fromJSON (readFile ./flake.lock)).nodes.nixos.locked; + nixpkgs = fetchTarball { + url = "https://github.com/NixOS/nixpkgs/archive/${nixos.rev}.tar.gz"; + sha256 = nixos.narHash; + }; +in +nixpkgs diff --git a/shell.nix b/shell.nix index 4e9af0ca..b9de6b79 100644 --- a/shell.nix +++ b/shell.nix @@ -1,7 +1,4 @@ -{ pkgs ? import { - overlays = [ (import ./overlays/nix-zsh-completions.nix) ]; - } -}: +{ pkgs ? import (import ./nixpkgs-compat.nix) { } }: let configs = "${toString ./.}#nixosConfigurations"; build = "config.system.build";