From 05c8ab6c82b9e049b0303debef351c3cfc16fedc Mon Sep 17 00:00:00 2001 From: alex Date: Fri, 9 May 2025 14:40:19 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E9=A1=B9=E7=9B=AE=E7=BB=93?= =?UTF-8?q?=E6=9E=84=E5=92=8Creadme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 65 ++++++++++++++---- flake.nix | 5 +- modules/nixos/user.nix | 2 +- profiles/apollo/default.nix | 30 +++++++-- profiles/apollo/hm/ssh/config | 66 ------------------- profiles/apollo/{hm => home}/default.nix | 2 + profiles/apollo/{hm => home}/hyprland.nix | 0 profiles/apollo/home/ssh/config | 64 ++++++++++++++++++ profiles/apollo/{hm => home}/ssh/default.nix | 0 profiles/apollo/network.nix | 58 ---------------- .../{configuration.nix => nixos/default.nix} | 23 +------ .../{ => nixos}/hardware-configuration.nix | 0 profiles/apollo/{ => nixos}/mount.nix | 0 profiles/apollo/nixos/network.nix | 42 ++++++++++++ profiles/gaea/configuration.nix | 52 --------------- profiles/gaea/default.nix | 31 +++++++-- profiles/gaea/hm/default.nix | 6 -- profiles/gaea/hm/ssh.nix | 61 ----------------- profiles/gaea/home/default.nix | 12 ++++ profiles/gaea/{hm => home}/hyprland.nix | 7 +- profiles/gaea/home/ssh/config | 64 ++++++++++++++++++ profiles/gaea/home/ssh/default.nix | 9 +++ profiles/gaea/nixos/default.nix | 22 +++++++ .../{ => nixos}/hardware-configuration.nix | 0 profiles/gaea/{ => nixos}/mount.nix | 0 profiles/gaea/{ => nixos}/network.nix | 0 profiles/luna/configuration.nix | 42 ------------ profiles/luna/default.nix | 55 ++++++++++++++-- 28 files changed, 373 insertions(+), 345 deletions(-) delete mode 100644 profiles/apollo/hm/ssh/config rename profiles/apollo/{hm => home}/default.nix (63%) rename profiles/apollo/{hm => home}/hyprland.nix (100%) create mode 100644 profiles/apollo/home/ssh/config rename profiles/apollo/{hm => home}/ssh/default.nix (100%) delete mode 100644 profiles/apollo/network.nix rename profiles/apollo/{configuration.nix => nixos/default.nix} (56%) rename profiles/apollo/{ => nixos}/hardware-configuration.nix (100%) rename profiles/apollo/{ => nixos}/mount.nix (100%) create mode 100644 profiles/apollo/nixos/network.nix delete mode 100644 profiles/gaea/configuration.nix delete mode 100644 profiles/gaea/hm/default.nix delete mode 100644 profiles/gaea/hm/ssh.nix create mode 100644 profiles/gaea/home/default.nix rename profiles/gaea/{hm => home}/hyprland.nix (57%) create mode 100644 profiles/gaea/home/ssh/config create mode 100644 profiles/gaea/home/ssh/default.nix create mode 100644 profiles/gaea/nixos/default.nix rename profiles/gaea/{ => nixos}/hardware-configuration.nix (100%) rename profiles/gaea/{ => nixos}/mount.nix (100%) rename profiles/gaea/{ => nixos}/network.nix (100%) delete mode 100644 profiles/luna/configuration.nix diff --git a/README.md b/README.md index 6b2d78f..95a6698 100644 --- a/README.md +++ b/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 清除所有未使用的 +``` diff --git a/flake.nix b/flake.nix index 54daa25..f14b769 100644 --- a/flake.nix +++ b/flake.nix @@ -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 < diff --git a/modules/nixos/user.nix b/modules/nixos/user.nix index a279300..8a769d4 100644 --- a/modules/nixos/user.nix +++ b/modules/nixos/user.nix @@ -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" diff --git a/profiles/apollo/default.nix b/profiles/apollo/default.nix index f324195..7fee5f8 100644 --- a/profiles/apollo/default.nix +++ b/profiles/apollo/default.nix @@ -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; }; + 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 -# 使用libs.mkNixosSystem创建nixosSystem -libs.mkNixosSystem { - inherit nixpkgs; - args = sysArgs; - path = ./.; +nixpkgs.lib.nixosSystem { + inherit specialArgs; + modules = [ + configuration + ]; } diff --git a/profiles/apollo/hm/ssh/config b/profiles/apollo/hm/ssh/config deleted file mode 100644 index 872786c..0000000 --- a/profiles/apollo/hm/ssh/config +++ /dev/null @@ -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 - diff --git a/profiles/apollo/hm/default.nix b/profiles/apollo/home/default.nix similarity index 63% rename from profiles/apollo/hm/default.nix rename to profiles/apollo/home/default.nix index 2883ab4..7ea97bf 100644 --- a/profiles/apollo/hm/default.nix +++ b/profiles/apollo/home/default.nix @@ -1,6 +1,8 @@ { self, pkgs, ... }: { imports = [ ./ssh + "${self}/home/desktop.nix" + "${self}/modules/home/develop.nix" ]; home.packages = with pkgs; [ diff --git a/profiles/apollo/hm/hyprland.nix b/profiles/apollo/home/hyprland.nix similarity index 100% rename from profiles/apollo/hm/hyprland.nix rename to profiles/apollo/home/hyprland.nix diff --git a/profiles/apollo/home/ssh/config b/profiles/apollo/home/ssh/config new file mode 100644 index 0000000..6e4878a --- /dev/null +++ b/profiles/apollo/home/ssh/config @@ -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 + diff --git a/profiles/apollo/hm/ssh/default.nix b/profiles/apollo/home/ssh/default.nix similarity index 100% rename from profiles/apollo/hm/ssh/default.nix rename to profiles/apollo/home/ssh/default.nix diff --git a/profiles/apollo/network.nix b/profiles/apollo/network.nix deleted file mode 100644 index d3493bc..0000000 --- a/profiles/apollo/network.nix +++ /dev/null @@ -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" ]; - }; -} diff --git a/profiles/apollo/configuration.nix b/profiles/apollo/nixos/default.nix similarity index 56% rename from profiles/apollo/configuration.nix rename to profiles/apollo/nixos/default.nix index aee3203..5728950 100644 --- a/profiles/apollo/configuration.nix +++ b/profiles/apollo/nixos/default.nix @@ -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 = { diff --git a/profiles/apollo/hardware-configuration.nix b/profiles/apollo/nixos/hardware-configuration.nix similarity index 100% rename from profiles/apollo/hardware-configuration.nix rename to profiles/apollo/nixos/hardware-configuration.nix diff --git a/profiles/apollo/mount.nix b/profiles/apollo/nixos/mount.nix similarity index 100% rename from profiles/apollo/mount.nix rename to profiles/apollo/nixos/mount.nix diff --git a/profiles/apollo/nixos/network.nix b/profiles/apollo/nixos/network.nix new file mode 100644 index 0000000..ee6549c --- /dev/null +++ b/profiles/apollo/nixos/network.nix @@ -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" + ]; + }; + }; + }; + }; +} diff --git a/profiles/gaea/configuration.nix b/profiles/gaea/configuration.nix deleted file mode 100644 index c2f88ff..0000000 --- a/profiles/gaea/configuration.nix +++ /dev/null @@ -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; -} diff --git a/profiles/gaea/default.nix b/profiles/gaea/default.nix index f324195..861f969 100644 --- a/profiles/gaea/default.nix +++ b/profiles/gaea/default.nix @@ -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; }; + 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 -# 使用libs.mkNixosSystem创建nixosSystem -libs.mkNixosSystem { - inherit nixpkgs; - args = sysArgs; - path = ./.; +nixpkgs.lib.nixosSystem { + inherit specialArgs; + modules = [ + configuration + ]; } diff --git a/profiles/gaea/hm/default.nix b/profiles/gaea/hm/default.nix deleted file mode 100644 index 6e2ed2b..0000000 --- a/profiles/gaea/hm/default.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ ... }: { - imports = [ - ./ssh.nix - ./hyprland.nix - ]; -} diff --git a/profiles/gaea/hm/ssh.nix b/profiles/gaea/hm/ssh.nix deleted file mode 100644 index 1e706a8..0000000 --- a/profiles/gaea/hm/ssh.nix +++ /dev/null @@ -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 - ''; - }; -} diff --git a/profiles/gaea/home/default.nix b/profiles/gaea/home/default.nix new file mode 100644 index 0000000..7ea97bf --- /dev/null +++ b/profiles/gaea/home/default.nix @@ -0,0 +1,12 @@ +{ self, pkgs, ... }: { + imports = [ + ./ssh + "${self}/home/desktop.nix" + "${self}/modules/home/develop.nix" + ]; + + home.packages = with pkgs; [ + nextcloud-client + kodi + ]; +} diff --git a/profiles/gaea/hm/hyprland.nix b/profiles/gaea/home/hyprland.nix similarity index 57% rename from profiles/gaea/hm/hyprland.nix rename to profiles/gaea/home/hyprland.nix index 19fa642..c6bb6a7 100644 --- a/profiles/gaea/hm/hyprland.nix +++ b/profiles/gaea/home/hyprland.nix @@ -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"; }; }; } diff --git a/profiles/gaea/home/ssh/config b/profiles/gaea/home/ssh/config new file mode 100644 index 0000000..d1c7832 --- /dev/null +++ b/profiles/gaea/home/ssh/config @@ -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 \ No newline at end of file diff --git a/profiles/gaea/home/ssh/default.nix b/profiles/gaea/home/ssh/default.nix new file mode 100644 index 0000000..72bc605 --- /dev/null +++ b/profiles/gaea/home/ssh/default.nix @@ -0,0 +1,9 @@ +{ config, flakesPath, ... }: { + programs.ssh = { + enable = true; + }; + + home.file.".ssh/config" = { + source = config.home-libs.mkOutOfStoreSymlink "profiles/apollo/hm/ssh/config"; + }; +} diff --git a/profiles/gaea/nixos/default.nix b/profiles/gaea/nixos/default.nix new file mode 100644 index 0000000..2126707 --- /dev/null +++ b/profiles/gaea/nixos/default.nix @@ -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; +} diff --git a/profiles/gaea/hardware-configuration.nix b/profiles/gaea/nixos/hardware-configuration.nix similarity index 100% rename from profiles/gaea/hardware-configuration.nix rename to profiles/gaea/nixos/hardware-configuration.nix diff --git a/profiles/gaea/mount.nix b/profiles/gaea/nixos/mount.nix similarity index 100% rename from profiles/gaea/mount.nix rename to profiles/gaea/nixos/mount.nix diff --git a/profiles/gaea/network.nix b/profiles/gaea/nixos/network.nix similarity index 100% rename from profiles/gaea/network.nix rename to profiles/gaea/nixos/network.nix diff --git a/profiles/luna/configuration.nix b/profiles/luna/configuration.nix deleted file mode 100644 index 8653c59..0000000 --- a/profiles/luna/configuration.nix +++ /dev/null @@ -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; -} diff --git a/profiles/luna/default.nix b/profiles/luna/default.nix index f324195..a6e86c5 100644 --- a/profiles/luna/default.nix +++ b/profiles/luna/default.nix @@ -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; }; + 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 -# 使用libs.mkNixosSystem创建nixosSystem -libs.mkNixosSystem { - inherit nixpkgs; - args = sysArgs; - path = ./.; +nixpkgs.lib.nixosSystem { + inherit specialArgs; + modules = [ + configuration + ]; }