feat(nunc): add nunc floating clock overlay package and service
- Add packages/nunc derivation built from Gitea with swiftPackages - Add home module reichard.services.nunc with configurable settings and launchd agent for macOS - Enable nunc service on mac-va-mbp-work - Tweak mac-va-mbp-work defaults: hide menu bar, disable auto brightness, hide Finder desktop icons
This commit is contained in:
@@ -40,6 +40,10 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
services = {
|
||||
nunc = enabled;
|
||||
};
|
||||
|
||||
security = {
|
||||
sops = enabled;
|
||||
};
|
||||
|
||||
109
modules/home/services/nunc/default.nix
Normal file
109
modules/home/services/nunc/default.nix
Normal file
@@ -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";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
48
packages/nunc/default.nix
Normal file
48
packages/nunc/default.nix
Normal file
@@ -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;
|
||||
};
|
||||
}
|
||||
@@ -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 = { };
|
||||
|
||||
Reference in New Issue
Block a user