Compare commits

...

3 Commits

Author SHA1 Message Date
ab4d5e1924 refactor: gate ssh sops symlinks, follow nixos-wsl, fix CRLF
- home/ssh.nix: only create /run/secrets symlinks when secrets exist
- flake.nix: nixos-wsl explicit nixpkgs follows
- fix CRLF line endings: nvchad.nix, virtualbox-guest.nix, docker.nix
2026-08-13 04:17:18 +08:00
1be8b3d8e8 security: comment out plaintext initialPassword
Temporary first-install shortcut kept as comment only;
avoid plaintext password landing in /nix/store (world-readable).
2026-08-13 04:17:18 +08:00
b2baaa5f5f chore: upgrade nixpkgs/home-manager to 26.05 and re-lock
- nixpkgs: nixos-25.05 -> nixos-26.05 (rev 70cc4559)
- home-manager: release-25.05 -> release-26.05
- fix 26.05 breaking changes: fcitx5-configtool/fcitx5-chinese-addons rename,
  resolved.extraConfig -> settings.Resolve, amdvlk removed (RADV default),
  desktop: import missing hardware-configuration.nix
- home/git.nix: migrate deprecated userName/extraConfig to settings
2026-08-13 04:17:18 +08:00
13 changed files with 109 additions and 165 deletions

View File

@@ -2,4 +2,4 @@ creation_rules:
- path_regex: ^secrets/users/.*\.ya?ml$ - path_regex: ^secrets/users/.*\.ya?ml$
key_groups: key_groups:
- age: - age:
- age1REPLACE_WITH_YOUR_AGE_PUBLIC_KEY - age1REPLACE_WITH_YOUR_AGE_PUBLIC_KEY

147
flake.lock generated
View File

@@ -16,39 +16,21 @@
"type": "github" "type": "github"
} }
}, },
"flake-utils": { "flake-parts": {
"inputs": { "inputs": {
"systems": "systems" "nixpkgs-lib": "nixpkgs-lib"
}, },
"locked": { "locked": {
"lastModified": 1731533236, "lastModified": 1772408722,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", "narHash": "sha256-rHuJtdcOjK7rAHpHphUb1iCvgkU3GpfvicLMwwnfMT0=",
"owner": "numtide", "owner": "hercules-ci",
"repo": "flake-utils", "repo": "flake-parts",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", "rev": "f20dc5d9b8027381c474144ecabc9034d6a839a3",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "numtide", "owner": "hercules-ci",
"repo": "flake-utils", "repo": "flake-parts",
"type": "github"
}
},
"flake-utils_2": {
"inputs": {
"systems": "systems_2"
},
"locked": {
"lastModified": 1681202837,
"narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "cfacdce06f30d2b68473a46042957675eebb3401",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github" "type": "github"
} }
}, },
@@ -59,34 +41,33 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1763992789, "lastModified": 1785119570,
"narHash": "sha256-WHkdBlw6oyxXIra/vQPYLtqY+3G8dUVZM8bEXk0t8x4=", "narHash": "sha256-Rgs2xKnGLFWQscxUaXX07oyZeuMDOHEbqDOsgliLFGM=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "44831a7eaba4360fb81f2acc5ea6de5fde90aaa3", "rev": "d4fd24667c8cbef124bb70a20380cab75ec8474d",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nix-community", "owner": "nix-community",
"ref": "release-25.05", "ref": "release-26.05",
"repo": "home-manager", "repo": "home-manager",
"type": "github" "type": "github"
} }
}, },
"nix4nvchad": { "nix4nvchad": {
"inputs": { "inputs": {
"flake-utils": "flake-utils",
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"
], ],
"nvchad-starter": "nvchad-starter" "nvchad-starter": "nvchad-starter"
}, },
"locked": { "locked": {
"lastModified": 1772187015, "lastModified": 1786241713,
"narHash": "sha256-8UA+HVKxRqyv1wuAln4gxskq8ZbW5ttKZg5kDp0R154=", "narHash": "sha256-+Ujhw7RDws25N6EYy/G4764k6T0hpGNqEup/bGTQrkc=",
"owner": "nix-community", "owner": "nix-community",
"repo": "nix4nvchad", "repo": "nix4nvchad",
"rev": "cde302611dfdcaece9756b48f68eb808645929b5", "rev": "a6277b06ed0de32831ce8e49686fd3a06201a23b",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -98,14 +79,16 @@
"nixos-wsl": { "nixos-wsl": {
"inputs": { "inputs": {
"flake-compat": "flake-compat", "flake-compat": "flake-compat",
"nixpkgs": "nixpkgs" "nixpkgs": [
"nixpkgs"
]
}, },
"locked": { "locked": {
"lastModified": 1771563879, "lastModified": 1784642409,
"narHash": "sha256-vA5hocvdGhr+jfBN7A7ogeZqIz2qx01EixXwdVsQcnE=", "narHash": "sha256-hcbDqFuySAJawljt5r0sKBCJKYnbtGD0T/ZIozH1Dq0=",
"owner": "nix-community", "owner": "nix-community",
"repo": "NixOS-WSL", "repo": "NixOS-WSL",
"rev": "379d20c55f552e91fb9f3f0382e4a97d3f452943", "rev": "eaeb18da90024448a60eb1ec7132eafa4003404e",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -117,50 +100,35 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1770019141, "lastModified": 1786430034,
"narHash": "sha256-VKS4ZLNx4PNrABoB0L8KUpc1fE7CLpQXQs985tGfaCU=", "narHash": "sha256-Vux08kA5PICwS2sViCMfwVLAHNoH8TkKAeBo25LjpMI=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "cb369ef2efd432b3cdf8622b0ffc0a97a02f3137", "rev": "70cc4559b10a6062b05ff1af17e0add065ccaed9",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "NixOS", "owner": "NixOS",
"ref": "nixos-unstable", "ref": "nixos-26.05",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }
}, },
"nixpkgs_2": { "nixpkgs-lib": {
"locked": { "locked": {
"lastModified": 1767313136, "lastModified": 1772328832,
"narHash": "sha256-16KkgfdYqjaeRGBaYsNrhPRRENs0qzkQVUooNHtoy2w=", "narHash": "sha256-e+/T/pmEkLP6BHhYjx6GmwP5ivonQQn0bJdH9YrRB+Q=",
"owner": "NixOS", "owner": "nix-community",
"repo": "nixpkgs", "repo": "nixpkgs.lib",
"rev": "ac62194c3917d5f474c1a844b6fd6da2db95077d", "rev": "c185c7a5e5dd8f9add5b2f8ebeff00888b070742",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "NixOS", "owner": "nix-community",
"ref": "nixos-25.05", "repo": "nixpkgs.lib",
"repo": "nixpkgs",
"type": "github" "type": "github"
} }
}, },
"nixpkgs_3": {
"locked": {
"lastModified": 1682134069,
"narHash": "sha256-TnI/ZXSmRxQDt2sjRYK/8j8iha4B4zP2cnQCZZ3vp7k=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "fd901ef4bf93499374c5af385b2943f5801c0833",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"nvchad-starter": { "nvchad-starter": {
"flake": false, "flake": false,
"locked": { "locked": {
@@ -183,7 +151,7 @@
"home-manager": "home-manager", "home-manager": "home-manager",
"nix4nvchad": "nix4nvchad", "nix4nvchad": "nix4nvchad",
"nixos-wsl": "nixos-wsl", "nixos-wsl": "nixos-wsl",
"nixpkgs": "nixpkgs_2", "nixpkgs": "nixpkgs",
"sops-nix": "sops-nix", "sops-nix": "sops-nix",
"vscode-server": "vscode-server" "vscode-server": "vscode-server"
} }
@@ -195,11 +163,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1772048434, "lastModified": 1786375908,
"narHash": "sha256-/wA0OaH6kZ/pFA+nXR/tvg5oupOmEDmMS5us79JT60o=", "narHash": "sha256-G7qDAT98nywA4EFmJCwIRO5wKvDlBBN3BWpsOnjAto8=",
"owner": "Mic92", "owner": "Mic92",
"repo": "sops-nix", "repo": "sops-nix",
"rev": "334daa7c273dd8bf7a0cd370e4e16022b64e55e9", "rev": "d1337e05ba0a8e88a75d2c0e1595d82f3b3e2ac4",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -208,47 +176,16 @@
"type": "github" "type": "github"
} }
}, },
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"systems_2": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"vscode-server": { "vscode-server": {
"inputs": { "inputs": {
"flake-utils": "flake-utils_2", "flake-parts": "flake-parts"
"nixpkgs": "nixpkgs_3"
}, },
"locked": { "locked": {
"lastModified": 1770124655, "lastModified": 1784312229,
"narHash": "sha256-yHmd2B13EtBUPLJ+x0EaBwNkQr9LTne1arLVxT6hSnY=", "narHash": "sha256-2uHCSUw341o3my1R0U0YCfbnMEazylxb58evWsjGL50=",
"owner": "nix-community", "owner": "nix-community",
"repo": "nixos-vscode-server", "repo": "nixos-vscode-server",
"rev": "92ce71c3ba5a94f854e02d57b14af4997ab54ef0", "rev": "2f984dfbe7e5271b5c413d3e734374cc1306c921",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@@ -2,10 +2,10 @@
description = "luochen570's NixOS configuration"; description = "luochen570's NixOS configuration";
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-26.05";
home-manager = { home-manager = {
url = "github:nix-community/home-manager/release-25.05"; url = "github:nix-community/home-manager/release-26.05";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
@@ -16,7 +16,10 @@
}; };
# NixOS WSL # NixOS WSL
nixos-wsl.url = "github:nix-community/NixOS-WSL/main"; nixos-wsl = {
url = "github:nix-community/NixOS-WSL/main";
inputs.nixpkgs.follows = "nixpkgs";
};
# VS Code Server # VS Code Server
vscode-server.url = "github:nix-community/nixos-vscode-server"; vscode-server.url = "github:nix-community/nixos-vscode-server";

View File

@@ -2,9 +2,9 @@
{ {
programs.git = { programs.git = {
enable = true; enable = true;
userName = "luochen570"; settings = {
userEmail = "1160510664@qq.com"; user.name = "luochen570";
extraConfig = { user.email = "1160510664@qq.com";
init.defaultBranch = "main"; init.defaultBranch = "main";
}; };
}; };

View File

@@ -1,28 +1,28 @@
{ config, pkgs, inputs, system, ... }: { config, pkgs, inputs, system, ... }:
{ {
# 导入 NvChad 模块 # 导入 NvChad 模块
imports = [ imports = [
inputs.nix4nvchad.homeManagerModules.default inputs.nix4nvchad.homeManagerModules.default
]; ];
programs.nvchad = { programs.nvchad = {
enable = true; enable = true;
# NvChad 需要的额外包 # NvChad 需要的额外包
extraPackages = with pkgs; [ extraPackages = with pkgs; [
# LSP 服务器 # LSP 服务器
nil # Nix LSP nil # Nix LSP
marksman # Markdown LSP marksman # Markdown LSP
# 格式化工具 # 格式化工具
nixpkgs-fmt nixpkgs-fmt
shfmt shfmt
]; ];
}; };
# 设置默认编辑器 # 设置默认编辑器
home.sessionVariables = { home.sessionVariables = {
EDITOR = "nvim"; EDITOR = "nvim";
VISUAL = "nvim"; VISUAL = "nvim";
}; };
} }

View File

@@ -1,12 +1,18 @@
{ config, ... }: { config, lib, ... }:
let
# 与 modules/core/sops.nix 保持同一开关secrets 文件存在时才启用。
secretsEnabled = builtins.pathExists ../../secrets/users/luochen570.enc.yaml;
in
{ {
programs.ssh.enable = true; programs.ssh.enable = true;
# ~/.ssh/id_rsa 来自 sops secret 文件。 home.file = lib.mkIf secretsEnabled {
home.file.".ssh/id_rsa".source = # ~/.ssh/id_rsa 来自 sops secret 文件。
config.lib.file.mkOutOfStoreSymlink "/run/secrets/users/luochen570/ssh_private_key"; ".ssh/id_rsa".source =
config.lib.file.mkOutOfStoreSymlink "/run/secrets/users/luochen570/ssh_private_key";
# ~/.ssh/config 来自 sops secret 文件。 # ~/.ssh/config 来自 sops secret 文件。
home.file.".ssh/config".source = ".ssh/config".source =
config.lib.file.mkOutOfStoreSymlink "/run/secrets/users/luochen570/ssh_config"; config.lib.file.mkOutOfStoreSymlink "/run/secrets/users/luochen570/ssh_config";
};
} }

View File

@@ -2,5 +2,6 @@
{ {
imports = [ imports = [
./configuration.nix ./configuration.nix
./hardware-configuration.nix
]; ];
} }

View File

@@ -21,10 +21,8 @@
# 由宿主机处理 fstrim # 由宿主机处理 fstrim
services.fstrim.enable = false; services.fstrim.enable = false;
services.resolved = { services.resolved.settings.Resolve = {
extraConfig = '' Cache = true;
Cache=true CacheFromLocalhost = true;
CacheFromLocalhost=true
'';
}; };
} }

View File

@@ -9,7 +9,9 @@
shell = pkgs.zsh; shell = pkgs.zsh;
} }
// lib.optionalAttrs (!(config.sops.secrets ? "users/luochen570/passwordHash")) { // lib.optionalAttrs (!(config.sops.secrets ? "users/luochen570/passwordHash")) {
initialPassword = "Dly928730@.."; # 安装新机时的临时密码快捷方式(明文仅用于首次安装,装完请改用 sops 哈希或移除)。
# 需要时解开注释使用;平时保持注释,避免明文进入 /nix/store。
# initialPassword = "Dly928730@..";
} }
// lib.optionalAttrs (config.sops.secrets ? "users/luochen570/authorized_key") { // lib.optionalAttrs (config.sops.secrets ? "users/luochen570/authorized_key") {
openssh.authorizedKeys.keyFiles = [ config.sops.secrets."users/luochen570/authorized_key".path ]; openssh.authorizedKeys.keyFiles = [ config.sops.secrets."users/luochen570/authorized_key".path ];

View File

@@ -4,9 +4,9 @@
enabled = "fcitx5"; enabled = "fcitx5";
fcitx5.addons = with pkgs; [ fcitx5.addons = with pkgs; [
fcitx5-rime fcitx5-rime
fcitx5-configtool qt6Packages.fcitx5-configtool
fcitx5-gtk fcitx5-gtk
fcitx5-chinese-addons qt6Packages.fcitx5-chinese-addons
]; ];
}; };

View File

@@ -3,14 +3,11 @@
# Ryzen 7 9700X 核显RDNA2相关的用户态支持。 # Ryzen 7 9700X 核显RDNA2相关的用户态支持。
# 作为辅助显卡配置保留X 的主显卡驱动仍由 # 作为辅助显卡配置保留X 的主显卡驱动仍由
# desktop profile / nvidia 模块控制。 # desktop profile / nvidia 模块控制。
# amdvlk 在 26.05 已被官方移除AMD 弃用RADV 默认启用)。
hardware.graphics = { hardware.graphics = {
enable = true; enable = true;
extraPackages = with pkgs; [ extraPackages = with pkgs; [
amdvlk
rocmPackages.clr.icd rocmPackages.clr.icd
]; ];
extraPackages32 = with pkgs; [
driversi686Linux.amdvlk
];
}; };
} }

View File

@@ -1,6 +1,6 @@
{ ... }: { ... }:
{ {
# VirtualBox Guest 增强支持 # VirtualBox Guest 增强支持
virtualisation.virtualbox.guest.enable = true; virtualisation.virtualbox.guest.enable = true;
virtualisation.virtualbox.guest.dragAndDrop = true; virtualisation.virtualbox.guest.dragAndDrop = true;
} }

View File

@@ -7,5 +7,5 @@
dates = "weekly"; dates = "weekly";
}; };
}; };
} }