feat: add new wayland compositor - niri

This commit is contained in:
Ryan Yin
2025-08-18 21:44:18 +08:00
parent 09fbea3f77
commit 69eee64e7e
52 changed files with 333 additions and 89 deletions

View File

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

View File

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View File

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View File

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

View File

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

View File

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View File

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

View File

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View File

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View File

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

View File

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 29 KiB

View File

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 33 KiB

View File

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

View File

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View File

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View File

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View File

Before

Width:  |  Height:  |  Size: 8.4 KiB

After

Width:  |  Height:  |  Size: 8.4 KiB

View File

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

View File

Before

Width:  |  Height:  |  Size: 7.8 KiB

After

Width:  |  Height:  |  Size: 7.8 KiB

View File

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

View File

Before

Width:  |  Height:  |  Size: 7.0 KiB

After

Width:  |  Height:  |  Size: 7.0 KiB

View File

@@ -0,0 +1,56 @@
{
config,
pkgs,
...
}:
{
imports = [
./anyrun.nix
];
home.packages = with pkgs; [
swaybg # the wallpaper
wl-clipboard # copying and pasting
hyprpicker # color picker
brightnessctl
hyprshot # screen shot
wf-recorder # screen recording
# audio
alsa-utils # provides amixer/alsamixer/...
networkmanagerapplet # provide GUI app: nm-connection-editor
];
xdg.configFile =
let
mkSymlink = config.lib.file.mkOutOfStoreSymlink;
confPath = "${config.home.homeDirectory}/nix-config/home/linux/gui/base/desktop/conf";
in
{
"mako".source = mkSymlink "${confPath}/mako";
"waybar".source = mkSymlink "${confPath}/waybar";
"wlogout".source = mkSymlink "${confPath}/wlogout";
"hypr/hypridle.conf".source = mkSymlink "${confPath}/hypridle.conf";
};
# status bar
programs.waybar = {
enable = true;
systemd.enable = true;
};
# Disable catppuccin to avoid conflict with my non-nix config.
catppuccin.waybar.enable = false;
# screen locker
programs.swaylock.enable = true;
# Logout Menu
programs.wlogout.enable = true;
catppuccin.wlogout.enable = false;
# Hyprland idle daemon
services.hypridle.enable = true;
# notification daemon, the same as dunst
services.mako.enable = true;
catppuccin.mako.enable = false;
}

View File

@@ -2,7 +2,6 @@
pkgs,
config,
lib,
anyrun,
...
}@args:
with lib;
@@ -11,7 +10,6 @@ let
in
{
imports = [
# anyrun.homeManagerModules.default # the module is already in hm now.
./options
];

View File

@@ -1,6 +1,5 @@
{
pkgs,
pkgs-stable,
config,
...
}:
@@ -11,38 +10,12 @@ in
xdg.configFile =
let
mkSymlink = config.lib.file.mkOutOfStoreSymlink;
hyprPath = "${config.home.homeDirectory}/nix-config/home/linux/gui/hyprland/conf";
confPath = "${config.home.homeDirectory}/nix-config/home/linux/gui/hyprland/conf";
in
{
"mako".source = mkSymlink "${hyprPath}/mako";
"waybar".source = mkSymlink "${hyprPath}/waybar";
"wlogout".source = mkSymlink "${hyprPath}/wlogout";
"hypr/hypridle.conf".source = mkSymlink "${hyprPath}/hypridle.conf";
"hypr/configs".source = mkSymlink "${hyprPath}/configs";
"hypr/configs".source = mkSymlink confPath;
};
# status bar
programs.waybar = {
enable = true;
systemd.enable = true;
};
# Disable catppuccin to avoid conflict with my non-nix config.
catppuccin.waybar.enable = false;
# screen locker
programs.swaylock.enable = true;
# Logout Menu
programs.wlogout.enable = true;
catppuccin.wlogout.enable = false;
# Hyprland idle daemon
services.hypridle.enable = true;
# notification daemon, the same as dunst
services.mako.enable = true;
catppuccin.mako.enable = false;
# NOTE:
# We have to enable hyprland/i3's systemd user service in home-manager,
# so that gammastep/wallpaper-switcher's user service can be start correctly!

View File

@@ -1,20 +0,0 @@
{
pkgs,
...
}:
{
home.packages = with pkgs; [
swaybg # the wallpaper
wl-clipboard # copying and pasting
hyprpicker # color picker
brightnessctl
hyprshot # screen shot
wf-recorder # screen recording
# audio
alsa-utils # provides amixer/alsamixer/...
networkmanagerapplet # provide GUI app: nm-connection-editor
];
}

View File

@@ -0,0 +1,66 @@
{
pkgs,
config,
lib,
...
}@args:
with lib;
let
cfg = config.modules.desktop.niri;
in
{
options.modules.desktop.niri = {
enable = mkEnableOption "niri compositor";
settings = lib.mkOption {
type =
with lib.types;
let
valueType =
nullOr (oneOf [
bool
int
float
str
path
(attrsOf valueType)
(listOf valueType)
])
// {
description = "niri configuration value";
};
in
valueType;
default = { };
};
};
config = mkIf cfg.enable (mkMerge ([
{
programs.wlogout.enable = true;
programs.alacritty.enable = true; # Super+T in the default setting (terminal)
programs.fuzzel.enable = true; # Super+D in the default setting (app launcher)
programs.swaylock.enable = true; # Super+Alt+L in the default setting (screen locker)
programs.waybar.enable = true; # launch on startup in the default setting (bar)
services.mako.enable = true; # notification daemon
services.swayidle.enable = true; # idle management daemon
services.polkit-gnome.enable = true; # polkit
home.packages = with pkgs; [
swaybg # wallpaper
];
# NOTE: this executable is used by greetd to start a wayland session when system boot up
# with such a vendor-no-locking script, we can switch to another wayland compositor without modifying greetd's config in NixOS module
home.file.".wayland-session" = {
source = pkgs.writeScript "init-session" ''
# trying to stop a previous niri session
systemctl --user is-active niri.service && systemctl --user stop niri.service
# and then we start a new one
/run/current-system/sw/bin/niri-session
'';
executable = true;
};
}
]
# ++ (import ./values args)
));
}