From 08a8033342dd241cd26e0456db9b495773d46b5e Mon Sep 17 00:00:00 2001 From: anemofilia Date: Fri, 4 Aug 2023 08:31:31 -0300 Subject: [PATCH] Add initial files --- home/services.scm | 12 +++++++ packages/.thinkfan.scm.kak.NYFziN | 5 +++ packages/fonts.scm | 38 +++++++++++++++++++++ packages/linux.scm | 26 +++++++++++++++ packages/wm.scm | 10 ++++++ services/linux.scm | 55 +++++++++++++++++++++++++++++++ system/setuid.scm | 15 +++++++++ utils.scm | 22 +++++++++++++ 8 files changed, 183 insertions(+) create mode 100644 home/services.scm create mode 100644 packages/.thinkfan.scm.kak.NYFziN create mode 100644 packages/fonts.scm create mode 100644 packages/linux.scm create mode 100644 packages/wm.scm create mode 100644 services/linux.scm create mode 100644 system/setuid.scm create mode 100644 utils.scm diff --git a/home/services.scm b/home/services.scm new file mode 100644 index 0000000..29e2d43 --- /dev/null +++ b/home/services.scm @@ -0,0 +1,12 @@ +(use-modules (anemofilia home services) + #:export (use-home-service-modules)) + +(define service-module-hint + (@@ (gnu) service-module-hint)) + +(define-syntax-rule (try-use-modules hint modules ...) + ((@@ (gnu) try-use-modules) hint modules ...)) + +(define-syntax-rule (use-home-service-modules module ...) + (try-use-modules service-module-hint + (gnu home services module) ...)) diff --git a/packages/.thinkfan.scm.kak.NYFziN b/packages/.thinkfan.scm.kak.NYFziN new file mode 100644 index 0000000..d2897f7 --- /dev/null +++ b/packages/.thinkfan.scm.kak.NYFziN @@ -0,0 +1,5 @@ +(define-module (anemofilia packages thinkfan) + #:use-modules (gnu packages linux) + #:use-modules (gnu packages linux)) + + diff --git a/packages/fonts.scm b/packages/fonts.scm new file mode 100644 index 0000000..ff19e3e --- /dev/null +++ b/packages/fonts.scm @@ -0,0 +1,38 @@ +(define-module (radix packages fonts) + #:use-module (guix packages) + #:use-module (guix download) + #:use-module (guix build-system font) + #:use-module (gnu packages compression) + #:use-module ((guix licenses) #:prefix license:)) + +(define-public font-meslo-lg + (package + (name "font-meslo-lg") + (version "1.2.1") + (source + (origin + (file-name "font-meslo-lg") + (method url-fetch/zipbomb) + (uri (string-append "https://github.com/andreberg/Meslo-Font/raw/master/" + "dist/v" version "Meslo%20LG%20v" version ".zip")) + (sha256 (base32 "1l08mxlzaz3i5bamnfr49s2k4k23vdm64b8nz2ha33ysimkbgg6h")))) + (build-system font-build-system) + (native-inputs (list unzip)) + (home-page "https://github.com/andreberg/Meslo-Font") + (synopsis "Font for dyslexics and high readability") + (description "Meslo LG is a customized version of Apple’s Menlo-Regular font +(which is a customized Bitstream Vera Sans Mono).") + (license license:silofl1.1))) + +(define-public font-meslo-lg-dz + (package + (inherit font-meslo-lg) + (name "font-meslo-lg-dz") + (version (package-version font-meslo-lg)) + (source + (origin + (file-name "font-meslo-lg-dz") + (method url-fetch/zipbomb) + (uri (string-append "https://github.com/andreberg/Meslo-Font/raw/master/" + "dist/v" version "Meslo%20LG%20DZ%20v" version ".zip")) + (sha256 (base32 "0lnbkrvcpgz9chnvix79j6fiz36wj6n46brb7b1746182rl1l875")))))) diff --git a/packages/linux.scm b/packages/linux.scm new file mode 100644 index 0000000..95cc775 --- /dev/null +++ b/packages/linux.scm @@ -0,0 +1,26 @@ +(define-module (radix packages linux) + #:use-module (guix packages) + #:use-module (guix gexp) + #:use-module (gnu packages linux) + #:export (thinkfan-next)) + +(define thinkfan-next + (package + (inherit thinkfan) + (arguments + (list #:modules '((guix build cmake-build-system) + (guix build utils) + (srfi srfi-26)) + #:tests? #f + #:configure-flags + #|Enable reading temperatures from hard disks via S.M.A.R.T.|# + #~(list "-DUSE_ATASMART:BOOL=ON") + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'create-init-scripts + #|Don't even verify for the presence of SystemD or OpenRC|# + (λ _ + (substitute* "CMakeLists.txt" + (("pkg_check_modules\\((SYSTEMD|OPENRC).*" _) "") + #|Fix the destinations|# + (("/etc" directory) (string-append #$output directory)))))))))) diff --git a/packages/wm.scm b/packages/wm.scm new file mode 100644 index 0000000..af9c69a --- /dev/null +++ b/packages/wm.scm @@ -0,0 +1,10 @@ +(define-module (radix packages wm) + #:use-module (gnu packages wm) + #:use-module (guix transformations) + #:export (awesome-next)) + +(define awesome-next + ((options->transformation + `((with-branch . "awesome=master") + (with-git-url . "awesome=https://github.com/awesomeWM/awesome"))) + awesome)) diff --git a/services/linux.scm b/services/linux.scm new file mode 100644 index 0000000..25beb47 --- /dev/null +++ b/services/linux.scm @@ -0,0 +1,55 @@ +(define-module (radix services linux) + #:use-module (gnu) + #:use-module (radix packages linux) + #:use-module (gnu services) + #:use-module (gnu services shepherd) + #:use-module (guix gexp) + #:use-module (guix records) + #:export ( + thinkfan-configuration + make-thinkfan-configuration + thinkfan-configuration? + thinkfan-shepherd-service + thinkfan-service-type)) + +(define-record-type* + thinkfan-configuration make-thinkfan-configuration + thinkfan-configuration? + (requirement thinkfan-configuration-requirement ;list of symbols + (default '(user-processes))) + (pid-file thinkfan-configuration-pid-file ;string + (default "/var/run/thinkfan.pid")) + (config-file thinkfan-configuration-config-file ;#f | file-like + (default #f)) + (respawn? thinkfan-configuration-respawn? ;boolean + (default #t)) + (extra-options thinkfan-configuration-extra-options ;list of strings + (default '()))) + +(define (thinkfan-shepherd-service config) + (match-record config + (requirement pid-file config-file respawn? extra-options) + (list (shepherd-service + (provision '(thinkfan)) + (documentation + "Adjust fan level according to configured temperature limits.") + (requirement requirement) + (start #~(make-forkexec-constructor + (list (string-append #$thinkfan-next "/sbin/thinkfan") + #$@(if config-file + #~((string-append "-c" #$config-file)) + #~()) + #$@extra-options) + #:pid-file #$pid-file)) + (stop #~(make-kill-destructor)) + (one-shot? #t) + (respawn? respawn?))))) + +(define thinkfan-service-type + (service-type (name 'thinkfan) + (extensions + (list (service-extension shepherd-root-service-type + thinkfan-shepherd-service))) + (default-value (thinkfan-configuration)) + (description + "Adjust fan level according to configured temperature limits."))) diff --git a/system/setuid.scm b/system/setuid.scm new file mode 100644 index 0000000..bccf916 --- /dev/null +++ b/system/setuid.scm @@ -0,0 +1,15 @@ +(define-module (radix system setuid) + #:use-module (pipe) + #:use-module (ice-9 match) + #:use-module (radix utils) + #:use-module (gnu system setuid) + #:export (map-setuid-programs)) + +(define-syntax-rule + (map-setuid-programs (package package-programs) clause ...) + (map (match-lambda ((package-program . package) + (setuid-program + (program (->> package-program + (string-append "/bin/") + (file-append package)))))) + (associate-right (package package-programs) clause ...))) diff --git a/utils.scm b/utils.scm new file mode 100644 index 0000000..c13e01e --- /dev/null +++ b/utils.scm @@ -0,0 +1,22 @@ +(define-module (radix utils) + #:use-module (srfi srfi-26) + #:export (associate-left + associate-right + flatmap)) + +(define-syntax-rule + (associate-left (key associations) ...) + `(,@(map (cut cons key <>) associations) ...)) + +(define-syntax-rule + (associate-right (association keys) ...) + `(,@(map (cut cons <> association) keys) ...)) + +(define (flatmap proc . args) + (if (null? (cdr args)) + (map proc (car args)) + (apply append + (map (lambda (x) (apply flatmap + (lambda arglist (apply proc x arglist)) + (cdr args))) + (car args)))))