Created
October 27, 2024 13:16
-
-
Save domenkozar/fa3908bf4f6acef65d50c6d3ae3c7661 to your computer and use it in GitHub Desktop.
eval-okay-fetchTree.nix
This file contains 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
let | |
assertTimestamps = result: | |
builtins.removeAttrs result ["lastModified" "lastModifiedDate"]; | |
in [ | |
# Git - Basic | |
(assertTimestamps (builtins.fetchTree { | |
type = "git"; | |
url = "https://github.com/octocat/Hello-World.git"; | |
})) | |
# Git - ref | |
(assertTimestamps (builtins.fetchTree { | |
type = "git"; | |
url = "https://github.com/octocat/Hello-World.git"; | |
})) | |
# Git - Full Parameters | |
(builtins.fetchTree { | |
type = "git"; | |
url = "https://github.com/octocat/Hello-World.git"; | |
ref = "octocat-patch-1"; | |
rev = "7fd1a60b01f91b314f59955a4e4d4e80d8edf11d"; | |
shallow = true; | |
submodules = true; | |
allRefs = true; | |
narHash = "sha256-gdkPz7VJ8ZOwJ5oetnuXBXPkkHlOsU7w0PghYjWgpAo="; | |
}) | |
# Git - URLs | |
# TODO (builtins.fetchTree "git://github.com/octocat/Hello-World.git") | |
(assertTimestamps (builtins.fetchTree "git+ssh://[email protected]/octocat/Hello-World.git")) | |
(assertTimestamps (builtins.fetchTree "git+https://github.com/octocat/Hello-World.git")) | |
(assertTimestamps (builtins.fetchTree "git+http://github.com/octocat/Hello-World.git")) | |
(assertTimestamps (builtins.fetchTree "git+file:///home/domen/dev/tvix")) | |
# GitHub | |
(assertTimestamps (builtins.fetchTree { | |
type = "github"; | |
owner = "octocat"; | |
repo = "Hello-World"; | |
ref = "master"; | |
})) | |
((builtins.fetchTree { | |
type = "github"; | |
owner = "octocat"; | |
repo = "Hello-World"; | |
rev = "b1b3f9723831141a31a1a7252a213e216ea76e56"; | |
narHash = "sha256-1TYQpjX9quzUrgYLO3G06DeYmrUjYnV/qrDpwjcwlFk="; | |
})) | |
# GitLab | |
(assertTimestamps (builtins.fetchTree { | |
type = "gitlab"; | |
owner = "k0001"; | |
repo = "moto"; | |
})) | |
# Self-Hosted GitLab | |
(assertTimestamps (builtins.fetchTree { | |
type = "gitlab"; | |
owner = "ghc"; | |
repo = "ci-config"; | |
ref = "master"; | |
host = "gitlab.haskell.org"; | |
})) | |
# SourceHut | |
(assertTimestamps (builtins.fetchTree { | |
type = "sourcehut"; | |
owner = "~kennylevinsen"; | |
repo = "gtkgreet"; | |
host = "git.sr.ht"; | |
})) | |
# TODO: No Mercurial support: https://github.com/search?q=path%3A%2F%5Eflake.lock%24%2F+%28%2F%22hg%22%2F+OR+%2F%22mercurial%22%2F%29&type=code | |
# File/Tarball - Direct URLs | |
(assertTimestamps (builtins.fetchTree "http://ftp.gnu.org/gnu/hello/hello-2.12.tar.gz")) | |
(assertTimestamps (builtins.fetchTree "https://ftp.gnu.org/gnu/hello/hello-2.12.tar.gz")) | |
(assertTimestamps (builtins.fetchTree "file:///home/domen/Downloads/hello-2.12.tar.gz")) | |
# File/Tarball - With attributes | |
(assertTimestamps (builtins.fetchTree { | |
type = "tarball"; | |
url = "https://ftp.gnu.org/gnu/hello/hello-2.12.tar.gz"; | |
narHash = "sha256-4GQeKLIxoWfYiOraJub5RsHNVQBr2H+3bfPP22PegdU="; | |
})) | |
# Path | |
(assertTimestamps (builtins.fetchTree { | |
type = "path"; | |
path = "/home/domen/Downloads/hello-2.12.tar.gz"; | |
})) | |
# Indirect/Flake | |
(assertTimestamps (builtins.fetchTree { | |
type = "indirect"; | |
id = "nixpkgs"; | |
})) | |
(assertTimestamps (builtins.fetchTree { | |
type = "indirect"; | |
id = "nixpkgs"; | |
ref = "nixos-23.05"; | |
})) | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment