Skip to content

Instantly share code, notes, and snippets.

@infinisil
Created October 4, 2018 07:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save infinisil/bb59b5258ccf17801179c249a9bb3342 to your computer and use it in GitHub Desktop.
Save infinisil/bb59b5258ccf17801179c249a9bb3342 to your computer and use it in GitHub Desktop.
# Evaluate with nix-instantiate --eval --argstr date 'next friday' --option allow-unsafe-native-code-during-evaluation true --read-write-mode
{ date }:
with import <nixpkgs> {};
let
dateToEpochScript = writeScript "dateToEpoch" ''
#!${stdenv.shell}
date --date "$1" +%s
'';
in
builtins.exec [ dateToEpochScript date ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment