aboutsummaryrefslogtreecommitdiffstats
path: root/pkgs/default.nix
diff options
context:
space:
mode:
authorLassulus <github@lassul.us>2018-10-27 16:17:46 +0200
committerGitHub <noreply@github.com>2018-10-27 16:17:46 +0200
commitf6b2139310546574942a1319cadab973b616d888 (patch)
treea1bba75b9297fd93bcc25a3aa06483993dc60738 /pkgs/default.nix
parentfc8a3802a0777a5f43a9a2fe0f5848ecaeb555a1 (diff)
parentcbd5ff05f3baab463a2b8792baccbc3e8cd9afb6 (diff)
Merge pull request #2 from krebs/write_c_v2
merge documentation
Diffstat (limited to 'pkgs/default.nix')
-rw-r--r--pkgs/default.nix23
1 files changed, 19 insertions, 4 deletions
diff --git a/pkgs/default.nix b/pkgs/default.nix
index bbfa3d3..4cc0df3 100644
--- a/pkgs/default.nix
+++ b/pkgs/default.nix
@@ -60,7 +60,6 @@ pkgs: oldpkgs: {
# Examples:
# writebash = makeScriptWriter { interpreter = "${pkgs.bash}/bin/bash"; }
# makeScriptWriter { interpreter = "${pkgs.dash}/bin/dash"; } "hello" "echo hello world"
- #
makeScriptWriter = { interpreter, check ? null }: name: text:
assert (with types; either absolute-pathname filename).check name;
pkgs.write (baseNameOf name) {
@@ -71,7 +70,7 @@ pkgs: oldpkgs: {
};
};
- # Take a name and specification and build a derivation out of it
+ # write takes a name and specification and build a derivation out of it
# Examples:
# write "name" { "/etc/test" = { text = "hello world"; }; }
#
@@ -89,7 +88,6 @@ pkgs: oldpkgs: {
# '';
# };
# }
- #
write = name: specs0:
let
env = filevars // { passAsFile = attrNames filevars; };
@@ -165,7 +163,6 @@ pkgs: oldpkgs: {
# writeBash "example" ''
# echo hello world
# ''
- #
writeBash = pkgs.makeScriptWriter {
interpreter = "${pkgs.bash}/bin/bash";
};
@@ -174,6 +171,24 @@ pkgs: oldpkgs: {
assert types.filename.check name;
pkgs.writeBash "/bin/${name}";
+ # writeC writes an executable c package called `name'
+ # to `destination' using `library'.
+ #
+ # Example:
+ # c = pkgs.writeC "hello-world-ncurses" { libraries = {ncurses = pkgs.ncurses;}; } ''
+ # #include <ncurses.h>
+ #
+ # int main()
+ # {
+ # initscr();
+ # printw("Hello World !!!");
+ # refresh();
+ # getch();
+ # endwin();
+ #
+ # return 0;
+ # }
+ # '';
writeC = name: {
destination ? "",
libraries ? {}