~jiglesias/fennel-guix-example

8a4ad5fe421354f4ae274c8803e04a295ce2c14b — Joaquin Iglesias Turina 8 months ago
added fennel sources
5 files changed, 60 insertions(+), 0 deletions(-)

A README.org
A guix.scm
A main.fnl
A test-loader.fnl
A test.fnl
A  => README.org +9 -0
@@ 1,9 @@
* Main concepts to understand
- Packages  
- Channels
- Profiles

* Install depencencies
#+begin_src bash
  guix install lume faith -L../fennel-channel --profile=./deps
#+end_src

A  => guix.scm +25 -0
@@ 1,25 @@
(use-modules (guix)
             (guix profiles)
             (guix search-paths)
             (guix build-system gnu)             
             (guix build-system copy)
             (guix build utils)
             (guix git-download)             
             (guix packages)
             (gnu packages lua)
             (gnu packages maths)
             ((guix licenses) #:prefix license:)
             (gnu packages version-control))

(define-public fennel-guix-example
  (package
   (name "fennel-guix-example")
   (version "0.0.0")
   (source (local-file "." #f #:recursive? #t))
   (build-system copy-build-system)
   (inputs (append (list lua fennel faith lume)))
   (synopsis "A minimal example for guix as a fennel package manager")
   (description "A minimal example for guix as a fennel package manager")
   (home-page "yeikoff.xyz")
   (license license:lgpl3+)))
fennel-guix-example

A  => main.fnl +4 -0
@@ 1,4 @@
(local lume (require :deps.lume))

(fn function-with-dep [a-list]
  (lume.map a-list (fn [x] (+ 1 x))))

A  => test-loader.fnl +3 -0
@@ 1,3 @@
(local faith (require :deps.faith))
(local default-modules [:test])
(faith.run default-modules)

A  => test.fnl +19 -0
@@ 1,19 @@
(local faith (require :deps.faith))
(local main-func (require :main))
(fn test-add [_data]
  (faith.= 2 (+ 1 1)))

(fn test-main [_data]
  (let [result (main-func [1 2 3])]
    (faith.= [2 3 4] result)))

(fn test-fail [_data]
  (faith.= 1 2))

{: test-add
 : test-main
 : test-fail}