Git Product home page Git Product logo

Comments (8)

LnL7 avatar LnL7 commented on August 17, 2024 2

Fixed by #50

from nix-darwin.

therealpxc avatar therealpxc commented on August 17, 2024

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.

cbarrett avatar cbarrett commented on August 17, 2024

@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.

therealpxc avatar therealpxc commented on August 17, 2024

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.

cbarrett avatar cbarrett commented on August 17, 2024

@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.

LnL7 avatar LnL7 commented on August 17, 2024

The other shell modules do something similar, but how is this related to setting PATH?

from nix-darwin.

therealpxc avatar therealpxc commented on August 17, 2024

@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.

therealpxc avatar therealpxc commented on August 17, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.