Skip to content

Latest commit

 

History

History
127 lines (85 loc) · 2.23 KB

nixon.md

File metadata and controls

127 lines (85 loc) · 2.23 KB

Nixon commands

Emacs

emacs-restart

systemctl --user stop emacs.{service,socket}
systemctl --user start emacs.socket

doom-sync

~/.emacs.d/bin/doom sync

NixOS

nix-pkgs

nix eval --json -f '<nixpkgs>' --apply 'pkgs: builtins.attrNames (pkgs {})' \
  | jq -r .[]

nrun

nix run "nixpkgs#$1"

_nixos-configurations

nix flake show --json | jq -r '.nixosConfigurations | keys[]'

nixos-test

nixos-rebuild test --use-remote-sudo --flake .

nixos-rebuild ${_nixos-rebuild-target} ${_nixos-configurations}

nixos-rebuild "$1" --use-remote-sudo --flake ".#$2"

_nixos-rebuild-target

build
test
switch

nixos-switch

nixos-rebuild switch --use-remote-sudo --flake .

home-manager-list-generations

nix-env --profile $HOME/.local/state/nix/profiles/home-manager --list-generations

home-manager-delete-generations ${home-manager-list-generations:1m}

nix-env --profile $HOME/.local/state/nix/profiles/home-manager --delete-generations "$@"

hm-activate

Activate a Home Manager profile without doing a full nixos-rebuild.

hm activate

hm-profiles

List Home Manager profiles.

nix eval .#homeConfigurations --apply builtins.attrNames --json | jq -r .[]

nixos-list-generations

sudo nix-env --profile /nix/var/nix/profiles/system --list-generations

nixos-delete-generations ${nixos-list-generations:1m}

sudo nix-env --profile /nix/var/nix/profiles/system --delete-generations "$@"

WSL

wsl-setup

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"