M .guix/modules/debugging-module.scm => .guix/modules/debugging-module.scm +14 -1
@@ 5,6 5,10 @@
(define-public debugging-module-location
(current-source-directory))
+(define-public debugging-module-source-props-location
+ (source-properties->location
+ (current-source-location)))
+
(define-public debugging-module-filename
(current-filename))
@@ 12,4 16,13 @@
(local-file "../../hello-world"))
(define-public two-folders-back
- (canonicalize-path (string-append debugging-module-location "../../")))
+ (if debugging-module-location
+ (canonicalize-path
+ (string-append debugging-module-location "/../../"))
+ "unknown"))
+
+(define-public two-folders-back-from-filename
+ (if debugging-module-filename
+ (canonicalize-path
+ (string-append (dirname debugging-module-filename) "/../../"))
+ "unknown"))
M debugging.scm => debugging.scm +27 -7
@@ 1,13 1,33 @@
-#!/usr/bin/env guile
-
(use-modules
(debugging-module)
(guix store)
- (guix gexp))
+ (guix gexp)
+ (guix derivations))
-(display debugging-module-location)
+(display "Source location: ")
+(display debugging-module-source-props-location)
+(display "\n")
+(display "Filename: ")
(display debugging-module-filename)
+(display "\n")
+
+(display "\n")
+
+(display "The local file's absolute location: ")
+(display (local-file-absolute-file-name debugging-hello-world))
+(display "\n")
+
+(define drv (with-store store
+ (run-with-store store
+ (gexp->derivation "my-source" #~(symlink #$debugging-hello-world #$output)))))
+
+(display "Hello world drv: ")
+
+(unless (with-store store (build-derivations store (list drv)))
+ (display "Error! Couldn't build!"))
-(with-store store
- (run-with-store store
- (gexp->derivation debugging-hello-world)))
+(display drv)
+(display "\n")
+(display "Path: ")
+(display (derivation->output-path drv))
+(display "\n")