mirror of
https://github.com/sadan4/dotfiles.git
synced 2025-06-16 17:27:00 -04:00
pray
This commit is contained in:
parent
59ee516926
commit
5a3af882ec
61 changed files with 705 additions and 562 deletions
8
common/users/homeModules/scripts/copy.sh
Normal file
8
common/users/homeModules/scripts/copy.sh
Normal file
|
@ -0,0 +1,8 @@
|
|||
command -v xsel > /dev/null
|
||||
if [[ $? -eq 0 ]]; then
|
||||
xsel -ib $@ && exit 0
|
||||
fi
|
||||
command -v wslclip > /dev/null
|
||||
if [[ $? -eq 0 ]]; then
|
||||
wslclip $@ && exit 0
|
||||
fi
|
62
common/users/homeModules/scripts/default.nix
Normal file
62
common/users/homeModules/scripts/default.nix
Normal file
|
@ -0,0 +1,62 @@
|
|||
{pkgs, lib, inputs, ...}:
|
||||
let
|
||||
cpkg = import ../../../customPackages { inherit pkgs inputs; };
|
||||
# https://discourse.nixos.org/t/how-to-create-a-script-with-dependencies/7970/6
|
||||
mkScript = { name, version ? "0.0.1", file, env ? [ ] }:
|
||||
pkgs.writeTextFile {
|
||||
name = "${name}-${version}";
|
||||
executable = true;
|
||||
destination = "/bin/${name}";
|
||||
text = ''
|
||||
for i in ${lib.concatStringsSep " " env}; do
|
||||
export PATH="$i/bin:$PATH"
|
||||
done
|
||||
|
||||
exec ${bash}/bin/bash ${file} $@
|
||||
'';
|
||||
};
|
||||
in
|
||||
{
|
||||
home = {
|
||||
packages = with pkgs; [
|
||||
# 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;
|
||||
env = [git];
|
||||
})
|
||||
(mkScript {
|
||||
name = "git_fetchAll";
|
||||
file = ./git_fetchAll.sh;
|
||||
env = [git];
|
||||
})
|
||||
(mkScript {
|
||||
name = "install_eslint";
|
||||
file = ./install_eslint.sh;
|
||||
})
|
||||
(mkScript {
|
||||
name = "math";
|
||||
file = ./math.sh;
|
||||
env = [python3];
|
||||
})
|
||||
(mkScript {
|
||||
name = "hashi18n";
|
||||
file = ./hashi18n.sh;
|
||||
})
|
||||
];
|
||||
file = {
|
||||
scripts = {
|
||||
source = "${cpkg.scripts}";
|
||||
target = ".scripts";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
3
common/users/homeModules/scripts/git_fetchAll.sh
Normal file
3
common/users/homeModules/scripts/git_fetchAll.sh
Normal file
|
@ -0,0 +1,3 @@
|
|||
git branch -r | grep -v '\->' | sed "s,\x1B\[[0-9;]*[a-zA-Z],,g" | while read remote; do git branch --track "${remote#origin/}" "$remote"; done
|
||||
git fetch --all
|
||||
git pull --all
|
1
common/users/homeModules/scripts/hashi18n.sh
Normal file
1
common/users/homeModules/scripts/hashi18n.sh
Normal file
|
@ -0,0 +1 @@
|
|||
xsel -ob | node $HOME/.scripts/hash.js | tr -d '\n' | xsel -ib
|
12
common/users/homeModules/scripts/http2ssh.sh
Normal file
12
common/users/homeModules/scripts/http2ssh.sh
Normal file
|
@ -0,0 +1,12 @@
|
|||
set -eo pipefail
|
||||
|
||||
if [[ -z $1 ]]; then
|
||||
echo "You need to provide a remote name";
|
||||
echo "Avilable remotes";
|
||||
git remote -v;
|
||||
exit 1;
|
||||
fi
|
||||
URL=$(git remote get-url $1);
|
||||
URL=${URL/https:\/\//git@};
|
||||
URL=${URL/\//:};
|
||||
git remote set-url $1 $URL;
|
10
common/users/homeModules/scripts/install_eslint.sh
Normal file
10
common/users/homeModules/scripts/install_eslint.sh
Normal file
|
@ -0,0 +1,10 @@
|
|||
set -x
|
||||
cp $HOME/.config/.eslintrc.json .
|
||||
pkgs=("@stylistic/eslint-plugin" "@typescript-eslint/eslint-plugin")
|
||||
if [[ -z $1 ]]; then
|
||||
echo please specify npm, pnpm, or yarn
|
||||
exit 1
|
||||
fi
|
||||
for i in "${pkgs[@]}"; do
|
||||
`$1 i -D $i`
|
||||
done
|
2
common/users/homeModules/scripts/math.sh
Normal file
2
common/users/homeModules/scripts/math.sh
Normal file
|
@ -0,0 +1,2 @@
|
|||
set -e
|
||||
python3 -c "print($*)"
|
8
common/users/homeModules/scripts/paste.sh
Normal file
8
common/users/homeModules/scripts/paste.sh
Normal file
|
@ -0,0 +1,8 @@
|
|||
command -v xsel > /dev/null
|
||||
if [[ $? -eq 0 ]]; then
|
||||
xsel -ob && exit 0
|
||||
fi
|
||||
command -v wslclip > /dev/null
|
||||
if [[ $? -eq 0 ]]; then
|
||||
wslclip -g && exit 0
|
||||
fi
|
Loading…
Add table
Add a link
Reference in a new issue