{"action":"created","issue":{"url":"https://api.github.com/repos/fish-shell/fish-shell/issues/2950","repository_url":"https://api.github.com/repos/fish-shell/fish-shell","labels_url":"https://api.github.com/repos/fish-shell/fish-shell/issues/2950/labels{/name}","comments_url":"https://api.github.com/repos/fish-shell/fish-shell/issues/2950/comments","events_url":"https://api.github.com/repos/fish-shell/fish-shell/issues/2950/events","html_url":"https://github.com/fish-shell/fish-shell/issues/2950","id":148934085,"number":2950,"title":"Environment variable for configuration snippet path","user":{"login":"chris-martin","id":399718,"avatar_url":"https://avatars.githubusercontent.com/u/399718?v=3","gravatar_id":"","url":"https://api.github.com/users/chris-martin","html_url":"https://github.com/chris-martin","followers_url":"https://api.github.com/users/chris-martin/followers","following_url":"https://api.github.com/users/chris-martin/following{/other_user}","gists_url":"https://api.github.com/users/chris-martin/gists{/gist_id}","starred_url":"https://api.github.com/users/chris-martin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chris-martin/subscriptions","organizations_url":"https://api.github.com/users/chris-martin/orgs","repos_url":"https://api.github.com/users/chris-martin/repos","events_url":"https://api.github.com/users/chris-martin/events{/privacy}","received_events_url":"https://api.github.com/users/chris-martin/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/fish-shell/fish-shell/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":15,"created_at":"2016-04-17T09:16:14Z","updated_at":"2016-04-18T20:49:22Z","closed_at":null,"body":"I'm trying to figure out how to design a Fish plugin infrastructure for the [Nix package manager](https://nixos.org/nix/). This generally involves creating a shim that wraps the `fish` binary and appends paths of managed plugins to environment variables.\r\n\r\nIt seems that a Fish plugin may consist of three things:\r\n\r\n1. Functions, in paths specified by `$fish_function_path`\r\n2. Completions, in paths specified by `$fish_complete_path`\r\n3. Configuration snippets, in `~/.config/fish/conf.d`\r\n\r\nThe first two are configured by environment variables that I can append to. For configuration snippets, I can't find any way to add additional paths. Is there something I'm missing, or can we add it?\r\n\r\nWhat I want to do here is very similar to what the \"vendor\" directories faciliate, but the problem is that those paths are compiled into Fish, not settable by environment variables. I need to change the snippet directory every time the plugin list changes, and it would be unpleasant to have to recompile Fish every time."},"comment":{"url":"https://api.github.com/repos/fish-shell/fish-shell/issues/comments/211569604","html_url":"https://github.com/fish-shell/fish-shell/issues/2950#issuecomment-211569604","issue_url":"https://api.github.com/repos/fish-shell/fish-shell/issues/2950","id":211569604,"user":{"login":"faho","id":5185367,"avatar_url":"https://avatars.githubusercontent.com/u/5185367?v=3","gravatar_id":"","url":"https://api.github.com/users/faho","html_url":"https://github.com/faho","followers_url":"https://api.github.com/users/faho/followers","following_url":"https://api.github.com/users/faho/following{/other_user}","gists_url":"https://api.github.com/users/faho/gists{/gist_id}","starred_url":"https://api.github.com/users/faho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/faho/subscriptions","organizations_url":"https://api.github.com/users/faho/orgs","repos_url":"https://api.github.com/users/faho/repos","events_url":"https://api.github.com/users/faho/events{/privacy}","received_events_url":"https://api.github.com/users/faho/received_events","type":"User","site_admin":false},"created_at":"2016-04-18T20:49:21Z","updated_at":"2016-04-18T20:49:21Z","body":">Okay, I think I get it. __extra_confdir is not a path, but rather a fish expression that evaluates to a path?\r\n\r\nYeah, it's a variable. `__fish_build_paths.in` is just a file that we run `sed` on via the Makefile to turn it into a proper fishscript that is then sourced.\r\n\r\n>That has the effect of replacing the default vendor snippets path ${datadir}/fish/vendor.d with a variable EXTRA_CONFDIR that will get resolved at runtime?\r\n\r\nYes. Do note though that this invalidates the pkg-config stuff (`fish.pc` in the root directory of the repo), so you might need to change packages that add to the vendor directories via that, but I'm sure you need to do that anyway.\r\n\r\nAlso note that the code I gave you will _fail_ if EXTRA_CONFDIR is unset by not looking at any vendor directory at all. That's because later on it goes into a for-loop:\r\n\r\n```fish\r\nfor file in $configdir/fish/conf.d/*.fish $__fish_sysconfdir/conf.d/*.fish $__extra_confdir/*.fish\r\n```\r\n\r\nHere, if $__extraconfdir is set to zero elements, the glob will expand to nothing, so the loop will effectively go through `$configdir/fish/conf.d/*.fish` and `$__fish_sysconfdir/conf.d/*.fish`.\r\n\r\nIf we added a patch for this, we'd probably do a default value if EXTRA_CONFDIR is unset, but my guess is you don't want that.\r\n\r\nAnything else?"}}