feat: update nixos's version to 23.05, update content in start-using-home-manager

This commit is contained in:
Ryan Yin 2023-07-08 11:44:49 +08:00
parent 7f28083a7f
commit 62369233a4
6 changed files with 21 additions and 14 deletions

View File

@ -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";
# Latest stable branch of nixpkgs, used for version rollback
# The current latest version is 22.11
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-22.11";
# The current latest version is 23.05
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-23.05";
# You can also use a specific git commit hash to lock the version
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`.
>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`.

View File

@ -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";
# home-manager, used for managing user configuration
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.
# 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.

View File

@ -112,6 +112,7 @@ According to the official [Home Manager Manual](https://nix-community.github.io/
# starship - an customizable prompt for any shell
programs.starship = {
enable = true;
# custom settings
settings = {
add_newline = false;
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
programs.alacritty = {
enable = true;
# custom settings
settings = {
env.TERM = "xterm-256color";
font = {
@ -137,15 +139,16 @@ According to the official [Home Manager Manual](https://nix-community.github.io/
programs.bash = {
enable = true;
enableCompletion = true;
# TODO add your cusotm bashrc here
bashrcExtra = ''
export PATH="$PATH:$HOME/bin:$HOME/.local/bin:$HOME/go/bin"
'';
# set some aliases, feel free to add more or remove some
shellAliases = {
k = "kubectl";
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()))'";
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
# the home Manager release notes for a list of state version
# changes in each release.
home.stateVersion = "22.11";
home.stateVersion = "23.05";
# Let home Manager install and manage itself.
programs.home-manager.enable = true;

View File

@ -14,8 +14,8 @@
# 默认使用 nixos-unstable 分支
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
# 最新 stable 分支的 nixpkgs用于回退个别软件包的版本当前最新版本为 22.11
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-22.11";
# 最新 stable 分支的 nixpkgs用于回退个别软件包的版本当前最新版本为 23.05
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-23.05";
# 另外也可以使用 git commit hash 来锁定版本,这是最彻底的锁定方式
nixpkgs-fd40cef8d.url = "github:nixos/nixpkgs/fd40cef8d797670e203a27a91e4b8e6decf0b90c";

View File

@ -70,7 +70,7 @@ cat flake.nix
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
# home-manager用于管理用户配置
home-manager = {
url = "github:nix-community/home-manager/release-22.11";
url = "github:nix-community/home-manager/release-23.05";
# `follows` 是 inputs 中的继承语法
# 这里使 sops-nix 的 `inputs.nixpkgs` 与当前 flake 的 `inputs.nixpkgs` 保持一致,
# 避免依赖的 nixpkgs 版本不一致导致问题

View File

@ -112,6 +112,7 @@
# 启用 starship这是一个漂亮的 shell 提示符
programs.starship = {
enable = true;
# 自定义配置
settings = {
add_newline = false;
aws.disabled = true;
@ -120,9 +121,11 @@
};
};
# alacritty 终端配置
# alacritty - 一个跨平台终端,带 GPU 加速功能
programs.alacritty = {
enable = true;
# 自定义配置
settings = {
env.TERM = "xterm-256color";
font = {
size = 12;
@ -130,20 +133,22 @@
};
scrolling.multiplier = 5;
selection.save_to_clipboard = true;
};
};
programs.bash = {
enable = true;
enableCompletion = true;
# TODO 在这里添加你的自定义 bashrc 内容
bashrcExtra = ''
export PATH="$PATH:$HOME/bin:$HOME/.local/bin:$HOME/go/bin"
'';
# set some aliases, feel free to add more or remove some
# TODO 设置一些别名方便使用,你可以根据自己的需要进行增删
shellAliases = {
k = "kubectl";
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()))'";
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
# the Home Manager release notes for a list of state version
# changes in each release.
home.stateVersion = "22.11";
home.stateVersion = "23.05";
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;