diff options
author | tdro <tdro@users.noreply.github.com> | 2022-02-19 03:01:28 -0500 |
---|---|---|
committer | tdro <tdro@users.noreply.github.com> | 2022-02-19 03:26:34 -0500 |
commit | 11f67b3301ace28cc56ef3961a029ed5449c85c3 (patch) | |
tree | 778a4421f491b13269d7b5d04fa96476a9974ac7 /.config | |
parent | b710281b132056105709c03dda1899a6afc68a93 (diff) | |
download | dotfiles-11f67b3301ace28cc56ef3961a029ed5449c85c3.tar.gz dotfiles-11f67b3301ace28cc56ef3961a029ed5449c85c3.tar.bz2 dotfiles-11f67b3301ace28cc56ef3961a029ed5449c85c3.zip |
.config/nixpkgs/helpers: Update usage comments
nixpkgs/helpers/mkShellMinimal.nix
nixpkgs/helpers/mkShellPure.nix
Diffstat (limited to '.config')
-rw-r--r-- | .config/nixpkgs/helpers/mkShellMinimal.nix | 14 | ||||
-rw-r--r-- | .config/nixpkgs/helpers/mkShellPure.nix | 26 |
2 files changed, 33 insertions, 7 deletions
diff --git a/.config/nixpkgs/helpers/mkShellMinimal.nix b/.config/nixpkgs/helpers/mkShellMinimal.nix index 057dd6e..1f41fde 100644 --- a/.config/nixpkgs/helpers/mkShellMinimal.nix +++ b/.config/nixpkgs/helpers/mkShellMinimal.nix @@ -4,17 +4,21 @@ # let # +# name = "nix-shell.minimal"; # pkgs = import <nixpkgs> { }; +# # mkShellMinimal = pkgs.callPackage (builtins.fetchurl { -# url = "https://raw.githubusercontent.com/tdro/dotfiles/ae8c382ca82135ad2910cb3ef18c4e6f31ff0fde/.config/nixpkgs/helpers/mkShellMinimal.nix"; -# sha256 = "123ax7v6fbj1cq0kvr8jiphg99k04zw6b4r5dnn94fj1gmd2hxay"; +# url = "https://raw.githubusercontent.com/tdro/dotfiles/b710281b132056105709c03dda1899a6afc68a93/.config/nixpkgs/helpers/mkShellMinimal.nix"; +# sha256 = "0smaflcj4r9q0ix45hx904sfmrhdkav6pvv2m7xapc68ykw0ry1i"; # }) { }; # # in mkShellMinimal { -# name = "minimal-shell"; -# packages = [ pkgs.hello ]; +# packages = [ pkgs.hello pkgs.gnugrep ]; # shellHook = '' -# printf 'hello world' +# hello +# printf "$PATH\n" +# grep --version +# export PS1='\h (${name}) \W \$ ' # ''; # } diff --git a/.config/nixpkgs/helpers/mkShellPure.nix b/.config/nixpkgs/helpers/mkShellPure.nix index de44c67..8ffa941 100644 --- a/.config/nixpkgs/helpers/mkShellPure.nix +++ b/.config/nixpkgs/helpers/mkShellPure.nix @@ -1,6 +1,27 @@ -### Pure version of mkShellMinimal that clears all environment variables. +### Experimental pure version of mkShellMinimal that clears all environment variables. ### Derived Source: https://github.com/NixOS/nixpkgs/commit/459771518d44f60b59a19381d07b12297908215d ### Article: https://fzakaria.com/2021/08/02/a-minimal-nix-shell.html +### Usage: + +# let +# +# name = "nix-shell.pure"; +# pkgs = import <nixpkgs> { }; +# +# mkShellPure = pkgs.callPackage (builtins.fetchurl { +# url = "https://raw.githubusercontent.com/tdro/dotfiles/b710281b132056105709c03dda1899a6afc68a93/.config/nixpkgs/helpers/mkShellPure.nix"; +# sha256 = "1ciwifsx2hrp0ymm077zfb5q8ravrk545bda1q249y2spw9np4ms"; +# }) { }; +# +# in mkShellPure { +# packages = [ pkgs.hello pkgs.coreutils ]; +# shellHook = '' +# export ENV=ENV +# env +# hello +# export PS1='\h (${name}) \W \$ ' +# ''; +# } { writeTextFile, writeScript, system }: @@ -16,12 +37,13 @@ derivation ({ destination = "/${name}"; text = '' set -e + NEW_PATH= for package in ${toString packages}; do export NEW_PATH=$package/bin:$NEW_PATH done exec /usr/bin/env --ignore-environment /bin/sh -c " export PATH=$NEW_PATH - ${shellHook} + ${shellHook} /bin/sh " ''; |