diff --git a/m/hut/configuration.nix b/m/hut/configuration.nix index 3a14eb6..f232df2 100644 --- a/m/hut/configuration.nix +++ b/m/hut/configuration.nix @@ -18,6 +18,7 @@ ./msmtp.nix ./postgresql.nix ./nginx.nix + ./p.nix #./pxe.nix ]; diff --git a/m/hut/p.nix b/m/hut/p.nix new file mode 100644 index 0000000..ae595c2 --- /dev/null +++ b/m/hut/p.nix @@ -0,0 +1,22 @@ +{ pkgs, ... }: +let + p = pkgs.writeShellScriptBin "p" '' + set -e + cd /ceph + pastedir="p/$USER" + mkdir -p "$pastedir" + + if [ -n "$1" ]; then + out="$pastedir/$1" + else + out=$(mktemp "$pastedir/XXXXXXXX.txt") + fi + + cat > "$out" + chmod go+r "$out" + echo "https://jungle.bsc.es/$out" + ''; +in +{ + environment.systemPackages = with pkgs; [ p ]; +}