Nix : Rename update functions.

This commit is contained in:
Dmitry Voronin 2024-01-31 03:32:45 +03:00
parent 312d0810a9
commit 31c34f3292
3 changed files with 25 additions and 31 deletions

View file

@ -34,7 +34,19 @@ function nix_channel() {
nix-channel --list nix-channel --list
} }
# Update system (rebuild). # Rebuild system.
# Optionally force the hostname.
# Usage: nix_rebuild [HOSTNAME]
function nix_rebuild() {
local target="${1}"
[[ "${target}" = "" ]] && target="${HOSTNAME}"
cd ${HOME}/.config/linux/system
nixos-rebuild switch --flake .#${target}
cd -
}
# Update system.
# Optionally force the hostname. # Optionally force the hostname.
# Usage: nix_update [HOSTNAME] # Usage: nix_update [HOSTNAME]
function nix_update() { function nix_update() {
@ -42,18 +54,8 @@ function nix_update() {
[[ "${target}" = "" ]] && target="${HOSTNAME}" [[ "${target}" = "" ]] && target="${HOSTNAME}"
cd ${HOME}/.config/linux/system cd ${HOME}/.config/linux/system
nixos-rebuild switch --flake .#${target} nix flake update
} cd -
# Upgrade system. Applies after reboot.
# Optionally force the hostname.
# Usage: nix_upgrade [HOSTNAME]
function nix_upgrade() {
local target="${1}"
[[ "${target}" = "" ]] && target="${HOSTNAME}"
cd ${HOME}/.config/linux/system
nix flake update && nix_update "${target}"
} }
# Free up root space. # Free up root space.

View file

@ -14,7 +14,7 @@
networking.extraHosts = '' networking.extraHosts = ''
10.1.0.2 git.voronind.com 10.1.0.2 git.voronind.com
''; '';
networking.nameservers = [ "1.1.1.1" "8.8.8.8" ]; networking.networkmanager.insertNameservers = [ "1.1.1.1" "8.8.8.8" ];
# Filesystems. # Filesystems.
fileSystems."/storage/cold_1" = { fileSystems."/storage/cold_1" = {

View file

@ -94,11 +94,10 @@ Command|Description
Command|Description Command|Description
---|--- ---|---
`cp <FROM> <TO>`|Replaces default cp with rsync. `rcp <FROM> <TO>`|Replaces default cp with rsync.
`cp_merge <FROM> <TO>`|Copy and also merge all changes (delete dst files that do not exist in src). `rcp_merge <FROM> <TO>`|Copy and also merge all changes (delete dst files that do not exist in src).
`cp_link <FROM> <TO>`|Copy by creating hardlinks. Works for directories, too. `cp_link <FROM> <TO>`|Copy by creating hardlinks. Works for directories, too.
`bcp`|Default cp, a.k.a builtin cp. When you don't need rsync. `rcp_test <FROM> <TO>`|Print output of cp_merge without writing anything.
`cp_test <FROM> <TO>`|Print output of cp_merge without writing anything.
## Date. ## Date.
@ -118,8 +117,8 @@ Command|Description
Command|Description Command|Description
---|--- ---|---
`df`|Show only physical drives info. `pdf`|Show only physical drives info.
`du [DIRS]`|Show combined size in SI. Current dir by default. `tdu [DIRS]`|Show total size in SI. Current dir by default.
## Docker. ## Docker.
@ -262,22 +261,15 @@ Command|Description
`name_replace <OLD> <NEW> [FILES]`|Replace part of the name. All matching files by default. `name_replace <OLD> <NEW> [FILES]`|Replace part of the name. All matching files by default.
`name_fix_numbering [FILES]`|Fix numbering for numbered files. I.e if there are 10 items and some of them start without zero, then append zero to it. 1..10 -> 01..10. `name_fix_numbering [FILES]`|Fix numbering for numbered files. I.e if there are 10 items and some of them start without zero, then append zero to it. 1..10 -> 01..10.
## Ncdu.
Command|Description
---|---
`ncdu [DIRS]`|Search only on current filesystem. Current dir by default.
## Nix. ## Nix.
Command|Description Command|Description
---|--- ---|---
`nix_find <PACKAGE>`|Find Nix package path. `nix_find <PACKAGE>`|Find Nix package path.
`nix_unstable`|Switch to Unstable branch. `nix_unstable`|Switch to Unstable branch.
`nix_unstable_small`|Switch to Small Unstable branch (for server).
`nix_channel`|Display current channel. `nix_channel`|Display current channel.
`nix_update [HOSTNAME]`|Update system (rebuild). Optionally force the hostname. `nix_rebuild [HOSTNAME]`|Rebuild system. Optionally force the hostname.
`nix_upgrade [HOSTNAME]`|Upgrade system. Applies after reboot. Optionally force the hostname. `nix_update [HOSTNAME]`|Update system. Optionally force the hostname.
`nix_clean`|Free up root space. `nix_clean`|Free up root space.
`nix_shell [NAME]`|Spawn shell with specified nix environment. `Main` is default. `nix_shell [NAME]`|Spawn shell with specified nix environment. `Main` is default.
`nix_tmpshell <PACKAGES>`|Spawn nix-shell with specified packages. `nix_tmpshell <PACKAGES>`|Spawn nix-shell with specified packages.
@ -321,7 +313,7 @@ Command|Description
`parse_startcase <STRING>`|Parse string to start case. `parse_startcase <STRING>`|Parse string to start case.
`parse_json <STRING>`|Parse string to pretty Json. `parse_json <STRING>`|Parse string to pretty Json.
## Permissions. ## Permission.
Command|Description Command|Description
---|--- ---|---