26 lines
541 B
Nix
26 lines
541 B
Nix
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/"
|
|
'';
|
|
} |