Initial commit
This commit is contained in:
26
hello-world/default.nix
Normal file
26
hello-world/default.nix
Normal 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
8
hello-world/src/hello.c
Normal file
@ -0,0 +1,8 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argn, char **argv)
|
||||
{
|
||||
printf("hello world!\n");
|
||||
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user