refactor: use `icat` from @nekowinston's nur

main
sgoudham 1 year ago
parent 029fd6fc08
commit b64e6f400c
Signed by: hammy
GPG Key ID: 44E818FD5457EEA4

@ -28,7 +28,10 @@
"inputs": { "inputs": {
"flake-compat": "flake-compat_2", "flake-compat": "flake-compat_2",
"flake-utils": "flake-utils_3", "flake-utils": "flake-utils_3",
"nixpkgs": "nixpkgs_2", "nixpkgs": [
"nekowinston-nur",
"nixpkgs"
],
"rust-overlay": "rust-overlay_3" "rust-overlay": "rust-overlay_3"
}, },
"locked": { "locked": {
@ -94,6 +97,22 @@
"type": "github" "type": "github"
} }
}, },
"flake-compat_4": {
"flake": false,
"locked": {
"lastModified": 1673956053,
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-parts": { "flake-parts": {
"inputs": { "inputs": {
"nixpkgs-lib": [ "nixpkgs-lib": [
@ -210,6 +229,24 @@
"inputs": { "inputs": {
"systems": "systems_3" "systems": "systems_3"
}, },
"locked": {
"lastModified": 1687709756,
"narHash": "sha256-Y5wKlQSkgEK2weWdOu4J3riRd+kV/VCgHsqLNTTWQ/0=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "dbabf0ca0c0c4bce6ea5eaf65af5cb694d2082c7",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_5": {
"inputs": {
"systems": "systems_4"
},
"locked": { "locked": {
"lastModified": 1685518550, "lastModified": 1685518550,
"narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=", "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=",
@ -266,7 +303,7 @@
"inputs": { "inputs": {
"flake-parts": "flake-parts_3", "flake-parts": "flake-parts_3",
"haskell-flake": "haskell-flake", "haskell-flake": "haskell-flake",
"nixpkgs": "nixpkgs_4" "nixpkgs": "nixpkgs_3"
}, },
"locked": { "locked": {
"lastModified": 1686721748, "lastModified": 1686721748,
@ -324,18 +361,46 @@
"type": "github" "type": "github"
} }
}, },
"icat": {
"inputs": {
"flake-utils": [
"nekowinston-nur",
"flake-utils"
],
"nixpkgs": [
"nekowinston-nur",
"nixpkgs"
]
},
"locked": {
"lastModified": 1688782189,
"narHash": "sha256-qQaXKPV5wpRqanrc7KNWu7Nz9N45s/Isd6Rd1QJsXUg=",
"owner": "nekowinston",
"repo": "icat",
"rev": "04edf68ace451a5d9a738fc1df6fe4dae64ed85d",
"type": "github"
},
"original": {
"owner": "nekowinston",
"repo": "icat",
"type": "github"
}
},
"nekowinston-nur": { "nekowinston-nur": {
"inputs": { "inputs": {
"crane": "crane_2", "crane": "crane_2",
"nixpkgs": "nixpkgs_3", "flake-compat": "flake-compat_3",
"flake-utils": "flake-utils_4",
"icat": "icat",
"nixpkgs": "nixpkgs_2",
"wezterm-src": "wezterm-src" "wezterm-src": "wezterm-src"
}, },
"locked": { "locked": {
"lastModified": 1685775911, "lastModified": 1688843383,
"narHash": "sha256-bXuKB89qJnUbE6h0Q677UC6aKh+9Yi3tGSbqqO0cs3A=", "narHash": "sha256-S6dV5SEbo6mFWvhjDMOc+wZ5bql7JmAfViowsb5dWYQ=",
"owner": "nekowinston", "owner": "nekowinston",
"repo": "nur", "repo": "nur",
"rev": "8912d039043c039ba0bb5a1a7ff51c2efee57202", "rev": "a40d451986379006e3a1d6f96964cae41fb5db0b",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -346,7 +411,7 @@
}, },
"neovim-flake": { "neovim-flake": {
"inputs": { "inputs": {
"flake-utils": "flake-utils_4", "flake-utils": "flake-utils_5",
"nixpkgs": [ "nixpkgs": [
"neovim-nightly-overlay", "neovim-nightly-overlay",
"nixpkgs" "nixpkgs"
@ -370,11 +435,11 @@
}, },
"neovim-nightly-overlay": { "neovim-nightly-overlay": {
"inputs": { "inputs": {
"flake-compat": "flake-compat_3", "flake-compat": "flake-compat_4",
"flake-parts": "flake-parts", "flake-parts": "flake-parts",
"hercules-ci-effects": "hercules-ci-effects", "hercules-ci-effects": "hercules-ci-effects",
"neovim-flake": "neovim-flake", "neovim-flake": "neovim-flake",
"nixpkgs": "nixpkgs_5" "nixpkgs": "nixpkgs_4"
}, },
"locked": { "locked": {
"lastModified": 1688601949, "lastModified": 1688601949,
@ -446,11 +511,11 @@
}, },
"nixpkgs_2": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1676426280, "lastModified": 1688646010,
"narHash": "sha256-7DltKPrvCP0A9Iemv2ts1vnBYn5xQKScK/sb1VALlao=", "narHash": "sha256-kCeza5eKI2NEi8k0EoeZfv3lN1r1Vwx+L/VA6I8tmG4=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "6d33e5e14fd12f99ba621683ae90cebadda753ca", "rev": "5daaa32204e9c46b05cd709218b7ba733d07e80c",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -461,22 +526,6 @@
} }
}, },
"nixpkgs_3": { "nixpkgs_3": {
"locked": {
"lastModified": 1685677062,
"narHash": "sha256-zoHF7+HNwNwne2XEomphbdc4Y8tdWT16EUxUTXpOKpQ=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "95be94370d09f97f6af6a1df1eb9649b5260724e",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_4": {
"locked": { "locked": {
"lastModified": 1686501370, "lastModified": 1686501370,
"narHash": "sha256-G0WuM9fqTPRc2URKP9Lgi5nhZMqsfHGrdEbrLvAPJcg=", "narHash": "sha256-G0WuM9fqTPRc2URKP9Lgi5nhZMqsfHGrdEbrLvAPJcg=",
@ -492,7 +541,7 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_5": { "nixpkgs_4": {
"locked": { "locked": {
"lastModified": 1688556768, "lastModified": 1688556768,
"narHash": "sha256-mhd6g0iJGjEfOr3+6mZZOclUveeNr64OwxdbNtLc8mY=", "narHash": "sha256-mhd6g0iJGjEfOr3+6mZZOclUveeNr64OwxdbNtLc8mY=",
@ -508,7 +557,7 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_6": { "nixpkgs_5": {
"locked": { "locked": {
"lastModified": 1687288566, "lastModified": 1687288566,
"narHash": "sha256-VckkiJ88Gzdc2cstm0z5eFcrHbvkm4VjxavHBGssvZI=", "narHash": "sha256-VckkiJ88Gzdc2cstm0z5eFcrHbvkm4VjxavHBGssvZI=",
@ -546,7 +595,7 @@
"nekowinston-nur": "nekowinston-nur", "nekowinston-nur": "nekowinston-nur",
"neovim-nightly-overlay": "neovim-nightly-overlay", "neovim-nightly-overlay": "neovim-nightly-overlay",
"nix-index-database": "nix-index-database", "nix-index-database": "nix-index-database",
"nixpkgs": "nixpkgs_6", "nixpkgs": "nixpkgs_5",
"nur": "nur" "nur": "nur"
} }
}, },
@ -674,14 +723,29 @@
"type": "github" "type": "github"
} }
}, },
"systems_4": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"wezterm-src": { "wezterm-src": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1685453249, "lastModified": 1688677653,
"narHash": "sha256-w/iQoWng7nrE+HAg0umpq8RCU0bjw5JogR2HHufspI8=", "narHash": "sha256-mCChFHIQc7EXZPd8VwbwYBTJcGTq5yWfmo0FGmO9pE0=",
"ref": "refs/heads/main", "ref": "refs/heads/main",
"rev": "95e44f2199d9779e353bccf387a1eb2dbaf41f44", "rev": "18e4b9bad14743c96f53ce59b92a5a4bedf506ec",
"revCount": 7255, "revCount": 7277,
"submodules": true, "submodules": true,
"type": "git", "type": "git",
"url": "https://github.com/wez/wezterm" "url": "https://github.com/wez/wezterm"

@ -287,21 +287,7 @@ in {
set fish_cursor_replace_one underscore set fish_cursor_replace_one underscore
set fish_cursor_visual block set fish_cursor_visual block
function pythonEnv --description 'start a nix-shell with the given python packages' --argument pythonVersion
if set -q argv[2]
set argv $argv[2..-1]
end
for el in $argv
set ppkgs $ppkgs "python"$pythonVersion"Packages.$el"
end
nix-shell -p $ppkgs
end
bind -s --user -M insert \e "if commandline -P; commandline -f cancel; else; set fish_bind_mode default; commandline -f repaint-mode; end" bind -s --user -M insert \e "if commandline -P; commandline -f cancel; else; set fish_bind_mode default; commandline -f repaint-mode; end"
# bind -s --user -M insert \t accept-autosuggestion
yes | fish_config theme save "Catppuccin Mocha" yes | fish_config theme save "Catppuccin Mocha"
''; '';
@ -329,7 +315,4 @@ in {
sha256 = "sha256-MlI9Bg4z6uGWnuKQcZoSxPEsat9vfi5O1NkeYFaEb2I="; sha256 = "sha256-MlI9Bg4z6uGWnuKQcZoSxPEsat9vfi5O1NkeYFaEb2I=";
}); });
}; };
xdg.dataFile = {
"scripts" = symlink "home/apps/scripts" {recursive = true;};
};
} }

@ -1,70 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
local MAPPINGS='
video/3gpp,3gp
video/3gpp2,3g2
video/MP2T,mpegts
video/MP2T,mpegtsraw
video/mp4,mp4
video/mpeg,mpeg
video/ogg,ogv
video/quicktime,mov
video/webm,webm
'
# format=$(echo "$MAPPINGS" | grep "$headers" | cut -d "," -f2-)
function icat() {
function display() {
if [[ "$TERM_PROGRAM" == "WezTerm" ]]; then
cat - | wezterm imgcat
elif [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
cat - | $(alias imgcat | cut -d "=" -f2-)
elif [[ "$TERM" = "xterm-kitty" ]]; then
cat - | kitty +kitten icat
else
echo "No image viewer defined for this terminal" && return 1
fi
return 0
}
function displaySVG() {
[[ ! -x "$(command -v convert)" ]] && echo "convert not found, install imagemagick" && return 1
convert -background none -density 192 - png:- | display
}
function displayVID() {
ffmpeg -loglevel fatal -hide_banner -i "$1" -vf scale=720:-1 -r 10 -f image2pipe -vcodec ppm pipe:1 | \
convert -delay 10 -loop 1 - gif:- | \
display
}
if [ ! -t 0 ]; then
input="$(cat - | base64)"
headers="$(echo "$input" | base64 -d | file - --mime-type | cut -d " " -f2-)"
case $headers in
*svg*) echo "$input" | base64 -d | displaySVG ;;
*video*) echo "haven't figured this part out yet" && return 1;;
*image*) echo "$input" | base64 -d | display ;;
*) echo "Unknown file type" && return 1 ;;
esac
elif [[ "$1" == http* ]]; then
case "$(curl -sSLI "$1" | grep -i "^content-type:")" in
*svg*) curl -fsSL "$1" | displaySVG ;;
*video*) echo "haven't figured this part out yet" && return 1;;
*image*) curl -fsSL "$1" | display ;;
*) echo "Unknown file type" && return 1 ;;
esac
else
[[ -z "$1" ]] && echo "Usage: icat <file|url>" && return 1
[[ ! -f "$1" ]] && echo "File not found: $1" && return 1
case "$(file -b --mime-type "$1")" in
*svg*) cat "$1" | displaySVG ;;
*video*) displayVID $1 ;;
*image*) cat "$1" | display ;;
*) echo "Unknown file type" && return 1 ;;
esac
fi
}

@ -34,6 +34,7 @@
fd fd
vivid vivid
git-view git-view
nur.repos.nekowinston.icat
]; ];
home.sessionVariables = { home.sessionVariables = {
TERMINAL = "wezterm-gui"; TERMINAL = "wezterm-gui";

Loading…
Cancel
Save