diff --git a/overlay.nix b/overlay.nix index 72fffff..ce7b205 100644 --- a/overlay.nix +++ b/overlay.nix @@ -49,7 +49,6 @@ extraPkgs // { # openssl is reqired by ntp - rsyncSmall = prev.rsync.overrideAttrs(o: { configureFlags = o.configureFlags ++ [ "--disable-openssl" diff --git a/pkgs/default.nix b/pkgs/default.nix index 0389663..8a569c6 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -44,4 +44,6 @@ swconfig = callPackage ./swconfig {}; openwrt = callPackage ./openwrt {}; + + hi = callPackage ./hi {}; } diff --git a/pkgs/hi/default.nix b/pkgs/hi/default.nix new file mode 100644 index 0000000..3dd65e4 --- /dev/null +++ b/pkgs/hi/default.nix @@ -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 + 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" +''