调整项目结构和readme
This commit is contained in:
65
README.md
65
README.md
@@ -10,27 +10,26 @@
|
||||
│ ├── desktop.nix # 桌面环境配置
|
||||
│ └── server.nix # 服务器配置
|
||||
├── libs # 自定义库函数
|
||||
│ ├── default.nix # 导出所有库函数
|
||||
│ └── mkNixosSystem.nix # 创建nixosSystem的通用函数
|
||||
├── modules # 通用模块,不同机器可以根据的需要引入
|
||||
│ ├── home # home manager 通用模块
|
||||
│ │ └── - # home manager 通用模块
|
||||
│ └── nixos # nixos 通用模块
|
||||
│ └── - # nixos 通用模块
|
||||
├── overlays # 安装包的修改配置
|
||||
│ └── - # 安装包的修改配置
|
||||
│ └── default.nix # 覆盖配置入口
|
||||
├── pkgs # 自定义软件包
|
||||
│ └── -
|
||||
├── profiles # 不同机器的配置文件, 放置只有特定主机可以使用的配置
|
||||
│ ├── apollo # 主服务器配置
|
||||
│ │ ├── configuration.nix # 主要配置文件,包含系统模块、服务、用户设置等
|
||||
│ │ └── default.nix # 入口文件,负责创建nixosSystem并选择使用的nixpkgs版本
|
||||
│ │ ├── default.nix # 入口文件,负责创建nixosSystem并选择使用的nixpkgs版本
|
||||
│ │ ├── home # apollo的home-manager配置
|
||||
│ │ └── nixos # apollo的NixOS配置
|
||||
│ │ └── network.nix # 网络配置
|
||||
│ ├── gaea # 主用机配置
|
||||
│ │ ├── configuration.nix # 主要配置文件,包含系统模块、服务、用户设置等
|
||||
│ │ └── default.nix # 入口文件,负责创建nixosSystem并选择使用的nixpkgs版本
|
||||
│ │ ├── default.nix # 入口文件,负责创建nixosSystem并选择使用的nixpkgs版本
|
||||
│ │ ├── home # gaea的home-manager配置
|
||||
│ │ └── nixos # gaea的NixOS配置
|
||||
│ └── luna # 虚拟机配置
|
||||
│ ├── configuration.nix # 主要配置文件,包含系统模块、服务、用户设置等
|
||||
│ └── default.nix # 入口文件,负责创建nixosSystem并选择使用的nixpkgs版本
|
||||
│ ├── default.nix # 入口文件,负责创建nixosSystem并选择使用的nixpkgs版本
|
||||
│ ├── hardware-configuration.nix # 硬件配置
|
||||
│ └── network.nix # 网络配置
|
||||
├── flake.lock # flake 锁定文件
|
||||
├── flake.nix # nix flake 入口
|
||||
├── nixos-install.sh # nixos 全新安装脚本
|
||||
@@ -170,3 +169,45 @@ nixos-switch
|
||||
2. **profiles/[hostname]/default.nix** - 这是配置的入口文件,负责选择使用的 nixpkgs 版本并调用 libs.mkNixosSystem 函数。
|
||||
|
||||
3. **profiles/[hostname]/configuration.nix** - 包含实际的配置内容,如系统模块、服务、用户设置等。
|
||||
|
||||
## 垃圾清理
|
||||
|
||||
home-manager profiles 文件夹
|
||||
|
||||
```bash
|
||||
~/.local/state/nix/profiles/
|
||||
```
|
||||
|
||||
1. 列出历史版本
|
||||
|
||||
```bash
|
||||
# 最新api
|
||||
nix profile history --profile /nix/var/nix/profiles/system
|
||||
nix profile history --profile ~/.local/state/nix/profiles/home-manager
|
||||
|
||||
# nixos系统api
|
||||
nixos-rebuild list-generations
|
||||
|
||||
# 旧版api
|
||||
nix-env --list-generations -p /nix/var/nix/profiles/system
|
||||
```
|
||||
|
||||
2. 查看根依赖
|
||||
|
||||
```bash
|
||||
nix-store --query --roots /nix/store/ijr7hck016n92ds7zh9syv51qv4cl8zg-wechat-uos-4.0.0.23
|
||||
```
|
||||
|
||||
3. 删除历史generations
|
||||
|
||||
```bash
|
||||
nix profile wipe-history --profile ~/.local/state/nix/profiles/home-manager # 清除所有非当前
|
||||
nix profile wipe-history --older-than 1d --profile /nix/var/nix/profiles/system # 保留最近7天
|
||||
nix profile wipe-history --older-than 7d --profile ~/.local/state/nix/profiles/home-manager # home-manager单独清除
|
||||
```
|
||||
4. 删除旧版本
|
||||
|
||||
```bash
|
||||
nix-collect-garbage --delete-older-than 30d
|
||||
nix-collect-garbage -d # --delete-old 清除所有未使用的
|
||||
```
|
||||
|
||||
@@ -33,7 +33,8 @@
|
||||
(profile: {
|
||||
name = profile;
|
||||
value = import ./profiles/${profile} {
|
||||
inherit self inputs outputs libs nixos sourcepath username useremail;
|
||||
inherit self inputs outputs libs nixos profile sourcepath username useremail;
|
||||
hostname = profile;
|
||||
};
|
||||
})
|
||||
(attrNames (readDir ./profiles))
|
||||
@@ -48,7 +49,7 @@
|
||||
extraSpecialArgs = {
|
||||
inherit inputs outputs username useremail;
|
||||
hyprland = inputs.hyprland;
|
||||
sysversion = "unstable";
|
||||
version = "${nixos.unstable.version}";
|
||||
};
|
||||
modules = [
|
||||
# > Our main home-manager configuration file <
|
||||
|
||||
@@ -17,8 +17,8 @@ in
|
||||
extraGroups = [
|
||||
"users"
|
||||
"wheel"
|
||||
"networkmanager"
|
||||
"audio"
|
||||
"networkmanager"
|
||||
];
|
||||
openssh.authorizedKeys.keys = [
|
||||
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCc62MxAVqX8LDFAiDiXlc8d3JU1S3xYVO8WpfgoVYPyrd2fkK2Dr1tSedJyGWc3ADOxzUbsTic8b1BOdmbx4ZPwI+a3nJrVVkmIRSAs5haEZqG8NXDv1kl4xL+J9tVA2jwScl6MRzqyVMgtIAvnsVW9+DrL2Y2b20NvuWz3XndZ8vEUFZLLCQJQRpGrY2ZnTvNXZo12GrD5daiMii52ZuhfNBx17oFnf70sj+phZbp5m2mKL9jfKaDSG+E7Pa/IbB/iivD/QSm0SueYXbsdtMBhtsxvH/i0pJogUlVpa42CRIDUVoHOvfk0Hk83xyIIl2b78xfGEyCQBBU6sSk726xXpqzfxJJ7FiYqhLMKKDFmD28EOs4BUveyZudWNcP0a1+uBBcrefNAwU6EOSg65BOxxvZFbNG1I7YDTiKvYFy965+WkN5QKbBVSy08ziS1MQt224ZooAdxCKESGRr9IqKvq9ONnb0MtmC4ht/n8U9VaeLVq3XDXZZHEUq0cw748k= alex@gaea"
|
||||
|
||||
@@ -2,11 +2,29 @@ args@{ libs, inputs, nixos, ... }:
|
||||
let
|
||||
# 使用pkgs.unstable中的nixpkgs和home-manager
|
||||
inherit (nixos.unstable) nixpkgs home-manager version;
|
||||
sysArgs = args // { inherit home-manager version; };
|
||||
in
|
||||
# 使用libs.mkNixosSystem创建nixosSystem
|
||||
libs.mkNixosSystem {
|
||||
inherit nixpkgs;
|
||||
args = sysArgs;
|
||||
path = ./.;
|
||||
specialArgs = args // { inherit home-manager version; };
|
||||
|
||||
configuration = conf-args@{ self, pkgs, home-manager, username, version, ... }: {
|
||||
imports = [
|
||||
./nixos
|
||||
|
||||
home-manager.nixosModules.home-manager
|
||||
{
|
||||
# home-manager.useGlobalPkgs = true;
|
||||
# home-manager.useUserPackages = true;
|
||||
home-manager = {
|
||||
extraSpecialArgs = {
|
||||
inherit (conf-args) self inputs outputs libs sourcepath hostname username useremail version;
|
||||
};
|
||||
users."${username}" = ./home;
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
in
|
||||
nixpkgs.lib.nixosSystem {
|
||||
inherit specialArgs;
|
||||
modules = [
|
||||
configuration
|
||||
];
|
||||
}
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
|
||||
|
||||
Host *
|
||||
ForwardAgent no
|
||||
AddKeysToAgent no
|
||||
Compression no
|
||||
ServerAliveInterval 0
|
||||
ServerAliveCountMax 3
|
||||
HashKnownHosts no
|
||||
UserKnownHostsFile ~/.ssh/known_hosts
|
||||
ControlMaster no
|
||||
ControlPath ~/.ssh/master-%r@%n:%p
|
||||
ControlPersist no
|
||||
|
||||
Host gaea
|
||||
HostName 10.7.43.20
|
||||
|
||||
Host zion
|
||||
HostName 10.7.43.1
|
||||
User root
|
||||
|
||||
Host themis
|
||||
HostName 10.7.43.30
|
||||
|
||||
Host armor
|
||||
HostName armor.synebula.com
|
||||
|
||||
Host server.company
|
||||
HostName file.xzdcbj.com.cn
|
||||
User xzdc
|
||||
Port 57982
|
||||
|
||||
Host server.info
|
||||
HostName info.xzdcbj.com.cn
|
||||
User info
|
||||
|
||||
Host server.file
|
||||
HostName file.xzdcbj.com.cn
|
||||
User file
|
||||
|
||||
Host server.armor
|
||||
HostName armor.synebula.com
|
||||
|
||||
Host ems.hc
|
||||
Port 57991
|
||||
User root
|
||||
|
||||
Host ems.cx
|
||||
Port 57996
|
||||
|
||||
Host ems.ph
|
||||
Port 57996
|
||||
|
||||
Host ems.yt
|
||||
Port 57996
|
||||
User xzdc
|
||||
|
||||
Host ems.*
|
||||
HostName file.xzdcbj.com.cn
|
||||
User ems
|
||||
|
||||
Host *
|
||||
Port 22
|
||||
User alex
|
||||
IdentityFile ~/.ssh/id_rsa
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
{ self, pkgs, ... }: {
|
||||
imports = [
|
||||
./ssh
|
||||
"${self}/home/desktop.nix"
|
||||
"${self}/modules/home/develop.nix"
|
||||
];
|
||||
|
||||
home.packages = with pkgs; [
|
||||
64
profiles/apollo/home/ssh/config
Normal file
64
profiles/apollo/home/ssh/config
Normal file
@@ -0,0 +1,64 @@
|
||||
Host *
|
||||
ForwardAgent no
|
||||
AddKeysToAgent no
|
||||
Compression no
|
||||
ServerAliveInterval 0
|
||||
ServerAliveCountMax 3
|
||||
HashKnownHosts no
|
||||
UserKnownHostsFile ~/.ssh/known_hosts
|
||||
ControlMaster no
|
||||
ControlPath ~/.ssh/master-%r@%n:%p
|
||||
ControlPersist no
|
||||
|
||||
Host gaea
|
||||
HostName 10.7.43.20
|
||||
|
||||
Host zion
|
||||
HostName 10.7.43.1
|
||||
User root
|
||||
|
||||
Host themis
|
||||
HostName 10.7.43.30
|
||||
|
||||
Host armor
|
||||
HostName armor.synebula.com
|
||||
|
||||
Host server.company
|
||||
HostName file.xzdcbj.com.cn
|
||||
User xzdc
|
||||
Port 57982
|
||||
|
||||
Host server.info
|
||||
HostName info.xzdcbj.com.cn
|
||||
User info
|
||||
|
||||
Host server.file
|
||||
HostName file.xzdcbj.com.cn
|
||||
User file
|
||||
|
||||
Host server.armor
|
||||
HostName armor.synebula.com
|
||||
|
||||
Host ems.hc
|
||||
Port 57991
|
||||
User root
|
||||
|
||||
Host ems.cx
|
||||
Port 57996
|
||||
|
||||
Host ems.ph
|
||||
Port 57996
|
||||
|
||||
Host ems.yt
|
||||
Port 57996
|
||||
User xzdc
|
||||
|
||||
Host ems.*
|
||||
HostName file.xzdcbj.com.cn
|
||||
User ems
|
||||
|
||||
Host *
|
||||
Port 22
|
||||
User alex
|
||||
IdentityFile ~/.ssh/id_rsa
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
{ config, pkgs, hostname, ... }: {
|
||||
networking = {
|
||||
hostId = "6fa8b74d";
|
||||
hostName = "${hostname}";
|
||||
|
||||
# wireless.enable = false; # Enables wireless support via wpa_supplicant.
|
||||
|
||||
# Configure network proxy if necessary
|
||||
# proxy.default = "http://user:password@proxy:port/";
|
||||
# proxy.noProxy = "127.0.0.1,localhost,internal.domain";
|
||||
|
||||
networkmanager = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
enableIPv6 = true;
|
||||
|
||||
# bridges = {
|
||||
# br0 = { interfaces = [ "eno1" ]; };
|
||||
# };
|
||||
|
||||
# Set up bridge network
|
||||
interfaces = {
|
||||
eno1 = {
|
||||
useDHCP = false;
|
||||
ipv4.addresses = [
|
||||
{
|
||||
address = "10.7.43.10";
|
||||
prefixLength = 24;
|
||||
}
|
||||
];
|
||||
wakeOnLan = {
|
||||
enable = true;
|
||||
policy = [
|
||||
"magic"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
# br0 = {
|
||||
# useDHCP = false;
|
||||
# ipv4.addresses = [
|
||||
# {
|
||||
# address = "10.7.43.10";
|
||||
# prefixLength = 24;
|
||||
# }
|
||||
# ];
|
||||
# };
|
||||
};
|
||||
|
||||
defaultGateway = {
|
||||
address = "10.7.43.30";
|
||||
interface = "eno1";
|
||||
# interface = "br0";
|
||||
};
|
||||
nameservers = [ "10.7.43.1" ];
|
||||
};
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
args@{ self, pkgs, home-manager, username, version, ... }: {
|
||||
# You can import other NixOS modules here
|
||||
{ self, pkgs, username, version, ... }: {
|
||||
imports = [
|
||||
./mount.nix
|
||||
./network.nix
|
||||
@@ -9,28 +8,10 @@ args@{ self, pkgs, home-manager, username, version, ... }: {
|
||||
"${self}/modules/nixos/fonts"
|
||||
"${self}/modules/nixos/user.nix"
|
||||
"${self}/modules/nixos/audio.nix"
|
||||
|
||||
"${self}/modules/nixos/samba.nix"
|
||||
"${self}/modules/nixos/virtualize/appimage.nix"
|
||||
"${self}/modules/nixos/virtualize/docker.nix"
|
||||
|
||||
home-manager.nixosModules.home-manager
|
||||
{
|
||||
# home-manager.useGlobalPkgs = true;
|
||||
# home-manager.useUserPackages = true;
|
||||
home-manager = {
|
||||
extraSpecialArgs = {
|
||||
inherit (args) self inputs outputs libs sourcepath hostname username useremail version;
|
||||
};
|
||||
users."${username}" = { ... }: {
|
||||
imports = [
|
||||
./hm
|
||||
"${self}/home/desktop.nix"
|
||||
"${self}/modules/home/develop.nix"
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
"${self}/modules/nixos/gnome.nix"
|
||||
];
|
||||
|
||||
hardware.graphics = {
|
||||
42
profiles/apollo/nixos/network.nix
Normal file
42
profiles/apollo/nixos/network.nix
Normal file
@@ -0,0 +1,42 @@
|
||||
{ config, pkgs, hostname, ... }: {
|
||||
networking = {
|
||||
hostId = "6fa8b74d";
|
||||
hostName = "${hostname}";
|
||||
|
||||
networkmanager = {
|
||||
enable = true;
|
||||
ensureProfiles.profiles = {
|
||||
"eno1" = {
|
||||
connection = {
|
||||
id = "eno1";
|
||||
type = "ethernet"; # 有线连接
|
||||
autoconnect = true; # 自动连接
|
||||
};
|
||||
ipv4 = {
|
||||
method = "manual"; # 设置为手动配置 IPv4
|
||||
addresses = "10.7.43.10/24,10.7.43.30";
|
||||
# 如果需要,可以添加 DNS 服务器
|
||||
# dns = [ "10.7.43.1" "8.8.8.8" ];
|
||||
};
|
||||
ipv6 = {
|
||||
method = "auto"; # 设置为自动配置 IPv6 (动态)
|
||||
};
|
||||
ethernet = {
|
||||
wake-on-lan=64;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
interfaces = {
|
||||
eno1 = {
|
||||
wakeOnLan = {
|
||||
enable = true;
|
||||
policy = [
|
||||
"magic"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
args@{ self, pkgs, home-manager, username, version, ... }: {
|
||||
# You can import other NixOS modules here
|
||||
imports = [
|
||||
# If you want to use modules your own flake exports (from modules/nixos):
|
||||
# outputs.nixosModules.example
|
||||
|
||||
# Or modules from other flakes (such as nixos-hardware):
|
||||
# inputs.hardware.nixosModules.common-cpu-amd
|
||||
# inputs.hardware.nixosModules.common-ssd
|
||||
|
||||
# You can also split up your configuration and import pieces of it here:
|
||||
# ./users
|
||||
|
||||
# Import your generated (nixos-generate-config) hardware configuration
|
||||
./mount.nix
|
||||
./network.nix
|
||||
./hardware-configuration.nix
|
||||
|
||||
"${self}/modules/nixos/core"
|
||||
"${self}/modules/nixos/fonts"
|
||||
"${self}/modules/nixos/user.nix"
|
||||
"${self}/modules/nixos/audio.nix"
|
||||
"${self}/modules/nixos/nvidia.nix"
|
||||
"${self}/modules/nixos/samba.nix"
|
||||
"${self}/modules/nixos/zfs.nix"
|
||||
"${self}/modules/nixos/sysatomic.nix"
|
||||
|
||||
"${self}/modules/nixos/virtualize/libvirtd"
|
||||
"${self}/modules/nixos/virtualize/docker.nix"
|
||||
|
||||
home-manager.nixosModules.home-manager
|
||||
{
|
||||
# home-manager.useGlobalPkgs = true;
|
||||
# home-manager.useUserPackages = true;
|
||||
home-manager = {
|
||||
extraSpecialArgs = {
|
||||
inherit (args) self inputs outputs libs sourcepath hostname username useremail version;
|
||||
};
|
||||
users."${username}" = { ... }: {
|
||||
imports = [
|
||||
./hm
|
||||
"${self}/home/desktop.nix"
|
||||
"${self}/modules/home/develop.nix"
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
];
|
||||
|
||||
# https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion
|
||||
system.stateVersion = version;
|
||||
}
|
||||
@@ -1,12 +1,29 @@
|
||||
args@{ libs, inputs, nixos, ... }:
|
||||
let
|
||||
# 使用pkgs.unstable中的nixpkgs和home-manager
|
||||
inherit (nixos.unstable) nixpkgs home-manager version;
|
||||
sysArgs = args // { inherit home-manager version; };
|
||||
in
|
||||
# 使用libs.mkNixosSystem创建nixosSystem
|
||||
libs.mkNixosSystem {
|
||||
inherit nixpkgs;
|
||||
args = sysArgs;
|
||||
path = ./.;
|
||||
specialArgs = args // { inherit home-manager version; };
|
||||
configuration = conf-args@{ self, home-manager, username, ... }: {
|
||||
imports = [
|
||||
./nixos
|
||||
|
||||
home-manager.nixosModules.home-manager
|
||||
{
|
||||
# home-manager.useGlobalPkgs = true;
|
||||
# home-manager.useUserPackages = true;
|
||||
home-manager = {
|
||||
extraSpecialArgs = {
|
||||
inherit (conf-args) self inputs outputs libs sourcepath hostname username useremail version;
|
||||
};
|
||||
users."${username}" = ./home;
|
||||
};
|
||||
}
|
||||
];
|
||||
|
||||
};
|
||||
in
|
||||
nixpkgs.lib.nixosSystem {
|
||||
inherit specialArgs;
|
||||
modules = [
|
||||
configuration
|
||||
];
|
||||
}
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
{ ... }: {
|
||||
imports = [
|
||||
./ssh.nix
|
||||
./hyprland.nix
|
||||
];
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
{ config, ... }:
|
||||
{
|
||||
programs.ssh = {
|
||||
enable = true;
|
||||
|
||||
# 全局 SSH 配置
|
||||
extraConfig = ''
|
||||
Host apollo
|
||||
HostName 10.7.43.10
|
||||
|
||||
Host zion
|
||||
HostName 10.7.43.1
|
||||
User root
|
||||
|
||||
Host themis
|
||||
HostName 10.7.43.30
|
||||
|
||||
Host armor
|
||||
HostName armor.synebula.com
|
||||
|
||||
Host server.company
|
||||
HostName file.xzdcbj.com.cn
|
||||
User xzdc
|
||||
Port 57982
|
||||
|
||||
Host server.info
|
||||
HostName info.xzdcbj.com.cn
|
||||
User info
|
||||
|
||||
Host server.file
|
||||
HostName file.xzdcbj.com.cn
|
||||
User file
|
||||
|
||||
Host server.armor
|
||||
HostName armor.synebula.com
|
||||
|
||||
Host ems.hc
|
||||
Port 57991
|
||||
User root
|
||||
|
||||
Host ems.cx
|
||||
Port 57996
|
||||
|
||||
Host ems.ph
|
||||
Port 57996
|
||||
|
||||
Host ems.yt
|
||||
Port 57996
|
||||
User xzdc
|
||||
|
||||
Host ems.*
|
||||
HostName file.xzdcbj.com.cn
|
||||
User ems
|
||||
|
||||
Host *
|
||||
Port 22
|
||||
User alex
|
||||
IdentityFile ~/.ssh/id_rsa
|
||||
'';
|
||||
};
|
||||
}
|
||||
12
profiles/gaea/home/default.nix
Normal file
12
profiles/gaea/home/default.nix
Normal file
@@ -0,0 +1,12 @@
|
||||
{ self, pkgs, ... }: {
|
||||
imports = [
|
||||
./ssh
|
||||
"${self}/home/desktop.nix"
|
||||
"${self}/modules/home/develop.nix"
|
||||
];
|
||||
|
||||
home.packages = with pkgs; [
|
||||
nextcloud-client
|
||||
kodi
|
||||
];
|
||||
}
|
||||
@@ -5,11 +5,8 @@
|
||||
sessionVariables = {
|
||||
# for hyprland with nvidia gpu, ref https://wiki.hyprland.org/Nvidia/
|
||||
# 启用注释部分会导致NVIDIA下无法启动hyprland
|
||||
LIBVA_DRIVER_NAME = "nvidia";
|
||||
__GLX_VENDOR_LIBRARY_NAME = "nvidia";
|
||||
|
||||
# WLR_RENDERER = "vulkan";
|
||||
# GBM_BACKEND = "nvidia-drm";
|
||||
WLR_DRM_DEVICES = "/dev/dri/card1";
|
||||
AQ_DRM_DEVICES = "/dev/dri/card1";
|
||||
};
|
||||
};
|
||||
}
|
||||
64
profiles/gaea/home/ssh/config
Normal file
64
profiles/gaea/home/ssh/config
Normal file
@@ -0,0 +1,64 @@
|
||||
|
||||
Host *
|
||||
ForwardAgent no
|
||||
AddKeysToAgent no
|
||||
Compression no
|
||||
ServerAliveInterval 0
|
||||
ServerAliveCountMax 3
|
||||
HashKnownHosts no
|
||||
UserKnownHostsFile ~/.ssh/known_hosts
|
||||
ControlMaster no
|
||||
ControlPath ~/.ssh/master-%r@%n:%p
|
||||
ControlPersist no
|
||||
|
||||
Host apollo
|
||||
HostName 10.7.43.10
|
||||
|
||||
Host zion
|
||||
HostName 10.7.43.1
|
||||
User root
|
||||
|
||||
Host themis
|
||||
HostName 10.7.43.30
|
||||
|
||||
Host armor
|
||||
HostName armor.synebula.com
|
||||
|
||||
Host server.company
|
||||
HostName file.xzdcbj.com.cn
|
||||
User xzdc
|
||||
Port 57982
|
||||
|
||||
Host server.info
|
||||
HostName info.xzdcbj.com.cn
|
||||
User info
|
||||
|
||||
Host server.file
|
||||
HostName file.xzdcbj.com.cn
|
||||
User file
|
||||
|
||||
Host server.armor
|
||||
HostName armor.synebula.com
|
||||
|
||||
Host ems.hc
|
||||
Port 57991
|
||||
User root
|
||||
|
||||
Host ems.cx
|
||||
Port 57996
|
||||
|
||||
Host ems.ph
|
||||
Port 57996
|
||||
|
||||
Host ems.yt
|
||||
Port 57996
|
||||
User xzdc
|
||||
|
||||
Host ems.*
|
||||
HostName file.xzdcbj.com.cn
|
||||
User ems
|
||||
|
||||
Host *
|
||||
Port 22
|
||||
User alex
|
||||
IdentityFile ~/.ssh/id_rsa
|
||||
9
profiles/gaea/home/ssh/default.nix
Normal file
9
profiles/gaea/home/ssh/default.nix
Normal file
@@ -0,0 +1,9 @@
|
||||
{ config, flakesPath, ... }: {
|
||||
programs.ssh = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
home.file.".ssh/config" = {
|
||||
source = config.home-libs.mkOutOfStoreSymlink "profiles/apollo/hm/ssh/config";
|
||||
};
|
||||
}
|
||||
22
profiles/gaea/nixos/default.nix
Normal file
22
profiles/gaea/nixos/default.nix
Normal file
@@ -0,0 +1,22 @@
|
||||
{ self, pkgs, version, ... }: {
|
||||
imports = [
|
||||
./mount.nix
|
||||
./network.nix
|
||||
./hardware-configuration.nix
|
||||
|
||||
"${self}/modules/nixos/core"
|
||||
"${self}/modules/nixos/fonts"
|
||||
"${self}/modules/nixos/user.nix"
|
||||
"${self}/modules/nixos/audio.nix"
|
||||
"${self}/modules/nixos/nvidia.nix"
|
||||
"${self}/modules/nixos/samba.nix"
|
||||
"${self}/modules/nixos/zfs.nix"
|
||||
"${self}/modules/nixos/sysatomic.nix"
|
||||
|
||||
"${self}/modules/nixos/virtualize/libvirtd"
|
||||
"${self}/modules/nixos/virtualize/docker.nix"
|
||||
];
|
||||
|
||||
# https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion
|
||||
system.stateVersion = version;
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
args@{ self, home-manager, username, version, ... }: {
|
||||
|
||||
# You can import other NixOS modules here
|
||||
imports = [
|
||||
# If you want to use modules your own flake exports (from modules/nixos):
|
||||
# outputs.nixosModules.example
|
||||
|
||||
# Or modules from other flakes (such as nixos-hardware):
|
||||
# inputs.hardware.nixosModules.common-cpu-amd
|
||||
# inputs.hardware.nixosModules.common-ssd
|
||||
|
||||
# You can also split up your configuration and import pieces of it here:
|
||||
# ./users.nix
|
||||
|
||||
# Import your generated (nixos-generate-config) hardware configuration
|
||||
./network.nix
|
||||
./hardware-configuration.nix
|
||||
|
||||
"${self}/modules/nixos/core"
|
||||
"${self}/modules/nixos/user.nix"
|
||||
"${self}/modules/nixos/sysatomic.nix"
|
||||
|
||||
home-manager.nixosModules.home-manager
|
||||
{
|
||||
# home-manager.useGlobalPkgs = true;
|
||||
# home-manager.useUserPackages = true;
|
||||
home-manager = {
|
||||
extraSpecialArgs = {
|
||||
inherit (args) self inputs outputs libs sourcepath hostname username useremail version;
|
||||
};
|
||||
users."${username}" = { ... }: {
|
||||
imports = [
|
||||
"${self}/home/desktop.nix"
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
];
|
||||
|
||||
# https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion
|
||||
system.stateVersion = version;
|
||||
}
|
||||
@@ -2,11 +2,54 @@ args@{ libs, inputs, nixos, ... }:
|
||||
let
|
||||
# 使用pkgs.unstable中的nixpkgs和home-manager
|
||||
inherit (nixos.unstable) nixpkgs home-manager version;
|
||||
sysArgs = args // { inherit home-manager version; };
|
||||
in
|
||||
# 使用libs.mkNixosSystem创建nixosSystem
|
||||
libs.mkNixosSystem {
|
||||
inherit nixpkgs;
|
||||
args = sysArgs;
|
||||
path = ./.;
|
||||
specialArgs = args // { inherit home-manager version; };
|
||||
|
||||
configuration = conf-args@{ self, home-manager, username, version, ... }: {
|
||||
# You can import other NixOS modules here
|
||||
imports = [
|
||||
# If you want to use modules your own flake exports (from modules/nixos):
|
||||
# outputs.nixosModules.example
|
||||
|
||||
# Or modules from other flakes (such as nixos-hardware):
|
||||
# inputs.hardware.nixosModules.common-cpu-amd
|
||||
# inputs.hardware.nixosModules.common-ssd
|
||||
|
||||
# You can also split up your configuration and import pieces of it here:
|
||||
# ./users.nix
|
||||
|
||||
# Import your generated (nixos-generate-config) hardware configuration
|
||||
./network.nix
|
||||
./hardware-configuration.nix
|
||||
|
||||
"${self}/modules/nixos/core"
|
||||
"${self}/modules/nixos/user.nix"
|
||||
"${self}/modules/nixos/sysatomic.nix"
|
||||
|
||||
home-manager.nixosModules.home-manager
|
||||
{
|
||||
# home-manager.useGlobalPkgs = true;
|
||||
# home-manager.useUserPackages = true;
|
||||
home-manager = {
|
||||
extraSpecialArgs = {
|
||||
inherit (conf-args) self inputs outputs libs sourcepath hostname username useremail version;
|
||||
};
|
||||
users."${username}" = { ... }: {
|
||||
imports = [
|
||||
"${self}/home/desktop.nix"
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
];
|
||||
|
||||
# https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion
|
||||
system.stateVersion = version;
|
||||
};
|
||||
|
||||
in
|
||||
nixpkgs.lib.nixosSystem {
|
||||
inherit specialArgs;
|
||||
modules = [
|
||||
configuration
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user