{"action":"created","issue":{"url":"https://api.github.com/repos/NixOS/nix/issues/598","repository_url":"https://api.github.com/repos/NixOS/nix","labels_url":"https://api.github.com/repos/NixOS/nix/issues/598/labels{/name}","comments_url":"https://api.github.com/repos/NixOS/nix/issues/598/comments","events_url":"https://api.github.com/repos/NixOS/nix/issues/598/events","html_url":"https://github.com/NixOS/nix/issues/598","id":99927539,"number":598,"title":"`--arg/--argstr` gets ignored when variables don't occur explicitly in the argument to the top-level function","user":{"login":"dfoxfranke","id":4708206,"avatar_url":"https://avatars.githubusercontent.com/u/4708206?v=3","gravatar_id":"","url":"https://api.github.com/users/dfoxfranke","html_url":"https://github.com/dfoxfranke","followers_url":"https://api.github.com/users/dfoxfranke/followers","following_url":"https://api.github.com/users/dfoxfranke/following{/other_user}","gists_url":"https://api.github.com/users/dfoxfranke/gists{/gist_id}","starred_url":"https://api.github.com/users/dfoxfranke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dfoxfranke/subscriptions","organizations_url":"https://api.github.com/users/dfoxfranke/orgs","repos_url":"https://api.github.com/users/dfoxfranke/repos","events_url":"https://api.github.com/users/dfoxfranke/events{/privacy}","received_events_url":"https://api.github.com/users/dfoxfranke/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2015-08-09T20:47:15Z","updated_at":"2016-11-08T15:49:25Z","closed_at":null,"body":"```\n[dfranke@pathfinder:~]$ nix-repl\nWelcome to Nix version 1.9. Type :? for help.\n\nnix-repl> #This behaves as expected\n\nnix-repl> let f = { x ? \"foo\" }: x; g = y@{...}: f y; in g { x = \"bar\"; }\n\"bar\"\n\nnix-repl> :quit\n\n[dfranke@pathfinder:~]$ cat test1.nix\nlet f = { x ? \"foo\", ... }: x; in y@{...}: f y\n\n[dfranke@pathfinder:~]$ #This too should evaluate to \"bar\", not \"foo\"\n\n[dfranke@pathfinder:~]$ nix-instantiate --eval --argstr x bar test1.nix\n\"foo\"\n\n[dfranke@pathfinder:~]$ #Now x is explicitly mentioned in the pattern\n\n[dfranke@pathfinder:~]$ cat test2.nix\nlet f = { x ? \"foo\", ... }: x; in y@{x,...}: f y\n\n[dfranke@pathfinder:~]$ #...and that's sufficient to produce a different result\"\n\n[dfranke@pathfinder:~]$ nix-instantiate --eval --argstr x bar test2.nix\n\"bar\"\n\n[dfranke@pathfinder:~]$ #Something's definitely wrong here!\n```\n"},"comment":{"url":"https://api.github.com/repos/NixOS/nix/issues/comments/259173418","html_url":"https://github.com/NixOS/nix/issues/598#issuecomment-259173418","issue_url":"https://api.github.com/repos/NixOS/nix/issues/598","id":259173418,"user":{"login":"periklis","id":152312,"avatar_url":"https://avatars.githubusercontent.com/u/152312?v=3","gravatar_id":"","url":"https://api.github.com/users/periklis","html_url":"https://github.com/periklis","followers_url":"https://api.github.com/users/periklis/followers","following_url":"https://api.github.com/users/periklis/following{/other_user}","gists_url":"https://api.github.com/users/periklis/gists{/gist_id}","starred_url":"https://api.github.com/users/periklis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/periklis/subscriptions","organizations_url":"https://api.github.com/users/periklis/orgs","repos_url":"https://api.github.com/users/periklis/repos","events_url":"https://api.github.com/users/periklis/events{/privacy}","received_events_url":"https://api.github.com/users/periklis/received_events","type":"User","site_admin":false},"created_at":"2016-11-08T15:49:25Z","updated_at":"2016-11-08T15:49:25Z","body":"Noticed this too. I tried to refactor the rtags package using a parameter for its underlying llvmPackages dependencies. Since, we have 6 different llvmPackages, it would be important to have `--arg/--argstr `propagated down to the package arguments. Otherwise any package maintainer has to bloat up the `top-level/all-packages.nix` by multiples of its package dependencies. e.g.:\r\n\r\n`nix-env -iA rtags --argstr withllvmVersion \"3.9\"`\r\n\r\nis a better solution than:\r\n```\r\nrtags = callPackage ../development/tools/rtags/default.nix {\r\n    inherit (darwin) apple_sdk;\r\n    llvmVersion = llvmPackages;\r\n  };\r\n\r\nrtags_with_llvm_38 = callPackage ../development/tools/rtags/default.nix {\r\n    inherit (darwin) apple_sdk;\r\n    llvmVersion = llvmPackages_38;\r\n  };\r\n\r\nrtags_with_llvm_39 = callPackage ../development/tools/rtags/default.nix {\r\n    inherit (darwin) apple_sdk;\r\n    llvmVersion = llvmPackages_39;\r\n  };\r\n```"}}
{"actor":{"display_login":"periklis"}}