|
1 | | -#!/usr/bin/env -S guix repl |
| 1 | +#!/usr/bin/env sh |
| 2 | +dir=${0%/*}; dir=${dir:-.} |
| 3 | +exec guix time-machine --channels=$dir/channels.scm -- repl "$0" |
2 | 4 | !# |
3 | 5 | ;;; GNU Guix development package. |
4 | 6 | ;;; |
|
65 | 67 | #:use-module ((gnu packages maths) #:select (sleef))) |
66 | 68 |
|
67 | 69 |
|
68 | | -(define %source-dir (dirname (current-filename))) |
| 70 | +(define %source-dir |
| 71 | + (let ((pipe (open-pipe* OPEN_READ "git" "rev-parse" "--show-toplevel"))) |
| 72 | + (read-line pipe))) |
69 | 73 |
|
70 | 74 | (define (git-version) |
71 | 75 | "Return a version string suitable for development builds." |
72 | | - (let* ((pipe (with-directory-excursion %source-dir |
73 | | - (open-pipe* OPEN_READ "git" "describe" "--always" |
| 76 | + (with-directory-excursion %source-dir |
| 77 | + (let* ((pipe (open-pipe* OPEN_READ "git" "describe" "--always" |
74 | 78 | "--tags" |
75 | | - "--abbrev=0"))) |
76 | | - (version (string-append (read-line pipe) "+git"))) |
77 | | - (close-pipe pipe) |
78 | | - version)) |
| 79 | + "--abbrev=0")) |
| 80 | + (version (string-append (read-line pipe) "+git"))) |
| 81 | + (close-pipe pipe) |
| 82 | + version))) |
79 | 83 |
|
80 | 84 | (define (git-user) |
81 | 85 | "Return a user info string scraped from Git." |
82 | | - (let* ((name-pipe (with-directory-excursion %source-dir |
83 | | - (open-pipe* OPEN_READ "git" "config" "user.name"))) |
84 | | - (email-pipe (with-directory-excursion %source-dir |
85 | | - (open-pipe* OPEN_READ "git" "config" "user.email"))) |
86 | | - (name (read-line name-pipe)) |
87 | | - (email (read-line email-pipe)) |
88 | | - (status (every identity (map close-pipe `(,name-pipe ,email-pipe))))) |
89 | | - (format #f "~a <~a>" name email))) |
| 86 | + (with-directory-excursion %source-dir |
| 87 | + (let* ((name-pipe (open-pipe* OPEN_READ "git" "config" "user.name")) |
| 88 | + (email-pipe (open-pipe* OPEN_READ "git" "config" "user.email")) |
| 89 | + (name (read-line name-pipe)) |
| 90 | + (email (read-line email-pipe)) |
| 91 | + (status (every identity (map close-pipe `(,name-pipe ,email-pipe))))) |
| 92 | + (format #f "~a <~a>" name email)))) |
90 | 93 |
|
91 | 94 | ;; Predicate intended for SELECT? argument of local-file procedure. Returns |
92 | 95 | ;; true if and only if file is tracked by git. |
93 | 96 | (define git-file? |
94 | | - (let* ((pipe (with-directory-excursion %source-dir |
95 | | - (open-pipe* OPEN_READ "git" "ls-files"))) |
96 | | - (files (let loop ((lines '())) |
97 | | - (match (read-line pipe) |
98 | | - ((? eof-object?) (reverse lines)) |
99 | | - ((? (lambda (file) ; skip this file |
100 | | - (string-match (current-filename) |
101 | | - (canonicalize-path file)))) |
102 | | - (loop lines)) |
103 | | - (line (loop (cons line lines)))))) |
104 | | - (status (close-pipe pipe))) |
105 | | - (lambda (file stat) |
106 | | - (match (stat:type stat) |
107 | | - ('directory #t) |
108 | | - ((or 'regular 'symlink) (any (cut string-suffix? <> file) files)) |
109 | | - (_ #f))))) |
| 97 | + (with-directory-excursion %source-dir |
| 98 | + (let* ((pipe (open-pipe* OPEN_READ "git" "ls-files")) |
| 99 | + (files (let loop ((lines '())) |
| 100 | + (match (read-line pipe) |
| 101 | + ((? eof-object?) (reverse lines)) |
| 102 | + ((? (lambda (file) ; skip this file |
| 103 | + (string-match (current-filename) |
| 104 | + (canonicalize-path file)))) |
| 105 | + (loop lines)) |
| 106 | + (line (loop (cons line lines)))))) |
| 107 | + (status (close-pipe pipe))) |
| 108 | + (lambda (file stat) |
| 109 | + (match (stat:type stat) |
| 110 | + ('directory #t) |
| 111 | + ((or 'regular 'symlink) (any (cut string-suffix? <> file) files)) |
| 112 | + (_ #f)))))) |
110 | 113 |
|
111 | 114 |
|
112 | 115 | ;; G-exp script that detects AVX/AVX2 support at runtime and executes jconsole |
|
0 commit comments