diff --git a/flake.nix b/flake.nix index d1456b8..78d9bb0 100644 --- a/flake.nix +++ b/flake.nix @@ -89,13 +89,6 @@ alejandra ]; }; - - # Shell for bootstrapping flake-enabled nix and home-manager - bootstrap = pkgs.mkShell { - # Enable experimental features without having to specify the argument - NIX_CONFIG = "experimental-features = nix-command flakes"; - nativeBuildInputs = with pkgs; [nix home-manager git]; - }; } ); diff --git a/nixpkgs.nix b/nixpkgs.nix new file mode 100644 index 0000000..e4d0588 --- /dev/null +++ b/nixpkgs.nix @@ -0,0 +1,9 @@ +# A nixpkgs instance that is grabbed from the pinned nixpkgs commit in the lock file +# This is useful to avoid using channels when using legacy nix commands +let + lock = (builtins.fromJSON (builtins.readFile ./flake.lock)).nodes.nixpkgs.locked; +in + import (fetchTarball { + url = "https://github.com/nixos/nixpkgs/archive/${lock.rev}.tar.gz"; + sha256 = lock.narHash; + }) diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..14ad0d8 --- /dev/null +++ b/shell.nix @@ -0,0 +1,8 @@ +# Shell for bootstrapping flake-enabled nix and home-manager +{pkgs ? (import ./nixpkgs.nix) {}}: { + bootstrap = pkgs.mkShell { + # Enable experimental features without having to specify the argument + NIX_CONFIG = "experimental-features = nix-command flakes"; + nativeBuildInputs = with pkgs; [nix home-manager git]; + }; +}