Compare commits
17 Commits
4e98a706ab
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7caf8a0a66 | ||
| 70c052c850 | |||
| ce7331fb35 | |||
| b1540dfb96 | |||
| 91b8e65a79 | |||
| 05c8ab6c82 | |||
| 79d3ca7ec4 | |||
| 457028533e | |||
| c133e5637f | |||
| e6891f9f8e | |||
| d605c0f637 | |||
| 057beb27e2 | |||
| 5d43285e9e | |||
| 87c1617885 | |||
| e69345b654 | |||
| 9a39e2512e | |||
| d4177d6823 |
65
README.md
65
README.md
@@ -10,27 +10,26 @@
|
|||||||
│ ├── desktop.nix # 桌面环境配置
|
│ ├── desktop.nix # 桌面环境配置
|
||||||
│ └── server.nix # 服务器配置
|
│ └── server.nix # 服务器配置
|
||||||
├── libs # 自定义库函数
|
├── libs # 自定义库函数
|
||||||
│ ├── default.nix # 导出所有库函数
|
|
||||||
│ └── mkNixosSystem.nix # 创建nixosSystem的通用函数
|
|
||||||
├── modules # 通用模块,不同机器可以根据的需要引入
|
├── modules # 通用模块,不同机器可以根据的需要引入
|
||||||
│ ├── home # home manager 通用模块
|
│ ├── home # home manager 通用模块
|
||||||
│ │ └── - # home manager 通用模块
|
|
||||||
│ └── nixos # nixos 通用模块
|
│ └── nixos # nixos 通用模块
|
||||||
│ └── - # nixos 通用模块
|
|
||||||
├── overlays # 安装包的修改配置
|
├── overlays # 安装包的修改配置
|
||||||
│ └── - # 安装包的修改配置
|
│ └── default.nix # 覆盖配置入口
|
||||||
├── pkgs # 自定义软件包
|
├── pkgs # 自定义软件包
|
||||||
│ └── -
|
|
||||||
├── profiles # 不同机器的配置文件, 放置只有特定主机可以使用的配置
|
├── profiles # 不同机器的配置文件, 放置只有特定主机可以使用的配置
|
||||||
│ ├── apollo # 主服务器配置
|
│ ├── apollo # 主服务器配置
|
||||||
│ │ ├── configuration.nix # 主要配置文件,包含系统模块、服务、用户设置等
|
│ │ ├── default.nix # 入口文件,负责创建nixosSystem并选择使用的nixpkgs版本
|
||||||
│ │ └── default.nix # 入口文件,负责创建nixosSystem并选择使用的nixpkgs版本
|
│ │ ├── home # apollo的home-manager配置
|
||||||
|
│ │ └── nixos # apollo的NixOS配置
|
||||||
|
│ │ └── network.nix # 网络配置
|
||||||
│ ├── gaea # 主用机配置
|
│ ├── gaea # 主用机配置
|
||||||
│ │ ├── configuration.nix # 主要配置文件,包含系统模块、服务、用户设置等
|
│ │ ├── default.nix # 入口文件,负责创建nixosSystem并选择使用的nixpkgs版本
|
||||||
│ │ └── default.nix # 入口文件,负责创建nixosSystem并选择使用的nixpkgs版本
|
│ │ ├── home # gaea的home-manager配置
|
||||||
|
│ │ └── nixos # gaea的NixOS配置
|
||||||
│ └── luna # 虚拟机配置
|
│ └── luna # 虚拟机配置
|
||||||
│ ├── configuration.nix # 主要配置文件,包含系统模块、服务、用户设置等
|
│ ├── default.nix # 入口文件,负责创建nixosSystem并选择使用的nixpkgs版本
|
||||||
│ └── default.nix # 入口文件,负责创建nixosSystem并选择使用的nixpkgs版本
|
│ ├── hardware-configuration.nix # 硬件配置
|
||||||
|
│ └── network.nix # 网络配置
|
||||||
├── flake.lock # flake 锁定文件
|
├── flake.lock # flake 锁定文件
|
||||||
├── flake.nix # nix flake 入口
|
├── flake.nix # nix flake 入口
|
||||||
├── nixos-install.sh # nixos 全新安装脚本
|
├── nixos-install.sh # nixos 全新安装脚本
|
||||||
@@ -170,3 +169,45 @@ nixos-switch
|
|||||||
2. **profiles/[hostname]/default.nix** - 这是配置的入口文件,负责选择使用的 nixpkgs 版本并调用 libs.mkNixosSystem 函数。
|
2. **profiles/[hostname]/default.nix** - 这是配置的入口文件,负责选择使用的 nixpkgs 版本并调用 libs.mkNixosSystem 函数。
|
||||||
|
|
||||||
3. **profiles/[hostname]/configuration.nix** - 包含实际的配置内容,如系统模块、服务、用户设置等。
|
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 清除所有未使用的
|
||||||
|
```
|
||||||
|
|||||||
24
flake.lock
generated
24
flake.lock
generated
@@ -7,11 +7,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1744743431,
|
"lastModified": 1747688870,
|
||||||
"narHash": "sha256-iyn/WBYDc7OtjSawbegINDe/gIkok888kQxk3aVnkgg=",
|
"narHash": "sha256-ypL9WAZfmJr5V70jEVzqGjjQzF0uCkz+AFQF7n9NmNc=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "home-manager",
|
"repo": "home-manager",
|
||||||
"rev": "c61bfe3ae692f42ce688b5865fac9e0de58e1387",
|
"rev": "d5f1f641b289553927b3801580598d200a501863",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -28,11 +28,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1745205007,
|
"lastModified": 1755442500,
|
||||||
"narHash": "sha256-k67bEcLkSo13TIBfs0CGYkJjG12aaikabMtxWbSeqr0=",
|
"narHash": "sha256-RHK4H6SWzkAtW/5WBHsyugaXJX25yr5y7FAZznxcBJs=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "home-manager",
|
"repo": "home-manager",
|
||||||
"rev": "3fbe9a2b76ff5c4dcb2a2a2027dac31cfc993c8c",
|
"rev": "d2ffdedfc39c591367b1ddf22b4ce107f029dcc3",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -58,11 +58,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1744440957,
|
"lastModified": 1751274312,
|
||||||
"narHash": "sha256-FHlSkNqFmPxPJvy+6fNLaNeWnF1lZSgqVCl/eWaJRc4=",
|
"narHash": "sha256-/bVBlRpECLVzjV19t5KMdMFWSwKLtb5RyXdjz3LJT+g=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "26d499fc9f1d567283d5d56fcf367edd815dba1d",
|
"rev": "50ab793786d9de88ee30ec4e4c24fb4236fc2674",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -74,11 +74,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs-unstable": {
|
"nixpkgs-unstable": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1744932701,
|
"lastModified": 1755186698,
|
||||||
"narHash": "sha256-fusHbZCyv126cyArUwwKrLdCkgVAIaa/fQJYFlCEqiU=",
|
"narHash": "sha256-wNO3+Ks2jZJ4nTHMuks+cxAiVBGNuEBXsT29Bz6HASo=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "b024ced1aac25639f8ca8fdfc2f8c4fbd66c48ef",
|
"rev": "fbcf476f790d8a217c3eab4e12033dc4a0f6d23c",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|||||||
19
flake.nix
19
flake.nix
@@ -5,7 +5,21 @@
|
|||||||
inherit (nixpkgs) lib;
|
inherit (nixpkgs) lib;
|
||||||
username = "alex";
|
username = "alex";
|
||||||
useremail = "reizero@live.com";
|
useremail = "reizero@live.com";
|
||||||
|
sourcepath = "/home/${username}/.nix";
|
||||||
libs = import ./libs;
|
libs = import ./libs;
|
||||||
|
|
||||||
|
nixos = {
|
||||||
|
stable = {
|
||||||
|
nixpkgs = nixpkgs;
|
||||||
|
home-manager = home-manager;
|
||||||
|
version = "25.05";
|
||||||
|
};
|
||||||
|
unstable = {
|
||||||
|
nixpkgs = nixpkgs-unstable;
|
||||||
|
home-manager = home-manager-unstable;
|
||||||
|
version = "25.11";
|
||||||
|
};
|
||||||
|
};
|
||||||
in
|
in
|
||||||
rec {
|
rec {
|
||||||
# Your custom packages and modifications, exported as overlays
|
# Your custom packages and modifications, exported as overlays
|
||||||
@@ -19,7 +33,8 @@
|
|||||||
(profile: {
|
(profile: {
|
||||||
name = profile;
|
name = profile;
|
||||||
value = import ./profiles/${profile} {
|
value = import ./profiles/${profile} {
|
||||||
inherit self inputs outputs libs username useremail;
|
inherit self inputs outputs libs nixos profile sourcepath username useremail;
|
||||||
|
hostname = profile;
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
(attrNames (readDir ./profiles))
|
(attrNames (readDir ./profiles))
|
||||||
@@ -34,7 +49,7 @@
|
|||||||
extraSpecialArgs = {
|
extraSpecialArgs = {
|
||||||
inherit inputs outputs username useremail;
|
inherit inputs outputs username useremail;
|
||||||
hyprland = inputs.hyprland;
|
hyprland = inputs.hyprland;
|
||||||
sysversion = "unstable";
|
version = "${nixos.unstable.version}";
|
||||||
};
|
};
|
||||||
modules = [
|
modules = [
|
||||||
# > Our main home-manager configuration file <
|
# > Our main home-manager configuration file <
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
# This is your home-manager configuration file
|
# This is your home-manager configuration file
|
||||||
# Use this to configure your home environment (it replaces ~/.config/nixpkgs/home.nix)
|
# Use this to configure your home environment (it replaces ~/.config/nixpkgs/home.nix)
|
||||||
|
|
||||||
{ outputs, pkgs, username, useremail, sysversion, ... }: {
|
{ self, outputs, pkgs, username, useremail, version, ... }: {
|
||||||
|
imports = [
|
||||||
|
"${self}/libs/home-libs.nix"
|
||||||
|
];
|
||||||
|
|
||||||
home = {
|
home = {
|
||||||
inherit username;
|
inherit username;
|
||||||
@@ -108,5 +111,5 @@
|
|||||||
systemd.user.startServices = "sd-switch";
|
systemd.user.startServices = "sd-switch";
|
||||||
|
|
||||||
# https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion
|
# https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion
|
||||||
home.stateVersion = sysversion;
|
home.stateVersion = version;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,10 +13,9 @@
|
|||||||
|
|
||||||
# You can also split up your configuration and import pieces of it here:
|
# You can also split up your configuration and import pieces of it here:
|
||||||
./core.nix
|
./core.nix
|
||||||
../modules/home/hyprland
|
|
||||||
../modules/home/vscode
|
../modules/home/vscode
|
||||||
../modules/home/zsh
|
../modules/home/zsh
|
||||||
../modules/home/xdg.nix
|
../modules/home/xdg
|
||||||
../modules/home/theme.nix
|
../modules/home/theme.nix
|
||||||
../modules/home/fcitx.nix
|
../modules/home/fcitx.nix
|
||||||
../modules/home/wechat.nix
|
../modules/home/wechat.nix
|
||||||
@@ -40,10 +39,6 @@
|
|||||||
htop # process monitor
|
htop # process monitor
|
||||||
pciutils # lspci etc.
|
pciutils # lspci etc.
|
||||||
];
|
];
|
||||||
|
|
||||||
sessionVariables = {
|
|
||||||
JAVA_HOME = "";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,4 @@ in
|
|||||||
{
|
{
|
||||||
# 导出mkNixosSystem函数
|
# 导出mkNixosSystem函数
|
||||||
inherit (mkNixosSystemLib) mkNixosSystem;
|
inherit (mkNixosSystemLib) mkNixosSystem;
|
||||||
|
|
||||||
# 转换相对路径到绝对路径
|
|
||||||
absolutePath = path: "${builtins.path { name = "path"; path = path; }}";
|
|
||||||
}
|
}
|
||||||
|
|||||||
18
libs/home-libs.nix
Normal file
18
libs/home-libs.nix
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
{ lib, config, sourcepath, ... }: # 声明你可能需要的参数
|
||||||
|
{
|
||||||
|
options = {
|
||||||
|
# 使用一个独特的顶层选项名,如 myLib
|
||||||
|
home-libs = lib.mkOption {
|
||||||
|
type = lib.types.attrsOf lib.types.anything;
|
||||||
|
default = { };
|
||||||
|
description = "Home manager custom utility functions.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config.home-libs = {
|
||||||
|
# path 参数目前无法通过内置函数的方式获取
|
||||||
|
# 需要是相对于 flake 的相对路径,直接由目录开始不需要加 `./`。
|
||||||
|
mkOutOfStoreSymlink = path:
|
||||||
|
config.lib.file.mkOutOfStoreSymlink "${sourcepath}/${path}";
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
{ pkgs, ... }:
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
@@ -11,8 +11,14 @@
|
|||||||
nodejs
|
nodejs
|
||||||
yarn
|
yarn
|
||||||
|
|
||||||
steam-run
|
sqlite
|
||||||
jetbrains.idea-community
|
jq
|
||||||
|
# steam-run
|
||||||
|
# jetbrains.idea-community # use prebuild binary
|
||||||
];
|
];
|
||||||
|
|
||||||
|
sessionVariables = {
|
||||||
|
GOPATH = "${config.home.homeDirectory}/data/go";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,21 @@
|
|||||||
# 输入法配置模块
|
# 输入法配置模块
|
||||||
{ config, lib, pkgs, ... }: {
|
{ config, lib, pkgs, ... }: {
|
||||||
|
|
||||||
i18n.inputMethod = {
|
i18n.inputMethod = (if lib.versionAtLeast config.home.stateVersion "25.05" then {
|
||||||
|
enable = true;
|
||||||
|
type = "fcitx5";
|
||||||
|
} else {
|
||||||
enabled = "fcitx5";
|
enabled = "fcitx5";
|
||||||
|
}) // {
|
||||||
fcitx5 = {
|
fcitx5 = {
|
||||||
addons = with pkgs; [
|
addons = with pkgs; [
|
||||||
fcitx5-gtk
|
fcitx5-gtk
|
||||||
fcitx5-chinese-addons
|
fcitx5-chinese-addons
|
||||||
fcitx5-nord
|
fcitx5-nord
|
||||||
];
|
];
|
||||||
waylandFrontend = true; # available in home-manager-25.05
|
} // (lib.optionalAttrs (lib.versionAtLeast config.home.stateVersion "25.05") {
|
||||||
};
|
waylandFrontend = true;
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
gtk = {
|
gtk = {
|
||||||
|
|||||||
@@ -26,39 +26,22 @@ monitor = ,preferred,auto,auto
|
|||||||
# See https://wiki.hyprland.org/Configuring/Keywords/ for more
|
# See https://wiki.hyprland.org/Configuring/Keywords/ for more
|
||||||
# Execute your favorite apps at launch
|
# Execute your favorite apps at launch
|
||||||
|
|
||||||
exec-once = dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP # for XDPH
|
|
||||||
exec-once = systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP # for XDPH
|
|
||||||
exec-once = /usr/lib/polkit-kde-authentication-agent-1 # authentication dialogue for GUI apps
|
|
||||||
exec-once = waybar # launch the system panel
|
exec-once = waybar # launch the system panel
|
||||||
exec-once = blueman-applet # systray app for BT
|
exec-once = blueman-applet # systray app for BT
|
||||||
exec-once = nm-applet --indicator # systray app for Network/Wifi
|
|
||||||
exec-once = mako # start notification demon
|
exec-once = mako # start notification demon
|
||||||
exec-once = wl-paste --type text --watch cliphist store # clipboard store text data
|
|
||||||
exec-once = wl-paste --type image --watch cliphist store # clipboard store image data
|
|
||||||
exec-once = ~/.config/swww/swwwallpaper.sh # start wallpaper daemon
|
|
||||||
exec-once = fcitx5 -d -r
|
exec-once = fcitx5 -d -r
|
||||||
|
exec-once = swww-daemon
|
||||||
|
# exec-once = nm-applet --indicator # systray app for Network/Wifi
|
||||||
|
# exec-once = dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP # for XDPH
|
||||||
|
# exec-once = systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP # for XDPH
|
||||||
|
# exec-once = /usr/lib/polkit-kde-authentication-agent-1 # authentication dialogue for GUI apps
|
||||||
|
# exec-once = wl-paste --type text --watch cliphist store # clipboard store text data
|
||||||
|
# exec-once = wl-paste --type image --watch cliphist store # clipboard store image data
|
||||||
|
# exec-once = ~/.config/swww/swwwallpaper.sh # start wallpaper daemon
|
||||||
#exec-once = swayidle -w timeout 900 'hyprctl dispatch dpms off' resume 'hyprctl dispatch dpms on' # turn off monitor after 15 mins
|
#exec-once = swayidle -w timeout 900 'hyprctl dispatch dpms off' resume 'hyprctl dispatch dpms on' # turn off monitor after 15 mins
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# █▀▀ █▄░█ █░█
|
|
||||||
# ██▄ █░▀█ ▀▄▀
|
|
||||||
|
|
||||||
# Some default env vars.
|
|
||||||
|
|
||||||
# env = XDG_CURRENT_DESKTOP,Hyprland
|
|
||||||
# env = XDG_SESSION_TYPE,wayland
|
|
||||||
# env = XDG_SESSION_DESKTOP,Hyprland
|
|
||||||
# env = GDK_BACKEND,wayland
|
|
||||||
# env = QT_QPA_PLATFORM,wayland
|
|
||||||
# #env = QT_STYLE_OVERRIDE,kvantum
|
|
||||||
# env = QT_QPA_PLATFORMTHEME,qt5ct
|
|
||||||
# env = QT_WAYLAND_DISABLE_WINDOWDECORATION,1
|
|
||||||
# env = QT_AUTO_SCREEN_SCALE_FACTOR,1
|
|
||||||
# env = XDG_PICTURES_DIR,$HOME/Pictures
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# █ █▄░█ █▀█ █░█ ▀█▀
|
# █ █▄░█ █▀█ █░█ ▀█▀
|
||||||
# █ █░▀█ █▀▀ █▄█ ░█░
|
# █ █░▀█ █▀▀ █▄█ ░█░
|
||||||
|
|
||||||
@@ -81,15 +64,6 @@ input {
|
|||||||
numlock_by_default = true
|
numlock_by_default = true
|
||||||
}
|
}
|
||||||
|
|
||||||
# Example per-device config
|
|
||||||
# See https://wiki.hyprland.org/Configuring/Keywords/#executing for more
|
|
||||||
|
|
||||||
#device:epic mouse V1 {
|
|
||||||
# sensitivity = -0.5
|
|
||||||
#}
|
|
||||||
|
|
||||||
# See https://wiki.hyprland.org/Configuring/Variables/ for more
|
|
||||||
|
|
||||||
gestures {
|
gestures {
|
||||||
workspace_swipe = true
|
workspace_swipe = true
|
||||||
workspace_swipe_fingers = 3
|
workspace_swipe_fingers = 3
|
||||||
@@ -97,23 +71,6 @@ gestures {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
# █░░ ▄▀█ █▄█ █▀█ █░█ ▀█▀ █▀
|
|
||||||
# █▄▄ █▀█ ░█░ █▄█ █▄█ ░█░ ▄█
|
|
||||||
|
|
||||||
# See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more
|
|
||||||
|
|
||||||
dwindle {
|
|
||||||
pseudotile = yes # master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below
|
|
||||||
preserve_split = yes # you probably want this
|
|
||||||
}
|
|
||||||
|
|
||||||
# See https://wiki.hyprland.org/Configuring/Master-Layout/ for more
|
|
||||||
|
|
||||||
#master {
|
|
||||||
# new_is_master = true
|
|
||||||
#}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# █▀▄▀█ █ █▀ █▀▀
|
# █▀▄▀█ █ █▀ █▀▀
|
||||||
# █░▀░█ █ ▄█ █▄▄
|
# █░▀░█ █ ▄█ █▄▄
|
||||||
@@ -139,5 +96,4 @@ source = ~/.config/hypr/theme.conf
|
|||||||
source = ~/.config/hypr/monitors.conf # initially empty, to be configured by user and remains static
|
source = ~/.config/hypr/monitors.conf # initially empty, to be configured by user and remains static
|
||||||
source = ~/.config/hypr/userprefs.conf # initially empty, to be configured by user and remains static
|
source = ~/.config/hypr/userprefs.conf # initially empty, to be configured by user and remains static
|
||||||
|
|
||||||
# Note: as userprefs.conf is sourced at the end, settings configured in this file will override the defaults
|
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
################################################
|
################################################
|
||||||
# Main modifier
|
# Main modifier
|
||||||
################################################
|
################################################
|
||||||
$mainMod = SUPER # windows key
|
$mod = SUPER # windows key
|
||||||
$terminal = kitty
|
$terminal = kitty
|
||||||
$filemanager = dolphin
|
$filemanager = dolphin
|
||||||
|
|
||||||
@@ -17,130 +17,137 @@ $filemanager = dolphin
|
|||||||
################################################
|
################################################
|
||||||
# Main actions
|
# Main actions
|
||||||
################################################
|
################################################
|
||||||
bind = $mainMod, Q, exec, ~/.config/hypr/scripts/dontkillsteam.sh # killactive, # kill the window on focus
|
bind = $mod, C, killactive # killactive, kill the window on focus
|
||||||
bind = $mainMod CTRL, delete, exit, # kill hyperland session
|
bind = $mod CTRL, delete, exit, # kill hyperland session
|
||||||
bind = $mainMod, F, togglefloating, # toggle the window on focus to float
|
bind = $mod, F, togglefloating, # toggle the window on focus to float
|
||||||
bind = $mainMod CTRL, L, exec, swaylock # lock screen
|
bind = $mod CTRL, L, exec, swaylock # lock screen
|
||||||
bind = $mainMod, P, pseudo, # dwindle
|
bind = $mod, P, pseudo, # dwindle
|
||||||
bind = $mainMod, S, togglesplit, # split screen
|
bind = $mod, S, togglesplit, # split screen
|
||||||
bind = $mainMod, return, fullscreen, # toggle the window on focus to fullscreen
|
bind = $mod, return, fullscreen, # toggle the window on focus to fullscreen
|
||||||
|
bind = $mod, F1, exec, ~/.config/hypr/scripts/keybinds.sh
|
||||||
|
|
||||||
# Application shortcuts
|
# Application shortcuts
|
||||||
bind = $mainMod, grave, exec, $terminal # ~ open terminal
|
bind = $mod, grave, exec, $terminal # ~ open terminal
|
||||||
bind = $mainMod, E, exec, $filemanager # open file manager
|
bind = $mod, E, exec, $filemanager # open file manager
|
||||||
bind = $mainMod, V, exec, code # open vscode
|
bind = $mod, V, exec, code # open vscode
|
||||||
|
|
||||||
################################################
|
################################################
|
||||||
# Control actions
|
# Control actions
|
||||||
################################################
|
################################################
|
||||||
# Rofi is toggled on/off if you repeat the key presses
|
# Rofi is toggled on/off if you repeat the key presses
|
||||||
bind = $mainMod, SPACE, exec, pkill rofi || rofi -show drun # launch desktop applications
|
bind = $mod, SPACE, exec, pkill rofi || rofi -show drun # launch desktop applications
|
||||||
bind = $mainMod, tab, exec, pkill rofi || rofi -show window # switch between desktop applications
|
bind = $mod, E, exec, pkill rofi || rofi -show filebrowser # browse system files
|
||||||
bind = $mainMod, D, exec, pkill rofi || rofi -show filebrowser # browse system files
|
bind = $mod, R, exec, pkill rofi || rofi -show run # run a command
|
||||||
bind = $mainMod, R, exec, pkill rofi || rofi -show run # run a command
|
|
||||||
|
|
||||||
# Audio control
|
# Audio control
|
||||||
# bind = , F10, exec, ~/.config/hypr/scripts/volumecontrol.sh -o m # toggle audio mute
|
# bind = , F10, exec, ~/.config/hypr/scripts/volumecontrol.sh -o m # toggle audio mute
|
||||||
# binde = , F11, exec, ~/.config/hypr/scripts/volumecontrol.sh -o d # decrease volume
|
# binde = , F11, exec, ~/.config/hypr/scripts/volumecontrol.sh -o d # decrease volume
|
||||||
# binde = , F12, exec, ~/.config/hypr/scripts/volumecontrol.sh -o i # increase volume
|
# binde = , F12, exec, ~/.config/hypr/scripts/volumecontrol.sh -o i # increase volume
|
||||||
bind = , XF86AudioMute, exec, ~/.config/hypr/scripts/volumecontrol.sh -o m # toggle audio mute
|
bind = , XF86AudioMute, exec, pamixer -t # toggle audio mute
|
||||||
bind = , XF86AudioMicMute, exec, ~/.config/hypr/scripts/volumecontrol.sh -i m # toggle microphone mute
|
bind = , XF86AudioMicMute, exec, pamixer --default-source -t # toggle microphone mute
|
||||||
binde = , XF86AudioLowerVolume, exec, ~/.config/hypr/scripts/volumecontrol.sh -o d # decrease volume
|
binde = , XF86AudioLowerVolume, exec, pamixer -d 2# decrease volume
|
||||||
binde = , XF86AudioRaiseVolume, exec, ~/.config/hypr/scripts/volumecontrol.sh -o i # increase volume
|
binde = , XF86AudioRaiseVolume, exec, pamixer -i 2# increase volume
|
||||||
bind = , XF86AudioPlay, exec, playerctl play-pause
|
bind = , XF86AudioPlay, exec, playerctl play-pause
|
||||||
bind = , XF86AudioPause, exec, playerctl play-pause
|
bind = , XF86AudioPause, exec, playerctl play-pause
|
||||||
bind = , XF86AudioNext, exec, playerctl next
|
bind = , XF86AudioNext, exec, playerctl next
|
||||||
bind = , XF86AudioPrev, exec, playerctl previous
|
bind = , XF86AudioPrev, exec, playerctl previous
|
||||||
|
|
||||||
# Brightness control
|
|
||||||
binde = , XF86MonBrightnessUp, exec, ~/.config/hypr/scripts/brightnesscontrol.sh i # increase brightness
|
|
||||||
binde = , XF86MonBrightnessDown, exec, ~/.config/hypr/scripts/brightnesscontrol.sh d # decrease brightness
|
|
||||||
|
|
||||||
# Screenshot/screencapture
|
# Screenshot/screencapture
|
||||||
bind = , PRINT, exec, hyprshot -m window # logout menu
|
bind = , PRINT, exec, hyprshot -z -m window
|
||||||
bind = ALT, PRINT, exec, hyprshot -m region # logout menu
|
bind = ALT, PRINT, exec, hyprshot -z -m region
|
||||||
bind = $CONTROL SHIFT, P, pass, ^(com\.obsproject\.Studio)$ # start/stop obs screen recording
|
|
||||||
|
|
||||||
|
|
||||||
################################################
|
################################################
|
||||||
# Exec custom scripts
|
# Exec custom scripts
|
||||||
################################################
|
################################################
|
||||||
bind = $mainMod, G, exec, ~/.config/hypr/scripts/gamemode.sh # disable hypr effects for gamemode
|
bind = $mod, G, exec, ~/.config/hypr/scripts/gamemode.sh # disable hypr effects for gamemode
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
################################################
|
################################################
|
||||||
# Window actions
|
# Window actions
|
||||||
################################################
|
################################################
|
||||||
# Move focus with mainMod + arrow keys
|
# Move focus with mod + arrow keys
|
||||||
bind = $mainMod, left, movefocus, l
|
bind = $mod, left, movefocus, l
|
||||||
bind = $mainMod, right, movefocus, r
|
bind = $mod, H, movefocus, l
|
||||||
bind = $mainMod, up, movefocus, u
|
bind = $mod, right, movefocus, r
|
||||||
bind = $mainMod, down, movefocus, d
|
bind = $mod, L, movefocus, r
|
||||||
bind = ALT, Tab, movefocus, d
|
bind = $mod, up, movefocus, u
|
||||||
|
bind = $mod, K, movefocus, u
|
||||||
|
bind = $mod, down, movefocus, d
|
||||||
|
bind = $mod, J, movefocus, d
|
||||||
|
|
||||||
# Resize windows
|
# Resize windows
|
||||||
binde = $mainMod CONTROL, right, resizeactive, 10 0
|
binde = $mod CONTROL, right, resizeactive, 10 0
|
||||||
binde = $mainMod CONTROL, left, resizeactive, -10 0
|
binde = $mod CONTROL, H, resizeactive, 10 0
|
||||||
binde = $mainMod CONTROL, up, resizeactive, 0 -10
|
binde = $mod CONTROL, left, resizeactive, -10 0
|
||||||
binde = $mainMod CONTROL, down, resizeactive, 0 10
|
binde = $mod CONTROL, L, resizeactive, -10 0
|
||||||
|
binde = $mod CONTROL, up, resizeactive, 0 -10
|
||||||
|
binde = $mod CONTROL, K, resizeactive, 0 -10
|
||||||
|
binde = $mod CONTROL, down, resizeactive, 0 10
|
||||||
|
binde = $mod CONTROL, J, resizeactive, 0 10
|
||||||
|
|
||||||
# Move Window with mainMod + SHIFT + arrow keys
|
# Move Window with mod + SHIFT + arrow keys
|
||||||
bind = $mainMod SHIFT, left, movewindow, l
|
bind = $mod SHIFT, left, movewindow, l
|
||||||
bind = $mainMod SHIFT, right, movewindow, r
|
bind = $mod SHIFT, H, movewindow, l
|
||||||
bind = $mainMod SHIFT, up, movewindow, u
|
bind = $mod SHIFT, right, movewindow, r
|
||||||
bind = $mainMod SHIFT, down, movewindow, d
|
bind = $mod SHIFT, L, movewindow, r
|
||||||
|
bind = $mod SHIFT, up, movewindow, u
|
||||||
|
bind = $mod SHIFT, K, movewindow, u
|
||||||
|
bind = $mod SHIFT, down, movewindow, d
|
||||||
|
bind = $mod SHIFT, J, movewindow, d
|
||||||
|
|
||||||
# Move/resize windows with mainMod + LMB/RMB and dragging
|
# Move/resize windows with mod + LMB/RMB and dragging
|
||||||
bindm = $mainMod, mouse:272, movewindow
|
bindm = $mod, mouse:272, movewindow
|
||||||
bindm = $mainMod, mouse:273, resizewindow
|
bindm = $mod, mouse:273, resizewindow
|
||||||
|
|
||||||
|
|
||||||
################################################
|
################################################
|
||||||
# Workspace actions
|
# Workspace actions
|
||||||
################################################
|
################################################
|
||||||
# Switch workspaces with mainMod + [0-9]
|
# Switch workspaces with mod + [0-9]
|
||||||
bind = $mainMod, 1, workspace, 1
|
bind = $mod, 1, workspace, 1
|
||||||
bind = $mainMod, 2, workspace, 2
|
bind = $mod, 2, workspace, 2
|
||||||
bind = $mainMod, 3, workspace, 3
|
bind = $mod, 3, workspace, 3
|
||||||
bind = $mainMod, 4, workspace, 4
|
bind = $mod, 4, workspace, 4
|
||||||
bind = $mainMod, 5, workspace, 5
|
bind = $mod, 5, workspace, 5
|
||||||
bind = $mainMod, 6, workspace, 6
|
bind = $mod, 6, workspace, 6
|
||||||
bind = $mainMod, 7, workspace, 7
|
bind = $mod, 7, workspace, 7
|
||||||
bind = $mainMod, 8, workspace, 8
|
bind = $mod, 8, workspace, 8
|
||||||
bind = $mainMod, 9, workspace, 9
|
bind = $mod, 9, workspace, 9
|
||||||
bind = $mainMod, 0, workspace, 10
|
bind = $mod, 0, workspace, 10
|
||||||
|
|
||||||
# Move active window to a workspace with mainMod + SHIFT + [0-9]
|
# Move active window to a workspace with mod + SHIFT + [0-9]
|
||||||
bind = $mainMod SHIFT, 1, movetoworkspace, 1
|
bind = $mod SHIFT, 1, movetoworkspace, 1
|
||||||
bind = $mainMod SHIFT, 2, movetoworkspace, 2
|
bind = $mod SHIFT, 2, movetoworkspace, 2
|
||||||
bind = $mainMod SHIFT, 3, movetoworkspace, 3
|
bind = $mod SHIFT, 3, movetoworkspace, 3
|
||||||
bind = $mainMod SHIFT, 4, movetoworkspace, 4
|
bind = $mod SHIFT, 4, movetoworkspace, 4
|
||||||
bind = $mainMod SHIFT, 5, movetoworkspace, 5
|
bind = $mod SHIFT, 5, movetoworkspace, 5
|
||||||
bind = $mainMod SHIFT, 6, movetoworkspace, 6
|
bind = $mod SHIFT, 6, movetoworkspace, 6
|
||||||
bind = $mainMod SHIFT, 7, movetoworkspace, 7
|
bind = $mod SHIFT, 7, movetoworkspace, 7
|
||||||
bind = $mainMod SHIFT, 8, movetoworkspace, 8
|
bind = $mod SHIFT, 8, movetoworkspace, 8
|
||||||
bind = $mainMod SHIFT, 9, movetoworkspace, 9
|
bind = $mod SHIFT, 9, movetoworkspace, 9
|
||||||
bind = $mainMod SHIFT, 0, movetoworkspace, 10
|
bind = $mod SHIFT, 0, movetoworkspace, 10
|
||||||
|
|
||||||
# Move window to workspace Super + Alt + [0-9]
|
# Move window to workspace Super + Alt + [0-9]
|
||||||
bind = $mainMod ALT, 1, movetoworkspacesilent, 1
|
bind = $mod ALT, 1, movetoworkspacesilent, 1
|
||||||
bind = $mainMod ALT, 2, movetoworkspacesilent, 2
|
bind = $mod ALT, 2, movetoworkspacesilent, 2
|
||||||
bind = $mainMod ALT, 3, movetoworkspacesilent, 3
|
bind = $mod ALT, 3, movetoworkspacesilent, 3
|
||||||
bind = $mainMod ALT, 4, movetoworkspacesilent, 4
|
bind = $mod ALT, 4, movetoworkspacesilent, 4
|
||||||
bind = $mainMod ALT, 5, movetoworkspacesilent, 5
|
bind = $mod ALT, 5, movetoworkspacesilent, 5
|
||||||
bind = $mainMod ALT, 6, movetoworkspacesilent, 6
|
bind = $mod ALT, 6, movetoworkspacesilent, 6
|
||||||
bind = $mainMod ALT, 7, movetoworkspacesilent, 7
|
bind = $mod ALT, 7, movetoworkspacesilent, 7
|
||||||
bind = $mainMod ALT, 8, movetoworkspacesilent, 8
|
bind = $mod ALT, 8, movetoworkspacesilent, 8
|
||||||
bind = $mainMod ALT, 9, movetoworkspacesilent, 9
|
bind = $mod ALT, 9, movetoworkspacesilent, 9
|
||||||
bind = $mainMod ALT, 0, movetoworkspacesilent, 10
|
bind = $mod ALT, 0, movetoworkspacesilent, 10
|
||||||
|
|
||||||
# Special workspaces (scratchpad)
|
# Special workspaces (scratchpad)
|
||||||
bind = $mainMod ALT, S, movetoworkspacesilent, special
|
bind = $mod ALT, S, movetoworkspacesilent, special
|
||||||
bind = $mainMod CONTROL, S, togglespecialworkspace,
|
bind = $mod CONTROL, S, togglespecialworkspace,
|
||||||
|
|
||||||
# Scroll through existing workspaces with mainMod + scroll
|
# Scroll through existing workspaces with mod + scroll
|
||||||
bind = $mainMod CTRL, right, workspace, e+1
|
bind = $mod CTRL, right, workspace, e+1
|
||||||
bind = $mainMod, mouse_up, workspace, e+1
|
|
||||||
bind = $mainMod CTRL, left, workspace, e-1
|
bind = $mod CTRL, left, workspace, e-1
|
||||||
bind = $mainMod, mouse_down, workspace, e-1
|
|
||||||
|
bind = $mod, TAB, exec, ~/.config/hypr/scripts/switch.sh
|
||||||
|
|||||||
@@ -1,42 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
ncolor="-h string:bgcolor:#343d46 -h string:fgcolor:#c0c5ce -h string:frcolor:#c0c5ce"
|
|
||||||
|
|
||||||
function send_notification {
|
|
||||||
brightness=`brightnessctl info | grep -oP "(?<=\()\d+(?=%)" | cat`
|
|
||||||
brightinfo=$(brightnessctl info | awk -F"'" '/Device/ {print $2}')
|
|
||||||
|
|
||||||
angle="$(((($brightness + 2) / 5) * 5))"
|
|
||||||
ico="~/.config/dunst/icons/vol/vol-${angle}.svg"
|
|
||||||
bar=$(seq -s "." $(($brightness / 15)) | sed 's/[0-9]//g')
|
|
||||||
|
|
||||||
if [ $brightness -ne 0 ]; then
|
|
||||||
notify-send $ncolor "brightctl" -i $ico -a "$brightness$bar" "Device: $brightinfo" -r 91190 -t 800
|
|
||||||
|
|
||||||
else
|
|
||||||
notify-send -i $ico "Brightness: ${brightness}%" -a "$brightinfo" -u low -r 91190 -t 800
|
|
||||||
fi
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function get_brightness {
|
|
||||||
brightnessctl -m | grep -o '[0-9]\+%' | head -c-2
|
|
||||||
}
|
|
||||||
|
|
||||||
case $1 in
|
|
||||||
i)
|
|
||||||
# increase the backlight by 5%
|
|
||||||
brightnessctl set +5%
|
|
||||||
send_notification
|
|
||||||
;;
|
|
||||||
d)
|
|
||||||
if [[ $(get_brightness) -lt 5 ]]; then
|
|
||||||
# avoid 0% brightness
|
|
||||||
brightnessctl set 1%
|
|
||||||
else
|
|
||||||
# decrease the backlight by 5%
|
|
||||||
brightnessctl set 5%-
|
|
||||||
fi
|
|
||||||
send_notification
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
if [[ $(hyprctl activewindow -j | jq -r ".class") == "Steam" ]]; then
|
|
||||||
xdotool windowunmap $(xdotool getactivewindow)
|
|
||||||
else
|
|
||||||
hyprctl dispatch killactive ""
|
|
||||||
fi
|
|
||||||
12
modules/home/hyprland/conf/hypr/scripts/keybinds.sh
Executable file
12
modules/home/hyprland/conf/hypr/scripts/keybinds.sh
Executable file
@@ -0,0 +1,12 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
# 简单示例:从 hyprland.conf 提取非注释的 bind= 行
|
||||||
|
# 注意:这可能需要根据你的配置复杂性进行调整(例如处理逗号后的空格、多行绑定等)
|
||||||
|
grep '^bind =' ~/.config/hypr/keybindings.conf | \
|
||||||
|
sed 's/^bind = //; s/, /\t/' | \
|
||||||
|
# 可以进一步处理,比如移除 exec 后面的命令细节,只留动作描述
|
||||||
|
# sed -E 's/,(.+)/ : \1/' | # 简单替换
|
||||||
|
column -t -s $'\t' | \
|
||||||
|
rofi -dmenu -i -p "Hyprland Keybinds" -markup-rows -config ~/.config/rofi/config-keybinds.rasi
|
||||||
|
# 或者使用 wofi:
|
||||||
|
# wofi --dmenu --prompt "Hyprland Keybinds" --insensitive
|
||||||
34
modules/home/hyprland/conf/hypr/scripts/switch.sh
Executable file
34
modules/home/hyprland/conf/hypr/scripts/switch.sh
Executable file
@@ -0,0 +1,34 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# 获取窗口列表,格式为 "ADDRESS [Workspace] Class: Title"
|
||||||
|
# 使用 jq 解析 hyprctl clients -j 的 JSON 输出
|
||||||
|
# select(.workspace.id != -1) 过滤掉特殊工作区(如概览)的窗口
|
||||||
|
WINDOWS_LIST=$(hyprctl clients -j | jq -r '.[] | select(.workspace.id != -1) | "\(.address)\t[\(.workspace.name)] \(.class): \(.title)"')
|
||||||
|
|
||||||
|
# 如果没有窗口,显示提示并退出
|
||||||
|
if [ -z "$WINDOWS_LIST" ]; then
|
||||||
|
rofi -e "No open windows found."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 使用 Rofi 显示窗口列表,允许用户选择
|
||||||
|
# -dmenu: dmenu 模式
|
||||||
|
# -i: 不区分大小写搜索
|
||||||
|
# -p: 提示符文本
|
||||||
|
# -markup-rows: (可选) 如果你想在列表中使用 Pango 标记
|
||||||
|
# -format 's': 输出选择的完整行
|
||||||
|
CHOSEN_WINDOW_LINE=$(echo -e "$WINDOWS_LIST" | rofi -dmenu -i -p " Switch Window" -format 's')
|
||||||
|
# 你可以使用其他图标,例如 或 Window:
|
||||||
|
|
||||||
|
# 如果用户取消了选择 (Rofi 返回空),则退出
|
||||||
|
if [ -z "$CHOSEN_WINDOW_LINE" ]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 从选择的行中提取窗口地址 (它是第一个字段,以制表符分隔)
|
||||||
|
CHOSEN_ADDRESS=$(echo "$CHOSEN_WINDOW_LINE" | awk -F'\t' '{print $1}')
|
||||||
|
|
||||||
|
# 使用 hyprctl 切换到选定的窗口
|
||||||
|
hyprctl dispatch focuswindow address:"$CHOSEN_ADDRESS"
|
||||||
|
|
||||||
|
exit 0
|
||||||
@@ -1,76 +0,0 @@
|
|||||||
#!/usr/bin/env sh
|
|
||||||
|
|
||||||
|
|
||||||
# define functions
|
|
||||||
|
|
||||||
function print_error
|
|
||||||
{
|
|
||||||
cat << "EOF"
|
|
||||||
./volumecontrol.sh -[device] <action>
|
|
||||||
...valid device are...
|
|
||||||
i -- [i]nput decive
|
|
||||||
o -- [o]utput device
|
|
||||||
...valid actions are...
|
|
||||||
i -- <i>ncrease volume [+5]
|
|
||||||
d -- <d>ecrease volume [-5]
|
|
||||||
m -- <m>ute [x]
|
|
||||||
EOF
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
function notify_vol
|
|
||||||
{
|
|
||||||
vol=`pamixer $srce --get-volume | cat`
|
|
||||||
angle="$(( (($vol+2)/5) * 5 ))"
|
|
||||||
ico="${icodir}/vol-${angle}.svg"
|
|
||||||
bar=$(seq -s "." $(($vol / 15)) | sed 's/[0-9]//g')
|
|
||||||
notify-send $ncolor "volctl" -a "$vol$bar" "$nsink" -i $ico -r 91190 -t 800
|
|
||||||
}
|
|
||||||
|
|
||||||
function notify_mute
|
|
||||||
{
|
|
||||||
mute=`pamixer $srce --get-mute | cat`
|
|
||||||
if [ "$mute" == "true" ] ; then
|
|
||||||
notify-send $ncolor "volctl" -a "muted" "$nsink" -i ${icodir}/muted-${dvce}.svg -r 91190 -t 800
|
|
||||||
else
|
|
||||||
notify-send $ncolor "volctl" -a "unmuted" "$nsink" -i ${icodir}/unmuted-${dvce}.svg -r 91190 -t 800
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# set device source
|
|
||||||
|
|
||||||
while getopts io SetSrc
|
|
||||||
do
|
|
||||||
case $SetSrc in
|
|
||||||
i) nsink=$(pamixer --list-sources | grep "_input." | head -1 | awk -F '" "' '{print $NF}' | sed 's/"//')
|
|
||||||
srce="--default-source"
|
|
||||||
dvce="mic" ;;
|
|
||||||
o) nsink=$(pamixer --get-default-sink | grep "_output." | awk -F '" "' '{print $NF}' | sed 's/"//')
|
|
||||||
srce=""
|
|
||||||
dvce="speaker" ;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ $OPTIND -eq 1 ] ; then
|
|
||||||
print_error
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
# set device action
|
|
||||||
|
|
||||||
shift $((OPTIND -1))
|
|
||||||
step="${2:-5}"
|
|
||||||
icodir="~/.config/dunst/icons/vol"
|
|
||||||
ncolor="-h string:bgcolor:#343d46 -h string:fgcolor:#c0c5ce -h string:frcolor:#c0c5ce"
|
|
||||||
|
|
||||||
case $1 in
|
|
||||||
i) pamixer $srce -i ${step}
|
|
||||||
notify_vol ;;
|
|
||||||
d) pamixer $srce -d ${step}
|
|
||||||
notify_vol ;;
|
|
||||||
m) pamixer $srce -t
|
|
||||||
notify_mute ;;
|
|
||||||
*) print_error ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
@@ -1,20 +1,13 @@
|
|||||||
exec = hyprctl setcursor Bibata-Modern-Ice 20
|
|
||||||
exec = gsettings set org.gnome.desktop.interface cursor-theme 'Bibata-Modern-Ice'
|
|
||||||
exec = gsettings set org.gnome.desktop.interface cursor-size 20
|
|
||||||
|
|
||||||
exec = kvantummanager --set Catppuccin-Latte
|
# █░░ ▄▀█ █▄█ █▀█ █░█ ▀█▀ █▀
|
||||||
exec = gsettings set org.gnome.desktop.interface icon-theme 'Tela-circle-grey'
|
# █▄▄ █▀█ ░█░ █▄█ █▄█ ░█░ ▄█
|
||||||
exec = gsettings set org.gnome.desktop.interface gtk-theme 'Catppuccin-Latte'
|
|
||||||
exec = gsettings set org.gnome.desktop.interface color-scheme 'prefer-light'
|
|
||||||
|
|
||||||
exec = gsettings set org.gnome.desktop.interface font-name 'Cantarell 10'
|
# See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more
|
||||||
exec = gsettings set org.gnome.desktop.interface document-font-name 'Cantarell 10'
|
|
||||||
exec = gsettings set org.gnome.desktop.interface monospace-font-name 'CaskaydiaCove Nerd Font Mono 9'
|
|
||||||
exec = gsettings set org.gnome.desktop.interface font-antialiasing 'rgba'
|
|
||||||
exec = gsettings set org.gnome.desktop.interface font-hinting 'full'
|
|
||||||
|
|
||||||
env = XCURSOR_THEME,Bibata-Modern-Ice
|
dwindle {
|
||||||
env = XCURSOR_SIZE,20
|
pseudotile = yes # master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below
|
||||||
|
preserve_split = yes # you probably want this
|
||||||
|
}
|
||||||
|
|
||||||
general {
|
general {
|
||||||
gaps_in = 2
|
gaps_in = 2
|
||||||
@@ -37,5 +30,3 @@ decoration {
|
|||||||
xray = false
|
xray = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
blurls = waybar
|
|
||||||
|
|||||||
@@ -10,8 +10,8 @@
|
|||||||
# See https://wiki.hyprland.org/Configuring/Window-Rules/ for more
|
# See https://wiki.hyprland.org/Configuring/Window-Rules/ for more
|
||||||
|
|
||||||
# Float rules for system dialogs and popups
|
# Float rules for system dialogs and popups
|
||||||
windowrulev2 = float,class:^(.*)$,title:^(Open [Ff]ile)
|
windowrulev2 = float,class:^(.*)$,title:^(Open [Ff]iles?)
|
||||||
windowrulev2 = center,class:^(.*)$,title:^(Open [Ff]ile)
|
windowrulev2 = center,class:^(.*)$,title:^(Open [Ff]iles?)
|
||||||
|
|
||||||
windowrulev2 = float,class:^(.*)$,title:^(Open [Ff]older)
|
windowrulev2 = float,class:^(.*)$,title:^(Open [Ff]older)
|
||||||
windowrulev2 = center,class:^(.*)$,title:^(Open [Ff]older)
|
windowrulev2 = center,class:^(.*)$,title:^(Open [Ff]older)
|
||||||
@@ -22,6 +22,9 @@ windowrulev2 = center,class:^(.*)$,title:^(Save [Ff]ile)
|
|||||||
windowrulev2 = float,class:^(.*)$,title:^(Save [Aa]s)
|
windowrulev2 = float,class:^(.*)$,title:^(Save [Aa]s)
|
||||||
windowrulev2 = center,class:^(.*)$,title:^(Save [Aa]s)
|
windowrulev2 = center,class:^(.*)$,title:^(Save [Aa]s)
|
||||||
|
|
||||||
|
windowrulev2 = float,class:^(wechat)$,title:^(预览)$
|
||||||
|
windowrulev2 = center,class:^(wechat)$,title:^(预览)$
|
||||||
|
|
||||||
windowrulev2 = center,class:^(.*)$,title:^(Location)$
|
windowrulev2 = center,class:^(.*)$,title:^(Location)$
|
||||||
windowrulev2 = center,class:^(Code)$
|
windowrulev2 = center,class:^(Code)$
|
||||||
|
|
||||||
@@ -32,6 +35,5 @@ windowrulev2 = float,class:^(blueman-manager)$
|
|||||||
windowrulev2 = opacity 0.80 0.70,class:^(blueman-manager)$
|
windowrulev2 = opacity 0.80 0.70,class:^(blueman-manager)$
|
||||||
|
|
||||||
|
|
||||||
windowrulev2 = opacity 0.50 0.50,class:^(Code)$
|
windowrulev2 = opacity 1.00 1.00,class:^(code)$
|
||||||
windowrulev2 = opacity 0.80 0.80,class:^(code-url-handler)$
|
windowrulev2 = opacity 0.80 0.80,class:^(code-url-handler)$
|
||||||
windowrulev2 = opacity 0.80 0.80,class:^(kitty)$
|
|
||||||
|
|||||||
@@ -1,11 +1,27 @@
|
|||||||
# vim:ft=kitty
|
# 背景透明度
|
||||||
|
background_opacity 0.6
|
||||||
|
|
||||||
## name: Catppuccin Latte 🐑
|
# 开启抗锯齿
|
||||||
## author: Pocco81 (https://github.com/Pocco81)
|
enable_ligatures yes
|
||||||
## license: MIT
|
# 开启字体平滑
|
||||||
## upstream: https://github.com/catppuccin/kitty/blob/main/latte.conf
|
font_antialias true
|
||||||
## blurb: Soothing pastel theme for the high-spirited!
|
# 开启子像素渲染
|
||||||
|
font_hinting full
|
||||||
|
|
||||||
|
# 终端兼容性设置
|
||||||
|
term xterm-256color
|
||||||
|
shell_integration no-rc
|
||||||
|
|
||||||
|
# 修复 SSH 退格键问题
|
||||||
|
map ctrl+h send_text all \x08
|
||||||
|
backspace_sends_backspace yes
|
||||||
|
|
||||||
|
# 设置四周边距(单位:像素)
|
||||||
|
window_padding_width 8
|
||||||
|
|
||||||
|
map ctrl+shift+equal change_font_size all +1
|
||||||
|
map ctrl+shift+minus change_font_size all -1
|
||||||
|
map ctrl+shift+backspace change_font_size all 0
|
||||||
|
|
||||||
|
|
||||||
# The basic colors
|
# The basic colors
|
||||||
@@ -78,11 +94,3 @@ color14 #179299
|
|||||||
# white
|
# white
|
||||||
color7 #ACB0BE
|
color7 #ACB0BE
|
||||||
color15 #ACB0BE
|
color15 #ACB0BE
|
||||||
|
|
||||||
# 终端兼容性设置
|
|
||||||
term xterm-256color
|
|
||||||
shell_integration no-rc
|
|
||||||
|
|
||||||
# 修复 SSH 退格键问题
|
|
||||||
map ctrl+h send_text all \x08
|
|
||||||
backspace_sends_backspace yes
|
|
||||||
|
|||||||
@@ -33,8 +33,8 @@ configuration {
|
|||||||
window {
|
window {
|
||||||
background-color: @bg0;
|
background-color: @bg0;
|
||||||
location: center;
|
location: center;
|
||||||
width: 560px;
|
width: 720px;
|
||||||
height: 450px;
|
height: 500px;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
border: 1px;
|
border: 1px;
|
||||||
border-color: @bg1;
|
border-color: @bg1;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"layer": "top",
|
"layer": "top",
|
||||||
"position": "top",
|
"position": "top",
|
||||||
"mod": "dock",
|
"mod": "dock",
|
||||||
"height": 28,
|
"height": 30,
|
||||||
"exclusive": true,
|
"exclusive": true,
|
||||||
"passthrough": false,
|
"passthrough": false,
|
||||||
"gtk-layer-shell": true,
|
"gtk-layer-shell": true,
|
||||||
@@ -10,10 +10,10 @@
|
|||||||
"modules-left": [
|
"modules-left": [
|
||||||
"custom/lr",
|
"custom/lr",
|
||||||
"hyprland/workspaces",
|
"hyprland/workspaces",
|
||||||
"custom/rr",
|
|
||||||
"custom/lr",
|
|
||||||
"hyprland/window",
|
|
||||||
"custom/rr"
|
"custom/rr"
|
||||||
|
// "custom/lr",
|
||||||
|
// "hyprland/window",
|
||||||
|
// "custom/rr"
|
||||||
],
|
],
|
||||||
"modules-center": ["custom/lr", "clock", "custom/rr"],
|
"modules-center": ["custom/lr", "clock", "custom/rr"],
|
||||||
"modules-right": [
|
"modules-right": [
|
||||||
@@ -32,7 +32,6 @@
|
|||||||
"network",
|
"network",
|
||||||
"bluetooth",
|
"bluetooth",
|
||||||
"wireplumber",
|
"wireplumber",
|
||||||
"wireplumber#microphone",
|
|
||||||
"custom/power",
|
"custom/power",
|
||||||
"custom/rr"
|
"custom/rr"
|
||||||
],
|
],
|
||||||
@@ -66,24 +65,29 @@
|
|||||||
"format-window-separator": " ",
|
"format-window-separator": " ",
|
||||||
"window-rewrite-default": "",
|
"window-rewrite-default": "",
|
||||||
"window-rewrite": {
|
"window-rewrite": {
|
||||||
|
"fcitx": "",
|
||||||
|
"code": "",
|
||||||
|
"Cursor": "",
|
||||||
|
"jetbrains-idea-ce": "",
|
||||||
|
"dbeaver": "",
|
||||||
|
|
||||||
"class<microsoft-edge>": "",
|
"class<microsoft-edge>": "",
|
||||||
"class<chromium-browser>": "",
|
"class<chromium-browser>": "",
|
||||||
"title<.*youtube.*>": "",
|
"title<.*youtube.*>": "",
|
||||||
"rofi": "",
|
"rofi": "",
|
||||||
"kitty": "",
|
"kitty": "",
|
||||||
"code": "",
|
"nemo": "",
|
||||||
"Cursor": "",
|
|
||||||
"org.gnome.Nautilus": "",
|
|
||||||
"wechat": "",
|
"wechat": "",
|
||||||
"wps": "",
|
"wps": "",
|
||||||
"class<et>": ""
|
"class<et>": "",
|
||||||
|
"vlc": ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
"hyprland/window": {
|
"hyprland/window": {
|
||||||
"format": "{title}",
|
"format": "{title}",
|
||||||
"tooltip-format": "{title}",
|
"tooltip-format": "[{class}]: {title}",
|
||||||
"rewrite": { "^(.{30}).+": "$1..." },
|
"max-length": 30,
|
||||||
"separate-outputs": true
|
"separate-outputs": true
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -129,14 +133,14 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
"cpu": {
|
"cpu": {
|
||||||
"interval": 10,
|
"interval": 5,
|
||||||
"format": " {usage}%",
|
"format": " {usage}%",
|
||||||
"format-alt": "{icon0}{icon1}{icon2}{icon3}",
|
"format-alt": "{icon0}{icon1}{icon2}{icon3}",
|
||||||
"format-icons": ["▁", "▂", "▃", "▄", "▅", "▆", "▇", "█"]
|
"format-icons": ["▁", "▂", "▃", "▄", "▅", "▆", "▇", "█"]
|
||||||
},
|
},
|
||||||
|
|
||||||
"temperature": {
|
"temperature": {
|
||||||
"interval": 10,
|
"interval": 5,
|
||||||
"hwmon-path": "/sys/devices/platform/coretemp.0/hwmon/hwmon2/temp1_input",
|
"hwmon-path": "/sys/devices/platform/coretemp.0/hwmon/hwmon2/temp1_input",
|
||||||
"format": " {temperatureC}°C"
|
"format": " {temperatureC}°C"
|
||||||
},
|
},
|
||||||
@@ -151,14 +155,14 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
"network": {
|
"network": {
|
||||||
|
"interval": 5,
|
||||||
// "interface": "wlp2*", // (Optional) To force the use of this interface
|
// "interface": "wlp2*", // (Optional) To force the use of this interface
|
||||||
"format-wifi": " {essid}",
|
"format-wifi": " {essid}",
|
||||||
"format-ethernet": " Wired",
|
"format-ethernet": " Wired",
|
||||||
"tooltip-format": " {ipaddr} {bandwidthUpBytes} {bandwidthDownBytes}",
|
"tooltip-format": " {ipaddr} {bandwidthUpBytes} {bandwidthDownBytes}",
|
||||||
"format-linked": " {ifname} (No IP)",
|
"format-linked": " {ifname} (No IP)",
|
||||||
"format-disconnected": " Disconnected",
|
"format-disconnected": " Disconnected",
|
||||||
"format-alt": " {signalStrength}%",
|
"format-alt": " {signalStrength}%"
|
||||||
"interval": 5
|
|
||||||
},
|
},
|
||||||
|
|
||||||
"bluetooth": {
|
"bluetooth": {
|
||||||
@@ -174,32 +178,10 @@
|
|||||||
"format": "{icon} {volume}",
|
"format": "{icon} {volume}",
|
||||||
"format-muted": "",
|
"format-muted": "",
|
||||||
"on-click": "pavucontrol -t 3",
|
"on-click": "pavucontrol -t 3",
|
||||||
"on-click-middle": "~/.config/hypr/scripts/volumecontrol.sh -o m",
|
"on-click-middle": "pamixer -t",
|
||||||
"on-scroll-up": "~/.config/hypr/scripts/volumecontrol.sh -o i",
|
|
||||||
"on-scroll-down": "~/.config/hypr/scripts/volumecontrol.sh -o d",
|
|
||||||
"tooltip-format": "{icon} {desc} // {volume}%",
|
"tooltip-format": "{icon} {desc} // {volume}%",
|
||||||
"scroll-step": 5,
|
"scroll-step": 2,
|
||||||
"format-icons": {
|
"format-icons": ["", "", ""]
|
||||||
"headphone": "",
|
|
||||||
"hands-free": "",
|
|
||||||
"headset": "",
|
|
||||||
"phone": "",
|
|
||||||
"portable": "",
|
|
||||||
"car": "",
|
|
||||||
"default": ["", "", ""]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
"wireplumber#microphone": {
|
|
||||||
"format": "{format_source}",
|
|
||||||
"format-source": "",
|
|
||||||
"format-source-muted": "",
|
|
||||||
"on-click": "c -t 4",
|
|
||||||
"on-click-middle": "~/.config/hypr/scripts/volumecontrol.sh -i m",
|
|
||||||
"on-scroll-up": "~/.config/hypr/scripts/volumecontrol.sh -i i",
|
|
||||||
"on-scroll-down": "~/.config/hypr/scripts/volumecontrol.sh -i d",
|
|
||||||
"tooltip-format": "{format_source} {source_desc} // {source_volume}%",
|
|
||||||
"scroll-step": 5
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// modules for padding //
|
// modules for padding //
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
{ config, libs, pkgs, ... }:
|
{ config, libs, pkgs, ... }:
|
||||||
let
|
let
|
||||||
conf = [ "hypr" "waybar" "rofi" "kitty" "mako" "wlogout" ];
|
confPath = "modules/home/hyprland/conf";
|
||||||
confPath = "${config.home.homeDirectory}/.nix/modules/home/hyprland/conf";
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
@@ -19,30 +18,22 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
home.packages = with pkgs; [
|
home.packages = with pkgs; [
|
||||||
|
hyprshot #screenshot
|
||||||
waybar # the status bar
|
waybar # the status bar
|
||||||
swww # wallpaper
|
swww # wallpaper
|
||||||
libnotify # for notify-send command
|
libnotify # for notify-send command
|
||||||
mako # notify daemon
|
mako # notify daemon
|
||||||
hyprshot #screenshot
|
|
||||||
rofi # app launcher
|
rofi # app launcher
|
||||||
kitty # terminal
|
kitty # terminal
|
||||||
wlogout # logout menu
|
wlogout # logout menu
|
||||||
killall
|
killall
|
||||||
pavucontrol # audio control
|
pavucontrol # audio control
|
||||||
nautilus #file manager for GNOME
|
nemo #file manager
|
||||||
|
jq # json query util
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
programs = {
|
programs = {
|
||||||
bash = {
|
|
||||||
initExtra = ''
|
|
||||||
if [ -z $DISPLAY ] && [ "$(tty)" = "/dev/tty1" ];
|
|
||||||
then
|
|
||||||
echo 'Welcome! '
|
|
||||||
fi
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
swaylock.enable = true;
|
swaylock.enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -52,10 +43,10 @@ in
|
|||||||
(name: {
|
(name: {
|
||||||
inherit name;
|
inherit name;
|
||||||
value = {
|
value = {
|
||||||
source = config.lib.file.mkOutOfStoreSymlink "${confPath}/${name}";
|
source = config.home-libs.mkOutOfStoreSymlink "${confPath}/${name}";
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
conf
|
(builtins.attrNames (builtins.readDir ./conf))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -48,5 +48,10 @@
|
|||||||
"workbench.colorTheme": "Default Light Modern",
|
"workbench.colorTheme": "Default Light Modern",
|
||||||
"augment.chat.userGuidelines": "Always response in 中文",
|
"augment.chat.userGuidelines": "Always response in 中文",
|
||||||
"augment.completions.enableAutomaticCompletions": true,
|
"augment.completions.enableAutomaticCompletions": true,
|
||||||
"editor.fontFamily": "'Source Code Pro', 'JetBrainsMono Nerd Font'"
|
"editor.fontFamily": "'Source Code Pro', 'JetBrainsMono Nerd Font'",
|
||||||
|
"github.copilot.nextEditSuggestions.enabled": true,
|
||||||
|
"update.mode": "none",
|
||||||
|
"github.copilot.chat.localeOverride": "zh-CN",
|
||||||
|
"github.copilot.selectedCompletionModel": "GPT-4.1",
|
||||||
|
"diffEditor.ignoreTrimWhitespace": false
|
||||||
}
|
}
|
||||||
@@ -1,12 +1,5 @@
|
|||||||
{ config, pkgs, libs, ... }:
|
{ config, pkgs, lib, libs, ... }:
|
||||||
|
let
|
||||||
{
|
|
||||||
imports = [
|
|
||||||
];
|
|
||||||
programs = {
|
|
||||||
vscode = {
|
|
||||||
enable = true;
|
|
||||||
profiles.default = {
|
|
||||||
extensions = with pkgs.vscode-extensions; [
|
extensions = with pkgs.vscode-extensions; [
|
||||||
bierner.markdown-mermaid
|
bierner.markdown-mermaid
|
||||||
esbenp.prettier-vscode
|
esbenp.prettier-vscode
|
||||||
@@ -18,16 +11,29 @@
|
|||||||
pkief.material-icon-theme
|
pkief.material-icon-theme
|
||||||
] ++ pkgs.vscode-utils.extensionsFromVscodeMarketplace [
|
] ++ pkgs.vscode-utils.extensionsFromVscodeMarketplace [
|
||||||
];
|
];
|
||||||
};
|
in
|
||||||
};
|
{
|
||||||
|
imports = [
|
||||||
|
];
|
||||||
|
programs = {
|
||||||
|
vscode = {
|
||||||
|
enable = true;
|
||||||
|
} // (if lib.versionAtLeast config.home.stateVersion "25.05" then {
|
||||||
|
profiles.default = { inherit extensions; };
|
||||||
|
} else {
|
||||||
|
inherit extensions;
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
xdg.configFile = {
|
# 使用map函数循环 conf 变量,动态的生成 home.file.<user>.config.${i}
|
||||||
"Code/User/keybindings.json" = {
|
xdg.configFile = builtins.listToAttrs
|
||||||
source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/.nix/modules/home/vscode/keybindings.json";
|
(builtins.map
|
||||||
};
|
(name: {
|
||||||
"Code/User/settings.json" = {
|
name = "Code/User/${name}";
|
||||||
source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/.nix/modules/home/vscode/settings.json";
|
value = {
|
||||||
};
|
source = config.home-libs.mkOutOfStoreSymlink "modules/home/vscode/conf/${name}";
|
||||||
};
|
};
|
||||||
|
})
|
||||||
|
(builtins.attrNames (builtins.readDir ./conf))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,85 +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" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
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";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
31
modules/home/xdg/conf/mimeapps.list
Normal file
31
modules/home/xdg/conf/mimeapps.list
Normal 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
|
||||||
50
modules/home/xdg/default.nix
Normal file
50
modules/home/xdg/default.nix
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
# 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";
|
||||||
|
|
||||||
|
systemDirs = {
|
||||||
|
data = [
|
||||||
|
"${config.home.homeDirectory}/.local/share/flatpak/exports/share"
|
||||||
|
"/var/lib/flatpak/exports/share"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
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))
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
history.size = 10000;
|
history.size = 10000;
|
||||||
history.ignoreAllDups = true;
|
history.ignoreAllDups = true;
|
||||||
history.path = "$HOME/.zsh_history";
|
history.path = "$HOME/.zsh_history";
|
||||||
history.ignorePatterns = [ "rm *" "pkill *" "cp *" ];
|
# history.ignorePatterns = [ "rm *" "pkill *" "cp *" ];
|
||||||
|
|
||||||
oh-my-zsh = {
|
oh-my-zsh = {
|
||||||
enable = true;
|
enable = true;
|
||||||
@@ -37,10 +37,5 @@
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
thefuck = {
|
|
||||||
enable = true;
|
|
||||||
enableZshIntegration = true; # 自动为 Zsh 设置别名 (通常是 'fuck')
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,10 @@
|
|||||||
# If you want to use JACK applications, uncomment this
|
# If you want to use JACK applications, uncomment this
|
||||||
#jack.enable = true;
|
#jack.enable = true;
|
||||||
|
|
||||||
wireplumber.extraConfig.bluetoothEnhancements = {
|
wireplumber = {
|
||||||
|
enable = true;
|
||||||
|
extraConfig = {
|
||||||
|
"80-bluetooth-enhancements" = {
|
||||||
"monitor.bluez.properties" = {
|
"monitor.bluez.properties" = {
|
||||||
"bluez5.enable-sbc-xq" = true;
|
"bluez5.enable-sbc-xq" = true;
|
||||||
"bluez5.enable-msbc" = true;
|
"bluez5.enable-msbc" = true;
|
||||||
@@ -16,10 +19,56 @@
|
|||||||
"bluez5.roles" = [ "hsp_hs" "hsp_ag" "hfp_hf" "hfp_ag" ];
|
"bluez5.roles" = [ "hsp_hs" "hsp_ag" "hfp_hf" "hfp_ag" ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
# Disable suspend for all ALSA nodes
|
||||||
|
"99-disable-suspend" = {
|
||||||
|
# ALSA Rules: Separate rule for input and output
|
||||||
|
"monitor.alsa.rules" = [
|
||||||
|
# Rule for ALSA outputs
|
||||||
|
{
|
||||||
|
matches = [
|
||||||
|
{
|
||||||
|
# Matches all sinks (outputs)
|
||||||
|
"node.name" = "~alsa_output.*";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
# Matches all sources (inputs)
|
||||||
|
"node.name" = "~alsa_input.*";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
actions = {
|
||||||
|
"update-props" = {
|
||||||
|
"session.suspend-timeout-seconds" = 0;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
# Bluez Rules: Separate rule for input and output
|
||||||
|
"monitor.bluez.rules" = [
|
||||||
|
# Rule for Bluez outputs
|
||||||
|
{
|
||||||
|
matches = [
|
||||||
|
{
|
||||||
|
"node.name" = "~bluez_output.*";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
"node.name" = "~bluez_input.*";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
actions = {
|
||||||
|
"update-props" = {
|
||||||
|
"session.suspend-timeout-seconds" = 0;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
environment.systemPackages = with pkgs;[
|
environment.systemPackages = with pkgs; [
|
||||||
# audio control software
|
# audio control software
|
||||||
pamixer
|
pamixer
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -15,8 +15,5 @@
|
|||||||
device = "nodev";
|
device = "nodev";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# Allow to modify store. It's dangerous!!
|
|
||||||
readOnlyNixStore = lib.mkDefault true;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -1,14 +1,21 @@
|
|||||||
{ lib, ... }:
|
{ lib, pkgs, ... }:
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./boot.nix
|
./boot.nix
|
||||||
./system.nix
|
./system.nix
|
||||||
|
./nixfhs.nix
|
||||||
|
../user.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
|
environment = {
|
||||||
|
systemPackages = with pkgs;
|
||||||
|
[
|
||||||
|
smartmontools
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
programs = {
|
programs = {
|
||||||
git.enable = true;
|
git.enable = true;
|
||||||
dconf.enable = true;
|
|
||||||
nix-ld.enable = true;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
# Configure firewall
|
# Configure firewall
|
||||||
@@ -19,9 +26,9 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
# Select internationalisation properties.
|
# Select internationalisation properties.
|
||||||
i18n.defaultLocale = "en_US.UTF-8";
|
i18n = {
|
||||||
|
defaultLocale = "en_US.UTF-8";
|
||||||
i18n.extraLocaleSettings = {
|
extraLocaleSettings = {
|
||||||
LC_ADDRESS = "zh_CN.UTF-8";
|
LC_ADDRESS = "zh_CN.UTF-8";
|
||||||
LC_IDENTIFICATION = "zh_CN.UTF-8";
|
LC_IDENTIFICATION = "zh_CN.UTF-8";
|
||||||
LC_MEASUREMENT = "zh_CN.UTF-8";
|
LC_MEASUREMENT = "zh_CN.UTF-8";
|
||||||
@@ -32,6 +39,7 @@
|
|||||||
LC_TELEPHONE = "zh_CN.UTF-8";
|
LC_TELEPHONE = "zh_CN.UTF-8";
|
||||||
LC_TIME = "zh_CN.UTF-8";
|
LC_TIME = "zh_CN.UTF-8";
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
time.timeZone = "Asia/Shanghai";
|
time.timeZone = "Asia/Shanghai";
|
||||||
}
|
}
|
||||||
|
|||||||
143
modules/nixos/core/nixfhs.nix
Normal file
143
modules/nixos/core/nixfhs.nix
Normal file
@@ -0,0 +1,143 @@
|
|||||||
|
{ 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设备访问库
|
||||||
|
libxkbcommon
|
||||||
|
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;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -10,6 +10,7 @@
|
|||||||
printing.enable = true;
|
printing.enable = true;
|
||||||
acpid.enable = true;
|
acpid.enable = true;
|
||||||
upower.enable = true;
|
upower.enable = true;
|
||||||
|
nix-fhs.enable = true;
|
||||||
|
|
||||||
openssh = {
|
openssh = {
|
||||||
enable = true;
|
enable = true;
|
||||||
@@ -23,6 +24,7 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Enable the Avahi daemon for mDNS/DNS-SD support
|
||||||
avahi = {
|
avahi = {
|
||||||
enable = true;
|
enable = true;
|
||||||
nssmdns4 = true; # 非常重要,允许系统解析 .local 地址
|
nssmdns4 = true; # 非常重要,允许系统解析 .local 地址
|
||||||
|
|||||||
@@ -29,17 +29,19 @@
|
|||||||
source-han-serif # 思源宋体
|
source-han-serif # 思源宋体
|
||||||
|
|
||||||
# wqy_zenhei # 文泉驿正黑
|
# wqy_zenhei # 文泉驿正黑
|
||||||
|
] ++ (
|
||||||
# nerdfonts
|
# nerdfonts
|
||||||
nerd-fonts.jetbrains-mono
|
if lib.versionAtLeast config.system.stateVersion "25.05" then
|
||||||
# (nerdfonts.override {
|
[ nerd-fonts.jetbrains-mono ]
|
||||||
# fonts = [
|
else [
|
||||||
# # "FiraCode"
|
(nerdfonts.override {
|
||||||
# "JetBrainsMono"
|
fonts = [
|
||||||
# # "Iosevka"
|
# "FiraCode"
|
||||||
# ];
|
"JetBrainsMono"
|
||||||
# })
|
# "Iosevka"
|
||||||
|
|
||||||
];
|
];
|
||||||
|
})
|
||||||
|
]
|
||||||
|
);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
{ config, pkgs, ... }:
|
{ config, pkgs, lib, username, ... }: {
|
||||||
{
|
|
||||||
services.xserver = {
|
services.xserver = {
|
||||||
enable = true;
|
enable = true;
|
||||||
displayManager.gdm.enable = true;
|
displayManager.gdm.enable = true;
|
||||||
@@ -8,22 +7,21 @@
|
|||||||
|
|
||||||
environment = {
|
environment = {
|
||||||
systemPackages = (with pkgs;[
|
systemPackages = (with pkgs;[
|
||||||
gnome.gnome-tweaks
|
gnome-tweaks
|
||||||
|
gnome-shell-extensions
|
||||||
]) ++ (with pkgs.gnomeExtensions;[
|
]) ++ (with pkgs.gnomeExtensions;[
|
||||||
dash-to-dock
|
dash-to-dock
|
||||||
captivate # cap button indicator
|
|
||||||
appindicator # tray icon
|
appindicator # tray icon
|
||||||
]);
|
]);
|
||||||
|
|
||||||
gnome.excludePackages = (with pkgs; [
|
gnome.excludePackages = (with pkgs; [
|
||||||
|
atomix # puzzle game
|
||||||
|
cheese # webcam tool
|
||||||
gnome-photos
|
gnome-photos
|
||||||
gnome-tour
|
gnome-tour
|
||||||
gnome-text-editor
|
gnome-text-editor
|
||||||
]) ++ (with pkgs.gnome; [
|
|
||||||
atomix # puzzle game
|
|
||||||
cheese # webcam tool
|
|
||||||
epiphany # web browser
|
epiphany # web browser
|
||||||
# geary # email reader
|
geary # email reader
|
||||||
evince # document viewer
|
evince # document viewer
|
||||||
gedit # text editor
|
gedit # text editor
|
||||||
gnome-contacts
|
gnome-contacts
|
||||||
@@ -39,9 +37,126 @@
|
|||||||
tali # poker game
|
tali # poker game
|
||||||
yelp # help viewer
|
yelp # help viewer
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
variables = {
|
||||||
|
"GTK_IM_MODULE" = "fcitx";
|
||||||
|
"QT_IM_MODULE" = "fcitx";
|
||||||
|
"XMODIFIERS" = "@im=fcitx";
|
||||||
|
"SDL_IM_MODULE" = "fcitx";
|
||||||
|
"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;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}];
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ in
|
|||||||
extraGroups = [
|
extraGroups = [
|
||||||
"users"
|
"users"
|
||||||
"wheel"
|
"wheel"
|
||||||
"networkmanager"
|
|
||||||
"audio"
|
"audio"
|
||||||
|
"networkmanager"
|
||||||
];
|
];
|
||||||
openssh.authorizedKeys.keys = [
|
openssh.authorizedKeys.keys = [
|
||||||
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCc62MxAVqX8LDFAiDiXlc8d3JU1S3xYVO8WpfgoVYPyrd2fkK2Dr1tSedJyGWc3ADOxzUbsTic8b1BOdmbx4ZPwI+a3nJrVVkmIRSAs5haEZqG8NXDv1kl4xL+J9tVA2jwScl6MRzqyVMgtIAvnsVW9+DrL2Y2b20NvuWz3XndZ8vEUFZLLCQJQRpGrY2ZnTvNXZo12GrD5daiMii52ZuhfNBx17oFnf70sj+phZbp5m2mKL9jfKaDSG+E7Pa/IbB/iivD/QSm0SueYXbsdtMBhtsxvH/i0pJogUlVpa42CRIDUVoHOvfk0Hk83xyIIl2b78xfGEyCQBBU6sSk726xXpqzfxJJ7FiYqhLMKKDFmD28EOs4BUveyZudWNcP0a1+uBBcrefNAwU6EOSg65BOxxvZFbNG1I7YDTiKvYFy965+WkN5QKbBVSy08ziS1MQt224ZooAdxCKESGRr9IqKvq9ONnb0MtmC4ht/n8U9VaeLVq3XDXZZHEUq0cw748k= alex@gaea"
|
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCc62MxAVqX8LDFAiDiXlc8d3JU1S3xYVO8WpfgoVYPyrd2fkK2Dr1tSedJyGWc3ADOxzUbsTic8b1BOdmbx4ZPwI+a3nJrVVkmIRSAs5haEZqG8NXDv1kl4xL+J9tVA2jwScl6MRzqyVMgtIAvnsVW9+DrL2Y2b20NvuWz3XndZ8vEUFZLLCQJQRpGrY2ZnTvNXZo12GrD5daiMii52ZuhfNBx17oFnf70sj+phZbp5m2mKL9jfKaDSG+E7Pa/IbB/iivD/QSm0SueYXbsdtMBhtsxvH/i0pJogUlVpa42CRIDUVoHOvfk0Hk83xyIIl2b78xfGEyCQBBU6sSk726xXpqzfxJJ7FiYqhLMKKDFmD28EOs4BUveyZudWNcP0a1+uBBcrefNAwU6EOSg65BOxxvZFbNG1I7YDTiKvYFy965+WkN5QKbBVSy08ziS1MQt224ZooAdxCKESGRr9IqKvq9ONnb0MtmC4ht/n8U9VaeLVq3XDXZZHEUq0cw748k= alex@gaea"
|
||||||
|
|||||||
@@ -4,6 +4,17 @@
|
|||||||
virtualisation.docker = {
|
virtualisation.docker = {
|
||||||
enable = true;
|
enable = true;
|
||||||
storageDriver = "btrfs";
|
storageDriver = "btrfs";
|
||||||
|
daemon.settings = {
|
||||||
|
userland-proxy = false;
|
||||||
|
experimental = true;
|
||||||
|
ipv6 = true;
|
||||||
|
ip6tables = true;
|
||||||
|
fixed-cidr-v6 = "fd00::/80";
|
||||||
|
metrics-addr = "0.0.0.0:9323";
|
||||||
|
log-driver = "json-file";
|
||||||
|
log-opts.max-size = "10m";
|
||||||
|
log-opts.max-file = "3";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# Enable Podman
|
# Enable Podman
|
||||||
|
|||||||
@@ -1,15 +1,30 @@
|
|||||||
args@{ libs, inputs, ... }:
|
args@{ libs, inputs, nixos, ... }:
|
||||||
let
|
let
|
||||||
# 这里可以选择使用稳定版或不稳定版的nixpkgs
|
# 使用pkgs.unstable中的nixpkgs和home-manager
|
||||||
# nixpkgs = inputs.nixpkgs;
|
inherit (nixos.unstable) nixpkgs home-manager version;
|
||||||
nixpkgs = inputs.nixpkgs-unstable; # 如果需要使用unstable版本,取消这行注释并注释上一行
|
specialArgs = args // { inherit home-manager version; };
|
||||||
home-manager = inputs.home-manager-unstable;
|
|
||||||
sysversion = "25.05";
|
configuration = conf-args@{ self, pkgs, home-manager, username, version, ... }: {
|
||||||
sysArgs = args // { inherit home-manager sysversion; };
|
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
|
in
|
||||||
# 使用libs.mkNixosSystem创建nixosSystem
|
nixpkgs.lib.nixosSystem {
|
||||||
libs.mkNixosSystem {
|
inherit specialArgs;
|
||||||
inherit nixpkgs;
|
modules = [
|
||||||
args = sysArgs;
|
configuration
|
||||||
path = ./.;
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
{ ... }: {
|
|
||||||
imports = [
|
|
||||||
./ssh
|
|
||||||
./hyprland.nix
|
|
||||||
];
|
|
||||||
}
|
|
||||||
@@ -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,9 +0,0 @@
|
|||||||
{ config, ... }: {
|
|
||||||
programs.ssh = {
|
|
||||||
enable = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
home.file.".ssh/config" = {
|
|
||||||
source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/.nix/profiles/apollo/hm/ssh/config";
|
|
||||||
};
|
|
||||||
}
|
|
||||||
12
profiles/apollo/home/default.nix
Normal file
12
profiles/apollo/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,7 +5,8 @@
|
|||||||
sessionVariables = {
|
sessionVariables = {
|
||||||
# for hyprland with nvidia gpu, ref https://wiki.hyprland.org/Nvidia/
|
# for hyprland with nvidia gpu, ref https://wiki.hyprland.org/Nvidia/
|
||||||
# 启用注释部分会导致NVIDIA下无法启动hyprland
|
# 启用注释部分会导致NVIDIA下无法启动hyprland
|
||||||
WLR_DRM_DEVICES = "/dev/dri/card1:/dev/dri/card0";
|
WLR_DRM_DEVICES = "/dev/dri/card1";
|
||||||
|
AQ_DRM_DEVICES = "/dev/dri/card1";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
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
|
||||||
|
|
||||||
9
profiles/apollo/home/ssh/default.nix
Normal file
9
profiles/apollo/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/home/ssh/config";
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -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.1";
|
|
||||||
interface = "eno1";
|
|
||||||
# interface = "br0";
|
|
||||||
};
|
|
||||||
nameservers = [ "10.7.43.1" ];
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
args@{ self, pkgs, home-manager, username, sysversion, ... }: {
|
{ self, pkgs, username, version, lib, config, ... }: {
|
||||||
# You can import other NixOS modules here
|
|
||||||
imports = [
|
imports = [
|
||||||
./mount.nix
|
./mount.nix
|
||||||
./network.nix
|
./network.nix
|
||||||
@@ -7,30 +6,11 @@ args@{ self, pkgs, home-manager, username, sysversion, ... }: {
|
|||||||
|
|
||||||
"${self}/modules/nixos/core"
|
"${self}/modules/nixos/core"
|
||||||
"${self}/modules/nixos/fonts"
|
"${self}/modules/nixos/fonts"
|
||||||
"${self}/modules/nixos/user.nix"
|
|
||||||
"${self}/modules/nixos/audio.nix"
|
"${self}/modules/nixos/audio.nix"
|
||||||
|
|
||||||
"${self}/modules/nixos/samba.nix"
|
"${self}/modules/nixos/samba.nix"
|
||||||
"${self}/modules/nixos/virtualize/appimage.nix"
|
"${self}/modules/nixos/virtualize/appimage.nix"
|
||||||
"${self}/modules/nixos/virtualize/docker.nix"
|
"${self}/modules/nixos/virtualize/docker.nix"
|
||||||
|
"${self}/modules/nixos/gnome.nix"
|
||||||
home-manager.nixosModules.home-manager
|
|
||||||
{
|
|
||||||
# home-manager.useGlobalPkgs = true;
|
|
||||||
# home-manager.useUserPackages = true;
|
|
||||||
home-manager = {
|
|
||||||
extraSpecialArgs = {
|
|
||||||
inherit (args) self inputs outputs libs hostname username useremail sysversion;
|
|
||||||
};
|
|
||||||
users."${username}" = { ... }: {
|
|
||||||
imports = [
|
|
||||||
./hm
|
|
||||||
"${self}/home/desktop.nix"
|
|
||||||
"${self}/modules/home/develop.nix"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
];
|
];
|
||||||
|
|
||||||
hardware.graphics = {
|
hardware.graphics = {
|
||||||
@@ -43,6 +23,11 @@ args@{ self, pkgs, home-manager, username, sysversion, ... }: {
|
|||||||
|
|
||||||
services = {
|
services = {
|
||||||
gnome.gnome-keyring.enable = true;
|
gnome.gnome-keyring.enable = true;
|
||||||
|
nix-fhs.gui.enable = true;
|
||||||
|
flatpak.enable = true;
|
||||||
|
apcupsd = {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
security.pam.services.swaylock = { };
|
security.pam.services.swaylock = { };
|
||||||
@@ -54,5 +39,5 @@ args@{ self, pkgs, home-manager, username, sysversion, ... }: {
|
|||||||
users.users."${username}".shell = pkgs.zsh;
|
users.users."${username}".shell = pkgs.zsh;
|
||||||
|
|
||||||
# https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion
|
# https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion
|
||||||
system.stateVersion = sysversion;
|
system.stateVersion = version;
|
||||||
}
|
}
|
||||||
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, sysversion, ... }: {
|
|
||||||
# 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 hostname username useremail sysversion;
|
|
||||||
};
|
|
||||||
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 = sysversion;
|
|
||||||
}
|
|
||||||
@@ -1,15 +1,29 @@
|
|||||||
args@{ libs, inputs, ... }:
|
args@{ libs, inputs, nixos, ... }:
|
||||||
let
|
let
|
||||||
# 这里可以选择使用稳定版或不稳定版的nixpkgs
|
inherit (nixos.unstable) nixpkgs home-manager version;
|
||||||
# nixpkgs = inputs.nixpkgs;
|
specialArgs = args // { inherit home-manager version; };
|
||||||
nixpkgs = inputs.nixpkgs-unstable; # 如果需要使用unstable版本,取消这行注释并注释上一行
|
configuration = conf-args@{ self, home-manager, username, ... }: {
|
||||||
home-manager = inputs.home-manager-unstable;
|
imports = [
|
||||||
sysversion = "25.05";
|
./nixos
|
||||||
sysArgs = args // { inherit home-manager sysversion; };
|
|
||||||
|
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
|
in
|
||||||
# 使用libs.mkNixosSystem创建nixosSystem
|
nixpkgs.lib.nixosSystem {
|
||||||
libs.mkNixosSystem {
|
inherit specialArgs;
|
||||||
inherit nixpkgs;
|
modules = [
|
||||||
args = sysArgs;
|
configuration
|
||||||
path = ./.;
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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 = {
|
sessionVariables = {
|
||||||
# for hyprland with nvidia gpu, ref https://wiki.hyprland.org/Nvidia/
|
# for hyprland with nvidia gpu, ref https://wiki.hyprland.org/Nvidia/
|
||||||
# 启用注释部分会导致NVIDIA下无法启动hyprland
|
# 启用注释部分会导致NVIDIA下无法启动hyprland
|
||||||
LIBVA_DRIVER_NAME = "nvidia";
|
WLR_DRM_DEVICES = "/dev/dri/card1";
|
||||||
__GLX_VENDOR_LIBRARY_NAME = "nvidia";
|
AQ_DRM_DEVICES = "/dev/dri/card1";
|
||||||
|
|
||||||
# WLR_RENDERER = "vulkan";
|
|
||||||
# GBM_BACKEND = "nvidia-drm";
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
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/gaea/home/ssh/config";
|
||||||
|
};
|
||||||
|
}
|
||||||
21
profiles/gaea/nixos/default.nix
Normal file
21
profiles/gaea/nixos/default.nix
Normal 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;
|
||||||
|
}
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
args@{ self, home-manager, username, sysversion, ... }: {
|
|
||||||
|
|
||||||
# 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 hostname username useremail sysversion;
|
|
||||||
};
|
|
||||||
users."${username}" = { ... }: {
|
|
||||||
imports = [
|
|
||||||
"${self}/home/desktop.nix"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
# https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion
|
|
||||||
system.stateVersion = sysversion;
|
|
||||||
}
|
|
||||||
@@ -1,15 +1,54 @@
|
|||||||
args@{ libs, inputs, ... }:
|
args@{ libs, inputs, nixos, ... }:
|
||||||
let
|
let
|
||||||
# 这里可以选择使用稳定版或不稳定版的nixpkgs
|
# 使用pkgs.unstable中的nixpkgs和home-manager
|
||||||
# nixpkgs = inputs.nixpkgs;
|
inherit (nixos.unstable) nixpkgs home-manager version;
|
||||||
nixpkgs = inputs.nixpkgs-unstable; # 如果需要使用unstable版本,取消这行注释并注释上一行
|
specialArgs = args // { inherit home-manager version; };
|
||||||
home-manager = inputs.home-manager-unstable;
|
|
||||||
sysversion = "25.05";
|
configuration = conf-args@{ self, home-manager, username, version, ... }: {
|
||||||
sysArgs = args // { inherit home-manager sysversion; };
|
# 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
|
in
|
||||||
# 使用libs.mkNixosSystem创建nixosSystem
|
nixpkgs.lib.nixosSystem {
|
||||||
libs.mkNixosSystem {
|
inherit specialArgs;
|
||||||
inherit nixpkgs;
|
modules = [
|
||||||
args = sysArgs;
|
configuration
|
||||||
path = ./.;
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user