Compare commits

..

3 Commits

Author SHA1 Message Date
b1540dfb96 修改mimeapps.list的配置方式 2025-05-19 10:41:29 +08:00
91b8e65a79 1 封装nix-fhs使用nix-ld
2 修改生成hylrland配置文件的方式
3 启用flatpak
2025-05-19 10:20:28 +08:00
05c8ab6c82 调整项目结构和readme 2025-05-09 14:40:19 +08:00
41 changed files with 733 additions and 594 deletions

View File

@@ -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 清除所有未使用的
```

View File

@@ -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 <

View File

@@ -15,7 +15,7 @@
./core.nix
../modules/home/vscode
../modules/home/zsh
../modules/home/xdg.nix
../modules/home/xdg
../modules/home/theme.nix
../modules/home/fcitx.nix
../modules/home/wechat.nix

View File

@@ -1,6 +1,5 @@
{ config, libs, pkgs, ... }:
let
conf = [ "hypr" "waybar" "rofi" "kitty" "mako" "wlogout" ];
confPath = "modules/home/hyprland/conf";
in
{
@@ -47,7 +46,7 @@ in
source = config.home-libs.mkOutOfStoreSymlink "${confPath}/${name}";
};
})
conf
(builtins.attrNames (builtins.readDir ./conf))
);
}

View File

@@ -49,11 +49,9 @@
"augment.chat.userGuidelines": "Always response in 中文",
"augment.completions.enableAutomaticCompletions": true,
"editor.fontFamily": "'Source Code Pro', 'JetBrainsMono Nerd Font'",
"github.copilot.enable": {
"*": true,
"plaintext": false,
"markdown": false,
"scminput": false,
"nix": true
}
"github.copilot.nextEditSuggestions.enabled": true,
"update.mode": "none",
"github.copilot.chat.localeOverride": "zh-CN",
"github.copilot.selectedCompletionModel": "GPT-4.1",
"diffEditor.ignoreTrimWhitespace": false
}

View File

@@ -25,12 +25,15 @@ in
});
};
xdg.configFile = {
"Code/User/keybindings.json" = {
source = config.home-libs.mkOutOfStoreSymlink "modules/home/vscode/keybindings.json";
};
"Code/User/settings.json" = {
source = config.home-libs.mkOutOfStoreSymlink "modules/home/vscode/settings.json";
};
};
# 使用map函数循环 conf 变量,动态的生成 home.file.<user>.config.${i}
xdg.configFile = builtins.listToAttrs
(builtins.map
(name: {
name = "Code/User/${name}";
value = {
source = config.home-libs.mkOutOfStoreSymlink "modules/home/vscode/conf/${name}";
};
})
(builtins.attrNames (builtins.readDir ./conf))
);
}

View File

@@ -1,92 +0,0 @@
# XDG stands for "Cross-Desktop Group", with X used to mean "cross".
# It's a bunch of specifications from freedesktop.org intended to standardize desktops and
# other GUI applications on various systems (primarily Unix-like) to be interoperable:
# https://www.freedesktop.org/wiki/Specifications/
{ config, pkgs, ... }: {
home.packages = with pkgs; [
xdg-utils # provides cli tools such as `xdg-mime` `xdg-open`
xdg-user-dirs
];
xdg = {
enable = true;
cacheHome = config.home.homeDirectory + "/.cache";
# manage $XDG_CONFIG_HOME/mimeapps.list
# xdg search all desktop entries from $XDG_DATA_DIRS, check it by command:
# echo $XDG_DATA_DIRS
# the system-level desktop entries can be list by command:
# ls -l /run/current-system/sw/share/applications/
# the user-level desktop entries can be list by command(user ryan):
# ls /etc/profiles/per-user/ryan/share/applications/
mimeApps = {
enable = true;
defaultApplications =
let
browser = [ "microsoft-edge.desktop" ];
in
{
"application/json" = browser;
"application/pdf" = browser; # TODO: pdf viewer
"text/html" = browser;
"text/xml" = browser;
"application/xml" = browser;
"application/xhtml+xml" = browser;
"application/xhtml_xml" = browser;
"application/rdf+xml" = browser;
"application/rss+xml" = browser;
"application/x-extension-htm" = browser;
"application/x-extension-html" = browser;
"application/x-extension-shtml" = browser;
"application/x-extension-xht" = browser;
"application/x-extension-xhtml" = browser;
"x-scheme-handler/about" = browser;
"x-scheme-handler/ftp" = browser;
"x-scheme-handler/http" = browser;
"x-scheme-handler/https" = browser;
"x-scheme-handler/unknown" = browser;
"x-scheme-handler/discord" = [ "discord.desktop" ];
"x-scheme-handler/tg" = [ "telegramdesktop.desktop" ];
"audio/*" = [ "vlc.desktop" ];
"video/*" = [ "vlc.dekstop" ];
"image/*" = [ "imv.desktop" ];
"image/gif" = [ "imv.desktop" ];
"image/jpeg" = [ "imv.desktop" ];
"image/png" = [ "imv.desktop" ];
"image/webp" = [ "imv.desktop" ];
"inode/directory" = [ ]
++ (if config.xdg.enable then [ "nemo.desktop" ] else [ ])
++ (if config.xdg.enable then [ "xdg-open.desktop" ] else [ ])
++ (if config.xdg.enable then [ "nemo.desktop" ] else [ ])
++ (if config.xdg.enable then [ "thunar.desktop" ] else [ ])
++ (if config.xdg.enable then [ "org.gnome.Nautilus.desktop" ] else [ ]);
};
associations.removed =
{
# ......
};
};
userDirs = {
enable = true;
createDirectories = false;
documents = config.home.homeDirectory + "/doc";
music = config.home.homeDirectory + "/doc/music";
desktop = config.home.homeDirectory + "/tmp";
download = config.home.homeDirectory + "/tmp";
videos = config.home.homeDirectory + "/tmp";
pictures = config.home.homeDirectory + "/tmp";
# templates = config.home.homeDirectory + "/tmp";
# publicShare = config.home.homeDirectory + "/tmp";
extraConfig = {
XDG_SCREENSHOTS_DIR = config.home.homeDirectory + "/tmp/Screenshots";
};
};
};
}

View File

@@ -0,0 +1,31 @@
[Default Applications]
application/json=microsoft-edge.desktop
application/pdf=microsoft-edge.desktop
application/rdf+xml=microsoft-edge.desktop
application/rss+xml=microsoft-edge.desktop
application/x-extension-htm=microsoft-edge.desktop
application/x-extension-html=microsoft-edge.desktop
application/x-extension-shtml=microsoft-edge.desktop
application/x-extension-xht=microsoft-edge.desktop
application/x-extension-xhtml=microsoft-edge.desktop
application/xhtml+xml=microsoft-edge.desktop
application/xhtml_xml=microsoft-edge.desktop
application/xml=microsoft-edge.desktop
audio/*=vlc.desktop
image/*=imv.desktop
image/gif=imv.desktop
image/jpeg=imv.desktop
image/png=imv.desktop
image/webp=imv.desktop
inode/directory=nemo.desktop;xdg-open.desktop;nemo.desktop;thunar.desktop;org.gnome.Nautilus.desktop
text/html=microsoft-edge.desktop
text/xml=microsoft-edge.desktop
video/*=vlc.dekstop
x-scheme-handler/about=microsoft-edge.desktop
x-scheme-handler/discord=discord.desktop
x-scheme-handler/ftp=microsoft-edge.desktop
x-scheme-handler/http=microsoft-edge.desktop
x-scheme-handler/https=microsoft-edge.desktop
x-scheme-handler/tg=telegramdesktop.desktop
x-scheme-handler/unknown=microsoft-edge.desktop
text/plain=code.desktop

View File

@@ -0,0 +1,51 @@
# XDG stands for "Cross-Desktop Group", with X used to mean "cross".
# It's a bunch of specifications from freedesktop.org intended to standardize desktops and
# other GUI applications on various systems (primarily Unix-like) to be interoperable:
# https://www.freedesktop.org/wiki/Specifications/
{ config, pkgs, ... }: {
home.packages = with pkgs; [
xdg-utils # provides cli tools such as `xdg-mime` `xdg-open`
xdg-user-dirs
];
xdg = {
enable = true;
cacheHome = config.home.homeDirectory + "/.cache";
# manage $XDG_CONFIG_HOME/mimeapps.list
# xdg search all desktop entries from $XDG_DATA_DIRS, check it by command:
# echo $XDG_DATA_DIRS
# the system-level desktop entries can be list by command:
# ls -l /run/current-system/sw/share/applications/
# the user-level desktop entries can be list by command(user ryan):
# ls /etc/profiles/per-user/ryan/share/applications/
userDirs = {
enable = true;
createDirectories = false;
documents = config.home.homeDirectory + "/doc";
music = config.home.homeDirectory + "/doc/music";
desktop = config.home.homeDirectory + "/tmp";
download = config.home.homeDirectory + "/tmp";
videos = config.home.homeDirectory + "/tmp";
pictures = config.home.homeDirectory + "/tmp";
# templates = config.home.homeDirectory + "/tmp";
# publicShare = config.home.homeDirectory + "/tmp";
extraConfig = {
XDG_SCREENSHOTS_DIR = config.home.homeDirectory + "/tmp/Screenshots";
};
};
};
# 使用map函数循环 conf 变量,动态的生成 home.file.<user>.config.${i}
xdg.configFile = builtins.listToAttrs
(builtins.map
(name: {
inherit name;
value = {
source = config.home-libs.mkOutOfStoreSymlink "modules/home/xdg/conf/${name}";
};
})
(builtins.attrNames (builtins.readDir ./conf))
);
}

View File

@@ -3,7 +3,8 @@
imports = [
./boot.nix
./system.nix
./nixld.nix
./nixfhs.nix
../user.nix
];
environment = {
@@ -15,7 +16,6 @@
programs = {
git.enable = true;
dconf.enable = true;
};
# Configure firewall

View File

@@ -0,0 +1,142 @@
{ config, lib, pkgs, ... }:
let
conf = config.services.nix-fhs;
inherit (lib) mkOption mkEnableOption types;
in
{
options.services.nix-fhs = with lib; {
enable = mkEnableOption "nix-fhs module";
gui.enable = mkEnableOption "/GUI//";
# 在这里定义其他选项
extraPackages = mkOption {
type = types.listOf types.package;
default = [ ];
example = [ pkgs.gcc pkgs.gdb ];
description = "nix-ld";
};
};
config = lib.mkIf conf.enable {
# NixOS 系统级配置
programs.nix-ld = {
enable = true;
# 这里可以添加其他nix-ld相关的配置
libraries = with pkgs;[
bzip2 # 高质量的数据压缩库
cups # 通用Unix打印系统提供打印功能
curlWithGnuTls # 使用GnuTLS的URL传输库用于网络请求
dbus # 进程间通信系统,用于应用程序之间的通信
dbus-glib # D-Bus的GLib绑定
e2fsprogs # ext2/3/4文件系统工具
expat # XML解析库
fontconfig # 字体配置和自定义库
freetype # 字体渲染引擎
fribidi # Unicode双向文本算法实现
fuse # 用户空间文件系统接口
fuse3 # FUSE的第3版用户空间文件系统接口
gmp # GNU多精度算术库
icu # 国际化组件提供Unicode和全球化支持
keyutils.lib # Linux密钥管理工具库
libcap # POSIX能力库
libgcrypt # GNU加密库
libgpg-error # GnuPG错误报告库
libidn # 国际化域名库
libpng12 # PNG图像编解码库1.2版本
libsamplerate # 音频采样率转换库
libuuid # UUID生成和解析库
libxcrypt-legacy # 旧版密码哈希库
libxml2 # XML解析和生成库
nspr # Netscape可移植运行时
nss # 网络安全服务
openssl # 安全套接字层库
p11-kit # PKCS#11模块加载库
pixman # 像素操作库
python3 # Python编程语言解释器
stdenv.cc.cc # 标准C编译器
tbb # 英特尔线程构建块库
udev # 设备管理器
] ++
(lib.optionals conf.gui.enable [
atk # 辅助技术工具包,提供辅助功能支持
cairo # 2D图形渲染库支持多种输出设备
desktop-file-utils # 用于处理桌面条目文件的工具
gdk-pixbuf # 图像加载库GNOME的一部分
glib # 通用工具库,提供数据结构处理、移植等功能
gtk2 # 图形用户界面工具包第2版
gtk3 # 图形用户界面工具包第3版
harfbuzz # 文本整形引擎
pango # 文本布局和渲染库
alsa-lib # 高级Linux声音架构库提供音频功能
flac # 无损音频编解码器
libcanberra # 声音主题规范的实现
libjack2 # JACK音频连接套件第2版
libmikmod # 模块音乐库
libogg # Ogg多媒体容器格式库
libvorbis # Vorbis音频编解码库
speex # 语音压缩格式
freeglut # OpenGL实用工具包用于创建OpenGL上下文
glew110 # OpenGL扩展加载库1.10版本
gst_all_1.gst-plugins-base # GStreamer基础插件集
gst_all_1.gst-plugins-ugly # GStreamer非自由插件集
gst_all_1.gstreamer # 多媒体框架
libGL # OpenGL库
libGLU # OpenGL实用工具库
librsvg # SVG渲染库
libtheora # Theora视频编解码库
libtiff # TIFF图像编解码库
libvdpau # 视频解码和呈现API
libvpx # VP8/VP9视频编解码库
mesa # 开源OpenGL实现
vulkan-loader # Vulkan图形API加载器
wayland # 显示服务器协议
at-spi2-atk # 辅助技术服务提供者接口连接ATK和AT-SPI
at-spi2-core # 辅助技术服务提供者接口核心组件
libappindicator-gtk2 # 应用程序指示器库,用于系统托盘图标
libcaca # 彩色ASCII艺术库
libclang.lib # Clang编译器库
libdbusmenu # D-Bus菜单库
libjpeg # JPEG图像编解码库
libudev0-shim # 旧版udev库兼容层
libusb1 # USB设备访问库
mesa # 开源OpenGL实现
]) ++
(lib.optionals (lib.versionAtLeast config.system.stateVersion "25.05") [
pkgs.libgbm # 通用缓冲区管理库25.05之前包含在mesa中
]) ++ (
if config.services.xserver.enable then
[
xorg.libICE # X11 Inter-Client Exchange库
xorg.libSM # X11会话管理库
xorg.libX11 # X11客户端库
xorg.libXScrnSaver # X11屏幕保护扩展库
xorg.libXcomposite # X11合成扩展库
xorg.libXcursor # X11光标管理库
xorg.libXdamage # X11损坏扩展库
xorg.libXext # X11通用扩展库
xorg.libXfixes # X11修复扩展库
xorg.libXft # X11 FreeType接口库
xorg.libXi # X11输入扩展库
xorg.libXinerama # X11多显示器扩展库
xorg.libXmu # X11杂项实用工具库
xorg.libXrandr # X11调整大小和旋转扩展库
xorg.libXrender # X11渲染扩展库
xorg.libXt # X11工具包内省库
xorg.libXtst # X11测试扩展库
xorg.libXxf86vm # X11 XFree86视频模式扩展库
xorg.libpciaccess # X11 PCI访问库
xorg.libxcb # X11 C绑定库
xorg.xcbutil # XCB实用工具库
xorg.xcbutilimage # XCB图像实用工具库
xorg.xcbutilkeysyms # XCB键符号实用工具库
xorg.xcbutilrenderutil # XCB渲染实用工具库
xorg.xcbutilwm # XCB窗口管理实用工具库
xorg.xkeyboardconfig # X11键盘配置数据库
]
else
[ ]
) ++ conf.extraPackages;
};
};
}

View File

@@ -1,129 +0,0 @@
{ config, lib, pkgs, ... }:
{
programs = {
# Allow to run prebuild binary app
nix-ld = {
enable = true;
libraries = with pkgs; [
SDL # 简单直接媒体层,用于图形、音频、输入等的跨平台库
SDL2 # SDL的第二个主要版本提供更多功能
SDL2_image # SDL2的图像加载库支持多种图像格式
SDL2_mixer # SDL2的音频混合库用于播放多种音频格式
SDL2_ttf # SDL2的TrueType字体渲染库
SDL_image # SDL1的图像加载库
SDL_mixer # SDL1的音频混合库
SDL_ttf # SDL1的TrueType字体渲染库
alsa-lib # 高级Linux声音架构库提供音频功能
at-spi2-atk # 辅助技术服务提供者接口连接ATK和AT-SPI
at-spi2-core # 辅助技术服务提供者接口核心组件
atk # 辅助技术工具包,提供辅助功能支持
bzip2 # 高质量的数据压缩库
cairo # 2D图形渲染库支持多种输出设备
cups # 通用Unix打印系统提供打印功能
curlWithGnuTls # 使用GnuTLS的URL传输库用于网络请求
dbus # 进程间通信系统,用于应用程序之间的通信
dbus-glib # D-Bus的GLib绑定
desktop-file-utils # 用于处理桌面条目文件的工具
e2fsprogs # ext2/3/4文件系统工具
expat # XML解析库
flac # 无损音频编解码器
fontconfig # 字体配置和自定义库
freeglut # OpenGL实用工具包用于创建OpenGL上下文
freetype # 字体渲染引擎
fribidi # Unicode双向文本算法实现
fuse # 用户空间文件系统接口
fuse3 # FUSE的第3版用户空间文件系统接口
gdk-pixbuf # 图像加载库GNOME的一部分
glew110 # OpenGL扩展加载库1.10版本
glib # 通用工具库,提供数据结构处理、移植等功能
gmp # GNU多精度算术库
gst_all_1.gst-plugins-base # GStreamer基础插件集
gst_all_1.gst-plugins-ugly # GStreamer非自由插件集
gst_all_1.gstreamer # 多媒体框架
gtk2 # 图形用户界面工具包第2版
gtk3 # 图形用户界面工具包第2版
harfbuzz # 文本整形引擎
icu # 国际化组件提供Unicode和全球化支持
keyutils.lib # Linux密钥管理工具库
libGL # OpenGL库
libGLU # OpenGL实用工具库
libappindicator-gtk2 # 应用程序指示器库,用于系统托盘图标
libcaca # 彩色ASCII艺术库
libcanberra # 声音主题规范的实现
libcap # POSIX能力库
libclang.lib # Clang编译器库
libdbusmenu # D-Bus菜单库
libdrm # 直接渲染管理器库
libgcrypt # GNU加密库
libgpg-error # GnuPG错误报告库
libidn # 国际化域名库
libjack2 # JACK音频连接套件第2版
libjpeg # JPEG图像编解码库
libmikmod # 模块音乐库
libogg # Ogg多媒体容器格式库
libpng12 # PNG图像编解码库1.2版本
librsvg # SVG渲染库
libsamplerate # 音频采样率转换库
libthai # 泰语支持库
libtheora # Theora视频编解码库
libtiff # TIFF图像编解码库
libudev0-shim # 旧版udev库兼容层
libusb1 # USB设备访问库
libuuid # UUID生成和解析库
libvdpau # 视频解码和呈现API
libvorbis # Vorbis音频编解码库
libvpx # VP8/VP9视频编解码库
libxcrypt-legacy # 旧版密码哈希库
libxkbcommon # 键盘处理库
libxml2 # XML解析和生成库
mesa # 开源OpenGL实现
nspr # Netscape可移植运行时
nss # 网络安全服务
openssl # 安全套接字层库
p11-kit # PKCS#11模块加载库
pango # 文本布局和渲染库
pixman # 像素操作库
python3 # Python编程语言解释器
speex # 语音压缩格式
stdenv.cc.cc # 标准C编译器
tbb # 英特尔线程构建块库
udev # 设备管理器
vulkan-loader # Vulkan图形API加载器
wayland # 显示服务器协议
# xorg.libICE # X11 Inter-Client Exchange库
# xorg.libSM # X11会话管理库
# xorg.libX11 # X11客户端库
# xorg.libXScrnSaver # X11屏幕保护扩展库
# xorg.libXcomposite # X11合成扩展库
# xorg.libXcursor # X11光标管理库
# xorg.libXdamage # X11损坏扩展库
# xorg.libXext # X11通用扩展库
# xorg.libXfixes # X11修复扩展库
# xorg.libXft # X11 FreeType接口库
# xorg.libXi # X11输入扩展库
# xorg.libXinerama # X11多显示器扩展库
# xorg.libXmu # X11杂项实用工具库
# xorg.libXrandr # X11调整大小和旋转扩展库
# xorg.libXrender # X11渲染扩展库
# xorg.libXt # X11工具包内省库
# xorg.libXtst # X11测试扩展库
# xorg.libXxf86vm # X11 XFree86视频模式扩展库
# xorg.libpciaccess # X11 PCI访问库
# xorg.libxcb # X11 C绑定库
# xorg.xcbutil # XCB实用工具库
# xorg.xcbutilimage # XCB图像实用工具库
# xorg.xcbutilkeysyms # XCB键符号实用工具库
# xorg.xcbutilrenderutil # XCB渲染实用工具库
# xorg.xcbutilwm # XCB窗口管理实用工具库
# xorg.xkeyboardconfig # X11键盘配置数据库
xz # LZMA压缩工具
zlib # 通用数据压缩库
] ++ (
if lib.versionAtLeast config.system.stateVersion "25.05" then
[ pkgs.libgbm ]
else
[ ]
);
};
};
}

View File

@@ -10,6 +10,7 @@
printing.enable = true;
acpid.enable = true;
upower.enable = true;
nix-fhs.enable = true;
openssh = {
enable = true;

View File

@@ -1,5 +1,4 @@
{ config, pkgs, ... }:
{
{ config, pkgs, lib, username, ... }: {
services.xserver = {
enable = true;
displayManager.gdm.enable = true;
@@ -47,8 +46,117 @@
"GLFW_IM_MODULE" = "ibus";
};
};
programs = {
dconf = {
enable = true;
profiles = {
# TODO: Investigate customizing gdm greeter.
user.databases = [{
settings = with lib.gvariant; {
"org/gnome/desktop/interface" = {
clock-show-weekday = true;
cursor-size = mkUint32 16;
cursor-theme = "capitaine-cursors";
enable-hot-corners = false;
icon-theme = "Papirus-Dark";
locate-pointer = false;
monospace-font-name = "JetBrainsMono Nerd Font Mono 10";
overlay-scrolling = true;
};
"org/gnome/mutter" = {
edge-tiling = true;
attach-modal-dialogs = true;
experimental-features = [ "scale-monitor-framebuffer" ];
};
"org/gnome/shell" = {
last-selected-power-profile = "power-saver";
};
"org/gnome/desktop/session" = {
idle-delay = mkUint32 900;
};
"org/gnome/settings-daemon/plugins/power" = {
power-button-action = "interactive";
sleep-inactive-ac-timeout = mkUint32 7200;
sleep-inactive-ac-type = "nothing";
};
"org/gtk/gtk4/settings/file-chooser" = {
sort-directories-first = true;
# show-hidden = true;
view-type = "list";
};
"org/gnome/desktop/wm/keybindings" = {
minimize = mkEmptyArray type.string;
move-to-workspace-1 = [ "<Shift><Super>1" ];
move-to-workspace-2 = [ "<Shift><Super>2" ];
move-to-workspace-3 = [ "<Shift><Super>3" ];
move-to-workspace-4 = [ "<Shift><Super>4" ];
switch-to-workspace-1 = [ "<Super>1" ];
switch-to-workspace-2 = [ "<Super>2" ];
switch-to-workspace-3 = [ "<Super>3" ];
switch-to-workspace-4 = [ "<Super>4" ];
switch-to-workspace-left = [ "<Control><Super>h" ];
switch-to-workspace-right = [ "<Control><Super>l" ];
switch-windows = [ "<Alt>Tab" ];
switch-windows-backward = [ "<Shift><Alt>Tab" ];
switch-applications = [ "<Super>Tab" ];
switch-applications-backward = [ "<Shift><Super>Tab" ];
};
"org/gnome/shell/keybindings" = {
# Following binds are replaced by the ones above.
switch-to-application-1 = mkEmptyArray type.string;
switch-to-application-2 = mkEmptyArray type.string;
switch-to-application-3 = mkEmptyArray type.string;
switch-to-application-4 = mkEmptyArray type.string;
};
"org/gnome/shell" = {
enabled-extensions = [
"appindicatorsupport@rgcjonas.gmail.com"
"dash-to-dock@micxgx.gmail.com"
"status-icons@gnome-shell-extensions.gcampax.github.com"
"system-monitor@gnome-shell-extensions.gcampax.github.com"
];
};
"org/gnome/shell/extensions/dash-to-panel" = {
apply-custom-theme = false;
background-opacity = 0.8;
click-action = "previews";
custom-background-color = false;
custom-theme-shrink = true;
dash-max-icon-size = mkUint32 40;
dock-position = "BOTTOM";
extend-height = false;
height-fraction = 0.9;
hot-keys = false;
icon-size-fixed = true;
isolate-monitors = true;
max-alpha = 0.8;
multi-monitor = true;
preview-size-scale = 0.0;
running-indicator-style = "DOTS";
scroll-action = "cycle-windows";
show-mounts = false;
show-mounts-only-mounted = true;
transparency-mode = "DYNAMIC";
};
"org/gnome/shell/extensions/system-monitor" = {
show-download = true;
show-swap = false;
show-upload = false;
};
};
}];
};
};
};
}

View 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"

View File

@@ -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
];
}

View File

@@ -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

View File

@@ -1,6 +1,8 @@
{ self, pkgs, ... }: {
imports = [
./ssh
"${self}/home/desktop.nix"
"${self}/modules/home/develop.nix"
];
home.packages = with pkgs; [

View 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

View File

@@ -4,6 +4,6 @@
};
home.file.".ssh/config" = {
source = config.home-libs.mkOutOfStoreSymlink "profiles/apollo/hm/ssh/config";
source = config.home-libs.mkOutOfStoreSymlink "profiles/apollo/home/ssh/config";
};
}

View File

@@ -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" ];
};
}

View File

@@ -1,5 +1,4 @@
args@{ self, pkgs, home-manager, username, version, ... }: {
# You can import other NixOS modules here
{ self, pkgs, username, version, lib, config, ... }: {
imports = [
./mount.nix
./network.nix
@@ -7,30 +6,11 @@ args@{ self, pkgs, home-manager, username, version, ... }: {
"${self}/modules/nixos/core"
"${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 = {
@@ -43,6 +23,8 @@ args@{ self, pkgs, home-manager, username, version, ... }: {
services = {
gnome.gnome-keyring.enable = true;
nix-fhs.gui.enable = true;
flatpak.enable = true;
};
security.pam.services.swaylock = { };

View 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"
];
};
};
};
};
}

View File

@@ -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;
}

View File

@@ -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
];
}

View File

@@ -1,6 +0,0 @@
{ ... }: {
imports = [
./ssh.nix
./hyprland.nix
];
}

View File

@@ -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
'';
};
}

View 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
];
}

View File

@@ -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";
};
};
}

View 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

View File

@@ -0,0 +1,9 @@
{ config, flakesPath, ... }: {
programs.ssh = {
enable = true;
};
home.file.".ssh/config" = {
source = config.home-libs.mkOutOfStoreSymlink "profiles/gaea/home/ssh/config";
};
}

View File

@@ -0,0 +1,21 @@
{ self, pkgs, version, ... }: {
imports = [
./mount.nix
./network.nix
./hardware-configuration.nix
"${self}/modules/nixos/core"
"${self}/modules/nixos/fonts"
"${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;
}

View File

@@ -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;
}

View File

@@ -2,11 +2,53 @@ 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/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
];
}