shell: add a nixpkgs-compat file

We are now able to pull in the same revision of nixpkgs as listed in
the lock file.
This commit is contained in:
Timothy DeHerrera 2020-12-27 00:40:12 -07:00
parent 94de0921e6
commit 5f7af10bae
No known key found for this signature in database
GPG key ID: 8985725DB5B0C122
3 changed files with 17 additions and 5 deletions

View file

@ -5,6 +5,8 @@
let let
inherit (builtins) attrNames readDir; inherit (builtins) attrNames readDir;
nixpkgs = toString (import ./nixpkgs-compat.nix);
hostname = lib.fileContents /etc/hostname; hostname = lib.fileContents /etc/hostname;
host = "/etc/nixos/hosts/${hostname}.nix"; host = "/etc/nixos/hosts/${hostname}.nix";
config = config =
@ -24,7 +26,7 @@ in
networking.hostName = hostname; networking.hostName = hostname;
nix.nixPath = [ nix.nixPath = [
"nixpkgs=${<nixpkgs>}" "nixpkgs=${nixpkgs}"
"nixos-config=/etc/nixos/configuration.nix" "nixos-config=/etc/nixos/configuration.nix"
"nixpkgs-overlays=/etc/nixos/overlays" "nixpkgs-overlays=/etc/nixos/overlays"
]; ];

13
nixpkgs-compat.nix Normal file
View file

@ -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

View file

@ -1,7 +1,4 @@
{ pkgs ? import <nixpkgs> { { pkgs ? import (import ./nixpkgs-compat.nix) { } }:
overlays = [ (import ./overlays/nix-zsh-completions.nix) ];
}
}:
let let
configs = "${toString ./.}#nixosConfigurations"; configs = "${toString ./.}#nixosConfigurations";
build = "config.system.build"; build = "config.system.build";