Git Product home page Git Product logo

Comments (24)

spease avatar spease commented on August 17, 2024 26

So...installed nix-darwin today. I'd have loved to have had some kind of description for these questions:

Would you like edit the default configuration.nix before starting? [y/n]
Would you like to manage with nix-channel? [y/n]
Would you like to load darwin configuration in /etc/bashrc? [y/n]
Would you like to create /run? [y/n]

from nix-darwin.

abathur avatar abathur commented on August 17, 2024 25

It'd be nice to have more context for the questions posed by the installer (either in the README, or in the installer itself...):

Would you like edit the default configuration.nix before starting? [y/n]
Would you like to manage <darwin> with nix-channel? [y/n]
Would you like to load darwin configuration in /etc/bashrc? [y/n]
Would you like to create /run? [y/n]

It's easy enough to infer the consequences of either answer to the 1st and 3rd questions, but I don't have much grasp of the immediate or long-term implications of answering either way to the 2nd or 4th questions (or under what circumstances I might want to answer one way or the other).

Similarly, the installer process triggered the warning below 6 separate times (I don't see this warning in the source, so I assume they're just a side-effect of actions nix-darwin is taking):

warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring

Nonetheless, I don't have any sense of what this means for my install. Is it fine? Do I need to update other components? Did I answer a question wrong? Does the install otherwise need repair or remove/fix/reinstall?

Edit: removed notes on a lockfile issue I had; isolated cause and opened new issue.

from nix-darwin.

spease avatar spease commented on August 17, 2024 9

Even just saying that would be useful and give a strong hint that you should select “yes” unless you know you need to select “no”.

from nix-darwin.

LnL7 avatar LnL7 commented on August 17, 2024 4

@spease I'm not sure how relevant it would be to fully explain them. The prompts are mostly there for posterity, unless you have a special setup you probably want/need all of them.

from nix-darwin.

LnL7 avatar LnL7 commented on August 17, 2024 2

While it's probably not what you're looking for, I finally worked on generating reference documentation for the options https://lnl7.github.io/nix-darwin/manual.

Other then certain options there's actually very little difference between this and nixos, if you're new to nix lost of stuff in the nixos manual (eg. https://nixos.org/nixos/manual/index.html#ch-configuration) also apply to this project. If you're looking for examples, there are a couple of simple configurations in the repo and a bunch of contributors have their dotfiles on github.

from nix-darwin.

thomasheartman avatar thomasheartman commented on August 17, 2024 2

I just went through the installation process, and I think I got most of it set up, but not everything. Here are the things I struggled with:

  1. On installation, I was asked whether I wanted to edit the configuration. I thought yeah, sure, but I ran into the same problem as described in this issue about error: Using the nix-daemon requires build users, aborting activation because I tried activating an option. A little searching around this repo and I found the issue, so I managed to fix it, but it wasn't obvious.
  2. I'd like to echo what was said previously about warnings about nix search paths and generally about the questions in abathur's comment.
  3. After the installation was finished, I didn't know what to do. I couldn't find any signs of anything having gone wrong, but I definitely didn't have the darwin-rebuild commands available. I tried opening a bash shell instead (usually use fish), but no difference.
  4. Decided to try the 'manual install' steps. The fish commands fail to run with the following error message:
fish: Command substitutions not allowed
  1. I copied the result of the expression and ran the commands, but was told that my system couldn't find darwin in $NIX_PATH. So I went and copied the $NIX_PATH setting to my config.fish.
  2. I also manually sourced /etc/static/config.fish in my fish config file. Should I need to do this?
  3. Now I can evaluate (nix-build '<darwin>' -A system --no-out-link), copy the path, and run the build. It seems to work. Maybe. I still don't have the darwin-rebuild commands in my path.

So I'd say all those are missing. And if I may take this chance to ask a question and get some help: how do I check whether the installation has worked as expected? And how do I get darwin-rebuild in my path?

Apart from this, though: very excited about this, so I'm happy to jump through a couple hoops to get there. Thanks!

from nix-darwin.

yurrriq avatar yurrriq commented on August 17, 2024 1

Sounds good. I might have a go tonight, depending on whether we have company or not.

from nix-darwin.

LnL7 avatar LnL7 commented on August 17, 2024 1

The nix-env only works on the user profile (~/.nix-profile) by default you can use --profile | -p to specify another profile. It works the same as on nixos, there's a small section on rolling back changes in the manual.

$ sudo nix-env -p /nix/var/nix/profiles/system --list-generations
576   2017-10-01 16:10:52
577   2017-10-01 16:38:56
578   2017-10-01 17:12:27   (current)

from nix-darwin.

bromanko avatar bromanko commented on August 17, 2024 1

I'm new to Nix and trying to convert my system setup from using Homebrew Bundle to Nix. I feel that nix-darwin is what I need but I am struggling to understand how to actually use it. I'd love to have some documentation on "Getting Started" with managing a macOS environment with nix-darwin.

from nix-darwin.

spease avatar spease commented on August 17, 2024 1

Came across this by accident.

https://dev.to/louy2/use-nix-on-macos-as-a-homebrew-user-22d

from nix-darwin.

sevillaarvin avatar sevillaarvin commented on August 17, 2024 1

Currently installing nix-darwin. I was confused by "Would you like to manage <darwin> with nix-channel? [y/n]".

The source code is pretty straight forward. It's basically asking to add nix-darwin as a channel called "darwin":

if test -t 0; then
read -p "Would you like to manage <darwin> with nix-channel? [y/n] " i
fi
case "$i" in
y|Y)
nix-channel --add https://github.com/LnL7/nix-darwin/archive/master.tar.gz darwin
nix-channel --update
;;
esac

y is also the default:
EDIT: the default value is n.

I'm thinking it would be better to capitalize the default choice, just to make it a bit clearer.

from nix-darwin.

yurrriq avatar yurrriq commented on August 17, 2024

I'd like to add some documentation of using this with the fish shell. The syntax is only slightly different, but examples in the README.md would've saved me a couple minutes.

Aside: This is fantastic! Thanks so much for making and releasing it. Since I occasionally have iOS work, I'm basically stuck on Darwin (for now) and this might be the final push I need to fully ditch Homebrew in favor of Nix. I'm happy to help develop and test this in any way I can. Don't hesitate to reach out.

from nix-darwin.

LnL7 avatar LnL7 commented on August 17, 2024

If you could contribute, would be great! I personally don't use fish so I'm not very familiar with it.
But I can probably add a programs.fish module myself based on the one from nixos, that sets up the nix-darwin environment properly.

from nix-darwin.

dejanr avatar dejanr commented on August 17, 2024

What can we do to simplify installation process? I am not a big fun of current approach.

I was thinking about publishing nix-darwin to nixpkgs repo as a package and just having a single CLI nix-darwin.

For me perfect scenario would be:

  • install nix normally : curl https://nixos.org/nix/install | sh
  • then install nix- darwin : nix-env -i nix-darwin
  • optionally setup dotfiles : git clone [email protected]:user/dotfiles.git ~/.dotfiles && ~/.dotfiles/install.sh
  • and just rebuild by : nix-darwin rebuild

nix-darwin should like now read default config, and optionally we could define NIX_PATH to use different darwin.

What do you think?

Even darwin name is available in nix registry, so darwin rebuild, darwin option, would be great! :D

from nix-darwin.

LnL7 avatar LnL7 commented on August 17, 2024

Installing the nix-darwin scripts with nix-env doesn't really make a lot of sense to me, this entire project might move to nixpkgs at some point but that's a different story.

I should probably create a bootstrap script like https://nixos.org/nix/install that people can use to install.
Since nix-darwin supports launchd services, it's also possible to provide a multi user installer for nix that uses the nix-daemon service, but that will be a bit harder to get right.

from nix-darwin.

yurrriq avatar yurrriq commented on August 17, 2024

Could we add an example of using nixops?

Edit: Trying this now.

Update: I'm getting ssh errors running nixops deploy on top of nix-darwin even though I can [nixops] ssh just fine..

from nix-darwin.

LnL7 avatar LnL7 commented on August 17, 2024

I assume you are talking about distributed builds. The options are the same as for nixos, but debugging issues with this is pretty hard because you don't get a lot of information to work with. These are some issues I've run into when setting it up:

  • NIX_CURRENT_LOAD has to exist (services.activate-system will do this for you)
  • the machine was not in the know_hosts yet, what's important to know is that when using the nix-daemon this has to be done for root
  • the signing key was not setup properly, I have some instructions for that here https://github.com/LnL7/nix-docker#create-a-signing-keypair (I think this is not required when using the nix-damon)

WARNING: don't use nix-build --check to verify if this is working correctly, it always builds locally.

from nix-darwin.

yurrriq avatar yurrriq commented on August 17, 2024

Yeah, I think your second point there might be my issue. Thanks.

from nix-darwin.

jrolfs avatar jrolfs commented on August 17, 2024

@LnL7 some documentation around generations and rollback might be helpful. I'm a little confused as to how generations relate to nix-env generations.

E.g: if I run darwin-rebuild --rollback right now it rolls back from 31 to 30. However, nix-env --list-generations prints:

   1   2017-07-07 12:21:35
   2   2017-07-07 12:21:35
   3   2017-08-06 02:01:47
   4   2017-08-21 05:42:01
   5   2017-09-06 17:40:43   (current)

from nix-darwin.

jrolfs avatar jrolfs commented on August 17, 2024

Sigh, having used NixOS (albeit briefly) I should have known this. Thanks!

from nix-darwin.

cbarrett avatar cbarrett commented on August 17, 2024

There're no docs about how to run the tests -- trying to figure that out now myself!

from nix-darwin.

LnL7 avatar LnL7 commented on August 17, 2024

@cbarrett Good point, added an example to the readme. 😄

from nix-darwin.

abathur avatar abathur commented on August 17, 2024

I think this is just a documentation hole, but let me know if I should resubmit as its own issue.

I've been working on a new python script that I'm running as a launchd agent, and had some debug code in while I set it up to handle a few signals. The signals passed fine when I was using kill to directly target the python process by PID, but I was a little confused at first when it wasn't receiving anything but SIGTERM if I used launchctl kill <signal> <service-target>.

It was pretty obvious once I pulled the pieces apart. I had just copy-pasted an initial service definition from somewhere else which set the script instead of command option. This made enough semantic sense at the time for me to move on as soon as it worked without thinking too deeply. I recall guessing that the script/command options may just provide distinct semantics for running a standalone script by path, and running a full literal command with arguments.

In my case, exec is swapping in the generated wrapper script, so it receives the signals from launchctl kill. I haven't re-verified this part in the bash docs, but since the wrapper is just bash AFAIR all un-trapped signals end up getting treated as SIGTERM and propagated to children.

When I specify the path of my python script as the command, the python process is what exec swaps in and the signals propagate as expected.

from nix-darwin.

spease avatar spease commented on August 17, 2024

Uninstalled nix again. Got the same questions. Still don't know what /run is exactly but I think it's used to symlink the current environment?

I think it's a little unreasonable to expect people to know how to answer all these questions when they may have no familiarity with it yet and there doesn't seem to be easily searchable documentation on what to do.

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.