From 5233547d76ee4eda5e4ca6a7a806c7b2b53bee49 Mon Sep 17 00:00:00 2001 From: Matan Bendix Shenhav Date: Sat, 20 Sep 2025 11:46:28 +0200 Subject: [PATCH 1/4] feat(flake): systemd service --- flake.nix | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/flake.nix b/flake.nix index 401b370d..09696b11 100644 --- a/flake.nix +++ b/flake.nix @@ -80,5 +80,60 @@ }); defaultPackage = eachSystem (system: self.packages.${system}.default); + + nixosModules.default = + { + config, + lib, + pkgs, + ... + }: + let + cfg = config.services.noctalia-shell; + in + { + options.services.noctalia-shell = { + enable = lib.mkEnableOption "Noctalia shell systemd service"; + + package = lib.mkOption { + type = lib.types.package; + default = self.packages.${pkgs.system}.default; + description = "The noctalia-shell package to use"; + }; + + target = lib.mkOption { + type = lib.types.str; + default = "graphical-session.target"; + example = "hyprland-session.target"; + description = "The systemd target for the noctalia-shell service."; + }; + }; + + config = lib.mkIf cfg.enable { + systemd.user.services.noctalia-shell = { + description = "Noctalia Shell - Wayland desktop shell"; + documentation = [ "https://github.com/noctalia-dev/noctalia-shell" ]; + after = [ cfg.target ]; + partOf = [ cfg.target ]; + wantedBy = [ cfg.target ]; + + unitConfig = { + StartLimitIntervalSec = 60; + StartLimitBurst = 3; + }; + + serviceConfig = { + ExecStart = "${cfg.package}/bin/noctalia-shell"; + Restart = "on-failure"; + RestartSec = 3; + TimeoutStartSec = 10; + TimeoutStopSec = 5; + Environment = [ "PATH=${config.system.path}/bin" ]; + }; + }; + + environment.systemPackages = [ cfg.package ]; + }; + }; }; } From ba5e85ca67db1ca6c3e316a5c76e5d6da58bbd1c Mon Sep 17 00:00:00 2001 From: Matan Bendix Shenhav Date: Sat, 20 Sep 2025 14:02:20 +0200 Subject: [PATCH 2/4] chore(flake): format with nixfmt-rfc-style --- flake.nix | 58 +++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 39 insertions(+), 19 deletions(-) diff --git a/flake.nix b/flake.nix index 09696b11..1e36f154 100644 --- a/flake.nix +++ b/flake.nix @@ -1,6 +1,5 @@ { - description = - "Noctalia shell - a Wayland desktop shell built with Quickshell"; + description = "Noctalia shell - a Wayland desktop shell built with Quickshell"; inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; @@ -12,13 +11,22 @@ }; }; - outputs = { self, nixpkgs, systems, quickshell, ... }: - let eachSystem = nixpkgs.lib.genAttrs (import systems); - in { - formatter = - eachSystem (system: nixpkgs.legacyPackages.${system}.alejandra); + outputs = + { + self, + nixpkgs, + systems, + quickshell, + ... + }: + let + eachSystem = nixpkgs.lib.genAttrs (import systems); + in + { + formatter = eachSystem (system: nixpkgs.legacyPackages.${system}.alejandra); - packages = eachSystem (system: + packages = eachSystem ( + system: let pkgs = nixpkgs.legacyPackages.${system}; qs = quickshell.packages.${system}.default.override { @@ -26,7 +34,8 @@ withI3 = false; }; - runtimeDeps = with pkgs; + runtimeDeps = + with pkgs; [ bash bluez @@ -42,21 +51,32 @@ networkmanager wlsunset wl-clipboard - ] ++ lib.optionals (pkgs.stdenv.hostPlatform.isx86_64) - [ gpu-screen-recorder ]; + ] + ++ lib.optionals (pkgs.stdenv.hostPlatform.isx86_64) [ gpu-screen-recorder ]; fontconfig = pkgs.makeFontsConf { - fontDirectories = [ pkgs.roboto pkgs.inter-nerdfont ]; + fontDirectories = [ + pkgs.roboto + pkgs.inter-nerdfont + ]; }; - in { + in + { default = pkgs.stdenv.mkDerivation { pname = "noctalia-shell"; version = self.rev or self.dirtyRev or "dirty"; src = ./.; - nativeBuildInputs = - [ pkgs.gcc pkgs.makeWrapper pkgs.qt6.wrapQtAppsHook ]; - buildInputs = [ qs pkgs.xkeyboard_config pkgs.qt6.qtbase ]; + nativeBuildInputs = [ + pkgs.gcc + pkgs.makeWrapper + pkgs.qt6.wrapQtAppsHook + ]; + buildInputs = [ + qs + pkgs.xkeyboard_config + pkgs.qt6.qtbase + ]; propagatedBuildInputs = runtimeDeps; installPhase = '' @@ -70,14 +90,14 @@ ''; meta = { - description = - "A sleek and minimal desktop shell thoughtfully crafted for Wayland, built with Quickshell."; + description = "A sleek and minimal desktop shell thoughtfully crafted for Wayland, built with Quickshell."; homepage = "https://github.com/noctalia-dev/noctalia-shell"; license = pkgs.lib.licenses.mit; mainProgram = "noctalia-shell"; }; }; - }); + } + ); defaultPackage = eachSystem (system: self.packages.${system}.default); From f8313a04fd09e6bf417eeb0f3e24e6e3154079f9 Mon Sep 17 00:00:00 2001 From: Matan Bendix Shenhav Date: Sat, 20 Sep 2025 15:11:12 +0200 Subject: [PATCH 3/4] feat(flake): enable home-manager settings config --- flake.nix | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/flake.nix b/flake.nix index 1e36f154..bcd72ac3 100644 --- a/flake.nix +++ b/flake.nix @@ -101,6 +101,73 @@ defaultPackage = eachSystem (system: self.packages.${system}.default); + homeModules.default = + { + config, + lib, + pkgs, + ... + }: + let + cfg = config.programs.noctalia-shell; + in + { + options.programs.noctalia-shell = { + enable = lib.mkEnableOption "Noctalia shell configuration"; + + settings = lib.mkOption { + type = + with lib.types; + nullOr (oneOf [ + attrs + str + path + ]); + default = null; + example = lib.literalExpression '' + { + bar = { + position = "bottom"; + floating = true; + backgroundOpacity = 0.95; + }; + general = { + animationSpeed = 1.5; + radiusRatio = 1.2; + }; + colorSchemes = { + darkMode = true; + useWallpaperColors = true; + }; + } + ''; + description = '' + Noctalia shell configuration settings as an attribute set, string + or filepath, to be written to ~/.config/noctalia/settings.json. + ''; + }; + }; + + config = lib.mkIf cfg.enable { + xdg.configFile.noctalia = lib.mkIf (cfg.settings != null) ( + { + target = "noctalia/settings.json"; + onChange = '' + ${pkgs.systemd}/bin/systemctl --user try-restart noctalia-shell.service 2>/dev/null || true + ''; + } + // ( + if builtins.isAttrs cfg.settings then + { text = builtins.toJSON cfg.settings; } + else if builtins.isString cfg.settings then + { text = cfg.settings; } + else + { source = cfg.settings; } + ) + ); + }; + }; + nixosModules.default = { config, From 8f596f14b0f334a224c4228f6fd93ad8be42f71b Mon Sep 17 00:00:00 2001 From: Matan Bendix Shenhav Date: Sat, 20 Sep 2025 17:32:28 +0200 Subject: [PATCH 4/4] feat(flake): enable home-manager colors options --- flake.nix | 87 +++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 69 insertions(+), 18 deletions(-) diff --git a/flake.nix b/flake.nix index bcd72ac3..490e35cc 100644 --- a/flake.nix +++ b/flake.nix @@ -146,26 +146,77 @@ or filepath, to be written to ~/.config/noctalia/settings.json. ''; }; + + colors = lib.mkOption { + type = + with lib.types; + nullOr (oneOf [ + attrs + str + path + ]); + default = null; + example = lib.literalExpression '' + { + mError = "#dddddd"; + mOnError = "#111111"; + mOnPrimary = "#111111"; + mOnSecondary = "#111111"; + mOnSurface = "#828282"; + mOnSurfaceVariant = "#5d5d5d"; + mOnTertiary = "#111111"; + mOutline = "#3c3c3c"; + mPrimary = "#aaaaaa"; + mSecondary = "#a7a7a7"; + mShadow = "#000000"; + mSurface = "#111111"; + mSurfaceVariant = "#191919"; + mTertiary = "#cccccc"; + } + ''; + description = '' + Noctalia shell color configuration as an attribute set, string + or filepath, to be written to ~/.config/noctalia/colors.json. + ''; + }; }; - config = lib.mkIf cfg.enable { - xdg.configFile.noctalia = lib.mkIf (cfg.settings != null) ( - { - target = "noctalia/settings.json"; - onChange = '' - ${pkgs.systemd}/bin/systemctl --user try-restart noctalia-shell.service 2>/dev/null || true - ''; - } - // ( - if builtins.isAttrs cfg.settings then - { text = builtins.toJSON cfg.settings; } - else if builtins.isString cfg.settings then - { text = cfg.settings; } - else - { source = cfg.settings; } - ) - ); - }; + config = + let + restart = '' + ${pkgs.systemd}/bin/systemctl --user try-restart noctalia-shell.service 2>/dev/null || true + ''; + in + lib.mkIf cfg.enable { + xdg.configFile = { + "noctalia/settings.json" = lib.mkIf (cfg.settings != null) ( + { + onChange = restart; + } + // ( + if builtins.isAttrs cfg.settings then + { text = builtins.toJSON cfg.settings; } + else if builtins.isString cfg.settings then + { text = cfg.settings; } + else + { source = cfg.settings; } + ) + ); + "noctalia/colors.json" = lib.mkIf (cfg.colors != null) ( + { + onChange = restart; + } + // ( + if builtins.isAttrs cfg.colors then + { text = builtins.toJSON cfg.colors; } + else if builtins.isString cfg.colors then + { text = cfg.colors; } + else + { source = cfg.colors; } + ) + ); + }; + }; }; nixosModules.default =