Skip to content

Commit

Permalink
feat: nix profile
Browse files Browse the repository at this point in the history
  • Loading branch information
ryan4yin committed Feb 7, 2024
1 parent 52ba377 commit 3f687c4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
9 changes: 9 additions & 0 deletions docs/development/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,15 @@ nix build "nixpkgs#ponysay"
▀ ▀▀█
```

## Using `nix profile` to manage development environments and entertainment environments

`nix develop` is a tool for creating and managing multiple user environments, and switch to different environments when needed.

Unlike `nix develop`, `nix profile` manages the user's system environment, instead of creating a temporary shell environment.
So it's more compatible with Jetbrains IDE / VSCode and other IDEs, and won't have the problem of not being able to use the configured development environment in the IDE.

TODO

## Other Commands

There are other commands like `nix flake init`, which you can explore in [New Nix Commands][New Nix Commands]. For more detailed information, please refer to the documentation.
Expand Down
10 changes: 9 additions & 1 deletion docs/zh/development/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
在 NixOS 上,全局环境中只建议安装一些通用的工具,比如 `git``vim``emacs``tmux``zsh` 等等,而各语言的开发环境,最好是每个项目都有一个独立的环境。
为了简便,你也可以考虑提前为常用语言创建一些通用的开发环境,在需要时切换进去。

总而言之,NixOS 上的开发环境不应该装在全局,应该是一个个独立的项目环境,或许还带有一些通用的语言环境,但是它们都是完全隔离的,不会相互影响
总而言之,NixOS 上的开发环境不要一股脑都装在全局,弄成一个个相互隔离、不会互相影响的项目环境会优雅很多

在本章中我们先学习一下 Nix Flakes 开发环境的实现原理,后面的章节再按使用场景介绍一些更具体的内容。

Expand Down Expand Up @@ -435,6 +435,14 @@ nix build "nixpkgs#ponysay"
▀ ▀▀█
```

## 使用 `nix profile` 分别管理日常娱乐环境跟开发环境

`nix profile` 是 NixOS 中用于管理用户环境的工具,它可以用于创建管理多个用户环境,并在需要时切换到不同的环境。

`nix develop` 不同,`nix profile` 管理的是用户级别的系统环境,而不是临时创建的一个 shell 环境,因此它对 Jetbrains IDE / VSCode 等 IDE 的兼容性会好很多,不会出现无法在 IDE 内使用我们配置好的开发环境的情况。

TODO 未完待续

## 其他命令

其他还有些 `nix flake init` 之类的命令,请自行查阅 [New Nix Commands][New Nix Commands] 学习研究,这里就不详细介绍了。
Expand Down

0 comments on commit 3f687c4

Please sign in to comment.