Skip to content

Instantly share code, notes, and snippets.

@thoughtpolice
Created August 3, 2018 14:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thoughtpolice/ac5ecc46a922b4b886e03b9548f194bb to your computer and use it in GitHub Desktop.
Save thoughtpolice/ac5ecc46a922b4b886e03b9548f194bb to your computer and use it in GitHub Desktop.
with import <nixpkgs> {};
let
source = lib.writeFile "something.cc" ''
#include <stdio.h>
int main(void) { printf("%d\n", 42); return 0; }
'';
in
stdenv.mkDerivation {
name = "example";
phases = [ "buildPhase" ];
buildPhase = ''
mkdir -p $out/bin
cc -o $out/bin/example ${source}
'';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment