diff --git a/homes/aarch64-darwin/evanreichard@mac-va-mbp-work/default.nix b/homes/aarch64-darwin/evanreichard@mac-va-mbp-work/default.nix index f8d3d26..e675f09 100755 --- a/homes/aarch64-darwin/evanreichard@mac-va-mbp-work/default.nix +++ b/homes/aarch64-darwin/evanreichard@mac-va-mbp-work/default.nix @@ -40,6 +40,10 @@ in }; }; + services = { + nunc = enabled; + }; + security = { sops = enabled; }; diff --git a/modules/home/services/nunc/default.nix b/modules/home/services/nunc/default.nix new file mode 100644 index 0000000..2345f56 --- /dev/null +++ b/modules/home/services/nunc/default.nix @@ -0,0 +1,109 @@ +{ config +, lib +, pkgs +, namespace +, ... +}: +let + cfg = config.${namespace}.services.nunc; +in +{ + options.${namespace}.services.nunc = { + enable = lib.mkEnableOption "nunc floating clock overlay"; + + settings = lib.mkOption { + type = lib.types.submodule { + options = { + fontSize = lib.mkOption { + type = lib.types.number; + default = 12; + description = "Font size for the clock display."; + }; + + verticalPadding = lib.mkOption { + type = lib.types.number; + default = 9; + description = "Vertical padding around the clock text."; + }; + + horizontalPadding = lib.mkOption { + type = lib.types.number; + default = 20; + description = "Horizontal padding around the clock text."; + }; + + position = lib.mkOption { + type = lib.types.enum [ + "top_left" + "top_center" + "top_right" + "bottom_left" + "bottom_center" + "bottom_right" + ]; + default = "top_right"; + description = "Position of the clock overlay on screen."; + }; + + offsetX = lib.mkOption { + type = lib.types.number; + default = -12; + description = "Horizontal offset from the base position."; + }; + + offsetY = lib.mkOption { + type = lib.types.number; + default = 4; + description = "Vertical offset from the base position."; + }; + + dateFormat = lib.mkOption { + type = lib.types.str; + default = "EEE MMM d HH:mm:ss"; + description = "Date format string (NSDateFormatter / Unicode TR35 format)."; + }; + }; + }; + default = { }; + description = "Nunc configuration. Written to ~/.config/nunc/config.json."; + }; + }; + + config = lib.mkIf cfg.enable { + assertions = [ + { + assertion = pkgs.stdenv.isDarwin; + message = "reichard.services.nunc is only supported on macOS (Darwin)."; + } + ]; + + home.packages = [ pkgs.reichard.nunc ]; + + home.file.".config/nunc/config.json" = { + text = builtins.toJSON { + inherit (cfg.settings) + fontSize + verticalPadding + horizontalPadding + position + offsetX + offsetY + dateFormat + ; + }; + }; + + launchd.agents.nunc = { + enable = true; + config = { + Label = "io.reichard.nunc"; + Program = "${pkgs.reichard.nunc}/bin/nunc"; + RunAtLoad = true; + KeepAlive = true; + ProcessType = "Interactive"; + StandardOutPath = "${config.home.homeDirectory}/Library/Logs/nunc/nunc.out.log"; + StandardErrorPath = "${config.home.homeDirectory}/Library/Logs/nunc/nunc.err.log"; + }; + }; + }; +} diff --git a/packages/nunc/default.nix b/packages/nunc/default.nix new file mode 100644 index 0000000..b899aaa --- /dev/null +++ b/packages/nunc/default.nix @@ -0,0 +1,48 @@ +{ lib +, swiftPackages +, fetchgit +, +}: + +swiftPackages.stdenv.mkDerivation rec { + pname = "nunc"; + version = "unstable-2026-04-15"; + + src = fetchgit { + url = "https://gitea.va.reichard.io/evan/Nunc.git"; + rev = "95d95840aa0bc7b595293c6c5c9f53d120a90cca"; + hash = "sha256-UXBKcEuNnVO7WzuvmVqXMiJH7uvjLkcWiqBO0BhynsU="; + }; + + nativeBuildInputs = [ + swiftPackages.swift + swiftPackages.swiftpm + ]; + + buildInputs = [ + swiftPackages.Foundation + swiftPackages.XCTest + ]; + + buildPhase = '' + runHook preBuild + swift build -c release + runHook postBuild + ''; + + installPhase = '' + runHook preInstall + mkdir -p $out/bin + cp .build/release/Nunc $out/bin/nunc + runHook postInstall + ''; + + meta = { + description = "Minimal floating clock overlay for macOS"; + homepage = "https://gitea.va.reichard.io/evan/Nunc"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ evanreichard ]; + mainProgram = "nunc"; + platforms = lib.platforms.darwin; + }; +} diff --git a/systems/aarch64-darwin/mac-va-mbp-work/default.nix b/systems/aarch64-darwin/mac-va-mbp-work/default.nix index ca23aec..2916555 100644 --- a/systems/aarch64-darwin/mac-va-mbp-work/default.nix +++ b/systems/aarch64-darwin/mac-va-mbp-work/default.nix @@ -28,12 +28,20 @@ KeyRepeat = 2; NSWindowShouldDragOnGesture = true; AppleICUForce24HourTime = true; + _HIHideMenuBar = true; }; WindowManager = { HideDesktop = true; }; + finder = { + CreateDesktop = false; + }; }; + system.activationScripts.postActivation.text = '' + sudo defaults write /Library/Preferences/com.apple.iokit.AmbientLightSensor "Automatic Display Enabled" -bool false + ''; + security.pam.services.sudo_local.touchIdAuth = true; reichard = { };