Add noita-helper script
This commit is contained in:
		| @@ -1,6 +1,9 @@ | |||||||
| { pkgs, config, ... }: | { pkgs, config, ... }: | ||||||
| { | { | ||||||
|   imports = [ ./lockhelper.nix ]; |   imports = [ | ||||||
|  |     ./lockhelper.nix | ||||||
|  |     ./noita-helper.nix | ||||||
|  |   ]; | ||||||
|   home.file.".local/bin/hl-no-opacity" = { |   home.file.".local/bin/hl-no-opacity" = { | ||||||
|     source = ./hl-no-opacity.sh; |     source = ./hl-no-opacity.sh; | ||||||
|     executable = true; |     executable = true; | ||||||
|   | |||||||
							
								
								
									
										14
									
								
								home/scripts/noita-helper.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								home/scripts/noita-helper.nix
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,14 @@ | |||||||
|  | { pkgs, ... }: | ||||||
|  | let | ||||||
|  |   noita-helper = pkgs.writeShellApplication { | ||||||
|  |     name = "noita-helper"; | ||||||
|  |     runtimeInputs = with pkgs; [ | ||||||
|  |       grim | ||||||
|  |       jq | ||||||
|  |     ]; | ||||||
|  |     text = (builtins.readFile ./noita-helper.sh); | ||||||
|  |   }; | ||||||
|  | in | ||||||
|  | { | ||||||
|  |   home.packages = [ noita-helper ]; | ||||||
|  | } | ||||||
							
								
								
									
										29
									
								
								home/scripts/noita-helper.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								home/scripts/noita-helper.sh
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,29 @@ | |||||||
|  | #!/usr/bin/env bash | ||||||
|  |  | ||||||
|  | SAVE_DIR="/home/torjus/.local/share/Steam/steamapps/compatdata/881100/pfx/drive_c/users/steamuser/AppData/LocalLow/Nolla_Games_Noita" | ||||||
|  |  | ||||||
|  | RESTIC_REPOSITORY="/home/$(whoami)/tmp/noita-backup" | ||||||
|  | export RESTIC_REPOSITORY | ||||||
|  | export RESTIC_PASSWORD="noita" | ||||||
|  |  | ||||||
|  | echo "Doing initial backup" | ||||||
|  | restic backup -q "$SAVE_DIR" | ||||||
|  | echo "Backup done" | ||||||
|  |  | ||||||
|  | echo "Mounting tmpfs for save folder..." | ||||||
|  | sudo mount -o size=2G -t tmpfs none "$SAVE_DIR" | ||||||
|  |  | ||||||
|  | echo "Restoring initial backup..." | ||||||
|  | restic restore "latest:$SAVE_DIR" --target "$SAVE_DIR" | ||||||
|  |  | ||||||
|  | echo "Ready to play Noita!" | ||||||
|  | echo "Remember to unmount the tmpfs after playing:" | ||||||
|  | echo "sudo umount $SAVE_DIR" | ||||||
|  | echo "restic restore latest:$SAVE_DIR --target $SAVE_DIR" | ||||||
|  |  | ||||||
|  | while true | ||||||
|  | do | ||||||
|  |     restic backup -q "$SAVE_DIR" | ||||||
|  |     echo "Periodic backup done..." | ||||||
|  |     sleep 30m | ||||||
|  | done | ||||||
		Reference in New Issue
	
	Block a user