Skip to content

Instantly share code, notes, and snippets.

@Kiwi
Created May 18, 2019 17:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kiwi/354ca9c133dd8953726c5ccf5a8a6b4f to your computer and use it in GitHub Desktop.
Save Kiwi/354ca9c133dd8953726c5ccf5a8a6b4f to your computer and use it in GitHub Desktop.
nixos-rebuild that does nix-channel --update on --upgrade
#thanks sphalerite
#nixos-rebuild = [(lib.hiPrio (pkgs.writeShellScriptBin "nixos-rebuild"
# ''REAL_ARGS=() ; while [[ $# -gt 0 ]] ; do if [[ --upgrade = $1 ]] ; then nix-channel --update ; shift ; fi ; REAL_ARGS+=("$1") ; shift ; done ;
# exec ${config.system.build.nixos-rebuild}/bin/nixos-rebuild ''${REAL_ARGS[@]}'' ))];
nixos-rebuild = [(lib.hiPrio (pkgs.writeShellScriptBin "nixos-rebuild"
''
REAL_ARGS=() ;
while [[ $# -gt 0 ]] ; do
if [[ --upgrade = $1 ]] ;
then nix-channel --update ; shift ;
fi ;
REAL_ARGS+=("$1") ;
shift ;
done ;
exec ${config.system.build.nixos-rebuild}/bin/nixos-rebuild ''${REAL_ARGS[@]}''
))];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment