From dc34a785f77fd227622ab1111454f234a0108d18 Mon Sep 17 00:00:00 2001 From: Chris Toph Date: Mon, 16 Jun 2025 23:52:40 -0400 Subject: [PATCH] Adds dev shell in flake and removes old shell.nix --- flake.nix | 66 +++++++++++++++++++++++++++++++++++++++++++ shell.nix | 84 ------------------------------------------------------- 2 files changed, 66 insertions(+), 84 deletions(-) delete mode 100644 shell.nix diff --git a/flake.nix b/flake.nix index aef837e..263cca3 100644 --- a/flake.nix +++ b/flake.nix @@ -166,5 +166,71 @@ in customPackages ); + + ## SHELL ## + + devShells = forAllSystems ( + system: + let + pkgs = import nixpkgs { + inherit system; + overlays = [ self.overlays.default ]; + }; + in + { + default = pkgs.mkShell { + nativeBuildInputs = + with pkgs; + [ + # Basic nix tools + nix + nixos-rebuild + home-manager + nh + # Git and git-crypt + git + git-crypt + gnupg + gpg-tui + # Shells + fish + bash + # Config tools + dconf2nix + # Network tools + curl + wget + # System tools + coreutils + findutils + gzip + zstd + # Text editors + micro + # microsoft-edit + # Diagnostics + inxi + pciutils + usbutils + lshw + ] + ++ [ + inputs.yay.packages.${system}.default # My yay.nix tool + ]; + + NIX_CONFIG = "experimental-features = nix-command flakes"; + + shellHook = '' + clear + echo "Development shell initialized" + echo -e "Run '\033[1;34myay rebuild\033[0m' to rebuild your system" + + # Set FLAKE to the current working directory + export FLAKE="$PWD" + echo -e "FLAKE environment variable is set to: \033[1;34m$FLAKE\033[0m" + ''; + }; + } + ); }; } diff --git a/shell.nix b/shell.nix deleted file mode 100644 index c164aca..0000000 --- a/shell.nix +++ /dev/null @@ -1,84 +0,0 @@ -# This is a Nix flake shell that provides a minimal environment for new install or system recovery -{ - pkgs ? - # If pkgs is not defined, instantiate nixpkgs from locked commit - let - lock = (builtins.fromJSON (builtins.readFile ./flake.lock)).nodes.nixpkgs.locked; - nixpkgs = fetchTarball { - url = "https://github.com/nixos/nixpkgs/archive/${lock.rev}.tar.gz"; - sha256 = lock.narHash; - }; - # Import overlays from the flake's overlay structure - overlays = [ - (import ./overlays { inputs = { }; }).default - ]; - in - import nixpkgs { inherit overlays; }, - inputs ? null, - ... -}: -let - # Import yay directly from its flake, incase overlay or config flake fucks up - yay = builtins.getFlake "git+https://git.ryot.foo/toph/yay.nix.git"; - inherit (pkgs) lib; -in -{ - default = pkgs.mkShell { - nativeBuildInputs = - builtins.attrValues { - inherit (pkgs) - # Basic nix tools - nix - nixos-rebuild - home-manager - nh - - # Git and git-crypt - git - git-crypt - gnupg - gpg-tui - - # Shells - fish - bash - - # Config tools - dconf2nix - - # Network tools - curl - wget - - # System tools - coreutils - findutils - gzip - zstd - - # Text editors - micro - nano - - # Diagnostics - inxi - pciutils - usbutils - lshw - ; - } - ++ [ - yay.packages.${pkgs.system}.default - ]; - - # Overwrite FLAKE to current path, for yay and nh - FLAKE = toString ./.; - - shellHook = '' - clear - echo "Minimal shell initialized with flake overlays" - echo -e "Run '\033[1;34myay rebuild\033[0m' to rebuild your system if needed" - echo -e "FLAKE environment variable is set to: \033[1;34m$FLAKE\033[0m" - ''; - }; -}