Refactor shell.nix to import overlays and yay. Better fitted for doomsday scenario
This commit is contained in:
parent
b45261c251
commit
40fffe6a55
1 changed files with 62 additions and 13 deletions
75
shell.nix
75
shell.nix
|
@ -1,4 +1,4 @@
|
||||||
# Shell for bootstrapping flake-enabled nix and other tooling
|
# This is a Nix flake shell that provides a minimal environment for new install or system recovery
|
||||||
{
|
{
|
||||||
pkgs ?
|
pkgs ?
|
||||||
# If pkgs is not defined, instantiate nixpkgs from locked commit
|
# If pkgs is not defined, instantiate nixpkgs from locked commit
|
||||||
|
@ -8,23 +8,72 @@
|
||||||
url = "https://github.com/nixos/nixpkgs/archive/${lock.rev}.tar.gz";
|
url = "https://github.com/nixos/nixpkgs/archive/${lock.rev}.tar.gz";
|
||||||
sha256 = lock.narHash;
|
sha256 = lock.narHash;
|
||||||
};
|
};
|
||||||
|
# Import overlays from the flake's overlay structure
|
||||||
|
overlays = [
|
||||||
|
(import ./overlays { inputs = { }; }).default
|
||||||
|
];
|
||||||
in
|
in
|
||||||
import nixpkgs { overlays = [ ]; },
|
import nixpkgs { inherit overlays; },
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
let
|
||||||
|
# Explicitly add the yay package to the shell in case overlay fucks up
|
||||||
|
yay = import ./pkgs/yay/package.nix { inherit pkgs lib; };
|
||||||
|
inherit (pkgs) lib;
|
||||||
|
in
|
||||||
{
|
{
|
||||||
default = pkgs.mkShell {
|
default = pkgs.mkShell {
|
||||||
nativeBuildInputs = builtins.attrValues {
|
nativeBuildInputs =
|
||||||
inherit (pkgs)
|
builtins.attrValues {
|
||||||
|
inherit (pkgs)
|
||||||
|
# Basic nix tools
|
||||||
|
nix
|
||||||
|
nixos-rebuild
|
||||||
|
home-manager
|
||||||
|
nh
|
||||||
|
|
||||||
nix
|
# Git for repo management
|
||||||
home-manager
|
git
|
||||||
nh
|
|
||||||
git
|
# Shells
|
||||||
fish
|
fish
|
||||||
dconf2nix
|
bash
|
||||||
bats # for bash testing
|
|
||||||
;
|
# Config tools
|
||||||
};
|
dconf2nix
|
||||||
|
|
||||||
|
# Network tools (for recovery scenarios)
|
||||||
|
curl
|
||||||
|
wget
|
||||||
|
|
||||||
|
# System tools
|
||||||
|
coreutils
|
||||||
|
findutils
|
||||||
|
gzip
|
||||||
|
zstd
|
||||||
|
|
||||||
|
# Text editors for emergency config edits
|
||||||
|
micro
|
||||||
|
nano
|
||||||
|
|
||||||
|
# Diagnostics
|
||||||
|
inxi
|
||||||
|
pciutils
|
||||||
|
usbutils
|
||||||
|
lshw
|
||||||
|
;
|
||||||
|
}
|
||||||
|
++ [
|
||||||
|
yay
|
||||||
|
];
|
||||||
|
|
||||||
|
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"
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue