# SPDX-FileCopyrightText: 2026 Nitesh Kumar Debnath # # SPDX-License-Identifier: GPL-3.0-or-later { # inputs, config, lib, ... }: let inherit (config.flake) wrappers; in { flake.wrappers = { noctalia-v5 = { wlib, pkgs, config, ... }: { imports = [ wlib.modules.default ]; options.settings = lib.mkOption { type = wlib.types.structuredValueWith { typeName = "TOML"; }; default = { }; example = lib.literalExpression '' { "shell" = { "panel" = { "transparency_mode" = "soft"; }; "password_style" = "random"; "polkit_agent" = true; "session" = { "grid" = true; }; "settings_window_translucent" = true; }; }; ''; description = '' Noctalia configuration settings as an attribute set, ''; }; config = { env.NOCTALIA_CONFIG_HOME = "${placeholder "out"}/config"; passthru.tests.config-is-correct = pkgs.testers.runCommand { name = "noctalia-config"; nativeBuildInputs = [ config.wrapper ]; script = '' noctalia config validate noctalia config export touch $out ''; }; package = pkgs.noctalia; runtimePkgs = [ pkgs.ddcutil pkgs.glib pkgs.kdePackages.kdialog pkgs.satty pkgs.wl-screenrec pkgs.slurp pkgs.grim pkgs.hyprpicker pkgs.zbar pkgs.tesseract ]; settings = lib.readFile ./noctalia-config.toml |> lib.fromTOML; constructFiles.generatedConfig = { content = lib.toJSON config.settings; relPath = "config/noctalia/config.toml"; builder = ''${pkgs.remarshal}/bin/json2toml "$1" "$2"''; }; }; }; niri-pc = { pkgs, config, ... }: let noctaliaExe = lib.getExe' config.noctaliaPackage "noctalia"; in { options.noctaliaPackage = lib.mkPackageOption pkgs "noctalia" { }; config = { noctaliaPackage = lib.mkDefault (wrappers.noctalia-v5.wrap { inherit pkgs; }); extraSettings = [ { include = [ { optional = true; } "~/.config/niri/noctalia.kdl" ]; } ]; settings = { spawn-at-startup = [ noctaliaExe # [ # "valent" # "--gapplication-service" # ] ]; binds."Mod+Space" = _: { props = { hotkey-overlay-title = "Toggle launcher"; }; content.spawn = [ noctaliaExe "msg" "panel-toggle" "launcher" ]; }; binds."Mod+E" = _: { props = { hotkey-overlay-title = "Toggle control center"; }; content.spawn = [ noctaliaExe "msg" "panel-toggle" "control-center" ]; }; binds."Mod+Delete" = _: { props = { hotkey-overlay-title = "Toggle logout menu"; }; content.spawn = [ noctaliaExe "msg" "panel-toggle" "session" ]; }; layer-rules = [ { matches = [ { namespace = "^noctalia-wallpaper*"; } ]; place-within-backdrop = true; } ]; debug = { honor-xdg-activation-with-invalid-serial = _: { }; }; layout = { background-color = "transparent"; }; overview = { workspace-shadow.off = _: { }; }; }; }; }; }; flake.modules.nixos.msi-colgate = _: { wrappers.noctalia-v5.settings = { plugin_settings."alexander/screen-toolkit".record-codec = lib.mkForce "hevc"; }; }; flake.modules.nixos.lightMode = _: { wrappers.noctalia-v5.settings = { theme.mode = lib.mkForce "light"; }; }; flake.modules.nixos.pc = { pkgs, ... }: { wrappers.noctalia-v5.enable = true; environment.systemPackages = [ pkgs.wtype pkgs.ffmpeg pkgs.imagemagick ]; }; }