mirror of
https://github.com/elkowar/dots-of-war.git
synced 2024-12-25 05:42:22 +00:00
use niv for zsh plugins
This commit is contained in:
parent
101e97c853
commit
de0d8cd9c0
5 changed files with 293 additions and 58 deletions
|
@ -1,4 +1,3 @@
|
||||||
setopt HIST_IGNORE_ALL_DUPS
|
|
||||||
local __bright_cyan="#8ec07c"
|
local __bright_cyan="#8ec07c"
|
||||||
local __bright_white="#ebdbb2"
|
local __bright_white="#ebdbb2"
|
||||||
local __bright_green="#b8bb26"
|
local __bright_green="#b8bb26"
|
||||||
|
|
|
@ -124,7 +124,6 @@ in
|
||||||
compinit
|
compinit
|
||||||
_comp_options+=(globdots)
|
_comp_options+=(globdots)
|
||||||
|
|
||||||
|
|
||||||
# enable cdr command
|
# enable cdr command
|
||||||
autoload -Uz chpwd_recent_dirs cdr add-zsh-hook
|
autoload -Uz chpwd_recent_dirs cdr add-zsh-hook
|
||||||
add-zsh-hook chpwd chpwd_recent_dirs
|
add-zsh-hook chpwd chpwd_recent_dirs
|
||||||
|
@ -142,66 +141,81 @@ in
|
||||||
${builtins.readFile ./prompt.zsh}
|
${builtins.readFile ./prompt.zsh}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
envExtra = ''
|
||||||
|
export GITHUB_TOKEN="fc40b6cb38dd8eb54f90e3e652f14d758f21e24d"
|
||||||
|
|
||||||
plugins = [
|
'';
|
||||||
#{
|
|
||||||
#name = "zsh-completions";
|
|
||||||
#src = pkgs.fetchFromGitHub {
|
|
||||||
#owner = "zsh-users";
|
|
||||||
#repo = "zsh-completions";
|
|
||||||
#rev = "0.32.0";
|
|
||||||
#sha256 = "12l9wrx0aysyj62kgp5limglz0nq73w8c415wcshxnxmhyk6sw6d";
|
|
||||||
#};
|
|
||||||
#}
|
|
||||||
|
|
||||||
|
|
||||||
{
|
plugins =
|
||||||
name = "fzf-tab";
|
let
|
||||||
src = pkgs.fetchFromGitHub {
|
sources = import ./zsh/nix/sources.nix;
|
||||||
owner = "Aloxaf";
|
in
|
||||||
repo = "fzf-tab";
|
[
|
||||||
rev = "d92299baafdf197c93a88e54f9bbc1c8bb31d427";
|
{ name = "fzf-tab"; src = sources.fzf-tab; }
|
||||||
sha256 = "046fbhp5777iwl6n901db84bbmxbjgnh5gv9yqy9x15s8ikagzdl";
|
{ name = "zsh-autosuggestions"; src = sources.zsh-autosuggestions; }
|
||||||
};
|
{ name = "history-substring-search"; src = sources.zsh-history-substring-search; }
|
||||||
}
|
{ name = "zsh-abbr"; src = sources.zsh-abbr; }
|
||||||
{
|
{ name = "fast-syntax-highlighting"; src = sources.fast-syntax-highlighting; }
|
||||||
name = "zsh-autosuggestions";
|
]
|
||||||
src = pkgs.fetchFromGitHub {
|
++ [
|
||||||
owner = "zsh-users";
|
#{
|
||||||
repo = "zsh-autosuggestions";
|
#name = "zsh-completions";
|
||||||
rev = "v0.6.4";
|
#src = pkgs.fetchFromGitHub {
|
||||||
sha256 = "0h52p2waggzfshvy1wvhj4hf06fmzd44bv6j18k3l9rcx6aixzn6";
|
#owner = "zsh-users";
|
||||||
};
|
#repo = "zsh-completions";
|
||||||
}
|
#rev = "0.32.0";
|
||||||
|
#sha256 = "12l9wrx0aysyj62kgp5limglz0nq73w8c415wcshxnxmhyk6sw6d";
|
||||||
|
#};
|
||||||
|
#}
|
||||||
|
|
||||||
{
|
|
||||||
name = "history-substring-search";
|
|
||||||
src = pkgs.fetchFromGitHub {
|
|
||||||
owner = "zsh-users";
|
|
||||||
repo = "zsh-history-substring-search";
|
|
||||||
rev = "v1.0.2";
|
|
||||||
sha256 = "0y8va5kc2ram38hbk2cibkk64ffrabfv1sh4xm7pjspsba9n5p1y";
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
#{
|
||||||
name = "zsh-abbr";
|
#name = "fzf-tab";
|
||||||
src = pkgs.fetchFromGitHub {
|
#src = pkgs.fetchFromGitHub {
|
||||||
owner = "olets";
|
#owner = "Aloxaf";
|
||||||
repo = "zsh-abbr";
|
#repo = "fzf-tab";
|
||||||
rev = "v3.3.3";
|
#rev = "d92299baafdf197c93a88e54f9bbc1c8bb31d427";
|
||||||
sha256 = "0aln7ashadbgharfn4slhimbw624ai82p4yizsxwvz70y4dv0wpg";
|
#sha256 = "046fbhp5777iwl6n901db84bbmxbjgnh5gv9yqy9x15s8ikagzdl";
|
||||||
};
|
#};
|
||||||
}
|
#}
|
||||||
|
#{
|
||||||
|
#name = "zsh-autosuggestions";
|
||||||
|
#src = pkgs.fetchFromGitHub {
|
||||||
|
#owner = "zsh-users";
|
||||||
|
#repo = "zsh-autosuggestions";
|
||||||
|
#rev = "v0.6.4";
|
||||||
|
#sha256 = "0h52p2waggzfshvy1wvhj4hf06fmzd44bv6j18k3l9rcx6aixzn6";
|
||||||
|
#};
|
||||||
|
#}
|
||||||
|
|
||||||
{
|
#{
|
||||||
name = "fast-syntax-highlighting";
|
#name = "history-substring-search";
|
||||||
src = pkgs.fetchFromGitHub {
|
#src = pkgs.fetchFromGitHub {
|
||||||
owner = "zdharma";
|
#owner = "zsh-users";
|
||||||
repo = "fast-syntax-highlighting";
|
#repo = "zsh-history-substring-search";
|
||||||
rev = "v1.55";
|
#rev = "v1.0.2";
|
||||||
sha256 = "0h7f27gz586xxw7cc0wyiv3bx0x3qih2wwh05ad85bh2h834ar8d";
|
#sha256 = "0y8va5kc2ram38hbk2cibkk64ffrabfv1sh4xm7pjspsba9n5p1y";
|
||||||
};
|
#};
|
||||||
}
|
#}
|
||||||
];
|
#{
|
||||||
|
#name = "zsh-abbr";
|
||||||
|
#src = pkgs.fetchFromGitHub {
|
||||||
|
#owner = "olets";
|
||||||
|
#repo = "zsh-abbr";
|
||||||
|
#rev = "v3.3.3";
|
||||||
|
#sha256 = "0aln7ashadbgharfn4slhimbw624ai82p4yizsxwvz70y4dv0wpg";
|
||||||
|
#};
|
||||||
|
#}
|
||||||
|
|
||||||
|
#{
|
||||||
|
#name = "fast-syntax-highlighting";
|
||||||
|
#src = pkgs.fetchFromGitHub {
|
||||||
|
#owner = "zdharma";
|
||||||
|
#repo = "fast-syntax-highlighting";
|
||||||
|
#rev = "v1.55";
|
||||||
|
#sha256 = "0h7f27gz586xxw7cc0wyiv3bx0x3qih2wwh05ad85bh2h834ar8d";
|
||||||
|
#};
|
||||||
|
#}
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
86
files/nix-stuff/nixpkgs/config/zsh/nix/sources.json
Normal file
86
files/nix-stuff/nixpkgs/config/zsh/nix/sources.json
Normal file
|
@ -0,0 +1,86 @@
|
||||||
|
{
|
||||||
|
"fast-syntax-highlighting": {
|
||||||
|
"branch": "master",
|
||||||
|
"description": "(Short name F-Sy-H). Syntax-highlighting for Zshell – fine granularity, number of features, 40 work hours themes",
|
||||||
|
"homepage": "http://zdharma.org",
|
||||||
|
"owner": "zdharma",
|
||||||
|
"repo": "fast-syntax-highlighting",
|
||||||
|
"rev": "865566ce48cfd9bb5cdbaf5b1a74b0a675f4ccd4",
|
||||||
|
"sha256": "00d6nssh73k26w69fdp8iff1xghyr8ziy5w5a2li0z9lvm6j0nik",
|
||||||
|
"type": "tarball",
|
||||||
|
"url": "https://github.com/zdharma/fast-syntax-highlighting/archive/865566ce48cfd9bb5cdbaf5b1a74b0a675f4ccd4.tar.gz",
|
||||||
|
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
||||||
|
},
|
||||||
|
"fzf-tab": {
|
||||||
|
"branch": "master",
|
||||||
|
"description": "Replace zsh's default completion selection menu with fzf!",
|
||||||
|
"homepage": null,
|
||||||
|
"owner": "Aloxaf",
|
||||||
|
"repo": "fzf-tab",
|
||||||
|
"rev": "d92299baafdf197c93a88e54f9bbc1c8bb31d427",
|
||||||
|
"sha256": "046fbhp5777iwl6n901db84bbmxbjgnh5gv9yqy9x15s8ikagzdl",
|
||||||
|
"type": "tarball",
|
||||||
|
"url": "https://github.com/Aloxaf/fzf-tab/archive/d92299baafdf197c93a88e54f9bbc1c8bb31d427.tar.gz",
|
||||||
|
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
||||||
|
},
|
||||||
|
"niv": {
|
||||||
|
"branch": "master",
|
||||||
|
"description": "Easy dependency management for Nix projects",
|
||||||
|
"homepage": "https://github.com/nmattia/niv",
|
||||||
|
"owner": "nmattia",
|
||||||
|
"repo": "niv",
|
||||||
|
"rev": "f73bf8d584148677b01859677a63191c31911eae",
|
||||||
|
"sha256": "0jlmrx633jvqrqlyhlzpvdrnim128gc81q5psz2lpp2af8p8q9qs",
|
||||||
|
"type": "tarball",
|
||||||
|
"url": "https://github.com/nmattia/niv/archive/f73bf8d584148677b01859677a63191c31911eae.tar.gz",
|
||||||
|
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
|
"branch": "nixos-19.09",
|
||||||
|
"description": "A read-only mirror of NixOS/nixpkgs tracking the released channels. Send issues and PRs to",
|
||||||
|
"homepage": "https://github.com/NixOS/nixpkgs",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs-channels",
|
||||||
|
"rev": "289466dd6a11c65a7de4a954d6ebf66c1ad07652",
|
||||||
|
"sha256": "0r5ja052s86fr54fm1zlhld3fwawz2w1d1gd6vbvpjrpjfyajibn",
|
||||||
|
"type": "tarball",
|
||||||
|
"url": "https://github.com/NixOS/nixpkgs-channels/archive/289466dd6a11c65a7de4a954d6ebf66c1ad07652.tar.gz",
|
||||||
|
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
||||||
|
},
|
||||||
|
"zsh-abbr": {
|
||||||
|
"branch": "master",
|
||||||
|
"description": "fish-like abbreviation management for zsh, enhanced",
|
||||||
|
"homepage": "",
|
||||||
|
"owner": "olets",
|
||||||
|
"repo": "zsh-abbr",
|
||||||
|
"rev": "703ba651e4f9c0ae18402e2462177e6253585386",
|
||||||
|
"sha256": "0aln7ashadbgharfn4slhimbw624ai82p4yizsxwvz70y4dv0wpg",
|
||||||
|
"type": "tarball",
|
||||||
|
"url": "https://github.com/olets/zsh-abbr/archive/703ba651e4f9c0ae18402e2462177e6253585386.tar.gz",
|
||||||
|
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
||||||
|
},
|
||||||
|
"zsh-autosuggestions": {
|
||||||
|
"branch": "master",
|
||||||
|
"description": "Fish-like autosuggestions for zsh",
|
||||||
|
"homepage": null,
|
||||||
|
"owner": "zsh-users",
|
||||||
|
"repo": "zsh-autosuggestions",
|
||||||
|
"rev": "ae315ded4dba10685dbbafbfa2ff3c1aefeb490d",
|
||||||
|
"sha256": "0h52p2waggzfshvy1wvhj4hf06fmzd44bv6j18k3l9rcx6aixzn6",
|
||||||
|
"type": "tarball",
|
||||||
|
"url": "https://github.com/zsh-users/zsh-autosuggestions/archive/ae315ded4dba10685dbbafbfa2ff3c1aefeb490d.tar.gz",
|
||||||
|
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
||||||
|
},
|
||||||
|
"zsh-history-substring-search": {
|
||||||
|
"branch": "master",
|
||||||
|
"description": "🐠 ZSH port of Fish history search (up arrow)",
|
||||||
|
"homepage": "",
|
||||||
|
"owner": "zsh-users",
|
||||||
|
"repo": "zsh-history-substring-search",
|
||||||
|
"rev": "0f80b8eb3368b46e5e573c1d91ae69eb095db3fb",
|
||||||
|
"sha256": "0y8va5kc2ram38hbk2cibkk64ffrabfv1sh4xm7pjspsba9n5p1y",
|
||||||
|
"type": "tarball",
|
||||||
|
"url": "https://github.com/zsh-users/zsh-history-substring-search/archive/0f80b8eb3368b46e5e573c1d91ae69eb095db3fb.tar.gz",
|
||||||
|
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
||||||
|
}
|
||||||
|
}
|
134
files/nix-stuff/nixpkgs/config/zsh/nix/sources.nix
Normal file
134
files/nix-stuff/nixpkgs/config/zsh/nix/sources.nix
Normal file
|
@ -0,0 +1,134 @@
|
||||||
|
# This file has been generated by Niv.
|
||||||
|
|
||||||
|
let
|
||||||
|
|
||||||
|
#
|
||||||
|
# The fetchers. fetch_<type> fetches specs of type <type>.
|
||||||
|
#
|
||||||
|
|
||||||
|
fetch_file = pkgs: spec:
|
||||||
|
if spec.builtin or true then
|
||||||
|
builtins_fetchurl { inherit (spec) url sha256; }
|
||||||
|
else
|
||||||
|
pkgs.fetchurl { inherit (spec) url sha256; };
|
||||||
|
|
||||||
|
fetch_tarball = pkgs: spec:
|
||||||
|
if spec.builtin or true then
|
||||||
|
builtins_fetchTarball { inherit (spec) url sha256; }
|
||||||
|
else
|
||||||
|
pkgs.fetchzip { inherit (spec) url sha256; };
|
||||||
|
|
||||||
|
fetch_git = spec:
|
||||||
|
builtins.fetchGit { url = spec.repo; inherit (spec) rev ref; };
|
||||||
|
|
||||||
|
fetch_builtin-tarball = spec:
|
||||||
|
builtins.trace
|
||||||
|
''
|
||||||
|
WARNING:
|
||||||
|
The niv type "builtin-tarball" will soon be deprecated. You should
|
||||||
|
instead use `builtin = true`.
|
||||||
|
|
||||||
|
$ niv modify <package> -a type=tarball -a builtin=true
|
||||||
|
''
|
||||||
|
builtins_fetchTarball { inherit (spec) url sha256; };
|
||||||
|
|
||||||
|
fetch_builtin-url = spec:
|
||||||
|
builtins.trace
|
||||||
|
''
|
||||||
|
WARNING:
|
||||||
|
The niv type "builtin-url" will soon be deprecated. You should
|
||||||
|
instead use `builtin = true`.
|
||||||
|
|
||||||
|
$ niv modify <package> -a type=file -a builtin=true
|
||||||
|
''
|
||||||
|
(builtins_fetchurl { inherit (spec) url sha256; });
|
||||||
|
|
||||||
|
#
|
||||||
|
# Various helpers
|
||||||
|
#
|
||||||
|
|
||||||
|
# The set of packages used when specs are fetched using non-builtins.
|
||||||
|
mkPkgs = sources:
|
||||||
|
let
|
||||||
|
sourcesNixpkgs =
|
||||||
|
import (builtins_fetchTarball { inherit (sources.nixpkgs) url sha256; }) {};
|
||||||
|
hasNixpkgsPath = builtins.any (x: x.prefix == "nixpkgs") builtins.nixPath;
|
||||||
|
hasThisAsNixpkgsPath = <nixpkgs> == ./.;
|
||||||
|
in
|
||||||
|
if builtins.hasAttr "nixpkgs" sources
|
||||||
|
then sourcesNixpkgs
|
||||||
|
else if hasNixpkgsPath && ! hasThisAsNixpkgsPath then
|
||||||
|
import <nixpkgs> {}
|
||||||
|
else
|
||||||
|
abort
|
||||||
|
''
|
||||||
|
Please specify either <nixpkgs> (through -I or NIX_PATH=nixpkgs=...) or
|
||||||
|
add a package called "nixpkgs" to your sources.json.
|
||||||
|
'';
|
||||||
|
|
||||||
|
# The actual fetching function.
|
||||||
|
fetch = pkgs: name: spec:
|
||||||
|
|
||||||
|
if ! builtins.hasAttr "type" spec then
|
||||||
|
abort "ERROR: niv spec ${name} does not have a 'type' attribute"
|
||||||
|
else if spec.type == "file" then fetch_file pkgs spec
|
||||||
|
else if spec.type == "tarball" then fetch_tarball pkgs spec
|
||||||
|
else if spec.type == "git" then fetch_git spec
|
||||||
|
else if spec.type == "builtin-tarball" then fetch_builtin-tarball spec
|
||||||
|
else if spec.type == "builtin-url" then fetch_builtin-url spec
|
||||||
|
else
|
||||||
|
abort "ERROR: niv spec ${name} has unknown type ${builtins.toJSON spec.type}";
|
||||||
|
|
||||||
|
# Ports of functions for older nix versions
|
||||||
|
|
||||||
|
# a Nix version of mapAttrs if the built-in doesn't exist
|
||||||
|
mapAttrs = builtins.mapAttrs or (
|
||||||
|
f: set: with builtins;
|
||||||
|
listToAttrs (map (attr: { name = attr; value = f attr set.${attr}; }) (attrNames set))
|
||||||
|
);
|
||||||
|
|
||||||
|
# fetchTarball version that is compatible between all the versions of Nix
|
||||||
|
builtins_fetchTarball = { url, sha256 }@attrs:
|
||||||
|
let
|
||||||
|
inherit (builtins) lessThan nixVersion fetchTarball;
|
||||||
|
in
|
||||||
|
if lessThan nixVersion "1.12" then
|
||||||
|
fetchTarball { inherit url; }
|
||||||
|
else
|
||||||
|
fetchTarball attrs;
|
||||||
|
|
||||||
|
# fetchurl version that is compatible between all the versions of Nix
|
||||||
|
builtins_fetchurl = { url, sha256 }@attrs:
|
||||||
|
let
|
||||||
|
inherit (builtins) lessThan nixVersion fetchurl;
|
||||||
|
in
|
||||||
|
if lessThan nixVersion "1.12" then
|
||||||
|
fetchurl { inherit url; }
|
||||||
|
else
|
||||||
|
fetchurl attrs;
|
||||||
|
|
||||||
|
# Create the final "sources" from the config
|
||||||
|
mkSources = config:
|
||||||
|
mapAttrs (
|
||||||
|
name: spec:
|
||||||
|
if builtins.hasAttr "outPath" spec
|
||||||
|
then abort
|
||||||
|
"The values in sources.json should not have an 'outPath' attribute"
|
||||||
|
else
|
||||||
|
spec // { outPath = fetch config.pkgs name spec; }
|
||||||
|
) config.sources;
|
||||||
|
|
||||||
|
# The "config" used by the fetchers
|
||||||
|
mkConfig =
|
||||||
|
{ sourcesFile ? ./sources.json
|
||||||
|
, sources ? builtins.fromJSON (builtins.readFile sourcesFile)
|
||||||
|
, pkgs ? mkPkgs sources
|
||||||
|
}: rec {
|
||||||
|
# The sources, i.e. the attribute set of spec name to spec
|
||||||
|
inherit sources;
|
||||||
|
|
||||||
|
# The "pkgs" (evaluated nixpkgs) to use for e.g. non-builtin fetchers
|
||||||
|
inherit pkgs;
|
||||||
|
};
|
||||||
|
in
|
||||||
|
mkSources (mkConfig {}) // { __functor = _: settings: mkSources (mkConfig settings); }
|
|
@ -30,6 +30,8 @@ in
|
||||||
bat
|
bat
|
||||||
fontforge
|
fontforge
|
||||||
websocat
|
websocat
|
||||||
|
zsh-completions
|
||||||
|
niv
|
||||||
#pkgs.timg
|
#pkgs.timg
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue