Comments (8)
Fixed by #50
from nix-darwin.
All of the Nix environment setup scripts I've seen (in the nix.sh
script of GNU+Linux, the environment on NixOS, the nix-daemon.sh
script on macOS, and in nix-darwin) set PATH this way. I think it makes sense on initial startup, but we have to make sure it runs as early as possible and never twice. Take a look at the NixOS module for Fish and the fish package in nixpkgs for an example.
I think if we change the Fish package to source /etc/static/preinit-whatever.fish instead of in plain /etc, then nix-darwin can put the file in place and NixOS should be unaffected. Right now nix-darwin can't put the file where Fish expects because it doesn't (and shouldn't) own /etc
.
from nix-darwin.
@therealpxc That makes sense to me, I think. I understand what the NixOS things in the Fish package are doing, at any rate.
How do you suggest managing the tickets for this?
from nix-darwin.
I think we should make the changes we want on the Nixpkgs side on a local checkout while we work out the nix-darwin stuff, then submit the PRs for both pieces. That way the PR for Nixpkgs can say 'this makes the following achievable in nix-darwin' instead of 'we hope this will enable us to do xyz for nix-darwin'.
from nix-darwin.
@therealpxc Sounds good to me.
What the fish package does looks reasonable to me. I'm assuming we don't export the _fish_nixos*_sourced variables because the idea is that we reset things anew in subshells anyway?
from nix-darwin.
The other shell modules do something similar, but how is this related to setting PATH
?
from nix-darwin.
@cbarrett that's right.
@LnL7 The way that PATH is set is neither by appending nor pre-pending but straight-up setting PATH, so that if the Nix configuration stuff gets sourced after other things (like nix-shell
, for example) try to set the PATH, it will be erased.
Since EDITOR also gets set this way, for example, it overrides the ~/.config/fish/conf.d/env.fish
snippet I have which sets it to vim
, so I have to re-override it at the end ~/.config/fish/config.fish
, which gets sourced later, as a workaround.
from nix-darwin.
And to make Nix-installed CLI programs available to snippets in ~/.config/fish/conf.d
and directories like it, the Nix stuff has to be sourced prior to shell initialization proper, which is what the preinit
stuff in the Fish package and NixOS module take care of. This is because the conf.d stuff is sourced before config.fish and in alphanumeric order, so adding a Fish snippet for Nix init doesn't guarantee that it will execute first either.
from nix-darwin.
Related Issues (20)
- Putting the configuration in `~/.config/nixpkgs` instead `~/.nixpkgs` HOT 1
- `cachix-agent` service dies at launch HOT 3
- Always fail to pull nix-darwin from github? HOT 1
- Feature request: add com.apple.dock.persistent-others
- vscode-extensions not found on share directory HOT 1
- Is nix-darwin installing a second Nix? HOT 29
- Encountering an mdDoc related error when updating nix-darwin via flake HOT 13
- `pkg-config` not functioning as expected on fresh install and shells HOT 10
- Casks not updated automatically HOT 2
- [Question] /run symlink necessary? HOT 5
- use-xdg-base-directories does not effect $PATH
- Logging in and out breaks Yabai's Scripting Addition
- Yabi Scripting Addition fails to inject into Dock.app HOT 1
- (re)install fails with nonexistent path in nix-store HOT 1
- If use-xdg-base-directories is true then NIX_PROFILES is not correct
- Flake installation fails if `~/.config` is a Git repository and `nix-darwin/flake.nix` is not committed HOT 2
- sdate builds and installs but will not run HOT 3
- nix-darwin doesnt build after updating flake HOT 2
- Is there a better (native) way to enable AppExposé HOT 1
- `persistent-others` doesn't work with relative paths HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nix-darwin.