From 31c34f3292f17e578f523d41780ffdbe9309bc38 Mon Sep 17 00:00:00 2001 From: Dmitry Voronin Date: Wed, 31 Jan 2024 03:32:45 +0300 Subject: [PATCH] Nix : Rename update functions. --- .config/bash/module/Nix.sh | 28 ++++++++++--------- .../linux/system/host/home/Configuration.nix | 2 +- .doc/Bash.md | 26 ++++++----------- 3 files changed, 25 insertions(+), 31 deletions(-) diff --git a/.config/bash/module/Nix.sh b/.config/bash/module/Nix.sh index 4381009..b530705 100644 --- a/.config/bash/module/Nix.sh +++ b/.config/bash/module/Nix.sh @@ -34,7 +34,19 @@ function nix_channel() { 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. # Usage: nix_update [HOSTNAME] function nix_update() { @@ -42,18 +54,8 @@ function nix_update() { [[ "${target}" = "" ]] && target="${HOSTNAME}" cd ${HOME}/.config/linux/system - nixos-rebuild switch --flake .#${target} -} - -# 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}" + nix flake update + cd - } # Free up root space. diff --git a/.config/linux/system/host/home/Configuration.nix b/.config/linux/system/host/home/Configuration.nix index a605523..cde3718 100644 --- a/.config/linux/system/host/home/Configuration.nix +++ b/.config/linux/system/host/home/Configuration.nix @@ -14,7 +14,7 @@ networking.extraHosts = '' 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."/storage/cold_1" = { diff --git a/.doc/Bash.md b/.doc/Bash.md index 85e6b97..38eeebe 100644 --- a/.doc/Bash.md +++ b/.doc/Bash.md @@ -94,11 +94,10 @@ Command|Description Command|Description ---|--- -`cp `|Replaces default cp with rsync. -`cp_merge `|Copy and also merge all changes (delete dst files that do not exist in src). +`rcp `|Replaces default cp with rsync. +`rcp_merge `|Copy and also merge all changes (delete dst files that do not exist in src). `cp_link `|Copy by creating hardlinks. Works for directories, too. -`bcp`|Default cp, a.k.a builtin cp. When you don't need rsync. -`cp_test `|Print output of cp_merge without writing anything. +`rcp_test `|Print output of cp_merge without writing anything. ## Date. @@ -118,8 +117,8 @@ Command|Description Command|Description ---|--- -`df`|Show only physical drives info. -`du [DIRS]`|Show combined size in SI. Current dir by default. +`pdf`|Show only physical drives info. +`tdu [DIRS]`|Show total size in SI. Current dir by default. ## Docker. @@ -262,22 +261,15 @@ Command|Description `name_replace [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. -## Ncdu. - -Command|Description ----|--- -`ncdu [DIRS]`|Search only on current filesystem. Current dir by default. - ## Nix. Command|Description ---|--- `nix_find `|Find Nix package path. `nix_unstable`|Switch to Unstable branch. -`nix_unstable_small`|Switch to Small Unstable branch (for server). `nix_channel`|Display current channel. -`nix_update [HOSTNAME]`|Update system (rebuild). Optionally force the hostname. -`nix_upgrade [HOSTNAME]`|Upgrade system. Applies after reboot. Optionally force the hostname. +`nix_rebuild [HOSTNAME]`|Rebuild system. Optionally force the hostname. +`nix_update [HOSTNAME]`|Update system. Optionally force the hostname. `nix_clean`|Free up root space. `nix_shell [NAME]`|Spawn shell with specified nix environment. `Main` is default. `nix_tmpshell `|Spawn nix-shell with specified packages. @@ -321,11 +313,11 @@ Command|Description `parse_startcase `|Parse string to start case. `parse_json `|Parse string to pretty Json. -## Permissions. +## Permission. Command|Description ---|--- -`perm_share`|Recursively change permissions to allow read sharing with group and others. +`perm_share`|Recursively change permissions to allow read sharing with group and others. `perm`|Recursively change permissions to restrict access for group and others. ## Ps.