From 1432ea461ccbfd730f3f21a08b15640c223eb97a Mon Sep 17 00:00:00 2001 From: LavaDesu Date: Wed, 14 Jul 2021 11:02:42 +0700 Subject: [PATCH] flake-managed zsh plugins --- flake.lock | 70 ++++++++++++++++++++++++++++++++++++++++++++++- flake.nix | 8 ++++++ users/rin/zsh.nix | 49 ++++++++------------------------- 3 files changed, 88 insertions(+), 39 deletions(-) diff --git a/flake.lock b/flake.lock index 18da90e..53c62fb 100644 --- a/flake.lock +++ b/flake.lock @@ -116,7 +116,11 @@ "home-manager": "home-manager", "neovim-nightly": "neovim-nightly", "nixpkgs": "nixpkgs", - "secrets": "secrets" + "secrets": "secrets", + "zsh-abbr": "zsh-abbr", + "zsh-fast-syntax-highlighting": "zsh-fast-syntax-highlighting", + "zsh-history-substring-search": "zsh-history-substring-search", + "zsh-pure": "zsh-pure" } }, "secrets": { @@ -133,6 +137,70 @@ "repo": "flakes-secrets", "type": "github" } + }, + "zsh-abbr": { + "flake": false, + "locked": { + "lastModified": 1619965311, + "narHash": "sha256-+oOk2ePd4/OjmRP245Kb5ku/R1PAQCI6IJth7GbcnwQ=", + "owner": "olets", + "repo": "zsh-abbr", + "rev": "99af0455b7b86ff3894a4bcf73380be2d595fa54", + "type": "github" + }, + "original": { + "owner": "olets", + "repo": "zsh-abbr", + "type": "github" + } + }, + "zsh-fast-syntax-highlighting": { + "flake": false, + "locked": { + "lastModified": 1621022231, + "narHash": "sha256-rHdOnA0Y/i/ISDlriGrGDXr5rD2nZ4T7iuG7PFUVIFQ=", + "owner": "zdharma", + "repo": "fast-syntax-highlighting", + "rev": "817916dfa907d179f0d46d8de355e883cf67bd97", + "type": "github" + }, + "original": { + "owner": "zdharma", + "repo": "fast-syntax-highlighting", + "type": "github" + } + }, + "zsh-history-substring-search": { + "flake": false, + "locked": { + "lastModified": 1557707754, + "narHash": "sha256-Ptxik1r6anlP7QTqsN1S2Tli5lyRibkgGlVlwWZRG3k=", + "owner": "zsh-users", + "repo": "zsh-history-substring-search", + "rev": "0f80b8eb3368b46e5e573c1d91ae69eb095db3fb", + "type": "github" + }, + "original": { + "owner": "zsh-users", + "repo": "zsh-history-substring-search", + "type": "github" + } + }, + "zsh-pure": { + "flake": false, + "locked": { + "lastModified": 1626016475, + "narHash": "sha256-6j6QZtsA5ZgfXthYjXRrND2zAJwZx0/6WRI1f3c+2mE=", + "owner": "sindresorhus", + "repo": "pure", + "rev": "f4c6d79ba2417d63c8008b6acce628631fd462ec", + "type": "github" + }, + "original": { + "owner": "sindresorhus", + "repo": "pure", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index cf0aa95..0918311 100644 --- a/flake.nix +++ b/flake.nix @@ -7,6 +7,12 @@ home-manager.inputs.nixpkgs.follows = "nixpkgs"; neovim-nightly.inputs.nixpkgs.follows = "nixpkgs"; + + # zsh plugins + zsh-abbr = { url = "github:olets/zsh-abbr"; flake = false; }; + zsh-history-substring-search = { url = "github:zsh-users/zsh-history-substring-search"; flake = false; }; + zsh-fast-syntax-highlighting = { url = "github:zdharma/fast-syntax-highlighting"; flake = false; }; + zsh-pure = { url = "github:sindresorhus/pure"; flake = false; }; }; outputs = inputs: with inputs; @@ -52,6 +58,7 @@ home-manager = { useGlobalPkgs = true; useUserPackages = true; + extraSpecialArgs = { inherit inputs; }; }; }; in @@ -65,6 +72,7 @@ ./hosts/winter secrets.nixosModules.winter ]; + specialArgs = { inherit inputs; }; }; packages.x86_64-linux = customPackages nixpkgs.legacyPackages.x86_64-linux; }; diff --git a/users/rin/zsh.nix b/users/rin/zsh.nix index 047bcb2..e66fcab 100644 --- a/users/rin/zsh.nix +++ b/users/rin/zsh.nix @@ -1,8 +1,13 @@ # vim: ft=nix -{ config, pkgs, ... }: +{ config, inputs, pkgs, ... }: let lib = pkgs.lib; + pluginFromInput = name: { + inherit name; + src = inputs.${name}; + }; + abbrs = { e = "$EDITOR"; rs = "source ~/.config/zsh/.zshrc"; @@ -140,43 +145,11 @@ in rec { viExtraNav ]; - plugins = [ - { - name = "zsh-abbr"; - src = pkgs.fetchFromGitHub { - owner = "olets"; - repo = "zsh-abbr"; - rev = "99af0455b7b86ff3894a4bcf73380be2d595fa54"; - sha256 = "014zvikfqqcv40x24h60ad3vyjz6kf9f7xhkk6iz7qyxwgcs90zs"; - }; - } - { - name = "zsh-history-substring-search"; - src = pkgs.fetchFromGitHub { - owner = "zsh-users"; - repo = "zsh-history-substring-search"; - rev = "0f80b8eb3368b46e5e573c1d91ae69eb095db3fb"; - sha256 = "0y8va5kc2ram38hbk2cibkk64ffrabfv1sh4xm7pjspsba9n5p1y"; - }; - } - { - name = "fast-syntax-highlighting"; - src = pkgs.fetchFromGitHub { - owner = "zdharma"; - repo = "fast-syntax-highlighting"; - rev = "817916dfa907d179f0d46d8de355e883cf67bd97"; - sha256 = "0m102makrfz1ibxq8rx77nngjyhdqrm8hsrr9342zzhq1nf4wxxc"; - }; - } - { - name = "pure"; - src = pkgs.fetchFromGitHub { - owner = "sindresorhus"; - repo = "pure"; - rev = "43aafe0b4dc05174c57ee623c03c64400e832ece"; - sha256 = "0qfs7rvpyd8jb7x4ziqrkh0b6g9ldds8sn6qbqgrir80vdk90gpa"; - }; - } + plugins = builtins.map (e: pluginFromInput e) [ + "zsh-abbr" + "zsh-history-substring-search" + "zsh-fast-syntax-highlighting" + "zsh-pure" ]; }; }