forked from DGNum/liminix
add smaller-than-gnu "hello world" package
This commit is contained in:
parent
2c4f8b823e
commit
28264febdb
3 changed files with 29 additions and 1 deletions
|
@ -49,7 +49,6 @@ extraPkgs // {
|
|||
|
||||
# openssl is reqired by ntp
|
||||
|
||||
|
||||
rsyncSmall = prev.rsync.overrideAttrs(o: {
|
||||
configureFlags = o.configureFlags ++ [
|
||||
"--disable-openssl"
|
||||
|
|
|
@ -44,4 +44,6 @@
|
|||
swconfig = callPackage ./swconfig {};
|
||||
|
||||
openwrt = callPackage ./openwrt {};
|
||||
|
||||
hi = callPackage ./hi {};
|
||||
}
|
||||
|
|
27
pkgs/hi/default.nix
Normal file
27
pkgs/hi/default.nix
Normal file
|
@ -0,0 +1,27 @@
|
|||
# A "hello world" program that's smaller than the GNU
|
||||
# one. Used for testing the toolchain/linker behaviour.
|
||||
{
|
||||
runCommandCC
|
||||
}:
|
||||
let code = ''
|
||||
#include <stdio.h>
|
||||
int main()
|
||||
{
|
||||
printf("hello world\n");
|
||||
return 0;
|
||||
}
|
||||
'';
|
||||
in runCommandCC "hello" {
|
||||
name = "hi";
|
||||
inherit code;
|
||||
executable = true;
|
||||
# hardeningDisable = ["all"];
|
||||
passAsFile = ["code"];
|
||||
preferLocalBuild = true;
|
||||
allowSubstitutes = false;
|
||||
} ''
|
||||
n=$out/bin/$name
|
||||
mkdir -p "$(dirname "$n")"
|
||||
mv "$codePath" code.c
|
||||
$CC -x c code.c -o "$n"
|
||||
''
|
Loading…
Reference in a new issue