scripts.scm (1675B)
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 "scripts" 27 #:recursive? #t)) 28 (build-system trivial-build-system) 29 (arguments 30 `(#:modules ((guix build utils)) 31 #:builder 32 (begin 33 (use-modules (guix build utils)) 34 (let* ((bin-dir (string-append %output "/bin")) 35 (dash-bin (string-append (assoc-ref %build-inputs "dash") 36 "/bin")) 37 (copy-script (lambda (file dest) 38 (copy-file file dest) 39 (patch-shebang dest (list dash-bin)) 40 (chmod dest #o555)))) 41 (mkdir-p bin-dir) 42 (copy-recursively (assoc-ref %build-inputs "source") bin-dir 43 #:copy-file copy-script))))) 44 (inputs `(("dash" ,dash-w-sh-symlink))) 45 (home-page #f) 46 (synopsis "My shell scripts") 47 (description #f) 48 (license #f)))