{"action":"created","issue":{"url":"https://api.github.com/repos/NixOS/nixpkgs/issues/6750","labels_url":"https://api.github.com/repos/NixOS/nixpkgs/issues/6750/labels{/name}","comments_url":"https://api.github.com/repos/NixOS/nixpkgs/issues/6750/comments","events_url":"https://api.github.com/repos/NixOS/nixpkgs/issues/6750/events","html_url":"https://github.com/NixOS/nixpkgs/issues/6750","id":60604366,"number":6750,"title":"fetchFromGitHub sha256 checksum error","user":{"login":"giogadi","id":1713676,"avatar_url":"https://avatars.githubusercontent.com/u/1713676?v=3","gravatar_id":"","url":"https://api.github.com/users/giogadi","html_url":"https://github.com/giogadi","followers_url":"https://api.github.com/users/giogadi/followers","following_url":"https://api.github.com/users/giogadi/following{/other_user}","gists_url":"https://api.github.com/users/giogadi/gists{/gist_id}","starred_url":"https://api.github.com/users/giogadi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/giogadi/subscriptions","organizations_url":"https://api.github.com/users/giogadi/orgs","repos_url":"https://api.github.com/users/giogadi/repos","events_url":"https://api.github.com/users/giogadi/events{/privacy}","received_events_url":"https://api.github.com/users/giogadi/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-03-11T03:19:48Z","updated_at":"2015-03-11T06:18:17Z","closed_at":null,"body":"I'm using Nix on OSX 10.10, with nixpkgs from GitHub. I can't get fetchFromGitHub to accept the sha256 checksum I supply to it for a repository. For example:\r\n\r\n```\r\n# default.nix\r\nwith import <nixpkgs> {};\r\n\r\nstdenv.mkDerivation {\r\n  name = \"github-test\";\r\n  src = fetchFromGitHub {\r\n    owner = \"octocat\";\r\n    repo = \"Spoon-Knife\";\r\n    rev = \"d0dd1f61b33d64e29d8bc1372a94ef6a2fee76a9\";\r\n    sha256 = \"71529cd6998a14f6482a78f078e1e868570f37b946ea4ba04820879479e3aa2c\";\r\n  };\r\n  builder = ./builder.sh;\r\n}\r\n```\r\n\r\nWhen I run `nix-shell`, I get the following error:\r\n\r\n```\r\nunpacking source archive /private/var/folders/nr/77qh9x2j1nbfc_gmy9v5smz40000gn/T/nix-build-Spoon-Knife-d0dd1f61b33d64e29d8bc1372a94ef6a2fee76a9-src.drv-0/d0dd1f61b33d64e29d8bc1372a94ef6a2fee76a9.tar.gz\r\noutput path ‘/nix/store/rqyyzn38i2vnp6hjp17synq3jyph0d7x-Spoon-Knife-d0dd1f61b33d64e29d8bc1372a94ef6a2fee76a9-src’ should have r:sha256 hash ‘1jzxn58pjxrnis7ca37rgsxflsx8578w4iyn3bzkdfn51d5k0l5c’, instead has ‘1imvnn0k59yban4drm8x3lsdhs8rvm1j854zghigd2pfhqk70ipn’\r\nerror: build of ‘/nix/store/wbjsg7cc9777yy8sbbsdsj6kf2gvcljv-Spoon-Knife-d0dd1f61b33d64e29d8bc1372a94ef6a2fee76a9-src.drv’ failed\r\n```\r\n\r\nThese are the commands I used to generate the checksum of the repository:\r\n```\r\n$ curl -OL https://github.com/octocat/Spoon-Knife/archive/d0dd1f61b33d64e29d8bc1372a94ef6a2fee76a9.tar.gz\r\n$ shasum -a 256 d0dd1f61b33d64e29d8bc1372a94ef6a2fee76a9.tar.gz\r\n```\r\n\r\nI also double-checked that the archive downloaded in the commands above indeed result in the correct archived repository. I also noticed that the sha256 checksum for the file changed at least once upon newly downloading the same archive from GitHub. Is there some nondeterministic behavior in downloading archives from GitHub in this way?"},"comment":{"url":"https://api.github.com/repos/NixOS/nixpkgs/issues/comments/78211260","html_url":"https://github.com/NixOS/nixpkgs/issues/6750#issuecomment-78211260","issue_url":"https://api.github.com/repos/NixOS/nixpkgs/issues/6750","id":78211260,"user":{"login":"copumpkin","id":2623,"avatar_url":"https://avatars.githubusercontent.com/u/2623?v=3","gravatar_id":"","url":"https://api.github.com/users/copumpkin","html_url":"https://github.com/copumpkin","followers_url":"https://api.github.com/users/copumpkin/followers","following_url":"https://api.github.com/users/copumpkin/following{/other_user}","gists_url":"https://api.github.com/users/copumpkin/gists{/gist_id}","starred_url":"https://api.github.com/users/copumpkin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/copumpkin/subscriptions","organizations_url":"https://api.github.com/users/copumpkin/orgs","repos_url":"https://api.github.com/users/copumpkin/repos","events_url":"https://api.github.com/users/copumpkin/events{/privacy}","received_events_url":"https://api.github.com/users/copumpkin/received_events","type":"User","site_admin":false},"created_at":"2015-03-11T06:18:17Z","updated_at":"2015-03-11T06:18:17Z","body":"Use `nix-prefetch-git` to figure out the sha256 to use in your expression (or just look at the error message; that's what I do). It uses `fetchzip` to hash the contents of the tarball as opposed to the tarball itself, which as you noted will vary between downloads."}}