systemctl --user stop emacs.{service,socket}
systemctl --user start emacs.socket
~/.emacs.d/bin/doom sync
nix eval --json -f '<nixpkgs>' --apply 'pkgs: builtins.attrNames (pkgs {})' \
| jq -r .[]
nix run "nixpkgs#$1"
nix flake show --json | jq -r '.nixosConfigurations | keys[]'
nixos-rebuild test --use-remote-sudo --flake .
nixos-rebuild "$1" --use-remote-sudo --flake ".#$2"
build
test
switch
nixos-rebuild switch --use-remote-sudo --flake .
nix-env --profile $HOME/.local/state/nix/profiles/home-manager --list-generations
nix-env --profile $HOME/.local/state/nix/profiles/home-manager --delete-generations "$@"
Activate a Home Manager profile without doing a full nixos-rebuild
.
hm activate
List Home Manager profiles.
nix eval .#homeConfigurations --apply builtins.attrNames --json | jq -r .[]
sudo nix-env --profile /nix/var/nix/profiles/system --list-generations
sudo nix-env --profile /nix/var/nix/profiles/system --delete-generations "$@"
WSL struggles with a startup delay for SystemD where it's not immediately ready when the WSL distro boots up. Consequently, the user services are not started at all automatically when starting the login shell.
See: nix-community/NixOS-WSL#375 (comment)
echo "Waiting for systemd..."
until systemctl &>/dev/null; do sleep 1; done
if ! systemctl --user &>/dev/null; then
echo "Restarting user services..."
sudo systemctl restart "user@$(id -u)"
fi
echo "Propagate WSLENV..."
systemctl --user set-environment WSLENV="$WSLENV"