Skip to content

Instantly share code, notes, and snippets.

@grahamc
Created April 23, 2018 02:18
Show Gist options
  • Save grahamc/1493857a070df6574a79cb23400bedc6 to your computer and use it in GitHub Desktop.
Save grahamc/1493857a070df6574a79cb23400bedc6 to your computer and use it in GitHub Desktop.
{ runCommand, lib, php }:
runCommand "ihavenoideawhatimdoing.dog" {
buildInputs = [ php ];
gifs = (builtins.toJSON
(builtins.map
(name: ./gifs + "/${name}")
(builtins.attrNames
(lib.filterAttrs
(name: value: value == "regular")
(builtins.readDir ./gifs)
)
)
)
);
} ''
cp ${./index.php} ./index.php
chmod a+w ./index.php
printf 'function giflist() {\n\treturn %s;\n}' "$gifs" >> ./index.php
cat index.php
php -l ./index.php
mkdir $out
cp ./index.php $out/index.php
''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment