loquatdev

MonasTech system configurations dogfooded by yours truly
Log | Files | Refs | README

scripts.scm (1760B)


      1 (define-module (home lukejw scripts)
      2   #:use-module (gnu packages shells)
      3   #:use-module (guix build-system trivial)
      4   #:use-module (guix gexp)
      5   #:use-module (guix packages)
      6   #:export (scripts))
      7 
      8 (define dash-w-sh-symlink
      9   (package
     10     (inherit dash)
     11     (arguments
     12      `(#:phases
     13        (modify-phases %standard-phases
     14          (add-after 'install 'install-sh-symlink
     15            (lambda* (#:key outputs #:allow-other-keys)
     16              ;; Add a `sh' -> `dash' link.
     17              (let ((out (assoc-ref outputs "out")))
     18                (with-directory-excursion (string-append out "/bin")
     19                  (symlink "dash" "sh")
     20                  #t)))))))))
     21 
     22 (define scripts    
     23   (package
     24     (name "scripts")
     25     (version "0.1")
     26     (source (local-file (string-append (dirname (current-filename))
     27                                        "/scripts")
     28                         #:recursive? #t))
     29     (build-system trivial-build-system)
     30     (arguments
     31      `(#:modules ((guix build utils))
     32        #:builder
     33        (begin
     34          (use-modules (guix build utils))
     35          (let* ((bin-dir  (string-append %output "/bin"))
     36                 (dash-bin (string-append (assoc-ref %build-inputs "dash")
     37                                          "/bin"))
     38                 (copy-script (lambda (file dest)
     39                                (copy-file file dest)
     40                                (patch-shebang dest (list dash-bin))
     41                                (chmod dest #o555))))
     42            (mkdir-p bin-dir)
     43            (copy-recursively (assoc-ref %build-inputs "source") bin-dir
     44                              #:copy-file copy-script)))))
     45     (inputs `(("dash" ,dash-w-sh-symlink)))
     46     (home-page #f)
     47     (synopsis "My shell scripts")
     48     (description #f)
     49     (license #f)))