This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def raise_msg(msg, path): | |
| if len(path) > 0: | |
| msg = 'At path {}: {}'.format('.'.join(path), msg) | |
| raise AssertionError(msg) | |
| def list_diff(list1, list2, path): | |
| if len(list1) != len(list2): | |
| raise_msg('List lengths differ: {} vs {}' | |
| .format(len(list1), len(list2)), path) | |
| for i, (obj1, obj2) in enumerate(zip(list1, list2)): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class ParseError(Exception): | |
| pass | |
| # Each parser function should take a list of characters and an index | |
| # into that list, and return something that it parsed and a new index. | |
| def parse_optionally(parser): | |
| """ | |
| Parses or returns None | |
| """ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Function which takes a list of packages to install and creates a | |
| # tarball which contains the full list of dependencies of those paths, | |
| # and a script which will install them. | |
| # | |
| # For example, here's how you would create a tarball packaging up | |
| # python3 and nodejs: | |
| # | |
| # | |
| # let | |
| # pkgs = import <nixpkgs> {}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| ### THIS WORKS | |
| # Fetches a package from a github repo. | |
| fetchRepo = {repo, name, version, sha256}: | |
| let | |
| github_token = builtins.getEnv "GITHUB_TOKEN"; | |
| url = "https://api.github.com/repos/adnelson/${repo}/tarball/${name}%2F${version}"; | |
| curlCmd = "curl --fail -fL -H 'Authorization: token ${github_token}'"; | |
| in | |
| pkgs.stdenv.mkDerivation { |
NewerOlder