From 17e2ab5ab95106788ff2aecec6fb90b2ddc0fd67 Mon Sep 17 00:00:00 2001 From: dan Date: Wed, 22 Oct 2025 12:11:34 +0800 Subject: [PATCH] gnu: Add darkman. * gnu/packages/freedesktop.scm (darkman): New variable. Change-Id: I02074a326bbfb173cfa31872c320994f40677809 Reviewed-by: Sergey Trofimov Signed-off-by: Sharlatan Hellseher --- gnu/packages/xdisorg.scm | 76 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/gnu/packages/xdisorg.scm b/gnu/packages/xdisorg.scm index bc3dd249f6c..ad01b322f56 100644 --- a/gnu/packages/xdisorg.scm +++ b/gnu/packages/xdisorg.scm @@ -71,6 +71,7 @@ ;;; Copyright © 2025 Evgeny Pisemsky ;;; Copyright © 2025 Janneke Nieuwenhuizen ;;; Copyright © 2025 iamawacko +;;; Copyright © 2025 dan ;;; ;;; This file is part of GNU Guix. ;;; @@ -4499,3 +4500,78 @@ a simple GUI for XKB (X KeyBoard extension) and just sends commands to and accepts events from XKB. That means that it will work with the existing setup of your X Server without any modifications.") (license license:artistic2.0))) + +(define-public darkman + (package + (name "darkman") + (version "2.1.0") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://gitlab.com/WhyNotHugo/darkman") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "039xqi9pll7vl1m8lri5x626s7n0wqrjzyy979kh3wmpqbk8jz3j")) + (modules '((guix build utils))) + (snippet + '(begin + (substitute* "Makefile" + ;; Avoid building the binary again when installing. + (("install: build") "install: darkman.1") + ;; Don't install the systemd service. + ((".@install.*systemd.*") "") + ;; The binary will be installed by `go install'. + ((".@install.*bin.*") "")))))) + (build-system go-build-system) + (arguments + (list + #:tests? #f ; No tests. + #:install-source? #f + #:import-path "gitlab.com/WhyNotHugo/darkman/cmd/darkman" + #:unpack-path "gitlab.com/WhyNotHugo/darkman" + #:build-flags + #~(list (string-append "-ldflags= -X main.Version=" #$version)) + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'patch-paths + (lambda* (#:key unpack-path #:allow-other-keys) + (let ((source (string-append "src/" unpack-path "/contrib/dbus/"))) + (substitute* + (list (string-append + source "nl.whynothugo.darkman.service") + (string-append + source + "org.freedesktop.impl.portal.desktop.darkman.service")) + (("/usr") #$output))))) + (replace 'install + (lambda* (#:key unpack-path #:allow-other-keys) + (with-directory-excursion (string-append "src/" unpack-path) + (let ((darkman (string-append #$output "/bin/darkman"))) + (with-output-to-file "_darkman.zsh" + (lambda () + (invoke darkman "completion" "zsh"))) + (with-output-to-file "darkman.bash" + (lambda () + (invoke darkman "completion" "bash"))) + (with-output-to-file "darkman.fish" + (lambda () + (invoke darkman "completion" "fish")))) + (invoke "make" "install" (string-append "PREFIX=" #$output)))))))) + (native-inputs + (list gnu-make + go-github-com-adrg-xdg + go-github-com-godbus-dbus-v5 + go-github-com-rxwycdh-rxhash + go-github-com-sj14-astral + go-github-com-spf13-cobra + go-gopkg-in-yaml-v3 + scdoc)) + (home-page "https://gitlab.com/WhyNotHugo/darkman") + (synopsis "Control dark-mode and light-mode transitions") + (description + "Darkman is a framework for dark-mode and light-mode transitions on Unix-like +desktops.") + (license license:bsd-0)))