1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2025-03-05 08:17:01 +00:00

lnl: update functions

This commit is contained in:
Daiderd Jordan 2020-05-30 13:39:28 +02:00
parent 3d20a28b33
commit 6a3564296b
No known key found for this signature in database
GPG key ID: D02435D05B810C96

View file

@ -231,7 +231,7 @@
:u() { :u() {
local exports local exports
exports=$(direnv apply_dump <(nix-shell -E "with import <dotpkgs> {}; mkShell { buildInputs = [ $* ]; }" --run 'direnv dump')) exports=$(direnv apply_dump <(nix-shell -E "with import <nixpkgs> {}; mkShell { buildInputs = [ $* ]; }" --run 'direnv dump'))
eval "$exports" eval "$exports"
name+="''${name:+ }$*" name+="''${name:+ }$*"
@ -241,24 +241,18 @@
z() { z() {
local dir local dir
dir=$(find ~/Code -mindepth 2 -maxdepth 2 | fzf --preview-window right:50% --preview 'git -C {} log --pretty=color --color=always -16') dir=$(find ~/Code -mindepth 2 -maxdepth 2 | fzf --preview-window right:50% --preview 'git -C {} log --pretty=color --color=always -16')
cd "$dir" cd "$dir"
} }
fzf-store() {
find /nix/store -type d -mindepth 1 -maxdepth 1 | fzf -m --preview-window right:50% --preview 'nix-store -q --tree {}'
}
xi() { xi() {
curl -F 'f:1=<-' ix.io curl -F 'f:1=<-' ix.io
} }
mount_ram() {
local dev
if [ -e /Volumes/RAM ]; then
dev=$(diskutil info | awk '/Device Node:/ {print $3}')
umount /Volumes/RAM
hdiutil detach "$dev"
fi
diskutil erasevolume JHFS+ RAM $(hdiutil attach -nomount ram://10248576)
}
ls() { ls() {
${pkgs.coreutils}/bin/ls --color=auto "$@" ${pkgs.coreutils}/bin/ls --color=auto "$@"
} }
@ -275,20 +269,22 @@
${pkgs.darwin.cctools}/bin/otool "$@" ${pkgs.darwin.cctools}/bin/otool "$@"
} }
aarch-build() { vat() {
nix-build --option system aarch64-linux --store ssh-ng://aarch1 "$@" TERM=vt100 nvim -R "$@" "+setl updatetime=0" "+autocmd CursorHold * :q"
} }
arm-build() { nixq() {
nix-build --option system armv7l-linux --store ssh-ng://arm1 "$@" nix eval --json "(
} with builtins;
with import <nixpkgs/lib>;
darwin-build() { let
nix-build --option system x86_64-darwin --store ssh-ng://mac1 "$@" _ = fromJSON (readFile /dev/stdin);
} _0 = head _;
_1 = head _0;
linux-build() { _2 = head _1;
nix-build --option system x86_64-linux --store ssh-ng://nixos1 "$@" in
$*
)"
} }
nix-unpack() { nix-unpack() {
@ -374,6 +370,28 @@
tmux send-keys -t . "$*" Enter tmux send-keys -t . "$*" Enter
fi fi
} }
gh-darwin-debug() {
curl -X POST -fsSL \
-H "Accept: application/vnd.github.everest-preview+json" \
-H "Authorization: token $GITHUB_TOKEN" \
--data '{"event_type": "debug"}' \
https://api.github.com/repos/LnL7/nix-darwin/dispatches
}
pushover() {
local i
"$@"
i=$?
curl -fsSL -XPOST \
--form-string "token=$PUSHOVER_TOKEN" \
--form-string "user=$PUSHOVER_USER" \
--form-string "expire=60" \
--form-string "sound=intermission" \
--form-string "message=$*: completed with status $i" \
https://api.pushover.net/1/messages.json > /dev/null
return "$i"
}
''; '';
programs.zsh.interactiveShellInit = '' programs.zsh.interactiveShellInit = ''