summaryrefslogtreecommitdiff
path: root/upstream
diff options
context:
space:
mode:
Diffstat (limited to 'upstream')
-rw-r--r--upstream/packages/nbfc.scm56
-rw-r--r--upstream/services/nbfc.scm65
2 files changed, 121 insertions, 0 deletions
diff --git a/upstream/packages/nbfc.scm b/upstream/packages/nbfc.scm
new file mode 100644
index 0000000..0190d0c
--- /dev/null
+++ b/upstream/packages/nbfc.scm
@@ -0,0 +1,56 @@
+(define-module (upstream packages nbfc)
+ #:use-module (gnu packages admin)
+ #:use-module (gnu packages autotools)
+ #:use-module (gnu packages linux)
+ #:use-module (gnu packages pkg-config)
+ #:use-module (gnu packages python)
+ #:use-module (guix utils)
+ #:use-module (guix build utils)
+ #:use-module (guix build-system gnu)
+ #:use-module (guix gexp)
+ #:use-module (guix git-download)
+ #:use-module ((guix licenses) #:prefix license:)
+ #:use-module (guix packages))
+
+(define-public nbfc-linux
+ (let ((version "0.1.12")
+ (commit "a7d0bb68e934ab88906a9410363b6481a2afca4c")
+ (revision "0"))
+ (package
+ (name "nbfc-linux")
+ (version (git-version version revision commit))
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/nbfc-linux/nbfc-linux")
+ (commit commit)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "04spib9j9218vyhv5mbdd0p5bxsn1gxbh0kcbl5vgqig5r6nzkf7"))))
+ (build-system gnu-build-system)
+ (arguments
+ `(#:make-flags (list (string-append "CC="
+ ,(cc-for-target))
+ (string-append "PREFIX="
+ (assoc-ref %outputs "out"))
+ ;; (string-append "CONFDIR="
+ ;; (assoc-ref %outputs "out")
+ ;; "/etc")
+ ;; (string-append "BINDIR="
+ ;; (assoc-ref %outputs "out")
+ ;; "/bin")
+ )
+ #:tests? #f
+ #:phases (modify-phases %standard-phases
+ (delete 'configure))))
+ (native-inputs (list autoconf pkg-config))
+ (inputs (list kmod))
+ (propagated-inputs (list python dmidecode))
+ (synopsis "NoteBook FanControl ported to Linux")
+ (description
+ "This package provides a C port of NoteBook FanControl (NBFC), a fan
+control service for notebooks. It provides the same utilities with the same
+interfaces as the original NBFC, although the implementation differs.")
+ (home-page "https://github.com/nbfc-linux/nbfc-linux")
+ (license license:gpl3+))))
diff --git a/upstream/services/nbfc.scm b/upstream/services/nbfc.scm
new file mode 100644
index 0000000..4b0b646
--- /dev/null
+++ b/upstream/services/nbfc.scm
@@ -0,0 +1,65 @@
+(define-module (upstream services nbfc)
+ ;; #:use-module (gnu packages linux)
+ #:use-module (gnu services)
+ #:use-module (gnu services shepherd)
+ #:use-module (guix build utils)
+ #:use-module (guix gexp)
+ #:use-module (guix records)
+ #:use-module (upstream packages nbfc)
+ #:export (nbfc-configuration))
+
+(define-record-type* <nbfc-configuration>
+ nbfc-configuration
+ make-nbfc-configuration
+ nbfc-configuration?
+ (package get-nbfc-configuration-package
+ (default nbfc-linux))
+ (model get-nbfc-configuration-model
+ (default "undefined")))
+
+(define (nbfc-etc-extension configuration-record)
+ (let* ((model (get-nbfc-configuration-model configuration-record))
+
+ (nbfc-configuration-file (mixed-text-file "nbfc.json-stored"
+ "{\"SelectedConfigId\": \""
+ model
+ "\"}\n")))
+ (list `("nbfc.json" ,nbfc-configuration-file))))
+
+(define nbfc-profile-extension
+ (lambda (configuration-record)
+ (list (get-nbfc-configuration-package configuration-record))))
+
+(define (nbfc-shepherd-extension configuration-record)
+ (let* ((profile (get-nbfc-configuration-package configuration-record))
+
+ (service-executable (file-append profile
+ "/bin/nbfc_service"))
+
+ (start-command #~ (list #$ service-executable
+ "--config-file"
+ "/etc/nbfc.json"))
+
+ (start-process #~ (make-forkexec-constructor #$ start-command))
+ (symbols (list 'nbfc))
+
+ (default-service (shepherd-service (provision symbols)
+ (start start-process))))
+ (list default-service)))
+
+(define-public nbfc-service-type
+ (let* ((nbfc-etc-extension* (service-extension etc-service-type
+ nbfc-etc-extension))
+ (nbfc-profile-extension* (service-extension profile-service-type
+ nbfc-profile-extension))
+ (nbfc-shepherd-extension* (service-extension shepherd-root-service-type
+ nbfc-shepherd-extension))
+
+ (description "C port of Stefan Hirschmann's NoteBook FanControl")
+ (extensions (list nbfc-etc-extension*
+ nbfc-profile-extension*
+ nbfc-shepherd-extension*)))
+ (service-type (name 'nbfc)
+ (extensions extensions)
+ (description description)
+ (default-value (nbfc-configuration)))))