a bunch of random changes again

This commit is contained in:
Sebastian Moser
2024-01-16 09:03:26 +01:00
parent 6c72ddc81d
commit 22d3e2bd96
96 changed files with 1878 additions and 476 deletions

View File

@@ -5,7 +5,8 @@
build_from_github(){
export out_path=$(nix build --refresh "github:c2vi/nixos#nixosConfigurations.$host.config.system.build.toplevel" --impure --no-link --print-out-paths $args_to_pass)
export NIXPKGS_ALLOW_UNFREE=1
export out_path=$(nix build --refresh "github:c2vi/nixos#nixosConfigurations.$host.config.system.build.toplevel" --impure --no-link --print-out-paths "${args_to_pass[@]}")
if [[ "$out_path" == "" ]]
then
@@ -21,7 +22,8 @@ build_from_github(){
}
build_from_local(){
export out_path=$(sudo nix build "$HOME/work/config#nixosConfigurations.$host.config.system.build.toplevel" --impure --no-link --print-out-paths $args_to_pass)
export NIXPKGS_ALLOW_UNFREE=1
export out_path=$(nix build "$HOME/work/config#nixosConfigurations.$host.config.system.build.toplevel" --impure --no-link --print-out-paths "${args_to_pass[@]}")
if [[ "$out_path" == "" ]]
then
@@ -42,13 +44,20 @@ do_switch(){
[[ "$boot" == "false" ]] && sudo $out_path/bin/switch-to-configuration switch
[[ "$boot" == "true" ]] && sudo $out_path/bin/switch-to-configuration boot
else
nix path-info $out_path -r | xargs sudo nix store sign -k ~/.mysecrets/nix-private-key
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
[[ "$boot" == "false" ]] && ssh $host "sudo $out_path/bin/switch-to-configuration switch"
[[ "$boot" == "true" ]] && ssh $host "sudo $out_path/bin/switch-to-configuration boot"
fi
}
function test(){
for arg in "$@";
do
echo got: $arg
done
}
# main
@@ -63,10 +72,18 @@ while getopts ':gbh:' flag; do
h) host="${OPTARG}";;
b) boot=true;;
g) use_github=true;;
*) break;; # makes it so, that at the first unknown option we start passing the rest of the arguments to the nix build command....
*) 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
# mahem with correctly passing args to the nix build command
#args_to_pass=$(for arg in "${args_to_pass[@]}"; do echo -en " \\\"$arg\\\""; done)
#for arg in "${args_to_pass[@]}"; do echo loop: "$arg"; done
#echo hiii: $args_to_pass
#test "${args_to_pass[@]}"
#exit
if [[ "$use_github" == "true" ]]
then
echo rebuild from github

View File

@@ -2,7 +2,19 @@
if [ "$1" == "sync-school" ]
then
~/work/config/rclone/sync-school.sh
~/work/config/scripts/sync-school.sh
elif [ "$1" == "rm-last-char" ]
then
truncate -s-1 $2
# total rubish
# cat $1 | xxd -ps | sed '$ s/.$//' $2 | xxd -r -ps > /tmp/1234; mv /tmp/1234 $2
elif [ "$1" == "rm-tab-cur" ]
then
ssh tab "rm /sdcard/note/CUR/*"
elif [ "$1" == "mnt-wechner" ]
@@ -29,7 +41,7 @@ ping orf.at
elif [ "$1" == "mnt-files-local" ]
then
sudo mount -t cifs //192.168.1.2/files /home/me/files -o x-gvfs-hide,rw,defaults,nofail,credentials=/home/me/.mysecrets/rpi-share-files,uid=1000,iocharset=utf8,gid=1000
sudo mount -t cifs //192.168.1.2/files /home/me/files -o x-gvfs-hide,rw,defaults,nofail,credentials=/home/me/work/here/secrets/rpi-share-files,uid=1000,iocharset=utf8,gid=1000

View File

@@ -1,3 +1,3 @@
#!/bin/bash
~/work/config/scripts/win -o main-win 192.168.122.5 sebastian $@
~/work/config/scripts/win -o main-win 192.168.122.190 sebastian $@