diff --git a/docs/chrs/install.md b/docs/chrs/install.md index d1818ba..73a9d61 100644 --- a/docs/chrs/install.md +++ b/docs/chrs/install.md @@ -55,3 +55,58 @@ If necessary, add the `bin` folder to `$PATH`: echo 'export PATH="$HOME/.cargo/bin:$PATH"' >> ~/.bashrc source ~/.bashrc ``` + +## Home Manager using Nix Flakes + +Edit `~/.config/home-manager/flake.nix` + +```nix +{ + description = "Home Manager configuration example"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + chrs.url = "github:FNNDSC/chrs"; # <-- add this line + }; + + outputs = { nixpkgs, home-manager, ... } @ inputs: + let + system = "x86_64-linux"; + pkgs = nixpkgs.legacyPackages.${system}; + in { + homeConfigurations."chris@computer" = home-manager.lib.homeManagerConfiguration { + inherit pkgs; + modules = [ + ./packages.nix # <-- file where chrs will be specified + ]; + extraSpecialArgs = { inherit inputs; }; # <-- pass inputs to modules + }; + }; +} +``` + +And create the file `~/.config/home-manager/packages.nix` with the content: + +```nix +{ lib, pkgs, inputs, ... }: + +{ + home.packages = with pkgs; [ + inputs.chrs.packages.${system}.default + ]; +} +``` + +Run + +```shell +cd ~/.config/home-manager +git add flake.nix packages.nix +nix flake update +git add flake.lock +home-manager switch +```