From aa6b22fc5c33e899b646ae8e0ffd76b404defcf1 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Mon, 25 Mar 2024 03:03:54 +0900 Subject: [PATCH] Need overlay, because used in shell soursing --- flake.nix | 20 +++++++++++++++++++- home-manager/packages.nix | 15 +-------------- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/flake.nix b/flake.nix index 171deca4..f6909711 100644 --- a/flake.nix +++ b/flake.nix @@ -1,3 +1,18 @@ +let + # https://github.com/NixOS/nixpkgs/blob/2e1b779e0a0e67fb4e4f3333606cc1b8a287afae/pkgs/shells/fzf-git-sh/default.nix#L22-L27 + fzf-git-sh-overlay = final: prev: { + fzf-git-sh = prev.fzf-git-sh.override { + version = "git"; + # https://github.com/kachick/fzf-git.sh/pull/1 + src = prev.fetchFromGitHub { + owner = "kachick"; + repo = "fzf-git.sh"; + rev = "cfbc4b1ef75352d57a64284d0a998c1c6b45af67"; + sha256 = "sha256-tY6dkBZVspo5lmBcjyg5VgWVgwRlO2GD9muizEf+kWo="; + }; + }; + }; +in { inputs = { # Candidate channels @@ -19,7 +34,10 @@ outputs = { self, nixpkgs, home-manager, flake-utils, my-nixpkgs }: flake-utils.lib.eachDefaultSystem (system: let - pkgs = nixpkgs.legacyPackages.${system}; + pkgs = import nixpkgs { + inherit system; + overlays = [ fzf-git-sh-overlay ]; + }; my-pkgs = my-nixpkgs.legacyPackages.${system}; in rec { diff --git a/home-manager/packages.nix b/home-manager/packages.nix index 35d5685d..e20a5477 100644 --- a/home-manager/packages.nix +++ b/home-manager/packages.nix @@ -1,18 +1,5 @@ { pkgs, my-pkgs, lib, ... }: -let - # https://github.com/NixOS/nixpkgs/blob/2e1b779e0a0e67fb4e4f3333606cc1b8a287afae/pkgs/shells/fzf-git-sh/default.nix#L22-L27 - patched-fzf-git-sh = pkgs.fzf-git-sh.overrideAttrs (prev: { - version = "git"; - # https://github.com/kachick/fzf-git.sh/pull/1 - src = pkgs.fetchFromGitHub { - owner = "kachick"; - repo = "fzf-git.sh"; - rev = "cfbc4b1ef75352d57a64284d0a998c1c6b45af67"; - sha256 = "sha256-tY6dkBZVspo5lmBcjyg5VgWVgwRlO2GD9muizEf+kWo="; - }; - }); -in { home.packages = with pkgs; [ # Use `bashInteractive`, don't `bash` - https://github.com/NixOS/nixpkgs/issues/29960, https://github.com/NixOS/nix/issues/730 @@ -30,7 +17,7 @@ in fzf # History: CTRL+R, Walker: CTRL+T # https://github.com/junegunn/fzf/blob/d579e335b5aa30e98a2ec046cb782bbb02bc28ad/ADVANCED.md#key-bindings-for-git-objects # CTRL+O does not open web browser in WSL: https://github.com/kachick/dotfiles/issues/499 - patched-fzf-git-sh # CTRL-G CTRL-{} keybinds for git + fzf-git-sh # CTRL-G CTRL-{} keybinds for git # Used in anywhere coreutils