One-liners

contents

Rust

Ensure cargo is on $PATH automatically, in fish shell

echo "set PATH \$HOME/.cargo/bin \$PATH" >> ~/.config/fish/config.fish

This is essentially what source ./cargo/env does. Alternatively...

echo ". \$HOME/.cargo/env" >> ~/.config/fish/config.fish

Nix/NixOS

Add unstable channel

nix-channel --list
nix-channel --add https://nixos.org/channels/nixos-unstable nixos

Upgrade

nixos-rebuild switch --upgrade

Fix error: cloning builder process: Operation not permitted on build

sudo sysctl kernel.unprivileged_userns_clone=1

Source.

Collect garbage

nix-collect-garbage

Rebasing Nixpks changes onto a channel

To avoid rebuilding a lot of stuff, you can rebase on unstable as follows (see here):

git remote add -f channels https://github.com/NixOS/nixpkgs-channels
git rebase channels/nixos-unstable

Upgrade a Nix environment

nix-env -u

Git

Rebase a branch to a point further back in history

git rebase --onto <new-parent> <old-parent>

Change the author of a commit

git commit --amend --author="John Doe <john@doe.org>" --no-edit

Or many commits:

git rebase -i master --exec 'git commit --amend --author "Ed Cragg <ed.cragg@eipi.xyz>" --no-edit'