aboutsummaryrefslogtreecommitdiff
path: root/guix
diff options
context:
space:
mode:
authorMark H Weaver <mhw@netris.org>2014-12-31 03:47:40 -0500
committerMark H Weaver <mhw@netris.org>2015-01-07 12:34:10 -0500
commit8eb8048432f57254e07d48ab17890cbeca50e96f (patch)
tree71460bde05b5b2aecddb8d858c71fb56d1ee80a8 /guix
parent270b501ee2b1b4ea4003a60b5568fc4dcb09d9db (diff)
downloadgnu-guix-8eb8048432f57254e07d48ab17890cbeca50e96f.tar
gnu-guix-8eb8048432f57254e07d48ab17890cbeca50e96f.tar.gz
Move 'nix-system->gnu-triplet' to (guix utils) and export it.
* gnu/packages/commencement.scm (nix-system->gnu-triplet): Move to... * guix/utils.scm (nix-system->gnu-triplet): ... here. Fix docstring typo.
Diffstat (limited to 'guix')
-rw-r--r--guix/utils.scm14
1 files changed, 14 insertions, 0 deletions
diff --git a/guix/utils.scm b/guix/utils.scm
index d0d2e8a3d4..7ac586b0aa 100644
--- a/guix/utils.scm
+++ b/guix/utils.scm
@@ -61,6 +61,7 @@
location-column
source-properties->location
+ nix-system->gnu-triplet
gnu-triplet->nix-system
%current-system
%current-target-system
@@ -476,6 +477,19 @@ previous value of the keyword argument."
(()
(reverse before)))))))
+(define* (nix-system->gnu-triplet
+ #:optional (system (%current-system)) (vendor "unknown"))
+ "Return a guess of the GNU triplet corresponding to Nix system
+identifier SYSTEM."
+ (let* ((dash (string-index system #\-))
+ (arch (substring system 0 dash))
+ (os (substring system (+ 1 dash))))
+ (string-append arch
+ "-" vendor "-"
+ (if (string=? os "linux")
+ "linux-gnu"
+ os))))
+
(define (gnu-triplet->nix-system triplet)
"Return the Nix system type corresponding to TRIPLET, a GNU triplet as
returned by `config.guess'."