From 15b39ab78ddb39bc14cb0bdf39c6c6d1550cc71f Mon Sep 17 00:00:00 2001 From: Rutherther Date: Mon, 13 Oct 2025 19:57:23 +0200 Subject: [PATCH] Update 2 --- .guix/modules/debugging-module.scm | 15 ++++++++++++- debugging.scm | 34 ++++++++++++++++++++++++------ 2 files changed, 41 insertions(+), 8 deletions(-) mode change 100644 => 100755 debugging.scm diff --git a/.guix/modules/debugging-module.scm b/.guix/modules/debugging-module.scm index 85e5ceb48d53b1b0d048bdc44783ec4395804b98..8963b03c4ec5bf82b27095743ee3ae2552259f64 100644 --- a/.guix/modules/debugging-module.scm +++ b/.guix/modules/debugging-module.scm @@ -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")) diff --git a/debugging.scm b/debugging.scm old mode 100644 new mode 100755 index 863746e162802278835b56a1f9afb3aabc08bfea..56a8e4c60581d549486a5c1df816cf8cbf6d3b35 --- a/debugging.scm +++ b/debugging.scm @@ -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")