Initial commit

This commit is contained in:
2024-03-17 17:33:12 +01:00
commit c56d09816f
24 changed files with 564 additions and 0 deletions

26
hello-world/default.nix Normal file
View File

@ -0,0 +1,26 @@
with import <nixpkgs> {}; stdenv.mkDerivation {
name = "hello";
# Source Code
# See: https://nixos.org/nixpkgs/manual/#ssec-unpack-phase
src = ./src;
# Dependencies
# See: https://nixos.org/nixpkgs/manual/#ssec-stdenv-dependencies
buildInputs = [ coreutils gcc ];
# Build Phases
# See: https://nixos.org/nixpkgs/manual/#sec-stdenv-phases
configurePhase = ''
declare -xp
'';
buildPhase = ''
gcc "$src/hello.c" -o ./hello
'';
installPhase = ''
mkdir -p "$out/bin"
cp ./hello "$out/bin/"
'';
}

8
hello-world/src/hello.c Normal file
View File

@ -0,0 +1,8 @@
#include <stdio.h>
int main(int argn, char **argv)
{
printf("hello world!\n");
return 0;
}