aboutsummaryrefslogtreecommitdiff
path: root/guix.scm
diff options
context:
space:
mode:
authorDavid Moc <personal@cdatgoose.org>2026-06-03 02:26:11 +0200
committerDavid Moc <personal@cdatgoose.org>2026-06-03 02:26:11 +0200
commitc6d44836fd8ed1442e01825cb0f9f97e7bf11515 (patch)
treed0e8cededdecafdf27476a744ac2d892d5a18620 /guix.scm
parentb68766967c86a6a789d65772f69f7f44939ebdf2 (diff)
Harden editor logging and packaging
Diffstat (limited to 'guix.scm')
-rw-r--r--guix.scm75
1 files changed, 75 insertions, 0 deletions
diff --git a/guix.scm b/guix.scm
new file mode 100644
index 0000000..bd2d244
--- /dev/null
+++ b/guix.scm
@@ -0,0 +1,75 @@
+(use-modules (guix packages)
+ (guix build-system gnu)
+ (guix gexp)
+ ((guix licenses) #:prefix license:)
+ (gnu packages fonts)
+ (gnu packages gl)
+ (gnu packages llvm)
+ (gnu packages pkg-config)
+ (ice-9 regex))
+
+(define (ecex-source-file? file stat)
+ (or (string-match "/src($|/)" file)
+ (string-match "/include($|/)" file)
+ (string-match "/config($|/)" file)
+ (string-match "/docs($|/)" file)
+ (string-match "/tests($|/)" file)
+ (string-match "/Makefile$" file)
+ (string-match "/LICENSE$" file)
+ (string-match "/README\\.md$" file)
+ (string-match "/manifest\\.scm$" file)
+ (string-match "/guix\\.scm$" file)
+ (string-match "/\\.gitignore$" file)))
+
+(define-public ecex
+ (package
+ (name "ecex")
+ (version "0.1.0")
+ (source
+ (local-file "." "ecex-checkout"
+ #:recursive? #t
+ #:select? ecex-source-file?))
+ (build-system gnu-build-system)
+ (arguments
+ (list
+ #:make-flags
+ #~(list "CC=clang"
+ (string-append "PREFIX=" #$output))
+ #:phases
+ #~(modify-phases %standard-phases
+ (delete 'configure)
+ (replace 'build
+ (lambda* (#:key make-flags #:allow-other-keys)
+ (apply invoke "make" "static" make-flags)))
+ (replace 'check
+ (lambda* (#:key tests? make-flags #:allow-other-keys)
+ (when tests?
+ (apply invoke "make" "check" make-flags))))
+ (replace 'install
+ (lambda* (#:key make-flags #:allow-other-keys)
+ (apply invoke "make" "install" make-flags)))
+ (add-after 'install 'wrap-ecex
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (font (assoc-ref inputs "font-dejavu"))
+ (font-path
+ (string-append font "/share/fonts/truetype/DejaVuSansMono.ttf")))
+ (wrap-program (string-append out "/bin/ecex")
+ `("ECEX_INCLUDE" ":" prefix
+ (,(string-append out "/include/ecex")))
+ `("ECEX_FONT" ":" = (,font-path)))))))))
+ (native-inputs
+ `(("clang-toolchain" ,clang-toolchain)
+ ("pkg-config" ,pkg-config)))
+ (inputs
+ `(("font-dejavu" ,font-dejavu)
+ ("glfw" ,glfw)
+ ("mesa" ,mesa)))
+ (home-page "git.cdatgoose.org/ecex.git")
+ (synopsis "Small C editor with CCDJIT-loaded C config and plugins")
+ (description
+ "Ecex is a small editor written in C with GLFW/OpenGL rendering and a
+C-based config/plugin system loaded through CCDJIT.")
+ (license license:bsd-2)))
+
+ecex