{"action":"created","issue":{"url":"https://api.github.com/repos/NixOS/nixpkgs/issues/45404","repository_url":"https://api.github.com/repos/NixOS/nixpkgs","labels_url":"https://api.github.com/repos/NixOS/nixpkgs/issues/45404/labels{/name}","comments_url":"https://api.github.com/repos/NixOS/nixpkgs/issues/45404/comments","events_url":"https://api.github.com/repos/NixOS/nixpkgs/issues/45404/events","html_url":"https://github.com/NixOS/nixpkgs/issues/45404","id":352280201,"node_id":"MDU6SXNzdWUzNTIyODAyMDE=","number":45404,"title":"nix-build --option builders '' doesn't build with impureEnvVars from current shell","user":{"login":"srghma","id":7573215,"node_id":"MDQ6VXNlcjc1NzMyMTU=","avatar_url":"https://avatars2.githubusercontent.com/u/7573215?v=4","gravatar_id":"","url":"https://api.github.com/users/srghma","html_url":"https://github.com/srghma","followers_url":"https://api.github.com/users/srghma/followers","following_url":"https://api.github.com/users/srghma/following{/other_user}","gists_url":"https://api.github.com/users/srghma/gists{/gist_id}","starred_url":"https://api.github.com/users/srghma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/srghma/subscriptions","organizations_url":"https://api.github.com/users/srghma/orgs","repos_url":"https://api.github.com/users/srghma/repos","events_url":"https://api.github.com/users/srghma/events{/privacy}","received_events_url":"https://api.github.com/users/srghma/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-08-20T20:16:12Z","updated_at":"2018-08-25T11:43:39Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"## Issue description\r\nduplicate of:\r\n\r\n- https://github.com/NixOS/nix/issues/1118#issuecomment-414083797\r\n- https://stackoverflow.com/questions/51912288/how-to-pass-impureenvvars-to-local-nix-build-instead-of-nix-daemon-how-to-disa\r\n\r\n### Steps to reproduce\r\n\r\n```\r\ncode=`<<'EOF'\r\nwith import <nixpkgs> {};\r\nstdenv.mkDerivation {\r\n  name=\"impure\";\r\n  phases=[\"buildPhase\"];\r\n  impureEnvVars=[\"IMPURE\"];\r\n  buildPhase=''\r\n    env | grep IMPURE\r\n    if [ -z $IMPURE ]; then\r\n      echo \"Error\"\r\n      exit 1\r\n    fi\r\n    echo \"foo\" > $out\r\n  '';\r\n}\r\nEOF`\r\nexport IMPURE=iop; nix-build --option builders \"\" --option trusted-users $USER -E \"$code\"\r\n\r\n```\r\n\r\nshould use IMPURE env variable inside buildPhase, but actually its empty\r\n\r\n## Technical details\r\n\r\n```\r\n$ nix-shell -p nix-info --run \"nix-info -m\"\r\n - system: `\"x86_64-linux\"`\r\n - host os: `Linux 4.14.59, NixOS, 18.03.133029.d0c868ec17c (Impala)`\r\n - multi-user?: `yes`\r\n - sandbox: `yes`\r\n - version: `nix-env (Nix) 2.0.4`\r\n - channels(srghma): `\"qtpass-1.2.1, terraform-0.11.7, nix-diff-1.0.1, intero-0.1.20.drv, libreoffice-6.0.2.1, icedtea-web-1.6.2, xkbcomp-1.4.0, qtox-1.13.0, utox-0.16.1, bfg-repo-cleaner, jq-1.5, firefox-60.0.2esr, home-manager-path, python3-3.6.5, sqlitebrowser-3.10.1\"`\r\n - channels(root): `\"nixos-18.03, nixpkgs-unstable-18.09pre147772.d1ae60cbad7\"`\r\n - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs`\r\n\r\n$ cat /etc/nix/nix.conf\r\n# WARNING: this file is generated from the nix.* options in\r\n# your NixOS configuration, typically\r\n# /etc/nixos/configuration.nix.  Do not edit it!\r\nbuild-users-group = nixbld\r\nmax-jobs = 8\r\ncores = 0\r\nsandbox = true\r\nextra-sandbox-paths =\r\nsubstituters = https://cache.nixos.org https://cachix.cachix.org https://srghma.cachix.org\r\ntrusted-substituters =\r\ntrusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= cachix.cachix.org-1:eWNHQldwUO7G2VkjpnjDbWwy4KQ/HNxht7H4SSoMckM= srghma.cachix.org-1:EUHKjTh/WKs49hFtw6bwDE9oQLeX5afml0cAKc97MbI=\r\nauto-optimise-store = false\r\nrequire-sigs = true\r\n\r\ntrusted-users = root srghma\r\nallowed-users = *\r\nbuilders =\r\n\r\nauto-optimise-store = true\r\nmax-jobs = auto\r\n\r\nkeep-outputs = true # don't delete store paths that are used at build time, useful for development\r\n\r\n\r\n```\r\n\r\nmy dotfiles https://github.com/srghma/dotfiles/tree/a543b62503d6539399149b20bb47bfc0469dc3b3"},"comment":{"url":"https://api.github.com/repos/NixOS/nixpkgs/issues/comments/415963558","html_url":"https://github.com/NixOS/nixpkgs/issues/45404#issuecomment-415963558","issue_url":"https://api.github.com/repos/NixOS/nixpkgs/issues/45404","id":415963558,"node_id":"MDEyOklzc3VlQ29tbWVudDQxNTk2MzU1OA==","user":{"login":"srghma","id":7573215,"node_id":"MDQ6VXNlcjc1NzMyMTU=","avatar_url":"https://avatars2.githubusercontent.com/u/7573215?v=4","gravatar_id":"","url":"https://api.github.com/users/srghma","html_url":"https://github.com/srghma","followers_url":"https://api.github.com/users/srghma/followers","following_url":"https://api.github.com/users/srghma/following{/other_user}","gists_url":"https://api.github.com/users/srghma/gists{/gist_id}","starred_url":"https://api.github.com/users/srghma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/srghma/subscriptions","organizations_url":"https://api.github.com/users/srghma/orgs","repos_url":"https://api.github.com/users/srghma/repos","events_url":"https://api.github.com/users/srghma/events{/privacy}","received_events_url":"https://api.github.com/users/srghma/received_events","type":"User","site_admin":false},"created_at":"2018-08-25T11:43:39Z","updated_at":"2018-08-25T11:43:39Z","author_association":"CONTRIBUTOR","body":"not working\r\n\r\n```\r\ncode=`<<'EOF'\r\nwith import <nixpkgs> {};\r\nstdenv.mkDerivation {\r\n  name=\"impure\";\r\n  phases=[\"buildPhase\"];\r\n  impureEnvVars=[\"IMPURE\"];\r\n  buildPhase=''\r\n    env | grep IMPURE\r\n    if [ -z $IMPURE ]; then\r\n      echo \"Error\"\r\n      exit 1\r\n    fi\r\n    echo \"foo\" > $out\r\n  '';\r\n}\r\nEOF`\r\nexport IMPURE=iop; nix-build --option sandbox false --option builders \"\" --option trusted-users $USER -E \"$code\"\r\n\r\n```"}}
{"actor":{"display_login":"srghma"}}