aboutsummaryrefslogtreecommitdiffstats
path: root/pkgs/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/default.nix')
-rw-r--r--pkgs/default.nix55
1 files changed, 32 insertions, 23 deletions
diff --git a/pkgs/default.nix b/pkgs/default.nix
index 21b837c..1c616bb 100644
--- a/pkgs/default.nix
+++ b/pkgs/default.nix
@@ -17,9 +17,9 @@
# nix-build hello_world.nix.
#
-with import ../lib;
-
-pkgs: oldpkgs: {
+pkgs: oldpkgs:
+with import ../lib { nixpkgs = pkgs; };
+{
exec = name: { filename, argv ? null, envp ? null, destination ? "" }:
pkgs.writeC name { inherit destination; } /* c */ ''
#include <unistd.h>
@@ -194,18 +194,18 @@ pkgs: oldpkgs: {
libraries ? {}
}: text: pkgs.runCommand name {
inherit text;
- buildInputs = [ pkgs.pkgconfig ] ++ attrValues libraries;
+ buildInputs = [ pkgs.pkg-config ] ++ attrValues libraries;
passAsFile = [ "text" ];
} /* sh */ ''
PATH=${makeBinPath [
pkgs.binutils-unwrapped
pkgs.coreutils
- pkgs.gcc
- pkgs.pkgconfig
+ pkgs.pkg-config
+ pkgs.stdenv.cc
]}
exe=$out${destination}
mkdir -p "$(dirname "$exe")"
- gcc \
+ cc \
${optionalString (libraries != [])
/* sh */ "$(pkg-config --cflags --libs ${
concatMapStringsSep " " escapeShellArg (attrNames libraries)
@@ -216,7 +216,9 @@ pkgs: oldpkgs: {
-Wall \
-x c \
"$textPath"
- strip --strip-unneeded "$exe"
+ ${optionalString (!pkgs.stdenv.hostPlatform.isDarwin) /* sh */ ''
+ strip --strip-unneeded "$exe"
+ ''}
'';
# Like writeScript but the first line is a shebang to dash
@@ -233,6 +235,20 @@ pkgs: oldpkgs: {
assert types.filename.check name;
pkgs.writeDash "/bin/${name}";
+ writeDeno = name: text: let
+ script = pkgs.writeTextFile { name = "${name}.deno"; inherit text; };
+ in
+ pkgs.writeDash name ''
+ exec ${pkgs.deno}/bin/deno run \
+ --allow-all \
+ --quiet \
+ ${script} "$@"
+ '';
+
+ writeDenoBin = name:
+ assert types.filename.check name;
+ pkgs.writeDeno "/bin/${name}";
+
writeEximConfig = name: text: pkgs.runCommand name {
inherit text;
passAsFile = [ "text" ];
@@ -243,6 +259,13 @@ pkgs: oldpkgs: {
mv "$textPath" $out
'';
+ writeGawk = pkgs.makeScriptWriter {
+ interpreter = "${pkgs.gawk}/bin/awk -f";
+ };
+
+ writeGawkBin = name:
+ pkgs.writeGawk "/bin/${name}";
+
writeHaskell = name: extra-depends: text:
pkgs.stdenv.mkDerivation {
inherit name;
@@ -401,6 +424,7 @@ pkgs: oldpkgs: {
} /* sh */ ''
cp "$textPath" $out
${pkgs.nginx-config-formatter}/bin/nginxfmt $out
+ ${pkgs.gnused}/bin/sed -i '/^$/d' $out
${pkgs.gixy}/bin/gixy $out
'';
@@ -430,21 +454,6 @@ pkgs: oldpkgs: {
writePerlBin = name:
pkgs.writePerl "/bin/${name}";
- writePython2 = name: { deps ? [], flakeIgnore ? [] }:
- let
- py = pkgs.python2.withPackages (ps: deps);
- ignoreAttribute = optionalString (flakeIgnore != []) "--ignore ${concatMapStringsSep "," escapeShellArg flakeIgnore}";
- in
- pkgs.makeScriptWriter {
- interpreter = "${py}/bin/python";
- check = pkgs.writeDash "python2check.sh" ''
- exec ${pkgs.python2Packages.flake8}/bin/flake8 --show-source ${ignoreAttribute} "$1"
- '';
- } name;
-
- writePython2Bin = name:
- pkgs.writePython2 "/bin/${name}";
-
writePython3 = name: { deps ? [], flakeIgnore ? [] }:
let
py = pkgs.python3.withPackages (ps: deps);