Add p command to paste files
Reviewed-by: Aleix Boné <abonerib@bsc.es>
This commit is contained in:
		
							parent
							
								
									0824de661d
								
							
						
					
					
						commit
						fb506460ba
					
				| @ -18,6 +18,7 @@ | ||||
|     ./msmtp.nix | ||||
|     ./postgresql.nix | ||||
|     ./nginx.nix | ||||
|     ./p.nix | ||||
|     #./pxe.nix | ||||
|   ]; | ||||
| 
 | ||||
|  | ||||
| @ -55,6 +55,9 @@ in | ||||
|           autoindex on; | ||||
|           absolute_redirect off; | ||||
|         } | ||||
|         location /p/ { | ||||
|           alias /ceph/p/; | ||||
|         } | ||||
|       ''; | ||||
|     }; | ||||
|   }; | ||||
|  | ||||
							
								
								
									
										24
									
								
								m/hut/p.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								m/hut/p.nix
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,24 @@ | ||||
| { pkgs, ... }: | ||||
| let | ||||
|   p = pkgs.writeShellScriptBin "p" '' | ||||
|     set -e | ||||
|     cd /ceph | ||||
|     pastedir="p/$USER" | ||||
|     mkdir -p "$pastedir" | ||||
| 
 | ||||
|     ext="txt" | ||||
| 
 | ||||
|     if [ -n "$1" ]; then | ||||
|       ext="$1" | ||||
|     fi | ||||
| 
 | ||||
|     out=$(mktemp "$pastedir/XXXXXXXX.$ext") | ||||
| 
 | ||||
|     cat > "$out" | ||||
|     chmod go+r "$out" | ||||
|     echo "https://jungle.bsc.es/$out" | ||||
|   ''; | ||||
| in | ||||
| { | ||||
|   environment.systemPackages = with pkgs; [ p ]; | ||||
| } | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user