diff --git a/common/users/homeModules/scripts/copy.sh b/common/users/homeModules/scripts/copy.sh index 59429c0..8b15a1c 100644 --- a/common/users/homeModules/scripts/copy.sh +++ b/common/users/homeModules/scripts/copy.sh @@ -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 \ No newline at end of file + exit 0 +fi + +echo "failed to find clipboard command. install xsel or wslclip" +exit 1 diff --git a/common/users/homeModules/scripts/default.nix b/common/users/homeModules/scripts/default.nix index ecdc17f..fc7e02f 100644 --- a/common/users/homeModules/scripts/default.nix +++ b/common/users/homeModules/scripts/default.nix @@ -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}"; }; }; diff --git a/common/users/homeModules/scripts/paste.sh b/common/users/homeModules/scripts/paste.sh index 0c68c24..5686222 100644 --- a/common/users/homeModules/scripts/paste.sh +++ b/common/users/homeModules/scripts/paste.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 \ No newline at end of file + exit 0 +fi + +echo "failed to find clipboard command. install xsel or wslclip" +exit 1