From 69eee64e7e42ec9570ca96a52b46b2bccc07572b Mon Sep 17 00:00:00 2001 From: Ryan Yin Date: Mon, 18 Aug 2025 21:44:18 +0800 Subject: [PATCH] feat: add new wayland compositor - niri --- Justfile | 8 ++ flake.lock | 126 +++++++++++++++++- flake.nix | 2 + .../values => base/desktop}/anyrun.nix | 0 .../desktop}/conf/hypridle.conf | 0 .../desktop}/conf/mako/config | 0 .../conf/mako/icons/brightness-100.png | Bin .../conf/mako/icons/brightness-20.png | Bin .../conf/mako/icons/brightness-40.png | Bin .../conf/mako/icons/brightness-60.png | Bin .../conf/mako/icons/brightness-80.png | Bin .../desktop}/conf/mako/icons/dropper.png | Bin .../conf/mako/icons/microphone-mute.png | Bin .../desktop}/conf/mako/icons/microphone.png | Bin .../desktop}/conf/mako/icons/music.png | Bin .../desktop}/conf/mako/icons/palette.png | Bin .../desktop}/conf/mako/icons/picture.png | Bin .../desktop}/conf/mako/icons/timer.png | Bin .../desktop}/conf/mako/icons/volume-high.png | Bin .../desktop}/conf/mako/icons/volume-low.png | Bin .../desktop}/conf/mako/icons/volume-mid.png | Bin .../desktop}/conf/mako/icons/volume-mute.png | Bin .../desktop}/conf/waybar/config.jsonc | 0 .../desktop}/conf/waybar/mocha.css | 0 .../desktop}/conf/waybar/style.css | 0 .../desktop}/conf/wlogout/icons/hibernate.png | Bin .../desktop}/conf/wlogout/icons/lock.png | Bin .../desktop}/conf/wlogout/icons/logout.png | Bin .../desktop}/conf/wlogout/icons/reboot.png | Bin .../desktop}/conf/wlogout/icons/shutdown.png | Bin .../desktop}/conf/wlogout/icons/suspend.png | Bin .../desktop}/conf/wlogout/layout | 0 .../desktop}/conf/wlogout/style.css | 0 home/linux/gui/base/desktop/default.nix | 56 ++++++++ .../values => base}/wayland-apps.nix | 0 .../gui/hyprland/conf/{configs => }/exec.conf | 0 .../hyprland/conf/{configs => }/fcitx5.conf | 0 .../conf/{configs => }/keybindings.conf | 0 .../hyprland/conf/{configs => }/settings.conf | 0 .../conf/{configs => }/windowrules.conf | 0 home/linux/gui/hyprland/default.nix | 2 - home/linux/gui/hyprland/values/hyprland.nix | 31 +---- home/linux/gui/hyprland/values/packages.nix | 20 --- home/linux/gui/niri/default.nix | 66 +++++++++ .../aarch64-linux/src/12kingdoms-shoukei.nix | 53 +++++--- .../tests/home-manager/expected.nix | 1 + .../aarch64-linux/tests/home-manager/expr.nix | 1 + .../aarch64-linux/tests/hostname/expected.nix | 1 + outputs/x86_64-linux/src/idols-ai.nix | 52 +++++--- .../tests/home-manager/expected.nix | 1 + .../x86_64-linux/tests/home-manager/expr.nix | 1 + .../x86_64-linux/tests/hostname/expected.nix | 1 + 52 files changed, 333 insertions(+), 89 deletions(-) rename home/linux/gui/{hyprland/values => base/desktop}/anyrun.nix (100%) rename home/linux/gui/{hyprland => base/desktop}/conf/hypridle.conf (100%) rename home/linux/gui/{hyprland => base/desktop}/conf/mako/config (100%) rename home/linux/gui/{hyprland => base/desktop}/conf/mako/icons/brightness-100.png (100%) rename home/linux/gui/{hyprland => base/desktop}/conf/mako/icons/brightness-20.png (100%) rename home/linux/gui/{hyprland => base/desktop}/conf/mako/icons/brightness-40.png (100%) rename home/linux/gui/{hyprland => base/desktop}/conf/mako/icons/brightness-60.png (100%) rename home/linux/gui/{hyprland => base/desktop}/conf/mako/icons/brightness-80.png (100%) rename home/linux/gui/{hyprland => base/desktop}/conf/mako/icons/dropper.png (100%) rename home/linux/gui/{hyprland => base/desktop}/conf/mako/icons/microphone-mute.png (100%) rename home/linux/gui/{hyprland => base/desktop}/conf/mako/icons/microphone.png (100%) rename home/linux/gui/{hyprland => base/desktop}/conf/mako/icons/music.png (100%) rename home/linux/gui/{hyprland => base/desktop}/conf/mako/icons/palette.png (100%) rename home/linux/gui/{hyprland => base/desktop}/conf/mako/icons/picture.png (100%) rename home/linux/gui/{hyprland => base/desktop}/conf/mako/icons/timer.png (100%) rename home/linux/gui/{hyprland => base/desktop}/conf/mako/icons/volume-high.png (100%) rename home/linux/gui/{hyprland => base/desktop}/conf/mako/icons/volume-low.png (100%) rename home/linux/gui/{hyprland => base/desktop}/conf/mako/icons/volume-mid.png (100%) rename home/linux/gui/{hyprland => base/desktop}/conf/mako/icons/volume-mute.png (100%) rename home/linux/gui/{hyprland => base/desktop}/conf/waybar/config.jsonc (100%) rename home/linux/gui/{hyprland => base/desktop}/conf/waybar/mocha.css (100%) rename home/linux/gui/{hyprland => base/desktop}/conf/waybar/style.css (100%) rename home/linux/gui/{hyprland => base/desktop}/conf/wlogout/icons/hibernate.png (100%) rename home/linux/gui/{hyprland => base/desktop}/conf/wlogout/icons/lock.png (100%) rename home/linux/gui/{hyprland => base/desktop}/conf/wlogout/icons/logout.png (100%) rename home/linux/gui/{hyprland => base/desktop}/conf/wlogout/icons/reboot.png (100%) rename home/linux/gui/{hyprland => base/desktop}/conf/wlogout/icons/shutdown.png (100%) rename home/linux/gui/{hyprland => base/desktop}/conf/wlogout/icons/suspend.png (100%) rename home/linux/gui/{hyprland => base/desktop}/conf/wlogout/layout (100%) rename home/linux/gui/{hyprland => base/desktop}/conf/wlogout/style.css (100%) create mode 100644 home/linux/gui/base/desktop/default.nix rename home/linux/gui/{hyprland/values => base}/wayland-apps.nix (100%) rename home/linux/gui/hyprland/conf/{configs => }/exec.conf (100%) rename home/linux/gui/hyprland/conf/{configs => }/fcitx5.conf (100%) rename home/linux/gui/hyprland/conf/{configs => }/keybindings.conf (100%) rename home/linux/gui/hyprland/conf/{configs => }/settings.conf (100%) rename home/linux/gui/hyprland/conf/{configs => }/windowrules.conf (100%) delete mode 100644 home/linux/gui/hyprland/values/packages.nix create mode 100644 home/linux/gui/niri/default.nix diff --git a/Justfile b/Justfile index a93108ca..7b2e8e08 100644 --- a/Justfile +++ b/Justfile @@ -124,6 +124,14 @@ hypr mode="default": use {{utils_nu}} *; nixos-switch $"(hostname)-hyprland" {{mode}} +# Deploy the niri nixosConfiguration by hostname match +[linux] +[group('desktop')] +niri mode="default": + #!/usr/bin/env nu + use {{utils_nu}} *; + nixos-switch $"(hostname)-niri" {{mode}} + ############################################################################ # # Darwin related commands diff --git a/flake.lock b/flake.lock index 17a1f64f..ae6bbe28 100644 --- a/flake.lock +++ b/flake.lock @@ -539,6 +539,62 @@ "url": "ssh://git@github.com/ryan4yin/nix-secrets.git" } }, + "niri": { + "inputs": { + "niri-stable": "niri-stable", + "niri-unstable": "niri-unstable", + "nixpkgs": "nixpkgs_2", + "nixpkgs-stable": "nixpkgs-stable_2", + "xwayland-satellite-stable": "xwayland-satellite-stable", + "xwayland-satellite-unstable": "xwayland-satellite-unstable" + }, + "locked": { + "lastModified": 1755424351, + "narHash": "sha256-xcorYLNdtLpb0wH5CPlUcpmYQUxeK95j1X855xQw+DY=", + "owner": "sodiboo", + "repo": "niri-flake", + "rev": "9aa137af01f05386e5bb5050e983750017007a66", + "type": "github" + }, + "original": { + "owner": "sodiboo", + "repo": "niri-flake", + "type": "github" + } + }, + "niri-stable": { + "flake": false, + "locked": { + "lastModified": 1748151941, + "narHash": "sha256-z4viQZLgC2bIJ3VrzQnR+q2F3gAOEQpU1H5xHtX/2fs=", + "owner": "YaLTeR", + "repo": "niri", + "rev": "8ba57fcf25d2fc9565131684a839d58703f1dae7", + "type": "github" + }, + "original": { + "owner": "YaLTeR", + "ref": "v25.05.1", + "repo": "niri", + "type": "github" + } + }, + "niri-unstable": { + "flake": false, + "locked": { + "lastModified": 1755419373, + "narHash": "sha256-EFH3zbpyLYjEboNV2Lmkxf9joEuFCmeYX+MMLRPStpg=", + "owner": "YaLTeR", + "repo": "niri", + "rev": "a6febb86aa5af0df7bf2792ca027ef95a503d599", + "type": "github" + }, + "original": { + "owner": "YaLTeR", + "repo": "niri", + "type": "github" + } + }, "nix-darwin": { "inputs": { "nixpkgs": [ @@ -738,6 +794,22 @@ } }, "nixpkgs-stable_2": { + "locked": { + "lastModified": 1755274400, + "narHash": "sha256-rTInmnp/xYrfcMZyFMH3kc8oko5zYfxsowaLv1LVobY=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "ad7196ae55c295f53a7d1ec39e4a06d922f3b899", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-25.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-stable_3": { "locked": { "lastModified": 1755274400, "narHash": "sha256-rTInmnp/xYrfcMZyFMH3kc8oko5zYfxsowaLv1LVobY=", @@ -770,6 +842,22 @@ } }, "nixpkgs_2": { + "locked": { + "lastModified": 1755186698, + "narHash": "sha256-wNO3+Ks2jZJ4nTHMuks+cxAiVBGNuEBXsT29Bz6HASo=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "fbcf476f790d8a217c3eab4e12033dc4a0f6d23c", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { "locked": { "lastModified": 1755186698, "narHash": "sha256-wNO3+Ks2jZJ4nTHMuks+cxAiVBGNuEBXsT29Bz6HASo=", @@ -919,15 +1007,16 @@ "lanzaboote": "lanzaboote", "my-asahi-firmware": "my-asahi-firmware", "mysecrets": "mysecrets", + "niri": "niri", "nix-darwin": "nix-darwin", "nix-gaming": "nix-gaming", "nixos-apple-silicon": "nixos-apple-silicon", "nixos-generators": "nixos-generators", "nixpak": "nixpak", - "nixpkgs": "nixpkgs_2", + "nixpkgs": "nixpkgs_3", "nixpkgs-darwin": "nixpkgs-darwin", "nixpkgs-ollama": "nixpkgs-ollama", - "nixpkgs-stable": "nixpkgs-stable_2", + "nixpkgs-stable": "nixpkgs-stable_3", "nixpkgs-unstable": "nixpkgs-unstable", "nuenv": "nuenv", "nur-ryan4yin": "nur-ryan4yin", @@ -1077,6 +1166,39 @@ "type": "github" } }, + "xwayland-satellite-stable": { + "flake": false, + "locked": { + "lastModified": 1748488455, + "narHash": "sha256-IiLr1alzKFIy5tGGpDlabQbe6LV1c9ABvkH6T5WmyRI=", + "owner": "Supreeeme", + "repo": "xwayland-satellite", + "rev": "3ba30b149f9eb2bbf42cf4758d2158ca8cceef73", + "type": "github" + }, + "original": { + "owner": "Supreeeme", + "ref": "v0.6", + "repo": "xwayland-satellite", + "type": "github" + } + }, + "xwayland-satellite-unstable": { + "flake": false, + "locked": { + "lastModified": 1755219541, + "narHash": "sha256-yKV6xHaPbEbh5RPxAJnb9yTs1wypr7do86hFFGQm1w8=", + "owner": "Supreeeme", + "repo": "xwayland-satellite", + "rev": "5a184d435927c3423f0ad189ea2b490578450fb7", + "type": "github" + }, + "original": { + "owner": "Supreeeme", + "repo": "xwayland-satellite", + "type": "github" + } + }, "zig": { "inputs": { "flake-compat": [ diff --git a/flake.nix b/flake.nix index 1f087fd8..ab1ebb8f 100644 --- a/flake.nix +++ b/flake.nix @@ -143,6 +143,8 @@ inputs.nixpkgs.follows = "nixpkgs"; }; + niri.url = "github:sodiboo/niri-flake"; + ######################## Some non-flake repositories ######################################### polybar-themes = { diff --git a/home/linux/gui/hyprland/values/anyrun.nix b/home/linux/gui/base/desktop/anyrun.nix similarity index 100% rename from home/linux/gui/hyprland/values/anyrun.nix rename to home/linux/gui/base/desktop/anyrun.nix diff --git a/home/linux/gui/hyprland/conf/hypridle.conf b/home/linux/gui/base/desktop/conf/hypridle.conf similarity index 100% rename from home/linux/gui/hyprland/conf/hypridle.conf rename to home/linux/gui/base/desktop/conf/hypridle.conf diff --git a/home/linux/gui/hyprland/conf/mako/config b/home/linux/gui/base/desktop/conf/mako/config similarity index 100% rename from home/linux/gui/hyprland/conf/mako/config rename to home/linux/gui/base/desktop/conf/mako/config diff --git a/home/linux/gui/hyprland/conf/mako/icons/brightness-100.png b/home/linux/gui/base/desktop/conf/mako/icons/brightness-100.png similarity index 100% rename from home/linux/gui/hyprland/conf/mako/icons/brightness-100.png rename to home/linux/gui/base/desktop/conf/mako/icons/brightness-100.png diff --git a/home/linux/gui/hyprland/conf/mako/icons/brightness-20.png b/home/linux/gui/base/desktop/conf/mako/icons/brightness-20.png similarity index 100% rename from home/linux/gui/hyprland/conf/mako/icons/brightness-20.png rename to home/linux/gui/base/desktop/conf/mako/icons/brightness-20.png diff --git a/home/linux/gui/hyprland/conf/mako/icons/brightness-40.png b/home/linux/gui/base/desktop/conf/mako/icons/brightness-40.png similarity index 100% rename from home/linux/gui/hyprland/conf/mako/icons/brightness-40.png rename to home/linux/gui/base/desktop/conf/mako/icons/brightness-40.png diff --git a/home/linux/gui/hyprland/conf/mako/icons/brightness-60.png b/home/linux/gui/base/desktop/conf/mako/icons/brightness-60.png similarity index 100% rename from home/linux/gui/hyprland/conf/mako/icons/brightness-60.png rename to home/linux/gui/base/desktop/conf/mako/icons/brightness-60.png diff --git a/home/linux/gui/hyprland/conf/mako/icons/brightness-80.png b/home/linux/gui/base/desktop/conf/mako/icons/brightness-80.png similarity index 100% rename from home/linux/gui/hyprland/conf/mako/icons/brightness-80.png rename to home/linux/gui/base/desktop/conf/mako/icons/brightness-80.png diff --git a/home/linux/gui/hyprland/conf/mako/icons/dropper.png b/home/linux/gui/base/desktop/conf/mako/icons/dropper.png similarity index 100% rename from home/linux/gui/hyprland/conf/mako/icons/dropper.png rename to home/linux/gui/base/desktop/conf/mako/icons/dropper.png diff --git a/home/linux/gui/hyprland/conf/mako/icons/microphone-mute.png b/home/linux/gui/base/desktop/conf/mako/icons/microphone-mute.png similarity index 100% rename from home/linux/gui/hyprland/conf/mako/icons/microphone-mute.png rename to home/linux/gui/base/desktop/conf/mako/icons/microphone-mute.png diff --git a/home/linux/gui/hyprland/conf/mako/icons/microphone.png b/home/linux/gui/base/desktop/conf/mako/icons/microphone.png similarity index 100% rename from home/linux/gui/hyprland/conf/mako/icons/microphone.png rename to home/linux/gui/base/desktop/conf/mako/icons/microphone.png diff --git a/home/linux/gui/hyprland/conf/mako/icons/music.png b/home/linux/gui/base/desktop/conf/mako/icons/music.png similarity index 100% rename from home/linux/gui/hyprland/conf/mako/icons/music.png rename to home/linux/gui/base/desktop/conf/mako/icons/music.png diff --git a/home/linux/gui/hyprland/conf/mako/icons/palette.png b/home/linux/gui/base/desktop/conf/mako/icons/palette.png similarity index 100% rename from home/linux/gui/hyprland/conf/mako/icons/palette.png rename to home/linux/gui/base/desktop/conf/mako/icons/palette.png diff --git a/home/linux/gui/hyprland/conf/mako/icons/picture.png b/home/linux/gui/base/desktop/conf/mako/icons/picture.png similarity index 100% rename from home/linux/gui/hyprland/conf/mako/icons/picture.png rename to home/linux/gui/base/desktop/conf/mako/icons/picture.png diff --git a/home/linux/gui/hyprland/conf/mako/icons/timer.png b/home/linux/gui/base/desktop/conf/mako/icons/timer.png similarity index 100% rename from home/linux/gui/hyprland/conf/mako/icons/timer.png rename to home/linux/gui/base/desktop/conf/mako/icons/timer.png diff --git a/home/linux/gui/hyprland/conf/mako/icons/volume-high.png b/home/linux/gui/base/desktop/conf/mako/icons/volume-high.png similarity index 100% rename from home/linux/gui/hyprland/conf/mako/icons/volume-high.png rename to home/linux/gui/base/desktop/conf/mako/icons/volume-high.png diff --git a/home/linux/gui/hyprland/conf/mako/icons/volume-low.png b/home/linux/gui/base/desktop/conf/mako/icons/volume-low.png similarity index 100% rename from home/linux/gui/hyprland/conf/mako/icons/volume-low.png rename to home/linux/gui/base/desktop/conf/mako/icons/volume-low.png diff --git a/home/linux/gui/hyprland/conf/mako/icons/volume-mid.png b/home/linux/gui/base/desktop/conf/mako/icons/volume-mid.png similarity index 100% rename from home/linux/gui/hyprland/conf/mako/icons/volume-mid.png rename to home/linux/gui/base/desktop/conf/mako/icons/volume-mid.png diff --git a/home/linux/gui/hyprland/conf/mako/icons/volume-mute.png b/home/linux/gui/base/desktop/conf/mako/icons/volume-mute.png similarity index 100% rename from home/linux/gui/hyprland/conf/mako/icons/volume-mute.png rename to home/linux/gui/base/desktop/conf/mako/icons/volume-mute.png diff --git a/home/linux/gui/hyprland/conf/waybar/config.jsonc b/home/linux/gui/base/desktop/conf/waybar/config.jsonc similarity index 100% rename from home/linux/gui/hyprland/conf/waybar/config.jsonc rename to home/linux/gui/base/desktop/conf/waybar/config.jsonc diff --git a/home/linux/gui/hyprland/conf/waybar/mocha.css b/home/linux/gui/base/desktop/conf/waybar/mocha.css similarity index 100% rename from home/linux/gui/hyprland/conf/waybar/mocha.css rename to home/linux/gui/base/desktop/conf/waybar/mocha.css diff --git a/home/linux/gui/hyprland/conf/waybar/style.css b/home/linux/gui/base/desktop/conf/waybar/style.css similarity index 100% rename from home/linux/gui/hyprland/conf/waybar/style.css rename to home/linux/gui/base/desktop/conf/waybar/style.css diff --git a/home/linux/gui/hyprland/conf/wlogout/icons/hibernate.png b/home/linux/gui/base/desktop/conf/wlogout/icons/hibernate.png similarity index 100% rename from home/linux/gui/hyprland/conf/wlogout/icons/hibernate.png rename to home/linux/gui/base/desktop/conf/wlogout/icons/hibernate.png diff --git a/home/linux/gui/hyprland/conf/wlogout/icons/lock.png b/home/linux/gui/base/desktop/conf/wlogout/icons/lock.png similarity index 100% rename from home/linux/gui/hyprland/conf/wlogout/icons/lock.png rename to home/linux/gui/base/desktop/conf/wlogout/icons/lock.png diff --git a/home/linux/gui/hyprland/conf/wlogout/icons/logout.png b/home/linux/gui/base/desktop/conf/wlogout/icons/logout.png similarity index 100% rename from home/linux/gui/hyprland/conf/wlogout/icons/logout.png rename to home/linux/gui/base/desktop/conf/wlogout/icons/logout.png diff --git a/home/linux/gui/hyprland/conf/wlogout/icons/reboot.png b/home/linux/gui/base/desktop/conf/wlogout/icons/reboot.png similarity index 100% rename from home/linux/gui/hyprland/conf/wlogout/icons/reboot.png rename to home/linux/gui/base/desktop/conf/wlogout/icons/reboot.png diff --git a/home/linux/gui/hyprland/conf/wlogout/icons/shutdown.png b/home/linux/gui/base/desktop/conf/wlogout/icons/shutdown.png similarity index 100% rename from home/linux/gui/hyprland/conf/wlogout/icons/shutdown.png rename to home/linux/gui/base/desktop/conf/wlogout/icons/shutdown.png diff --git a/home/linux/gui/hyprland/conf/wlogout/icons/suspend.png b/home/linux/gui/base/desktop/conf/wlogout/icons/suspend.png similarity index 100% rename from home/linux/gui/hyprland/conf/wlogout/icons/suspend.png rename to home/linux/gui/base/desktop/conf/wlogout/icons/suspend.png diff --git a/home/linux/gui/hyprland/conf/wlogout/layout b/home/linux/gui/base/desktop/conf/wlogout/layout similarity index 100% rename from home/linux/gui/hyprland/conf/wlogout/layout rename to home/linux/gui/base/desktop/conf/wlogout/layout diff --git a/home/linux/gui/hyprland/conf/wlogout/style.css b/home/linux/gui/base/desktop/conf/wlogout/style.css similarity index 100% rename from home/linux/gui/hyprland/conf/wlogout/style.css rename to home/linux/gui/base/desktop/conf/wlogout/style.css diff --git a/home/linux/gui/base/desktop/default.nix b/home/linux/gui/base/desktop/default.nix new file mode 100644 index 00000000..d58dafe7 --- /dev/null +++ b/home/linux/gui/base/desktop/default.nix @@ -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; +} diff --git a/home/linux/gui/hyprland/values/wayland-apps.nix b/home/linux/gui/base/wayland-apps.nix similarity index 100% rename from home/linux/gui/hyprland/values/wayland-apps.nix rename to home/linux/gui/base/wayland-apps.nix diff --git a/home/linux/gui/hyprland/conf/configs/exec.conf b/home/linux/gui/hyprland/conf/exec.conf similarity index 100% rename from home/linux/gui/hyprland/conf/configs/exec.conf rename to home/linux/gui/hyprland/conf/exec.conf diff --git a/home/linux/gui/hyprland/conf/configs/fcitx5.conf b/home/linux/gui/hyprland/conf/fcitx5.conf similarity index 100% rename from home/linux/gui/hyprland/conf/configs/fcitx5.conf rename to home/linux/gui/hyprland/conf/fcitx5.conf diff --git a/home/linux/gui/hyprland/conf/configs/keybindings.conf b/home/linux/gui/hyprland/conf/keybindings.conf similarity index 100% rename from home/linux/gui/hyprland/conf/configs/keybindings.conf rename to home/linux/gui/hyprland/conf/keybindings.conf diff --git a/home/linux/gui/hyprland/conf/configs/settings.conf b/home/linux/gui/hyprland/conf/settings.conf similarity index 100% rename from home/linux/gui/hyprland/conf/configs/settings.conf rename to home/linux/gui/hyprland/conf/settings.conf diff --git a/home/linux/gui/hyprland/conf/configs/windowrules.conf b/home/linux/gui/hyprland/conf/windowrules.conf similarity index 100% rename from home/linux/gui/hyprland/conf/configs/windowrules.conf rename to home/linux/gui/hyprland/conf/windowrules.conf diff --git a/home/linux/gui/hyprland/default.nix b/home/linux/gui/hyprland/default.nix index 22a7a707..3aa7e63c 100644 --- a/home/linux/gui/hyprland/default.nix +++ b/home/linux/gui/hyprland/default.nix @@ -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 ]; diff --git a/home/linux/gui/hyprland/values/hyprland.nix b/home/linux/gui/hyprland/values/hyprland.nix index aaf18223..895a56d0 100644 --- a/home/linux/gui/hyprland/values/hyprland.nix +++ b/home/linux/gui/hyprland/values/hyprland.nix @@ -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! diff --git a/home/linux/gui/hyprland/values/packages.nix b/home/linux/gui/hyprland/values/packages.nix deleted file mode 100644 index a681cfcb..00000000 --- a/home/linux/gui/hyprland/values/packages.nix +++ /dev/null @@ -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 - ]; -} diff --git a/home/linux/gui/niri/default.nix b/home/linux/gui/niri/default.nix new file mode 100644 index 00000000..4ccfd809 --- /dev/null +++ b/home/linux/gui/niri/default.nix @@ -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) + )); +} diff --git a/outputs/aarch64-linux/src/12kingdoms-shoukei.nix b/outputs/aarch64-linux/src/12kingdoms-shoukei.nix index f2fbe22a..68ecf3c3 100644 --- a/outputs/aarch64-linux/src/12kingdoms-shoukei.nix +++ b/outputs/aarch64-linux/src/12kingdoms-shoukei.nix @@ -14,17 +14,26 @@ let # Shoukei (祥瓊, Shōkei) name = "shoukei"; base-modules = { - nixos-modules = map mylib.relativeToRoot [ - # common - "secrets/nixos.nix" - "modules/nixos/desktop.nix" - # host specific - "hosts/12kingdoms-${name}" - # nixos hardening - # "hardening/profiles/default.nix" - "hardening/nixpaks" - "hardening/bwraps" - ]; + nixos-modules = + (map mylib.relativeToRoot [ + # common + "secrets/nixos.nix" + "modules/nixos/desktop.nix" + # host specific + "hosts/12kingdoms-${name}" + # nixos hardening + # "hardening/profiles/default.nix" + "hardening/nixpaks" + "hardening/bwraps" + ]) + ++ [ + { + modules.desktop.fonts.enable = true; + modules.desktop.wayland.enable = true; + modules.secrets.desktop.enable = true; + modules.secrets.preservation.enable = true; + } + ]; home-modules = map mylib.relativeToRoot [ # common "home/linux/gui.nix" @@ -35,14 +44,6 @@ let modules-hyprland = { nixos-modules = [ - { - modules.desktop.wayland.enable = true; - modules.secrets.desktop.enable = true; - modules.secrets.preservation.enable = true; - - # TODO: remove this option - nixpkgs.config.allowUnsupportedSstem = true; - } ] ++ base-modules.nixos-modules; home-modules = [ @@ -50,15 +51,29 @@ let ] ++ base-modules.home-modules; }; + + modules-niri = { + nixos-modules = [ + inputs.niri.nixosModules.niri + { programs.niri.enable = true; } + ] + ++ base-modules.nixos-modules; + home-modules = [ + { modules.desktop.niri.enable = true; } + ] + ++ base-modules.home-modules; + }; in { nixosConfigurations = { # host with hyprland compositor "${name}-hyprland" = mylib.nixosSystem (modules-hyprland // args); + "${name}-niri" = mylib.nixosSystem (modules-niri // args); }; # generate iso image for hosts with desktop environment packages = { "${name}-hyprland" = inputs.self.nixosConfigurations."${name}-hyprland".config.formats.iso; + "${name}-niri" = inputs.self.nixosConfigurations."${name}-niri".config.formats.iso; }; } diff --git a/outputs/aarch64-linux/tests/home-manager/expected.nix b/outputs/aarch64-linux/tests/home-manager/expected.nix index 8f338aaa..06990df2 100644 --- a/outputs/aarch64-linux/tests/home-manager/expected.nix +++ b/outputs/aarch64-linux/tests/home-manager/expected.nix @@ -6,6 +6,7 @@ let username = myvars.username; hosts = [ "shoukei-hyprland" + "shoukei-niri" ]; in lib.genAttrs hosts (_: "/home/${username}") diff --git a/outputs/aarch64-linux/tests/home-manager/expr.nix b/outputs/aarch64-linux/tests/home-manager/expr.nix index 05c367a4..2c127312 100644 --- a/outputs/aarch64-linux/tests/home-manager/expr.nix +++ b/outputs/aarch64-linux/tests/home-manager/expr.nix @@ -7,6 +7,7 @@ let username = myvars.username; hosts = [ "shoukei-hyprland" + "shoukei-niri" ]; in lib.genAttrs hosts ( diff --git a/outputs/aarch64-linux/tests/hostname/expected.nix b/outputs/aarch64-linux/tests/hostname/expected.nix index 24df8902..0b061943 100644 --- a/outputs/aarch64-linux/tests/hostname/expected.nix +++ b/outputs/aarch64-linux/tests/hostname/expected.nix @@ -5,6 +5,7 @@ let specialExpected = { "shoukei-hyprland" = "shoukei"; + "shoukei-niri" = "shoukei"; }; specialHostNames = builtins.attrNames specialExpected; diff --git a/outputs/x86_64-linux/src/idols-ai.nix b/outputs/x86_64-linux/src/idols-ai.nix index dece6db9..c00b9e1e 100644 --- a/outputs/x86_64-linux/src/idols-ai.nix +++ b/outputs/x86_64-linux/src/idols-ai.nix @@ -8,23 +8,33 @@ mylib, system, genSpecialArgs, + niri, ... }@args: let # 星野 アイ, Hoshino Ai name = "ai"; base-modules = { - nixos-modules = map mylib.relativeToRoot [ - # common - "secrets/nixos.nix" - "modules/nixos/desktop.nix" - # host specific - "hosts/idols-${name}" - # nixos hardening - # "hardening/profiles/default.nix" - "hardening/nixpaks" - "hardening/bwraps" - ]; + nixos-modules = + (map mylib.relativeToRoot [ + # common + "secrets/nixos.nix" + "modules/nixos/desktop.nix" + # host specific + "hosts/idols-${name}" + # nixos hardening + # "hardening/profiles/default.nix" + "hardening/nixpaks" + "hardening/bwraps" + ]) + ++ [ + { + modules.desktop.fonts.enable = true; + modules.desktop.wayland.enable = true; + modules.secrets.desktop.enable = true; + modules.secrets.preservation.enable = true; + } + ]; home-modules = map mylib.relativeToRoot [ # common "home/linux/gui.nix" @@ -35,12 +45,6 @@ let modules-hyprland = { nixos-modules = [ - { - modules.desktop.fonts.enable = true; - modules.desktop.wayland.enable = true; - modules.secrets.desktop.enable = true; - modules.secrets.preservation.enable = true; - } ] ++ base-modules.nixos-modules; home-modules = [ @@ -48,15 +52,29 @@ let ] ++ base-modules.home-modules; }; + + modules-niri = { + nixos-modules = [ + inputs.niri.nixosModules.niri + { programs.niri.enable = true; } + ] + ++ base-modules.nixos-modules; + home-modules = [ + { modules.desktop.niri.enable = true; } + ] + ++ base-modules.home-modules; + }; in { nixosConfigurations = { # host with hyprland compositor "${name}-hyprland" = mylib.nixosSystem (modules-hyprland // args); + "${name}-niri" = mylib.nixosSystem (modules-niri // args); }; # generate iso image for hosts with desktop environment packages = { "${name}-hyprland" = inputs.self.nixosConfigurations."${name}-hyprland".config.formats.iso; + "${name}-niri" = inputs.self.nixosConfigurations."${name}-niri".config.formats.iso; }; } diff --git a/outputs/x86_64-linux/tests/home-manager/expected.nix b/outputs/x86_64-linux/tests/home-manager/expected.nix index 417a2c84..14d95dbf 100644 --- a/outputs/x86_64-linux/tests/home-manager/expected.nix +++ b/outputs/x86_64-linux/tests/home-manager/expected.nix @@ -6,6 +6,7 @@ let username = myvars.username; hosts = [ "ai-hyprland" + "ai-niri" "ruby" "k3s-prod-1-master-1" ]; diff --git a/outputs/x86_64-linux/tests/home-manager/expr.nix b/outputs/x86_64-linux/tests/home-manager/expr.nix index 124368dd..964d201a 100644 --- a/outputs/x86_64-linux/tests/home-manager/expr.nix +++ b/outputs/x86_64-linux/tests/home-manager/expr.nix @@ -7,6 +7,7 @@ let username = myvars.username; hosts = [ "ai-hyprland" + "ai-niri" "ruby" "k3s-prod-1-master-1" ]; diff --git a/outputs/x86_64-linux/tests/hostname/expected.nix b/outputs/x86_64-linux/tests/hostname/expected.nix index 59d9a213..bd18950b 100644 --- a/outputs/x86_64-linux/tests/hostname/expected.nix +++ b/outputs/x86_64-linux/tests/hostname/expected.nix @@ -5,6 +5,7 @@ let specialExpected = { "ai-hyprland" = "ai"; + "ai-niri" = "ai"; }; specialHostNames = builtins.attrNames specialExpected;