aboutsummaryrefslogtreecommitdiff
path: root/hello-world
diff options
context:
space:
mode:
authorArun Isaac2025-04-07 15:57:53 +0100
committerArun Isaac2025-04-07 15:57:53 +0100
commita760bff3efa44c282ed119032a6831bdaac79e7b (patch)
tree44a74e8d59b44065ab5b3a3270ba57827ec5fc1a /hello-world
downloadgexp-make-a760bff3efa44c282ed119032a6831bdaac79e7b.tar.gz
gexp-make-a760bff3efa44c282ed119032a6831bdaac79e7b.tar.lz
gexp-make-a760bff3efa44c282ed119032a6831bdaac79e7b.zip
Initial commit
Diffstat (limited to 'hello-world')
-rw-r--r--hello-world/README.md8
-rw-r--r--hello-world/hello.c7
-rw-r--r--hello-world/make.scm21
3 files changed, 36 insertions, 0 deletions
diff --git a/hello-world/README.md b/hello-world/README.md
new file mode 100644
index 0000000..e279105
--- /dev/null
+++ b/hello-world/README.md
@@ -0,0 +1,8 @@
+Build hello.
+```
+guix build -f make.scm
+```
+Run it.
+```
+$(guix build -f make.scm)
+```
diff --git a/hello-world/hello.c b/hello-world/hello.c
new file mode 100644
index 0000000..05ce120
--- /dev/null
+++ b/hello-world/hello.c
@@ -0,0 +1,7 @@
+#include <stdio.h>
+
+int main ()
+{
+ printf("Hello world!\n");
+ return 0;
+}
diff --git a/hello-world/make.scm b/hello-world/make.scm
new file mode 100644
index 0000000..7d3c6e8
--- /dev/null
+++ b/hello-world/make.scm
@@ -0,0 +1,21 @@
+(use-modules (gnu packages commencement)
+ (guix gexp))
+
+(define hello-gexp
+ (with-imported-modules '((guix build utils))
+ #~(begin
+ (use-modules (guix build utils))
+
+ (set-path-environment-variable "PATH"
+ '("bin")
+ (list #$gcc-toolchain))
+ (set-path-environment-variable "C_INCLUDE_PATH"
+ '("include")
+ (list #$gcc-toolchain))
+ (set-path-environment-variable "LIBRARY_PATH"
+ '("lib")
+ (list #$gcc-toolchain))
+ (invoke "gcc" #$(local-file "hello.c")
+ "-o" #$output))))
+
+(computed-file "hello" hello-gexp)