This commit is contained in:
iFargle 2024-02-15 21:57:22 +09:00
parent c26cc10ed4
commit 052113c7e7

View file

@ -30,177 +30,176 @@
]; ];
}; };
bash = { bash = {
enable = true; enable = true;
enableCompletion = true; enableCompletion = true;
initExtra = '' initExtra = ''
GPG_TTY=$(tty) GPG_TTY=$(tty)
ssh-add > /dev/null &> /dev/null ssh-add > /dev/null &> /dev/null
''; '';
sessionVariables = { sessionVariables = {
# Set the GTK Theme # Set the GTK Theme
# GTK_THEME = "Gruvbox-Dark-BL"; # GTK_THEME = "Gruvbox-Dark-BL";
XDG_DATA_HOME = "$HOME/.local/share"; XDG_DATA_HOME = "$HOME/.local/share";
# Disable askpass for cli auth: # Disable askpass for cli auth:
# SSH_ASKPASS = ""; # SSH_ASKPASS = "";
}; };
bashrcExtra = '' bashrcExtra = ''
docker-restart() { docker-restart() {
pushd /Storage/Data/docker-compose/sysctl.io pushd /Storage/Data/docker-compose/sysctl.io
docker stop $1 docker stop $1
docker rm $1 docker rm $1
docker-compose up -d $1 docker-compose up -d $1
popd popd
} }
# Build ISOs/SD Card Images # Build ISOs/SD Card Images
nixos-build-all-images-verbose() { nixos-build-all-images-verbose() {
echo "Building Linode image..." echo "Building Linode image..."
nixos-build-linode-img-verbose nixos-build-linode-img-verbose
echo "Building Raspberry Pi image..." echo "Building Raspberry Pi image..."
nixos-build-pi-img-verbose nixos-build-pi-img-verbose
echo "Building ISO Console image..." echo "Building ISO Console image..."
nixos-build-console-verbose nixos-build-console-verbose
echo "Building ISO Desktop image..." echo "Building ISO Desktop image..."
nixos-build-desktop-verbose nixos-build-desktop-verbose
ls -lah ~/ | grep nixos ls -lah ~/ | grep nixos
} }
nixos-build-all-images() { nixos-build-all-images() {
echo "Building Linode image..." echo "Building Linode image..."
nixos-build-linode-img nixos-build-linode-img
echo "Building Raspberry Pi image..." echo "Building Raspberry Pi image..."
nixos-build-pi-img nixos-build-pi-img
echo "Building ISO Console image..." echo "Building ISO Console image..."
nixos-build-console nixos-build-console
echo "Building ISO Desktop image..." echo "Building ISO Desktop image..."
nixos-build-desktop nixos-build-desktop
ls -lah ~/ | grep nixos ls -lah ~/ | grep nixos
} }
nixos-build-pi-img-verbose() { nixos-build-pi-img-verbose() {
pushd /etc/nixos/git pushd /etc/nixos/git
git pull git pull
nix build .#imageConfigurations.nixos-rpi4-img --show-trace --verbose nix build .#imageConfigurations.nixos-rpi4-img --show-trace --verbose
cp result/sd-image/nixos-sd-image* ~/. cp result/sd-image/nixos-sd-image* ~/.
rm -f result rm -f result
popd popd
} }
nixos-build-linode-img-verbose() { nixos-build-linode-img-verbose() {
pushd /etc/nixos/git pushd /etc/nixos/git
git pull git pull
nix build .#imageConfigurations.nixos-linode-img --show-trace --verbose nix build .#imageConfigurations.nixos-linode-img --show-trace --verbose
cp result/nixos.img.gz ~/nixos-linode-`ddate`-`git rev-parse HEAD | cut -b 1-7`.img.gz cp result/nixos.img.gz ~/nixos-linode-`ddate`-`git rev-parse HEAD | cut -b 1-7`.img.gz
rm -f result rm -f result
popd popd
} }
nixos-build-console-verbose() { nixos-build-console-verbose() {
pushd /etc/nixos/git pushd /etc/nixos/git
git pull git pull
nix build .#imageConfigurations.nixos-iso-console --show-trace --verbose nix build .#imageConfigurations.nixos-iso-console --show-trace --verbose
cp result/iso/nixos.iso ~/nixos-console-`ddate`-`git rev-parse HEAD | cut -b 1-7`.iso cp result/iso/nixos.iso ~/nixos-console-`ddate`-`git rev-parse HEAD | cut -b 1-7`.iso
rm -f result rm -f result
popd popd
} }
nixos-build-desktop-verbose() { nixos-build-desktop-verbose() {
pushd /etc/nixos/git pushd /etc/nixos/git
git pull git pull
nix build .#imageConfigurations.nixos-iso-desktop --show-trace --verbose nix build .#imageConfigurations.nixos-iso-desktop --show-trace --verbose
cp result/iso/nixos.iso ~/nixos-desktop-`ddate`-`git rev-parse HEAD | cut -b 1-7`.iso cp result/iso/nixos.iso ~/nixos-desktop-`ddate`-`git rev-parse HEAD | cut -b 1-7`.iso
rm -f result rm -f result
popd popd
} }
nixos-build-pi-img() { nixos-build-pi-img() {
pushd /etc/nixos/git pushd /etc/nixos/git
git pull git pull
nix build .#imageConfigurations.nixos-rpi4-img nix build .#imageConfigurations.nixos-rpi4-img
cp result/sd-image/nixos-sd-image* ~/. cp result/sd-image/nixos-sd-image* ~/.
rm -f result rm -f result
popd popd
} }
nixos-build-linode-img() { nixos-build-linode-img() {
pushd /etc/nixos/git pushd /etc/nixos/git
git pull git pull
nix build .#imageConfigurations.nixos-linode-img nix build .#imageConfigurations.nixos-linode-img
cp result/nixos.img.gz ~/nixos-linode-`ddate`-`git rev-parse HEAD | cut -b 1-7`.img.gz cp result/nixos.img.gz ~/nixos-linode-`ddate`-`git rev-parse HEAD | cut -b 1-7`.img.gz
rm -f result rm -f result
popd popd
} }
nixos-build-console() { nixos-build-console() {
pushd /etc/nixos/git pushd /etc/nixos/git
git pull git pull
nix build .#imageConfigurations.nixos-iso-console nix build .#imageConfigurations.nixos-iso-console
cp result/iso/nixos.iso ~/nixos-console-`ddate`-`git rev-parse HEAD | cut -b 1-7`.iso cp result/iso/nixos.iso ~/nixos-console-`ddate`-`git rev-parse HEAD | cut -b 1-7`.iso
rm -f result rm -f result
popd popd
} }
nixos-build-desktop() { nixos-build-desktop() {
pushd /etc/nixos/git pushd /etc/nixos/git
git pull git pull
nix build .#imageConfigurations.nixos-iso-desktop nix build .#imageConfigurations.nixos-iso-desktop
cp result/iso/nixos.iso ~/nixos-desktop-`ddate`-`git rev-parse HEAD | cut -b 1-7`.iso cp result/iso/nixos.iso ~/nixos-desktop-`ddate`-`git rev-parse HEAD | cut -b 1-7`.iso
rm -f result rm -f result
popd popd
} }
# NixOS Related # NixOS Related
nix-clean-all() { nix-clean-all() {
sudo nix-env -u --always sudo nix-env -u --always
sudo nix-collect-garbage -d sudo nix-collect-garbage -d
} }
''; '';
shellAliases = { shellAliases = {
prime-select = "nvidia-offload"; prime-select = "nvidia-offload";
screenshot = ''grim -g "$(slurp)" | wl-copy -t image/png''; screenshot = ''grim -g "$(slurp)" | wl-copy -t image/png'';
# Don't use X to open emacs # Don't use X to open emacs
emacs = "emacs -nw"; emacs = "emacs -nw";
# docker # docker
d = "docker"; d = "docker";
dc = "docker-compose"; dc = "docker-compose";
de = "docker exec -it"; de = "docker exec -it";
dl = "docker logs -f "; dl = "docker logs -f ";
dps = ''docker ps --format "table [{{.ID}}] {{.Names}}\t{{.Status}}\t{{.State}}\t{{.Label \"type\"}}"''; dps = ''docker ps --format "table [{{.ID}}] {{.Names}}\t{{.Status}}\t{{.State}}\t{{.Label \"type\"}}"'';
# bash / system # bash / system
ls = "exa --icons -F --group-directories-first --git"; ls = "exa --icons -F --group-directories-first --git";
cp = "rsync -avr"; cp = "rsync -avr";
ll = "exa -lah --icons -F --group-directories-first --git"; ll = "exa -lah --icons -F --group-directories-first --git";
rm = "rm -i"; rm = "rm -i";
df = "duf"; df = "duf";
cat = "bat"; cat = "bat";
# git # git
g = "git"; g = "git";
ga = "git add -A"; ga = "git add -A";
gb = "git branch"; gb = "git branch";
gc = "git commit"; gc = "git commit";
gca = "git commit -a"; gca = "git commit -a";
gco = "git checkout"; gco = "git checkout";
gd = "git diff"; gd = "git diff";
gp = "git pull --prune"; gp = "git pull --prune";
gpu = "git push origin HEAD"; gpu = "git push origin HEAD";
gs = "git status -sb"; gs = "git status -sb";
# time / date # time / date
tdate = "date +%Y.%m.%d..%H.%M"; tdate = "date +%Y.%m.%d..%H.%M";
ttime = "date +%H.%M"; ttime = "date +%H.%M";
ddate = "date +%Y.%m.%d"; ddate = "date +%Y.%m.%d";
dday = "date +%A"; dday = "date +%A";
# nixos-rebuild # nixos-rebuild
ns = "nix shell"; ns = "nix shell";
nr = "sudo nixos-rebuild"; nr = "sudo nixos-rebuild";
nrs = "sudo nixos-rebuild --upgrade switch"; nrs = "sudo nixos-rebuild --upgrade switch";
nrt = "sudo nixos-rebuild test"; nrt = "sudo nixos-rebuild test";
nrb = "sudo nixos-rebuild build"; nrb = "sudo nixos-rebuild build";
# Rebuild everything # Rebuild everything
rebuild-home = "git -C /etc/nixos/git pull && home-manager switch -b backup --flake /etc/nixos/git"; rebuild-home = "git -C /etc/nixos/git pull && home-manager switch -b backup --flake /etc/nixos/git";
rebuild-host = "git -C /etc/nixos/git pull && sudo nixos-rebuild switch --flake /etc/nixos/git"; rebuild-host = "git -C /etc/nixos/git pull && sudo nixos-rebuild switch --flake /etc/nixos/git";
rebuild-all = "rebuild-host && rebuild-home"; rebuild-all = "rebuild-host && rebuild-home";
rebuild-host-remote = "git -C /etc/nixos/git pull && sudo nixos-rebuild switch --flake /etc/nixos/git -j0"; rebuild-host-remote = "git -C /etc/nixos/git pull && sudo nixos-rebuild switch --flake /etc/nixos/git -j0";
rebuild-home-remote = "git -C /etc/nixos/git pull && home-manager switch -b backup --flake /etc/nixos/git --max-jobs 0"; rebuild-home-remote = "git -C /etc/nixos/git pull && home-manager switch -b backup --flake /etc/nixos/git --max-jobs 0";
rebuild-all-remote = "rebuild-host-remote && rebuild-home-remote"; rebuild-all-remote = "rebuild-host-remote && rebuild-home-remote";
};
}; };
}; };
} }