...
This commit is contained in:
39
mybin/nixre
39
mybin/nixre
@@ -3,6 +3,8 @@
|
||||
# my nixos rebuild script
|
||||
|
||||
|
||||
set -e
|
||||
|
||||
|
||||
build_from_github(){
|
||||
export NIXPKGS_ALLOW_UNFREE=1
|
||||
@@ -38,11 +40,36 @@ build_from_local(){
|
||||
return $build_exit_code
|
||||
}
|
||||
|
||||
build_remote () {
|
||||
|
||||
rsync -r -v $HOME/work/config/* $host:my-nixos-config --exclude=.git --exclude=gitignore
|
||||
|
||||
out_path=$(ssh $host nix build "\$HOME/my-nixos-config#nixosConfigurations.$host.config.system.build.toplevel" --impure --no-link --print-out-paths -v -L "${args_to_pass[@]}")
|
||||
|
||||
if [[ "$out_path" == "" ]]
|
||||
then
|
||||
build_exit_code=1
|
||||
else
|
||||
build_exit_code=0
|
||||
fi
|
||||
|
||||
echo out_path: $out_path
|
||||
echo build_exit_code: $build_exit_code
|
||||
|
||||
return $build_exit_code
|
||||
|
||||
}
|
||||
|
||||
|
||||
do_switch(){
|
||||
if [[ "$host" == "$(hostname)" ]]
|
||||
then
|
||||
[[ "$boot" == "false" ]] && sudo $out_path/bin/switch-to-configuration switch
|
||||
[[ "$boot" == "true" ]] && sudo $out_path/bin/switch-to-configuration boot
|
||||
elif [[ "$build_remote" == "true" ]]
|
||||
then
|
||||
[[ "$boot" == "false" ]] && ssh $host "sudo nixos-rebuild switch --flake \$HOME/my-nixos-config --impure"
|
||||
[[ "$boot" == "true" ]] && ssh $host "sudo nixos-rebuild boot --flake \$HOME/my-nixos-config --impure"
|
||||
else
|
||||
nix path-info $out_path -r | xargs sudo nix store sign -k ~/work/here/secrets/nix-private
|
||||
nix copy --no-check-sigs --no-require-sigs --to ssh-ng://$host $out_path
|
||||
@@ -67,11 +94,12 @@ boot=false
|
||||
use_github=""
|
||||
flag=""
|
||||
|
||||
while getopts ':gbh:' flag; do
|
||||
while getopts ':rgbh:' flag; do
|
||||
case "${flag}" in
|
||||
h) host="${OPTARG}";;
|
||||
b) boot=true;;
|
||||
g) use_github=true;;
|
||||
r) build_remote=true;;
|
||||
*) export args_to_pass=( "${@:OPTIND}" ); break;; # makes it so, that at the first unknown option we start passing the rest of the arguments to the nix build command....
|
||||
esac
|
||||
done
|
||||
@@ -84,10 +112,19 @@ done
|
||||
#exit
|
||||
|
||||
|
||||
if [[ "$host" == "acern" ]] || [[ "$host" == "mosatop" ]]
|
||||
then
|
||||
build_remote=true
|
||||
fi
|
||||
|
||||
|
||||
if [[ "$use_github" == "true" ]]
|
||||
then
|
||||
echo rebuild from github
|
||||
build_from_github && do_switch
|
||||
elif [[ "$build_remote" == "true" ]]
|
||||
then
|
||||
build_remote && do_switch
|
||||
else
|
||||
echo "rebuild from local (~/work/config/)"
|
||||
build_from_local && do_switch
|
||||
|
||||
14
mybin/ru
14
mybin/ru
@@ -27,6 +27,18 @@ then
|
||||
rclone mount --vfs-cache-mode full -vvvv onedrive-school:projekt-autobatterie ~/work/htl/projekt/wechner/mnt
|
||||
|
||||
|
||||
elif [ "$1" == "mnt-host" ]
|
||||
then
|
||||
if [[ "$1" == "-r" ]]
|
||||
then
|
||||
host=$3
|
||||
sshfs $host:/ ~/mnt
|
||||
else
|
||||
host=$2
|
||||
sshfs $host: ~/mnt
|
||||
fi
|
||||
|
||||
|
||||
elif [ "$1" == "mnt-school" ]
|
||||
then
|
||||
rclone mount --vfs-cache-mode full -vvvv onedrive-school: ~/mnt
|
||||
@@ -41,7 +53,7 @@ wstunnel -L 55555:127.0.0.1:49388 ws://sebastian.dns.army:49389
|
||||
|
||||
elif [ "$1" == "speed-test-nixos-iso" ]
|
||||
then
|
||||
wget -O /tmp/speed-test.iso "https://dl.t2sde.org/binary/2022/t2-22.6-x86-64-minimal-desktop-gcc-glibc.iso"
|
||||
wget -O /tmp/speed-test.iso "https://channels.nixos.org/nixos-24.11/latest-nixos-gnome-x86_64-linux.iso"
|
||||
rm /tmp/speed-test.iso
|
||||
|
||||
|
||||
|
||||
1
mybin/waydroid-session-start
Executable file
1
mybin/waydroid-session-start
Executable file
@@ -0,0 +1 @@
|
||||
waydroid session start
|
||||
1
mybin/waydroid-session-stop
Executable file
1
mybin/waydroid-session-stop
Executable file
@@ -0,0 +1 @@
|
||||
waydroid session stop
|
||||
Reference in New Issue
Block a user