diff --git a/aliases.sh b/aliases.sh new file mode 100644 index 0000000..70d1065 --- /dev/null +++ b/aliases.sh @@ -0,0 +1,43 @@ +# misc START +alias copy="wl-copy <" +alias rs="rsync -avhzru -P" +alias rsh="rsync -avhzru -P -e ssh" +alias ws="webstorm" +alias size="du -hd1 | sort -hr" +alias la='ls -la' +alias list="tree -L 1" +alias tree="tree -L 2" +alias up="pnpm up -i -L" +# misc END + +# git START +alias gst="git status" +alias ga="git add" +alias gd="git diff" +alias gb="git branch" +alias gco="git checkout" +alias gc="git commit -m" +alias gp="git push" +alias gl="git pull" +alias glf="git fetch --all && git stash save -m 'Before force pull' && git reset --hard" +alias gr="git restore --staged" +# git END + +# docker START +alias dc="docker compose up -d" +alias dd="docker compose down" +alias dclean="docker system prune -af" +# docker END + +# webp BEGIN +function to_webp() { + setopt NULL_GLOB + for type in jpg png; do + for F in *.$type; do + cwebp "$F" -o "`basename "$\{F%.$type}"`.webp" + done + done + unsetopt NULL_GLOB +} +alias webp='to_webp' +# webp END \ No newline at end of file diff --git a/build-nix.sh b/build-nix.sh index 24b064f..d52d3e2 100755 --- a/build-nix.sh +++ b/build-nix.sh @@ -15,6 +15,7 @@ echo "Copying new configuration..." sudo cp ./configuration.nix "${NIXOS_CONFIG_PATH}" sudo mkdir -p "${NIXOS_CONFIG_PATH}/private" sudo cp ./private/* "${NIXOS_CONFIG_PATH}/private/" +sudo cp ./aliases.sh "${NIXOS_CONFIG_PATH}" echo "Rebuilding NixOS configuration..." # Rebuild the NixOS configuration and make the changes effective diff --git a/configuration.nix b/configuration.nix index c7a620f..a1d1cb5 100644 --- a/configuration.nix +++ b/configuration.nix @@ -5,13 +5,19 @@ { config, pkgs, lib, ... }: let - nixFolder = "/etc/nixos"; username = "spy4x"; userFullName = "Anton Shubin"; - sshConfigPath = "${nixFolder}/private/ssh-config"; - sshConfig = if builtins.pathExists "${sshConfigPath}" then builtins.readFile "${sshConfigPath}" else "# private ssh config file didn't exist to insert it's content here"; + gdrivePath = "/home/${username}/gdrive"; curBin = "/run/current-system/sw/bin"; + nixFolder = "/etc/nixos"; + + sshConfigPath = "${nixFolder}/private/ssh-config"; + sshConfig = if builtins.pathExists "${sshConfigPath}" then builtins.readFile "${sshConfigPath}" else "# private ssh config file didn't exist to insert it's content here"; + + aliasesPath = "${nixFolder}/aliases.sh"; + aliases = if builtins.pathExists "${aliasesPath}" then builtins.readFile "${aliasesPath}" else "# aliases file didn't exist to insert it's content here"; + home-manager = builtins.fetchTarball "https://github.com/nix-community/home-manager/archive/release-23.11.tar.gz"; in { @@ -170,47 +176,7 @@ in # Shell aliases and other init environment.interactiveShellInit = '' - alias copy="wl-copy <" - alias rs="rsync -avhzru -P" - alias rsh="rsync -avhzru -P -e ssh" - alias ws="webstorm" - alias size="du -hd1 | sort -hr" - alias la='ls -la' - alias list="tree -L 1" - alias tree="tree -L 2" - alias up="pnpm up -i -L" - - # git START - alias gst="git status" - alias ga="git add" - alias gd="git diff" - alias gb="git branch" - alias gco="git checkout" - alias gc="git commit -m" - alias gp="git push" - alias gl="git pull" - alias glf="git fetch --all && git stash save -m 'Before force pull' && git reset --hard" - alias gr="git restore --staged" - # git END - - # docker START - alias dc="docker compose up -d" - alias dd="docker compose down" - alias dclean="docker system prune -af" - # docker END - - # webp BEGIN - function to_webp() { - setopt NULL_GLOB - for type in jpg png; do - for F in *.$type; do - cwebp "$F" -o "`basename "$\{F%.$type}"`.webp" - done - done - unsetopt NULL_GLOB - } - alias webp='to_webp' - # webp END + ${aliases} '';