nix-samples/hello-world/default.nix
2024-03-17 17:33:12 +01:00

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/"
'';
}