From c5d2fbe031f562d3aaab0af311dadcf994e05897 Mon Sep 17 00:00:00 2001 From: gwg313 Date: Mon, 8 Jan 2024 15:49:26 -0500 Subject: [PATCH] refactor: pull bootstap into regular shell for ease of use --- flake.nix | 7 ------- nixpkgs.nix | 9 +++++++++ shell.nix | 8 ++++++++ 3 files changed, 17 insertions(+), 7 deletions(-) create mode 100644 nixpkgs.nix create mode 100644 shell.nix 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]; + }; +}