mirror of
https://github.com/ryan4yin/nixos-and-flakes-book.git
synced 2025-02-16 10:29:55 +01:00
feat: nix profile
This commit is contained in:
parent
52ba377c29
commit
3f687c4407
@ -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.
|
||||
|
@ -6,7 +6,7 @@
|
||||
在 NixOS 上,全局环境中只建议安装一些通用的工具,比如 `git`、`vim`、`emacs`、`tmux`、`zsh` 等等,而各语言的开发环境,最好是每个项目都有一个独立的环境。
|
||||
为了简便,你也可以考虑提前为常用语言创建一些通用的开发环境,在需要时切换进去。
|
||||
|
||||
总而言之,NixOS 上的开发环境不应该装在全局,应该是一个个独立的项目环境,或许还带有一些通用的语言环境,但是它们都是完全隔离的,不会相互影响。
|
||||
总而言之,NixOS 上的开发环境不要一股脑都装在全局,弄成一个个相互隔离、不会互相影响的项目环境会优雅很多。
|
||||
|
||||
在本章中我们先学习一下 Nix Flakes 开发环境的实现原理,后面的章节再按使用场景介绍一些更具体的内容。
|
||||
|
||||
@ -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] 学习研究,这里就不详细介绍了。
|
||||
|
Loading…
Reference in New Issue
Block a user