Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
sharpchen committed Jul 31, 2024
1 parent d568d61 commit bdb9934
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 1 deletion.
31 changes: 31 additions & 0 deletions docs/document/Nix/docs/2. Nix Cli Families/nix-channel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# nix-channel

## Add channel

```bash
nix-channel --add <url> [<channel_alias>]
```

:::info
`channel_alias` is optional, defaults to `nixpkgs`
:::

## List channel

```bash
nix-channel --list
```

## Remove channel

```bash
nix-channel --remove <channel_alias>
```

## Update channel

You'll need to fetch channel info after adding new channels

```bash
nix-channel --update [<...channel_alias>] # update all or specific channels
```
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ echo 'experimental-features = nix-command flakes' >> ~/.config/nix/nix.conf
or the following for multi-users:

```bash
echo 'experimental-features = nix-command flakes' >> /etc/nix/nix.conf
sudo sh -c 'echo "experimental-features = nix-command flakes" >> /etc/nix/nix.conf'
```

## Initialize home-manager
Expand Down Expand Up @@ -48,4 +48,12 @@ home-manager switch

This command uses `home.nix` and `flake.nix` under `~/.config/home-manager/` by default.

If you feel uncertain, try

```bash
home-manager build
```

This generates a folder named `result/` under `~/.config/home-manager/`

Currently we just tested the minimal config generated by home-manager, next we'll learn everything home-manager can do.
22 changes: 22 additions & 0 deletions docs/document/Nix/docs/Home Manager/Add Packages.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ There's two ways to install packages using home-manager.
```

**However, you won't be able to config the package in a same place.**
To generate any file as well as config file, use `home.file."<file_path>"`

```nix
{ cofig, pkgs, ... }: {
Expand All @@ -34,3 +35,24 @@ There's two ways to install packages using home-manager.
};
}
```

## Install and config by builtin option

**For some packages, nix provides builtin options to set them up programmatically**

```nix
{ cofig, pkgs, ... }: {
programs.git = {
enable = true;
userName = "foo";
userEmail = "[email protected]";
};
}
```

*`enable` implies that the package will be installed implicitly.*

:::info
Only few packages has builtin options, how do I know?
Go to [Home-manager Options](https://nix-community.github.io/home-manager/options.xhtml) and search `programs.<pkg_name>`
:::

0 comments on commit bdb9934

Please sign in to comment.