{"action":"created","issue":{"url":"https://api.github.com/repos/NixOS/nixpkgs/issues/43510","repository_url":"https://api.github.com/repos/NixOS/nixpkgs","labels_url":"https://api.github.com/repos/NixOS/nixpkgs/issues/43510/labels{/name}","comments_url":"https://api.github.com/repos/NixOS/nixpkgs/issues/43510/comments","events_url":"https://api.github.com/repos/NixOS/nixpkgs/issues/43510/events","html_url":"https://github.com/NixOS/nixpkgs/issues/43510","id":341211116,"node_id":"MDU6SXNzdWUzNDEyMTExMTY=","number":43510,"title":"Feature request: respect meta.version in fetchurl output hash","user":{"login":"danbst","id":743057,"node_id":"MDQ6VXNlcjc0MzA1Nw==","avatar_url":"https://avatars2.githubusercontent.com/u/743057?v=4","gravatar_id":"","url":"https://api.github.com/users/danbst","html_url":"https://github.com/danbst","followers_url":"https://api.github.com/users/danbst/followers","following_url":"https://api.github.com/users/danbst/following{/other_user}","gists_url":"https://api.github.com/users/danbst/gists{/gist_id}","starred_url":"https://api.github.com/users/danbst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danbst/subscriptions","organizations_url":"https://api.github.com/users/danbst/orgs","repos_url":"https://api.github.com/users/danbst/repos","events_url":"https://api.github.com/users/danbst/events{/privacy}","received_events_url":"https://api.github.com/users/danbst/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-07-14T05:38:44Z","updated_at":"2018-07-14T06:51:41Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"## Issue description\r\nSometimes Nix users do a mistake - when upgrading package they update only version/url and forget to change hash (`sha256`). The effect is that package is not updated.\r\n\r\nWhile changed `url` shouldn't trigger any warnings by design, situation with version isn't that clear.\r\n\r\n## Solution\r\nAdd `version` more love.\r\n\r\n1. Make it common to specify source version via `meta.version`. Example of derivation with new style:\r\n```\r\n{ stdenv, fetchurl\r\n}:\r\n\r\nlet\r\n    src = fetchurl rec {\r\n        meta.version = \"1.2.0\";\r\n        url = \"https://github.com/graknlabs/grakn/releases/download/v${meta.version}/grakn-dist-${meta.version}.tar.gz\";\r\n        sha256 = \"0hjsfj0m80nhd6mdj2m3razamqhqavpvjx80v1nsgfrypp4lr88f\";\r\n    };\r\nin\r\nstdenv.mkDerivation {\r\n    name = \"grakn-${src.meta.version}\";\r\n    inherit src;\r\n    inherit (src.meta) version;\r\n    meta.version = src.meta.version;\r\n}\r\n```\r\nI think most of fetchurl-s in Nixpkgs may get version attribute.\r\n2. When `meta.version` is specified, change `outputHashMode` to \"recursive\" and use `meta.version` in hash computation.\r\n3. Now, package *source* will be responsible for specifying package version. And changing *source* version will require changes to *source* hash. \r\n4. Out of added benefit, it will now be unneeded to change 1 symbol of hash to trigger redownload/rehash :smiley: \r\n5. Think of something similar for `fetchFromGithub` and co.\r\n"},"comment":{"url":"https://api.github.com/repos/NixOS/nixpkgs/issues/comments/405003895","html_url":"https://github.com/NixOS/nixpkgs/issues/43510#issuecomment-405003895","issue_url":"https://api.github.com/repos/NixOS/nixpkgs/issues/43510","id":405003895,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNTAwMzg5NQ==","user":{"login":"danbst","id":743057,"node_id":"MDQ6VXNlcjc0MzA1Nw==","avatar_url":"https://avatars2.githubusercontent.com/u/743057?v=4","gravatar_id":"","url":"https://api.github.com/users/danbst","html_url":"https://github.com/danbst","followers_url":"https://api.github.com/users/danbst/followers","following_url":"https://api.github.com/users/danbst/following{/other_user}","gists_url":"https://api.github.com/users/danbst/gists{/gist_id}","starred_url":"https://api.github.com/users/danbst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danbst/subscriptions","organizations_url":"https://api.github.com/users/danbst/orgs","repos_url":"https://api.github.com/users/danbst/repos","events_url":"https://api.github.com/users/danbst/events{/privacy}","received_events_url":"https://api.github.com/users/danbst/received_events","type":"User","site_admin":false},"created_at":"2018-07-14T06:51:40Z","updated_at":"2018-07-14T06:51:40Z","author_association":"CONTRIBUTOR","body":"@volth that `strcrypt` should be reversible\r\n\r\n1. update version\r\n2. build\r\n3. observe hash mismatch\r\n4. Convert hash from error message using `(strcrypt name)^(-1)` into input hash.\r\n\r\nOr maybe I don't see something?"}}
{"actor":{"display_login":"danbst"}}