feat: 配置 Hyprland 桌面环境、Noctalia Shell 与 Ghostty 终端,切换至 Lua 配置模式
This commit is contained in:
+24
-2
@@ -71,6 +71,7 @@
|
||||
services.xserver.enable = true;
|
||||
services.displayManager.sddm.enable = true;
|
||||
services.desktopManager.plasma6.enable = true;
|
||||
programs.hyprland.enable = true;
|
||||
security.pam.services.login.kwallet = {
|
||||
enable = true;
|
||||
forceRun = true;
|
||||
@@ -87,17 +88,29 @@
|
||||
noto-fonts
|
||||
noto-fonts-cjk-sans
|
||||
noto-fonts-cjk-serif
|
||||
sarasa-gothic # 更纱黑体,极其适合终端和编程
|
||||
sarasa-gothic # 更纱黑体
|
||||
lxgw-wenkai # 霞鹜文楷,非常漂亮的楷体
|
||||
wqy_microhei
|
||||
wqy_zenhei
|
||||
nerd-fonts.symbols-only # 补全终端图标
|
||||
];
|
||||
fonts.fontconfig = {
|
||||
enable = true;
|
||||
defaultFonts = {
|
||||
serif = [ "Noto Serif CJK SC" "Noto Serif" ];
|
||||
serif = [ "Noto Serif CJK SC" "LXGW WenKai" "Noto Serif" ];
|
||||
sansSerif = [ "Noto Sans CJK SC" "Noto Sans" ];
|
||||
monospace = [ "Sarasa Term SC" "Noto Sans Mono CJK SC" ];
|
||||
emoji = [ "Noto Color Emoji" ];
|
||||
};
|
||||
# 针对楷体的 fallback 专门配置
|
||||
localConf = ''
|
||||
<alias>
|
||||
<family>kaiti</family>
|
||||
<prefer>
|
||||
<family>LXGW WenKai</family>
|
||||
</prefer>
|
||||
</alias>
|
||||
'';
|
||||
antialias = true;
|
||||
hinting.enable = true;
|
||||
hinting.style = "slight";
|
||||
@@ -117,6 +130,10 @@
|
||||
|
||||
services.printing.enable = true;
|
||||
services.flatpak.enable = true;
|
||||
services.upower.enable = true;
|
||||
services.power-profiles-daemon.enable = true;
|
||||
services.gnome.evolution-data-server.enable = true;
|
||||
hardware.bluetooth.enable = true;
|
||||
|
||||
# 压缩内存 swap,大小等于物理内存。
|
||||
zramSwap = {
|
||||
@@ -144,6 +161,11 @@
|
||||
programs.nix-ld.enable = true;
|
||||
virtualisation.docker.enable = true;
|
||||
services.gnome.gnome-keyring.enable = true;
|
||||
security.polkit.enable = true;
|
||||
|
||||
# 确保 PAM 能够自动解锁 gnome-keyring
|
||||
security.pam.services.login.enableGnomeKeyring = true;
|
||||
security.pam.services.sddm.enableGnomeKeyring = true;
|
||||
|
||||
# ── 系统级软件包 ────────────────────────────────────────────
|
||||
environment.systemPackages = with pkgs; [
|
||||
|
||||
Generated
+103
-4
@@ -22,6 +22,22 @@
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1779971959,
|
||||
"narHash": "sha256-R5nauXyqyfRUFiZycFFZdkF7wl6eaUpPLst35+2nJQY=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "ec942ba042dad5ef097e2ef3a3effc034241f011",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-26.05",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-unstable": {
|
||||
"locked": {
|
||||
"lastModified": 1779560665,
|
||||
"narHash": "sha256-tpyBcxPpcQb8ukyNF7DoCwfSY3VPsxHoYwj00Cayv5o=",
|
||||
@@ -37,6 +53,50 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"noctalia": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs-unstable"
|
||||
],
|
||||
"noctalia-qs": "noctalia-qs"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1780197945,
|
||||
"narHash": "sha256-zeluNQgRgTglqKnv5EaM7DzSaqmrCdqTocmaWC7dxy0=",
|
||||
"owner": "noctalia-dev",
|
||||
"repo": "noctalia-shell",
|
||||
"rev": "b16dc50250af05d5048ac454dbf4e898d1adcac0",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "noctalia-dev",
|
||||
"repo": "noctalia-shell",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"noctalia-qs": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"noctalia",
|
||||
"nixpkgs"
|
||||
],
|
||||
"systems": "systems",
|
||||
"treefmt-nix": "treefmt-nix"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1780194487,
|
||||
"narHash": "sha256-M+YtjKCTkHrkplNaKVyaxfa8hAWjRF6wFOUBAZvxQ4U=",
|
||||
"owner": "noctalia-dev",
|
||||
"repo": "noctalia-qs",
|
||||
"rev": "07398e12b54f194e3a2d47c87e3fd10b8eeaa27d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "noctalia-dev",
|
||||
"repo": "noctalia-qs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"plasma-manager": {
|
||||
"inputs": {
|
||||
"home-manager": [
|
||||
@@ -64,6 +124,8 @@
|
||||
"inputs": {
|
||||
"home-manager": "home-manager",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"nixpkgs-unstable": "nixpkgs-unstable",
|
||||
"noctalia": "noctalia",
|
||||
"plasma-manager": "plasma-manager",
|
||||
"spicetify-nix": "spicetify-nix"
|
||||
}
|
||||
@@ -73,14 +135,14 @@
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
],
|
||||
"systems": "systems"
|
||||
"systems": "systems_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1779824049,
|
||||
"narHash": "sha256-dWHVUjP03KSVG1PaLKA6j9EdxWSxSQvipMUIcSyuA/U=",
|
||||
"lastModified": 1780213729,
|
||||
"narHash": "sha256-rdeBztPA6tiKp6gG4ihZAzeYGC9mYa2tAU4UIOLcZM0=",
|
||||
"owner": "Gerg-L",
|
||||
"repo": "spicetify-nix",
|
||||
"rev": "1362178e5f5f7a848c49fe9dee004ef8824f100a",
|
||||
"rev": "c679f3fa9fbe86903486a8f7ad71f99e26481d71",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -90,6 +152,21 @@
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1689347949,
|
||||
"narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default-linux",
|
||||
"rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default-linux",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems_2": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
@@ -103,6 +180,28 @@
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"treefmt-nix": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"noctalia",
|
||||
"noctalia-qs",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1775636079,
|
||||
"narHash": "sha256-pc20NRoMdiar8oPQceQT47UUZMBTiMdUuWrYu2obUP0=",
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"rev": "790751ff7fd3801feeaf96d7dc416a8d581265ba",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
|
||||
@@ -3,13 +3,16 @@
|
||||
|
||||
# 输入(也就是原材料供应链)
|
||||
inputs = {
|
||||
# 这里我们使用 nixos-unstable 分支,因为你之前用 CachyOS,大概率喜欢较新的内核和软件
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
# 主力系统使用稳定版,保证系统底盘绝对安全不出错
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-26.05";
|
||||
|
||||
# 引入 Home Manager
|
||||
# 额外引入 unstable 分支,专门用来提取最新软件
|
||||
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
|
||||
# 引入 Home Manager (与系统稳定版对应)
|
||||
home-manager = {
|
||||
url = "github:nix-community/home-manager/release-26.05";
|
||||
inputs.nixpkgs.follows = "nixpkgs"; # 保证 Home Manager 用的软件版本和系统一致
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
plasma-manager = {
|
||||
@@ -23,28 +26,55 @@
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
noctalia = {
|
||||
url = "github:noctalia-dev/noctalia-shell";
|
||||
inputs.nixpkgs.follows = "nixpkgs-unstable";
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
# 输出(最终建成的系统)
|
||||
outputs = { self, nixpkgs, home-manager, plasma-manager, ... }@inputs: {
|
||||
outputs = { self, nixpkgs, nixpkgs-unstable, home-manager, plasma-manager, noctalia, ... }@inputs: {
|
||||
nixosConfigurations = {
|
||||
# 这里的 "nixos" 是你的系统主机名 (hostname)。
|
||||
# 如果你在安装系统时改过主机名,请把这里的 "nixos" 换成你的实际主机名。
|
||||
"nixos" = nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
# 将 unstable 打包成 pkgs-unstable 注入系统模块
|
||||
specialArgs = {
|
||||
inherit inputs;
|
||||
pkgs-unstable = import nixpkgs-unstable {
|
||||
system = "x86_64-linux";
|
||||
config.allowUnfree = true;
|
||||
};
|
||||
};
|
||||
modules = [
|
||||
# 1. 引入系统底层的硬件和全局配置
|
||||
./configuration.nix
|
||||
|
||||
# 二进制缓存加速
|
||||
{
|
||||
nix.settings = {
|
||||
substituters = [ "https://noctalia.cachix.org" ];
|
||||
trusted-public-keys = [ "noctalia.cachix.org-1:pCOR47nnMEo5thcxNDtzWpOxNFQsBRglJzxWPp3dkU4=" ];
|
||||
};
|
||||
}
|
||||
|
||||
# 2. 把 Home Manager 作为系统模块请进来
|
||||
home-manager.nixosModules.home-manager
|
||||
{
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
home-manager.extraSpecialArgs = { inherit inputs; };
|
||||
# 同样将 pkgs-unstable 注入给 Home Manager 模块
|
||||
home-manager.extraSpecialArgs = {
|
||||
inherit inputs;
|
||||
pkgs-unstable = import nixpkgs-unstable {
|
||||
system = "x86_64-linux";
|
||||
config.allowUnfree = true;
|
||||
};
|
||||
};
|
||||
home-manager.sharedModules = [
|
||||
plasma-manager.homeModules.plasma-manager
|
||||
inputs.spicetify-nix.homeManagerModules.default
|
||||
noctalia.homeModules.default
|
||||
];
|
||||
|
||||
# ⚠️ 极其重要:把这里的 "luodh" 替换成你在 NixOS 里登录的实际系统用户名
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{ pkgs, ... }:
|
||||
{ pkgs, pkgs-unstable, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
@@ -13,7 +13,6 @@
|
||||
home.packages = with pkgs; [
|
||||
qq
|
||||
fastfetch
|
||||
jetbrains-toolbox
|
||||
google-chrome
|
||||
neovim
|
||||
htop
|
||||
@@ -36,6 +35,9 @@
|
||||
pnpm
|
||||
kdePackages.kate
|
||||
termius
|
||||
jetbrains.idea
|
||||
jetbrains.webstorm
|
||||
android-studio
|
||||
];
|
||||
|
||||
# 让 nix-shell 等传统命令也能安装 unfree 软件
|
||||
|
||||
@@ -7,5 +7,6 @@
|
||||
./plasma.nix
|
||||
./rime.nix
|
||||
./spicetify.nix
|
||||
./hyprland.nix
|
||||
];
|
||||
}
|
||||
|
||||
@@ -0,0 +1,149 @@
|
||||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
# 启用 Noctalia
|
||||
programs.noctalia-shell = {
|
||||
enable = true;
|
||||
# 可以在这里添加具体的 Noctalia 配置,暂时先用默认的
|
||||
settings = {
|
||||
# 可以在这里覆盖默认设置,例如:
|
||||
# colors.accent = "#88c0d0";
|
||||
};
|
||||
};
|
||||
|
||||
# 启用 Hyprland (Lua 模式)
|
||||
wayland.windowManager.hyprland = {
|
||||
enable = true;
|
||||
configType = "lua";
|
||||
settings = {
|
||||
# ── 基础变量 ──────────────────────────────────────────
|
||||
"$mainMod" = "SUPER";
|
||||
|
||||
# ── 基础设置 ──────────────────────────────────────────
|
||||
monitor = ",preferred,auto,1";
|
||||
|
||||
env = [
|
||||
"XCURSOR_SIZE,24"
|
||||
"HYPRCURSOR_SIZE,24"
|
||||
"XDG_CURRENT_DESKTOP,Hyprland"
|
||||
"XDG_SESSION_TYPE,wayland"
|
||||
"XDG_SESSION_DESKTOP,Hyprland"
|
||||
];
|
||||
|
||||
input = {
|
||||
kb_layout = "us";
|
||||
follow_mouse = 1;
|
||||
touchpad = {
|
||||
natural_scroll = true;
|
||||
};
|
||||
sensitivity = 0;
|
||||
};
|
||||
|
||||
general = {
|
||||
gaps_in = 5;
|
||||
gaps_out = 10;
|
||||
border_size = 2;
|
||||
"col.active_border" = "rgba(33ccffee) rgba(00ff99ee) 45deg";
|
||||
"col.inactive_border" = "rgba(595959aa)";
|
||||
layout = "dwindle";
|
||||
};
|
||||
|
||||
decoration = {
|
||||
rounding = 10;
|
||||
blur = {
|
||||
enabled = true;
|
||||
size = 3;
|
||||
passes = 1;
|
||||
};
|
||||
shadow = {
|
||||
enabled = true;
|
||||
range = 4;
|
||||
render_power = 3;
|
||||
color = "rgba(1a1a1aee)";
|
||||
};
|
||||
};
|
||||
|
||||
animations = {
|
||||
enabled = true;
|
||||
bezier = "myBezier, 0.05, 0.9, 0.1, 1.05";
|
||||
animation = [
|
||||
"windows, 1, 7, myBezier"
|
||||
"windowsOut, 1, 7, default, popin 80%"
|
||||
"border, 1, 10, default"
|
||||
"borderangle, 1, 8, default"
|
||||
"fade, 1, 7, default"
|
||||
"workspaces, 1, 6, default"
|
||||
];
|
||||
};
|
||||
|
||||
# ── 快捷键 (Keybindings) ──────────────────────────────
|
||||
bind = [
|
||||
"$mainMod, Q, exec, ghostty"
|
||||
"$mainMod, C, killactive,"
|
||||
"$mainMod, M, exit,"
|
||||
"$mainMod, E, exec, dolphin"
|
||||
"$mainMod, V, togglefloating,"
|
||||
|
||||
# 使用 Noctalia 的快捷键
|
||||
"$mainMod, R, exec, noctalia-shell ipc call launcher toggle"
|
||||
"$mainMod, N, exec, noctalia-shell ipc call notifications toggle"
|
||||
"$mainMod, B, exec, noctalia-shell ipc call dashboard toggle"
|
||||
|
||||
# 聚焦移动
|
||||
"$mainMod, left, movefocus, l"
|
||||
"$mainMod, right, movefocus, r"
|
||||
"$mainMod, up, movefocus, u"
|
||||
"$mainMod, down, movefocus, d"
|
||||
|
||||
# 工作区切换 (多桌面核心)
|
||||
"$mainMod, 1, workspace, 1"
|
||||
"$mainMod, 2, workspace, 2"
|
||||
"$mainMod, 3, workspace, 3"
|
||||
"$mainMod, 4, workspace, 4"
|
||||
"$mainMod, 5, workspace, 5"
|
||||
"$mainMod, 6, workspace, 6"
|
||||
"$mainMod, 7, workspace, 7"
|
||||
"$mainMod, 8, workspace, 8"
|
||||
"$mainMod, 9, workspace, 9"
|
||||
"$mainMod, 0, workspace, 10"
|
||||
|
||||
# 移动窗口到工作区
|
||||
"$mainMod SHIFT, 1, movetoworkspace, 1"
|
||||
"$mainMod SHIFT, 2, movetoworkspace, 2"
|
||||
"$mainMod SHIFT, 3, movetoworkspace, 3"
|
||||
"$mainMod SHIFT, 4, movetoworkspace, 4"
|
||||
"$mainMod SHIFT, 5, movetoworkspace, 5"
|
||||
"$mainMod SHIFT, 6, movetoworkspace, 6"
|
||||
"$mainMod SHIFT, 7, movetoworkspace, 7"
|
||||
"$mainMod SHIFT, 8, movetoworkspace, 8"
|
||||
"$mainMod SHIFT, 9, movetoworkspace, 9"
|
||||
"$mainMod SHIFT, 0, movetoworkspace, 10"
|
||||
|
||||
# 鼠标滚动切换工作区
|
||||
"$mainMod, mouse_down, workspace, e+1"
|
||||
"$mainMod, mouse_up, workspace, e-1"
|
||||
];
|
||||
|
||||
bindm = [
|
||||
"$mainMod, mouse:272, movewindow"
|
||||
"$mainMod, mouse:273, resizewindow"
|
||||
];
|
||||
|
||||
# ── 启动项 ────────────────────────────────────────────
|
||||
exec_once = [
|
||||
"noctalia-shell"
|
||||
"${pkgs.kdePackages.polkit-kde-agent-1}/libexec/polkit-kde-authentication-agent-1"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
# ── 必备终端 ──────────────────────────────────────────────
|
||||
programs.ghostty = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
home.packages = with pkgs; [
|
||||
libnotify
|
||||
wl-clipboard
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user