mirror of
https://github.com/ryan4yin/nixos-and-flakes-book.git
synced 2025-06-22 04:51:29 +02:00
feat: update nixos's version to 23.05, update content in start-using-home-manager
This commit is contained in:
parent
7f28083a7f
commit
62369233a4
@ -13,8 +13,8 @@ Here's an example of how you can add multiple nixpkgs inputs, each using a diffe
|
|||||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||||
|
|
||||||
# Latest stable branch of nixpkgs, used for version rollback
|
# Latest stable branch of nixpkgs, used for version rollback
|
||||||
# The current latest version is 22.11
|
# The current latest version is 23.05
|
||||||
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-22.11";
|
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-23.05";
|
||||||
|
|
||||||
# You can also use a specific git commit hash to lock the version
|
# You can also use a specific git commit hash to lock the version
|
||||||
nixpkgs-fd40cef8d.url = "github:nixos/nixpkgs/fd40cef8d797670e203a27a91e4b8e6decf0b90c";
|
nixpkgs-fd40cef8d.url = "github:nixos/nixpkgs/fd40cef8d797670e203a27a91e4b8e6decf0b90c";
|
||||||
@ -85,5 +85,4 @@ Next, you can refer to the packages from `pkgs-stable` or `pkgs-fd40cef8d` withi
|
|||||||
|
|
||||||
By adjusting the configuration as shown above, you can deploy it using `sudo nixos-rebuild switch`. This will downgrade your Firefox/Chrome/VSCode versions to the ones corresponding to `nixpkgs-stable` or `nixpkgs-fd40cef8d`.
|
By adjusting the configuration as shown above, you can deploy it using `sudo nixos-rebuild switch`. This will downgrade your Firefox/Chrome/VSCode versions to the ones corresponding to `nixpkgs-stable` or `nixpkgs-fd40cef8d`.
|
||||||
|
|
||||||
|
> According to [1000 instances of nixpkgs](https://discourse.nixos.org/t/1000-instances-of-nixpkgs/17347), it's not a good practice to use `import` in submodules to customize `nixpkgs`. Each `import` creates a new instance of nixpkgs, which increases build time and memory usage as the configuration grows. To avoid this problem, we create all nixpkgs instances in `flake.nix`.
|
||||||
>According to [1000 instances of nixpkgs](https://discourse.nixos.org/t/1000-instances-of-nixpkgs/17347), it's not a good practice to use `import` in submodules to customize `nixpkgs`. Each `import` creates a new instance of nixpkgs, which increases build time and memory usage as the configuration grows. To avoid this problem, we create all nixpkgs instances in `flake.nix`.
|
|
||||||
|
@ -78,7 +78,7 @@ Note that the copied template cannot be used directly. You need to modify it to
|
|||||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
# home-manager, used for managing user configuration
|
# home-manager, used for managing user configuration
|
||||||
home-manager = {
|
home-manager = {
|
||||||
url = "github:nix-community/home-manager/release-22.11";
|
url = "github:nix-community/home-manager/release-23.05";
|
||||||
# The `follows` keyword in inputs is used for inheritance.
|
# The `follows` keyword in inputs is used for inheritance.
|
||||||
# Here, `inputs.nixpkgs` of home-manager is kept consistent with the `inputs.nixpkgs` of the current flake,
|
# Here, `inputs.nixpkgs` of home-manager is kept consistent with the `inputs.nixpkgs` of the current flake,
|
||||||
# to avoid problems caused by different versions of nixpkgs.
|
# to avoid problems caused by different versions of nixpkgs.
|
||||||
|
@ -112,6 +112,7 @@ According to the official [Home Manager Manual](https://nix-community.github.io/
|
|||||||
# starship - an customizable prompt for any shell
|
# starship - an customizable prompt for any shell
|
||||||
programs.starship = {
|
programs.starship = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
# custom settings
|
||||||
settings = {
|
settings = {
|
||||||
add_newline = false;
|
add_newline = false;
|
||||||
aws.disabled = true;
|
aws.disabled = true;
|
||||||
@ -123,6 +124,7 @@ According to the official [Home Manager Manual](https://nix-community.github.io/
|
|||||||
# alacritty - a cross-platform, GPU-accelerated terminal emulator
|
# alacritty - a cross-platform, GPU-accelerated terminal emulator
|
||||||
programs.alacritty = {
|
programs.alacritty = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
# custom settings
|
||||||
settings = {
|
settings = {
|
||||||
env.TERM = "xterm-256color";
|
env.TERM = "xterm-256color";
|
||||||
font = {
|
font = {
|
||||||
@ -137,15 +139,16 @@ According to the official [Home Manager Manual](https://nix-community.github.io/
|
|||||||
programs.bash = {
|
programs.bash = {
|
||||||
enable = true;
|
enable = true;
|
||||||
enableCompletion = true;
|
enableCompletion = true;
|
||||||
|
# TODO add your cusotm bashrc here
|
||||||
bashrcExtra = ''
|
bashrcExtra = ''
|
||||||
export PATH="$PATH:$HOME/bin:$HOME/.local/bin:$HOME/go/bin"
|
export PATH="$PATH:$HOME/bin:$HOME/.local/bin:$HOME/go/bin"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# set some aliases, feel free to add more or remove some
|
# set some aliases, feel free to add more or remove some
|
||||||
shellAliases = {
|
shellAliases = {
|
||||||
|
k = "kubectl";
|
||||||
urldecode = "python3 -c 'import sys, urllib.parse as ul; print(ul.unquote_plus(sys.stdin.read()))'";
|
urldecode = "python3 -c 'import sys, urllib.parse as ul; print(ul.unquote_plus(sys.stdin.read()))'";
|
||||||
urlencode = "python3 -c 'import sys, urllib.parse as ul; print(ul.quote_plus(sys.stdin.read()))'";
|
urlencode = "python3 -c 'import sys, urllib.parse as ul; print(ul.quote_plus(sys.stdin.read()))'";
|
||||||
httpproxy = "export https_proxy=http://127.0.0.1:7890; export http_proxy=http://127.0.0.1:7890;";
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -157,7 +160,7 @@ According to the official [Home Manager Manual](https://nix-community.github.io/
|
|||||||
# You can update home Manager without changing this value. See
|
# You can update home Manager without changing this value. See
|
||||||
# the home Manager release notes for a list of state version
|
# the home Manager release notes for a list of state version
|
||||||
# changes in each release.
|
# changes in each release.
|
||||||
home.stateVersion = "22.11";
|
home.stateVersion = "23.05";
|
||||||
|
|
||||||
# Let home Manager install and manage itself.
|
# Let home Manager install and manage itself.
|
||||||
programs.home-manager.enable = true;
|
programs.home-manager.enable = true;
|
||||||
|
@ -14,8 +14,8 @@
|
|||||||
# 默认使用 nixos-unstable 分支
|
# 默认使用 nixos-unstable 分支
|
||||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||||
|
|
||||||
# 最新 stable 分支的 nixpkgs,用于回退个别软件包的版本,当前最新版本为 22.11
|
# 最新 stable 分支的 nixpkgs,用于回退个别软件包的版本,当前最新版本为 23.05
|
||||||
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-22.11";
|
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-23.05";
|
||||||
|
|
||||||
# 另外也可以使用 git commit hash 来锁定版本,这是最彻底的锁定方式
|
# 另外也可以使用 git commit hash 来锁定版本,这是最彻底的锁定方式
|
||||||
nixpkgs-fd40cef8d.url = "github:nixos/nixpkgs/fd40cef8d797670e203a27a91e4b8e6decf0b90c";
|
nixpkgs-fd40cef8d.url = "github:nixos/nixpkgs/fd40cef8d797670e203a27a91e4b8e6decf0b90c";
|
||||||
|
@ -70,7 +70,7 @@ cat flake.nix
|
|||||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
# home-manager,用于管理用户配置
|
# home-manager,用于管理用户配置
|
||||||
home-manager = {
|
home-manager = {
|
||||||
url = "github:nix-community/home-manager/release-22.11";
|
url = "github:nix-community/home-manager/release-23.05";
|
||||||
# `follows` 是 inputs 中的继承语法
|
# `follows` 是 inputs 中的继承语法
|
||||||
# 这里使 sops-nix 的 `inputs.nixpkgs` 与当前 flake 的 `inputs.nixpkgs` 保持一致,
|
# 这里使 sops-nix 的 `inputs.nixpkgs` 与当前 flake 的 `inputs.nixpkgs` 保持一致,
|
||||||
# 避免依赖的 nixpkgs 版本不一致导致问题
|
# 避免依赖的 nixpkgs 版本不一致导致问题
|
||||||
|
@ -112,6 +112,7 @@
|
|||||||
# 启用 starship,这是一个漂亮的 shell 提示符
|
# 启用 starship,这是一个漂亮的 shell 提示符
|
||||||
programs.starship = {
|
programs.starship = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
# 自定义配置
|
||||||
settings = {
|
settings = {
|
||||||
add_newline = false;
|
add_newline = false;
|
||||||
aws.disabled = true;
|
aws.disabled = true;
|
||||||
@ -120,9 +121,11 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# alacritty 终端配置
|
# alacritty - 一个跨平台终端,带 GPU 加速功能
|
||||||
programs.alacritty = {
|
programs.alacritty = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
# 自定义配置
|
||||||
|
settings = {
|
||||||
env.TERM = "xterm-256color";
|
env.TERM = "xterm-256color";
|
||||||
font = {
|
font = {
|
||||||
size = 12;
|
size = 12;
|
||||||
@ -130,20 +133,22 @@
|
|||||||
};
|
};
|
||||||
scrolling.multiplier = 5;
|
scrolling.multiplier = 5;
|
||||||
selection.save_to_clipboard = true;
|
selection.save_to_clipboard = true;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
programs.bash = {
|
programs.bash = {
|
||||||
enable = true;
|
enable = true;
|
||||||
enableCompletion = true;
|
enableCompletion = true;
|
||||||
|
# TODO 在这里添加你的自定义 bashrc 内容
|
||||||
bashrcExtra = ''
|
bashrcExtra = ''
|
||||||
export PATH="$PATH:$HOME/bin:$HOME/.local/bin:$HOME/go/bin"
|
export PATH="$PATH:$HOME/bin:$HOME/.local/bin:$HOME/go/bin"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# set some aliases, feel free to add more or remove some
|
# TODO 设置一些别名方便使用,你可以根据自己的需要进行增删
|
||||||
shellAliases = {
|
shellAliases = {
|
||||||
|
k = "kubectl";
|
||||||
urldecode = "python3 -c 'import sys, urllib.parse as ul; print(ul.unquote_plus(sys.stdin.read()))'";
|
urldecode = "python3 -c 'import sys, urllib.parse as ul; print(ul.unquote_plus(sys.stdin.read()))'";
|
||||||
urlencode = "python3 -c 'import sys, urllib.parse as ul; print(ul.quote_plus(sys.stdin.read()))'";
|
urlencode = "python3 -c 'import sys, urllib.parse as ul; print(ul.quote_plus(sys.stdin.read()))'";
|
||||||
httpproxy = "export https_proxy=http://127.0.0.1:7890; export http_proxy=http://127.0.0.1:7890;";
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -155,7 +160,7 @@
|
|||||||
# You can update Home Manager without changing this value. See
|
# You can update Home Manager without changing this value. See
|
||||||
# the Home Manager release notes for a list of state version
|
# the Home Manager release notes for a list of state version
|
||||||
# changes in each release.
|
# changes in each release.
|
||||||
home.stateVersion = "22.11";
|
home.stateVersion = "23.05";
|
||||||
|
|
||||||
# Let Home Manager install and manage itself.
|
# Let Home Manager install and manage itself.
|
||||||
programs.home-manager.enable = true;
|
programs.home-manager.enable = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user