mirror of
https://github.com/sadan4/dotfiles.git
synced 2025-06-28 06:54:22 -04:00
fix scripts
This commit is contained in:
parent
6b79323a65
commit
47cf925a08
3 changed files with 41 additions and 24 deletions
|
@ -1,8 +1,13 @@
|
|||
command -v xsel > /dev/null
|
||||
if [[ $? -eq 0 ]]; then
|
||||
xsel -ib $@ && exit 0
|
||||
exit 0
|
||||
fi
|
||||
command -v wslclip > /dev/null
|
||||
if [[ $? -eq 0 ]]; then
|
||||
wslclip $@ && exit 0
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "failed to find clipboard command. install xsel or wslclip"
|
||||
exit 1
|
||||
|
|
|
@ -14,19 +14,35 @@ let
|
|||
file,
|
||||
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 {
|
||||
name = "${name}-${version}";
|
||||
executable = true;
|
||||
destination = "/bin/${name}";
|
||||
text = ''
|
||||
export PATH=""
|
||||
for i in ${lib.concatStringsSep " " env}; do
|
||||
export PATH="$i/bin:$PATH"
|
||||
done
|
||||
|
||||
exec ${pkgs.bash}/bin/bash ${file} $@
|
||||
'';
|
||||
text = builtins.trace text text;
|
||||
};
|
||||
paste = mkScript {
|
||||
name = "paste";
|
||||
file = ./paste.sh;
|
||||
env = with pkgs; [
|
||||
coreutils
|
||||
xsel
|
||||
];
|
||||
};
|
||||
copy = mkScript {
|
||||
name = "copy";
|
||||
file = ./copy.sh;
|
||||
env = with pkgs; [
|
||||
xsel
|
||||
];
|
||||
};
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
|
@ -34,15 +50,9 @@ in
|
|||
];
|
||||
home = {
|
||||
packages = [
|
||||
paste
|
||||
copy
|
||||
# env for clipboard command will be required by their respective environemnts
|
||||
(mkScript {
|
||||
name = "paste";
|
||||
file = ./paste.sh;
|
||||
})
|
||||
(mkScript {
|
||||
name = "copy";
|
||||
file = ./copy.sh;
|
||||
})
|
||||
(mkScript {
|
||||
name = "http2ssh";
|
||||
file = ./http2ssh.sh;
|
||||
|
@ -95,12 +105,8 @@ in
|
|||
};
|
||||
};
|
||||
shellAliases = {
|
||||
paste = "${
|
||||
(mkScript {
|
||||
name = "paste";
|
||||
file = ./paste.sh;
|
||||
})
|
||||
}/bin/paste";
|
||||
# needed because of coreutils paste
|
||||
paste = "${paste}/bin/paste";
|
||||
p = "${builtins.readFile ./projectPicker.sh}";
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,8 +1,14 @@
|
|||
echo PATH: $PATH 2>&1
|
||||
command -v xsel > /dev/null
|
||||
if [[ $? -eq 0 ]]; then
|
||||
xsel -ob && exit 0
|
||||
exit 0
|
||||
fi
|
||||
command -v wslclip > /dev/null
|
||||
if [[ $? -eq 0 ]]; then
|
||||
wslclip -g && exit 0
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "failed to find clipboard command. install xsel or wslclip"
|
||||
exit 1
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue