new file: .gitignore
new file: .sops.yaml new file: README.md modified: flake.nix new file: home/README.md new file: home/default.nix modified: home/git.nix new file: home/ssh.nix new file: hosts/README.md new file: hosts/desktop/README.md new file: hosts/desktop/configuration.nix new file: hosts/desktop/default.nix new file: hosts/server/README.md new file: hosts/server/configuration.nix modified: hosts/server/default.nix new file: hosts/wsl/README.md new file: hosts/wsl/configuration.nix new file: hosts/wsl/default.nix new file: lib/README.md new file: lib/hosts.nix modified: lib/mkHost.nix new file: modules/README.md new file: modules/core/README.md new file: modules/core/default.nix new file: modules/core/sops.nix new file: modules/core/users.nix new file: modules/desktop/README.md new file: modules/desktop/apps.nix new file: modules/desktop/de/README.md new file: modules/desktop/de/default.nix new file: modules/desktop/de/kde.nix new file: modules/desktop/default.nix new file: modules/desktop/wm/README.md new file: modules/desktop/wm/default.nix new file: modules/drivers/README.md new file: modules/drivers/amdgpu.nix new file: modules/drivers/nvidia.nix new file: modules/server/README.md new file: modules/server/default.nix new file: modules/server/docker.nix new file: modules/server/ssh.nix new file: modules/wsl/README.md new file: modules/wsl/configuration.nix new file: modules/wsl/default.nix deleted: modules/wsl/wsl.nix new file: overlays/README.md new file: profiles/README.md new file: profiles/desktop.nix modified: profiles/server.nix new file: profiles/wsl.nix new file: secrets/README.md new file: secrets/users/README.md new file: secrets/users/luochen570.enc.yaml.example 添加了一些文件并优化了了部分配置 桌面驱动有待改进等我去nixos实际操作一下改进 该配置纯gpt生产,可能存在一些问题,欢迎大家提出意见和建议 未经任何测试,直接提交了,请勿直接使用
This commit is contained in:
11
modules/core/README.md
Normal file
11
modules/core/README.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# 🧭 modules/core
|
||||
|
||||
所有主机场景都会引入的基础模块。
|
||||
|
||||
## 🌲 目录树
|
||||
```text
|
||||
🧭 modules/core
|
||||
├─ 🧩 default.nix # 基础 imports + 时区/镜像源/flakes 等默认设置
|
||||
├─ 👤 users.nix # 用户、默认 shell、密码与公钥
|
||||
└─ 🔐 sops.nix # sops-nix secret 映射
|
||||
```
|
||||
46
modules/core/default.nix
Normal file
46
modules/core/default.nix
Normal file
@@ -0,0 +1,46 @@
|
||||
{ lib, pkgs, ... }:
|
||||
{
|
||||
imports = [
|
||||
./users.nix
|
||||
./sops.nix
|
||||
];
|
||||
|
||||
nix.settings = {
|
||||
experimental-features = [ "nix-command" "flakes" ];
|
||||
auto-optimise-store = true;
|
||||
substituters = [
|
||||
"https://cache.nixos.org"
|
||||
"https://mirrors.tuna.tsinghua.edu.cn/nix-channels/store"
|
||||
"https://mirror.sjtu.edu.cn/nix-channels/store"
|
||||
];
|
||||
trusted-public-keys = [
|
||||
"cache.nixos.org-1:6NCHdD59X431o0gWypbtr1HEhF2M7wP6+jJj6Jm23UM="
|
||||
];
|
||||
};
|
||||
|
||||
nix.gc = {
|
||||
automatic = true;
|
||||
dates = "weekly";
|
||||
options = "--delete-older-than 14d";
|
||||
};
|
||||
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
|
||||
time.timeZone = lib.mkDefault "Asia/Shanghai";
|
||||
i18n.defaultLocale = lib.mkDefault "zh_CN.UTF-8";
|
||||
|
||||
networking.firewall.enable = lib.mkDefault true;
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
curl
|
||||
eza
|
||||
git
|
||||
htop
|
||||
ranger
|
||||
vim
|
||||
wget
|
||||
];
|
||||
|
||||
system.stateVersion = lib.mkDefault "25.05";
|
||||
}
|
||||
|
||||
24
modules/core/sops.nix
Normal file
24
modules/core/sops.nix
Normal file
@@ -0,0 +1,24 @@
|
||||
{ lib, ... }:
|
||||
let
|
||||
secretFile = ../../secrets/users/luochen570.enc.yaml;
|
||||
in
|
||||
{
|
||||
sops = {
|
||||
age = {
|
||||
keyFile = "/var/lib/sops-nix/key.txt";
|
||||
generateKey = true;
|
||||
};
|
||||
defaultSopsFile = secretFile;
|
||||
secrets = lib.mkIf (builtins.pathExists secretFile) {
|
||||
"users/luochen570/authorized_key" = {};
|
||||
"users/luochen570/ssh_config" = {
|
||||
owner = "luochen570";
|
||||
group = "users";
|
||||
mode = "0600";
|
||||
};
|
||||
"users/luochen570/passwordHash" = {
|
||||
neededForUsers = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
23
modules/core/users.nix
Normal file
23
modules/core/users.nix
Normal file
@@ -0,0 +1,23 @@
|
||||
{ lib, pkgs, username, config, ... }:
|
||||
{
|
||||
programs.zsh.enable = true;
|
||||
users.defaultUserShell = pkgs.zsh;
|
||||
|
||||
users.users.${username} = {
|
||||
isNormalUser = true;
|
||||
extraGroups = [ "wheel" ];
|
||||
shell = pkgs.zsh;
|
||||
};
|
||||
|
||||
users.users.${username}.initialPassword = lib.mkIf
|
||||
(!(config.sops.secrets ? "users/luochen570/passwordHash"))
|
||||
"Dly928730@..";
|
||||
|
||||
users.users.${username}.openssh.authorizedKeys.keyFiles = lib.mkIf
|
||||
(config.sops.secrets ? "users/luochen570/authorized_key")
|
||||
[ config.sops.secrets."users/luochen570/authorized_key".path ];
|
||||
|
||||
users.users.${username}.hashedPasswordFile = lib.mkIf
|
||||
(config.sops.secrets ? "users/luochen570/passwordHash")
|
||||
config.sops.secrets."users/luochen570/passwordHash".path;
|
||||
}
|
||||
Reference in New Issue
Block a user