diff options
author | tdro <tdro@users.noreply.github.com> | 2022-02-19 01:11:17 -0500 |
---|---|---|
committer | tdro <tdro@users.noreply.github.com> | 2022-02-19 01:11:17 -0500 |
commit | ae8c382ca82135ad2910cb3ef18c4e6f31ff0fde (patch) | |
tree | 9b4994651501b6edd0a1767d83370e18d99bc6ce /.config/nixpkgs | |
parent | 069cd99fe353ba09ec78110e1996dfbac1edbb04 (diff) | |
download | dotfiles-ae8c382ca82135ad2910cb3ef18c4e6f31ff0fde.tar.gz dotfiles-ae8c382ca82135ad2910cb3ef18c4e6f31ff0fde.tar.bz2 dotfiles-ae8c382ca82135ad2910cb3ef18c4e6f31ff0fde.zip |
.config/nixpkgs/helpers: Use out of tree custom mkShellMinimal
Diffstat (limited to '.config/nixpkgs')
-rw-r--r-- | .config/nixpkgs/helpers/minimal-mkShell.nix | 30 | ||||
-rw-r--r-- | .config/nixpkgs/helpers/mkShellMinimal.nix | 33 |
2 files changed, 33 insertions, 30 deletions
diff --git a/.config/nixpkgs/helpers/minimal-mkShell.nix b/.config/nixpkgs/helpers/minimal-mkShell.nix deleted file mode 100644 index 8723380..0000000 --- a/.config/nixpkgs/helpers/minimal-mkShell.nix +++ /dev/null @@ -1,30 +0,0 @@ -### Derived from https://fzakaria.com/2021/08/02/a-minimal-nix-shell.html -### Usage Example: - -# let -# minimal = import (builtins.fetchurl { -# url = "https://raw.githubusercontent.com/tdro/dotfiles/83b77bf625613a01c47d82e2b08974bfdf219c51/.config/nixpkgs/helpers/minimal-mkShell.nix"; -# sha256 = "17w4slnz3p28y5h744wz0zw15122230jafy40yz4fsbvzg3hb6fh"; -# }); -# in minimal.mkShell { -# name = "minimal-shell"; -# buildInputs = [ ]; -# shellHook = ""; -# } - -rec { - pkgs = import (builtins.fetchTarball { - url = "https://releases.nixos.org/nixos/21.05/nixos-21.05.1510.a165aeceda9/nixexprs.tar.xz"; - sha256 = "124s05b0xk97arw0vvq8b4wcvsw6024dfdzwcx9qjxf3a2zszmam"; - }) { }; - - stdenv = pkgs.stdenvNoCC.override { - cc = null; - preHook = ""; - allowedRequisites = null; - initialPath = [ pkgs.busybox ]; - extraNativeBuildInputs = [ ]; - }; - - mkShell = pkgs.mkShell.override { inherit stdenv; }; -} diff --git a/.config/nixpkgs/helpers/mkShellMinimal.nix b/.config/nixpkgs/helpers/mkShellMinimal.nix new file mode 100644 index 0000000..437e557 --- /dev/null +++ b/.config/nixpkgs/helpers/mkShellMinimal.nix @@ -0,0 +1,33 @@ +### Source: https://github.com/NixOS/nixpkgs/commit/459771518d44f60b59a19381d07b12297908215d +### Article: https://fzakaria.com/2021/08/02/a-minimal-nix-shell.html + +{ writeTextFile, writeScript, system }: + +{ shellHook ? "", packages ? [ ], ... }@attrs: +derivation ({ + inherit system; + + name = "minimal-nix-shell"; + + "stdenv" = writeTextFile rec { + name = "setup"; + executable = true; + destination = "/${name}"; + text = '' + set -e + PATH= + for p in ${toString packages}; do + export PATH=$p/bin:$PATH + done + ${shellHook} + ''; + }; + + builder = writeScript "builder.sh" '' + #!/bin/sh + echo + echo "This derivation is not meant to be built, unless you want to capture the dependency closure."; + echo + export > $out + ''; +} // attrs) |