From 8ab533f0cc510471cf518031d20d4ec52eba23fd Mon Sep 17 00:00:00 2001 From: Samxamnam Date: Wed, 17 Apr 2024 09:53:16 +0200 Subject: [PATCH] Add: Nix + Home Manager to install doc --- doc/install/index.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/doc/install/index.md b/doc/install/index.md index 8bd3f63..97e23ec 100644 --- a/doc/install/index.md +++ b/doc/install/index.md @@ -53,6 +53,39 @@ sudo curl https://raw.githubusercontent.com/GitAlias/gitalias/main/gitalias.txt sudo git config --global include.path "$dir/gitalias.txt" ``` +#### For Nix with Home Manager + +You should get a `fetchFromGitHub`-snippet of the current version of the project via `nurl` with the following command: + +```bash +nix run nixpkgs#nurl https://github.com/GitAlias/gitalias/ +> fetchFromGitHub { +> owner = "GitAlias"; +> repo = "gitalias"; +> rev = "7b941c3abbcee391b6bfc4f8d6b8372064245b49"; +> hash = "sha256-IvHM6mRtoeVm01cUmTkKqjm6/n3Izau89B7MT69Afo0="; +> } +``` + +This snippet can then be used inside your Home Manager configuration like so: + +```nix +# link gitalias.txt from store to +# $XDG_CONFIG_HOME/gitalias/gitalias.txt +xdg.configFile = { + "gitalias/gitalias.txt".source = pkgs.fetchFromGitHub { + # fill with snippet here + } + "/gitalias.txt"; +}; + +# tell git to include gitalias.txt +programs.git = { + enable = true; + includes = [ + { path = "${config.xdg.configHome}/gitalias/gitalias.txt"; } + ]; +}; +``` ### For Windows