mirror of
https://gitlab.com/upRootNutrition/dotfiles.git
synced 2025-12-06 21:17:14 -06:00
77 lines
1.7 KiB
Nix
Executable file
77 lines
1.7 KiB
Nix
Executable file
{
|
|
flake,
|
|
config,
|
|
lib,
|
|
...
|
|
}:
|
|
|
|
let
|
|
inherit (flake.config.machines) devices;
|
|
inherit (flake.config.services) instances;
|
|
|
|
mars = devices.mars;
|
|
deimos = devices.deimos;
|
|
ceres = devices.ceres;
|
|
hostname = config.networking.hostName;
|
|
deviceLogic = if hostname == mars.name then deimos else mars;
|
|
|
|
vpnServers = [
|
|
"CA363"
|
|
"CA220"
|
|
"CA358"
|
|
"CA627"
|
|
];
|
|
|
|
vpnCommands = lib.concatStrings (
|
|
lib.imap0 (i: server: ''
|
|
vpn${toString i}:
|
|
sudo systemctl start wg-quick-Proton-${server}.service
|
|
|
|
'') vpnServers
|
|
);
|
|
in
|
|
{
|
|
text =
|
|
let
|
|
lamdaIP = "192.168.50.131";
|
|
in
|
|
''
|
|
rebuildBoot:
|
|
nixos-rebuild boot --sudo --flake ~/projects/dotfiles#${hostname} --show-trace
|
|
|
|
rebuild:
|
|
nixos-rebuild switch --sudo --flake ~/projects/dotfiles#${hostname} --show-trace
|
|
|
|
rebuild-server:
|
|
nixos-rebuild switch --flake ~/projects/dotfiles#${ceres.name} --target-host ${ceres.ip.address0} --sudo --ask-sudo-password
|
|
|
|
rebuild-lamda:
|
|
nixos-rebuild switch --flake ~/projects/lamdagibson#lamdagibson --target-host denise@${lamdaIP} --sudo --ask-sudo-password
|
|
|
|
update:
|
|
nix flake update --flake ~/projects/dotfiles
|
|
|
|
remove-redundant:
|
|
ls **/*.hs | each { |file| hlint --refactor --refactor-options="--inplace" $file.name }
|
|
|
|
remove-imports:
|
|
ls **/*.hs | each { |file| ormolu --mode inplace $file.name }
|
|
|
|
server:
|
|
ssh ${ceres.ip.address0}
|
|
|
|
lamda:
|
|
ssh denise@${lamdaIP}
|
|
|
|
serverRemote:
|
|
ssh ${instances.web.remotehost.address0}
|
|
|
|
${deviceLogic.name}:
|
|
ssh ${deviceLogic.ip.address0}
|
|
|
|
vpnoff:
|
|
sudo systemctl stop wg-quick-Proton-*.service
|
|
|
|
${vpnCommands}
|
|
'';
|
|
}
|