summaryrefslogtreecommitdiff
path: root/trivionomicon/templates/system-flake/pkgs/hello-world
diff options
context:
space:
mode:
Diffstat (limited to 'trivionomicon/templates/system-flake/pkgs/hello-world')
-rw-r--r--trivionomicon/templates/system-flake/pkgs/hello-world/Makefile6
-rw-r--r--trivionomicon/templates/system-flake/pkgs/hello-world/default.nix14
-rw-r--r--trivionomicon/templates/system-flake/pkgs/hello-world/hello-world.c7
3 files changed, 27 insertions, 0 deletions
diff --git a/trivionomicon/templates/system-flake/pkgs/hello-world/Makefile b/trivionomicon/templates/system-flake/pkgs/hello-world/Makefile
new file mode 100644
index 0000000..4eef056
--- /dev/null
+++ b/trivionomicon/templates/system-flake/pkgs/hello-world/Makefile
@@ -0,0 +1,6 @@
+CFLAGS += -O3 -s
+
+all: hello-world
+
+%: %.c
+ $(CC) $(CFLAGS) -o $@ $<
diff --git a/trivionomicon/templates/system-flake/pkgs/hello-world/default.nix b/trivionomicon/templates/system-flake/pkgs/hello-world/default.nix
new file mode 100644
index 0000000..19047a1
--- /dev/null
+++ b/trivionomicon/templates/system-flake/pkgs/hello-world/default.nix
@@ -0,0 +1,14 @@
+{stdenv, ...}:
+stdenv.mkDerivation {
+ name = "hello-world";
+ version = "1.0.0";
+
+ src = ./.;
+
+ installPhase = ''
+ mkdir -p $out/bin
+ cp hello-world $out/bin
+ '';
+
+ meta.mainProgram = "hello-world";
+}
diff --git a/trivionomicon/templates/system-flake/pkgs/hello-world/hello-world.c b/trivionomicon/templates/system-flake/pkgs/hello-world/hello-world.c
new file mode 100644
index 0000000..d6cfa6b
--- /dev/null
+++ b/trivionomicon/templates/system-flake/pkgs/hello-world/hello-world.c
@@ -0,0 +1,7 @@
+#include <stdio.h>
+
+int main()
+{
+ printf("Hello, world!\n");
+ return 0;
+}