fix scripts

This commit is contained in:
sadan 2025-06-24 14:02:20 -04:00
parent 6b79323a65
commit 47cf925a08
No known key found for this signature in database
3 changed files with 41 additions and 24 deletions

View file

@ -1,8 +1,13 @@
command -v xsel > /dev/null command -v xsel > /dev/null
if [[ $? -eq 0 ]]; then if [[ $? -eq 0 ]]; then
xsel -ib $@ && exit 0 xsel -ib $@ && exit 0
exit 0
fi fi
command -v wslclip > /dev/null command -v wslclip > /dev/null
if [[ $? -eq 0 ]]; then if [[ $? -eq 0 ]]; then
wslclip $@ && exit 0 wslclip $@ && exit 0
fi exit 0
fi
echo "failed to find clipboard command. install xsel or wslclip"
exit 1

View file

@ -14,19 +14,35 @@ let
file, file,
env ? [ ], env ? [ ],
}: }:
let
text = ''
export PATH="${builtins.trace (lib.makeSearchPath "bin" env) (lib.makeSearchPath "bin" env)}";
echo bar;
exec ${pkgs.bash}/bin/bash ${file} $@
'';
in
pkgs.writeTextFile { pkgs.writeTextFile {
name = "${name}-${version}"; name = "${name}-${version}";
executable = true; executable = true;
destination = "/bin/${name}"; destination = "/bin/${name}";
text = '' text = builtins.trace text text;
export PATH=""
for i in ${lib.concatStringsSep " " env}; do
export PATH="$i/bin:$PATH"
done
exec ${pkgs.bash}/bin/bash ${file} $@
'';
}; };
paste = mkScript {
name = "paste";
file = ./paste.sh;
env = with pkgs; [
coreutils
xsel
];
};
copy = mkScript {
name = "copy";
file = ./copy.sh;
env = with pkgs; [
xsel
];
};
in in
{ {
imports = [ imports = [
@ -34,15 +50,9 @@ in
]; ];
home = { home = {
packages = [ packages = [
paste
copy
# env for clipboard command will be required by their respective environemnts # env for clipboard command will be required by their respective environemnts
(mkScript {
name = "paste";
file = ./paste.sh;
})
(mkScript {
name = "copy";
file = ./copy.sh;
})
(mkScript { (mkScript {
name = "http2ssh"; name = "http2ssh";
file = ./http2ssh.sh; file = ./http2ssh.sh;
@ -95,12 +105,8 @@ in
}; };
}; };
shellAliases = { shellAliases = {
paste = "${ # needed because of coreutils paste
(mkScript { paste = "${paste}/bin/paste";
name = "paste";
file = ./paste.sh;
})
}/bin/paste";
p = "${builtins.readFile ./projectPicker.sh}"; p = "${builtins.readFile ./projectPicker.sh}";
}; };
}; };

View file

@ -1,8 +1,14 @@
echo PATH: $PATH 2>&1
command -v xsel > /dev/null command -v xsel > /dev/null
if [[ $? -eq 0 ]]; then if [[ $? -eq 0 ]]; then
xsel -ob && exit 0 xsel -ob && exit 0
exit 0
fi fi
command -v wslclip > /dev/null command -v wslclip > /dev/null
if [[ $? -eq 0 ]]; then if [[ $? -eq 0 ]]; then
wslclip -g && exit 0 wslclip -g && exit 0
fi exit 0
fi
echo "failed to find clipboard command. install xsel or wslclip"
exit 1