2023-07-01 12:12:43 +02:00
|
|
|
{ config, pkgs, ... }: {
|
|
|
|
# Configure BASH exports
|
2023-07-07 00:36:51 +02:00
|
|
|
# https://nix-community.github.io/home-manager/options.html
|
2023-07-07 00:47:28 +02:00
|
|
|
|
|
|
|
# https://github.com/justjanne/powerline-go
|
2023-08-16 03:53:33 +02:00
|
|
|
# https://nix-community.github.io/home-manager/options.html#opt-programs.powerline-go.enable
|
|
|
|
programs.powerline-go = {
|
|
|
|
enable = true;
|
|
|
|
# https://github.com/justjanne/powerline-go#customization
|
|
|
|
settings = {
|
2023-08-21 13:51:58 +02:00
|
|
|
hostname-only-if-ssh = true;
|
2023-09-01 10:22:07 +02:00
|
|
|
cwd-max-depth = 1;
|
2023-08-21 13:49:51 +02:00
|
|
|
condensed = true;
|
2023-08-16 03:53:33 +02:00
|
|
|
theme = "gruvbox";
|
|
|
|
};
|
2023-08-16 13:07:56 +02:00
|
|
|
modules = [
|
|
|
|
"venv"
|
|
|
|
"user"
|
2023-08-21 13:51:58 +02:00
|
|
|
"host"
|
2023-08-16 13:07:56 +02:00
|
|
|
"ssh"
|
|
|
|
"cwd"
|
|
|
|
"nix-shell"
|
|
|
|
"perms"
|
|
|
|
"git"
|
|
|
|
"docker"
|
|
|
|
"exit"
|
2023-08-21 12:33:50 +02:00
|
|
|
"root"
|
2023-08-16 13:07:56 +02:00
|
|
|
];
|
2023-08-16 03:53:33 +02:00
|
|
|
};
|
2023-07-10 12:50:38 +02:00
|
|
|
|
2023-07-01 12:12:43 +02:00
|
|
|
programs = {
|
|
|
|
bash = {
|
2023-07-01 12:39:48 +02:00
|
|
|
enable = true;
|
2023-07-01 12:12:43 +02:00
|
|
|
enableCompletion = true;
|
2023-09-01 10:22:07 +02:00
|
|
|
initExtra = ''
|
|
|
|
GPG_TTY=$(tty)
|
|
|
|
'';
|
2023-08-22 14:11:46 +02:00
|
|
|
sessionVariables = {
|
|
|
|
# Set the GTK Theme
|
2023-08-31 14:17:58 +02:00
|
|
|
# GTK_THEME = "Gruvbox-Dark-BL";
|
2023-08-22 14:11:46 +02:00
|
|
|
XDG_DATA_HOME = "$HOME/.local/share";
|
2023-09-01 06:07:30 +02:00
|
|
|
# Disable askpass for cli auth:
|
2023-10-16 05:39:13 +02:00
|
|
|
# SSH_ASKPASS = "";
|
2023-08-22 14:11:46 +02:00
|
|
|
};
|
2023-07-07 00:36:51 +02:00
|
|
|
bashrcExtra = ''
|
2023-09-30 07:03:08 +02:00
|
|
|
# Build ISOs/SD Card Images
|
|
|
|
nixos-build-pi-img() {
|
|
|
|
pushd /etc/nixos/git
|
|
|
|
git pull
|
|
|
|
nix build .#imageConfigurations.nixos-rpi4-img
|
|
|
|
popd
|
|
|
|
}
|
2023-12-05 05:31:11 +01:00
|
|
|
nixos-build-linode-img() {
|
|
|
|
pushd /etc/nixos/git
|
|
|
|
git pull
|
|
|
|
nix build .#imageConfigurations.nixos-linode-img
|
2023-12-13 08:58:59 +01:00
|
|
|
cp result/nixos.img.gz ~/nixos-linode-`ddate`-`git rev-parse HEAD | cut -b 1-7`.img.gz
|
|
|
|
rm -f result
|
2023-12-05 05:31:11 +01:00
|
|
|
popd
|
|
|
|
}
|
2023-09-30 07:03:08 +02:00
|
|
|
nixos-build-console() {
|
|
|
|
pushd /etc/nixos/git
|
|
|
|
git pull
|
|
|
|
nix build .#imageConfigurations.nixos-iso-console
|
|
|
|
cp result/iso/nixos.iso ~/nixos-console-`ddate`-`git rev-parse HEAD | cut -b 1-7`.iso
|
|
|
|
rm -f result
|
|
|
|
popd
|
|
|
|
}
|
2023-09-30 07:08:43 +02:00
|
|
|
nixos-build-desktop() {
|
|
|
|
pushd /etc/nixos/git
|
|
|
|
git pull
|
|
|
|
nix build .#imageConfigurations.nixos-iso-desktop
|
|
|
|
cp result/iso/nixos.iso ~/nixos-desktop-`ddate`-`git rev-parse HEAD | cut -b 1-7`.iso
|
|
|
|
rm -f result
|
|
|
|
popd
|
|
|
|
}
|
2023-09-30 07:03:08 +02:00
|
|
|
|
|
|
|
# NixOS Related
|
2023-07-07 00:33:18 +02:00
|
|
|
nix-clean-all() {
|
2023-08-23 15:14:35 +02:00
|
|
|
sudo nix-env -u --always
|
|
|
|
sudo nix-collect-garbage -d
|
2023-07-07 00:33:18 +02:00
|
|
|
}
|
2023-09-30 07:03:08 +02:00
|
|
|
|
|
|
|
# Update SOPS Secrets
|
2023-09-23 02:19:07 +02:00
|
|
|
install-secrets() {
|
|
|
|
pushd /etc/nixos/git
|
|
|
|
nix develop -c update-repo
|
|
|
|
popd
|
|
|
|
}
|
|
|
|
update-repo() {
|
|
|
|
for i in $(ls secrets); do
|
2023-09-23 02:21:44 +02:00
|
|
|
echo "Updateing secrets/$i"
|
2023-09-23 02:19:07 +02:00
|
|
|
sops updatekeys secrets/$i -y
|
|
|
|
done
|
|
|
|
}
|
2023-07-07 00:33:18 +02:00
|
|
|
'';
|
2023-07-01 12:12:43 +02:00
|
|
|
shellAliases = {
|
2023-07-12 05:54:40 +02:00
|
|
|
# nVidia prime selector alias:
|
2023-07-12 05:55:20 +02:00
|
|
|
prime-select = "nvidia-offload";
|
2023-07-12 05:54:40 +02:00
|
|
|
|
2023-08-25 14:27:31 +02:00
|
|
|
# Don't use X to open emacs
|
2023-08-25 14:29:57 +02:00
|
|
|
emacs = "emacs -nw";
|
2023-08-25 14:27:31 +02:00
|
|
|
|
2023-07-01 13:14:29 +02:00
|
|
|
# docker
|
2023-09-01 10:22:07 +02:00
|
|
|
d = "docker";
|
2023-07-01 12:12:43 +02:00
|
|
|
dc = "docker-compose";
|
|
|
|
de = "docker exec -it";
|
2023-07-01 13:14:29 +02:00
|
|
|
|
|
|
|
# bash / system
|
2023-09-28 13:05:34 +02:00
|
|
|
ls = "exa";
|
|
|
|
cp = "rsync -avr";
|
|
|
|
ll = "exa -lah";
|
|
|
|
rm = "rm -i";
|
|
|
|
df = "duf";
|
|
|
|
cat = "bat";
|
2023-07-01 13:14:29 +02:00
|
|
|
|
|
|
|
# git
|
2023-11-21 12:50:22 +01:00
|
|
|
g = "git";
|
2023-09-01 10:22:07 +02:00
|
|
|
ga = "git add -A";
|
|
|
|
gb = "git branch";
|
|
|
|
gc = "git commit";
|
2023-07-01 12:12:43 +02:00
|
|
|
gca = "git commit -a";
|
|
|
|
gco = "git checkout";
|
2023-09-01 10:22:07 +02:00
|
|
|
gd = "git diff";
|
|
|
|
gp = "git pull --prune";
|
2023-07-01 12:12:43 +02:00
|
|
|
gpu = "git push origin HEAD";
|
2023-09-01 10:22:07 +02:00
|
|
|
gs = "git status -sb";
|
2023-07-01 13:14:29 +02:00
|
|
|
|
|
|
|
# time / date
|
2023-07-01 12:12:43 +02:00
|
|
|
tdate = "date +%Y.%m.%d..%H.%M";
|
|
|
|
ttime = "date +%H.%M";
|
2023-07-01 13:14:29 +02:00
|
|
|
ddate = "date +%Y.%m.%d";
|
2023-09-01 10:22:07 +02:00
|
|
|
dday = "date +%A";
|
2023-07-01 13:42:01 +02:00
|
|
|
|
2023-07-01 13:14:29 +02:00
|
|
|
# nixos-rebuild
|
2023-09-20 11:52:00 +02:00
|
|
|
ns = "nix shell";
|
2023-09-01 10:22:07 +02:00
|
|
|
nr = "sudo nixos-rebuild";
|
2023-08-23 15:14:35 +02:00
|
|
|
nrs = "sudo nixos-rebuild --upgrade switch";
|
|
|
|
nrt = "sudo nixos-rebuild test";
|
|
|
|
nrb = "sudo nixos-rebuild build";
|
2023-08-23 08:09:52 +02:00
|
|
|
|
|
|
|
# Rebuild everything
|
2023-08-23 15:46:54 +02:00
|
|
|
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";
|
2023-12-10 05:54:39 +01:00
|
|
|
rebuild-all = "rebuild-host && rebuild-home";
|
2023-11-21 06:37:16 +01:00
|
|
|
rebuild-host-remote = "git -C /etc/nixos/git pull && sudo nixos-rebuild switch --flake /etc/nixos/git -j0";
|
2023-11-21 06:38:39 +01:00
|
|
|
rebuild-home-remote = "git -C /etc/nixos/git pull && home-manager switch -b backup --flake /etc/nixos/git --max-jobs 0";
|
2023-12-10 05:54:39 +01:00
|
|
|
rebuild-all-remote = "rebuild-host-remote && rebuild-home-remote";
|
2023-07-01 12:12:43 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2023-08-26 12:56:27 +02:00
|
|
|
}
|