!DkNkhjPMwKVMKgmGYw:nixos.org

Nix Installer

79 Members
17 Servers

You have reached the beginning of time (for this room).


SenderMessageTime
8 May 2024
@abathur:matrix.orgabathurok, sounds like we'll have stuff to look at04:00:19
@pxc:matrix.orgpxc

how nutty would it be to have a Nix installer attempt to get nix-daemon.sh's environment changes handled by an init system/session manager, if available, rather than plugging directly into a shell?

Fish users who are Nix novices (and maybe also Unix novices) have struggled getting their shell to 'nixify' properly forever. I've tried to work on it, and helped get something usable going for NixOS which is now also used in Nix-Darwin. But people still struggle, many years later, and other fun new shells (Elvish, Nushell, PowerShell, Xonsh, idk) face similar problems with Nix's POSIX initialization scripts

I think we could easily have the Nix stuff happen before the user session starts with systemd on Linux and launchd on macOS

06:37:25
@pxc:matrix.orgpxc *

how nutty would it be to have a Nix installer attempt to get nix-daemon.sh's environment changes handled by an init system/session manager, if available, rather than plugging directly into a shell?

Fish users who are Nix novices (and maybe also Unix novices) have struggled getting their shell to 'nixify' properly forever. I've tried to work on it, and helped get something usable going for NixOS which is now also used in Nix-Darwin. But people still struggle, many years later, on foreign Linux and macOS. Other fun new shells (Elvish, Nushell, PowerShell, Xonsh, idk) face similar problems with Nix's POSIX initialization scripts

I think we could easily have the Nix stuff happen before the user session starts with systemd on Linux and launchd on macOS

06:38:13
@pxc:matrix.orgpxcThe experimental new installer is already willing to get creative with this kind of stuff to avoid breakage on macOS, and I think it was a good choice.06:39:06
@abathur:matrix.orgabathur

Have you tried setting this up with launchctl (and on what macOS version?)

It sounds like (thanks to cole-h for finding my own past comments about this :)) we are hemmed in on the global environment point by macOS these days, see for example:

  • https://github.com/canonical/multipass/issues/2417#issuecomment-1553437799
  • https://github.com/cachix/install-nix-action/issues/183#issuecomment-1595055643
14:38:41
@abathur:matrix.orgabathurbut if you've got it working on a newer macOS, perhaps they caused trouble for someone important and had to back off from the change?14:39:37
@pxc:matrix.orgpxc
In reply to @abathur:matrix.org
but if you've got it working on a newer macOS, perhaps they caused trouble for someone important and had to back off from the change?

I do, but I don't think that's quite it, since I actually do get that error on my system (macOS 14.4.1)

This works:

  • setting per-user session variables interactively with launchctl setenv via LaunchAgents as my user (works immediately; close and relaunch your terminal emulator and it'll pick up the variables)
  • settting per-user session variables interactively with launchctl setenv in LaunchAgents that run as root
  • setting global session variables with launchctl setenv in LaunchAgents that run as root (takes effect with next session)

but this doesn't work:

  • interactively using launchctl setenv as root, which yields the message Could not set environment: 150: Operation not permitted while System Integrity Protection is engaged
15:46:35
@pxc:matrix.orgpxc I was assuming the restriction of launchctl setenv was limited this way from the start, but now that I think of it, maybe it was totally removed, then only partially backed off 15:48:15
@abathur:matrix.orgabathurI'm less sure if anyone who encountered/reported the problem would've been doing it through the indirection of a launchagent/daemon15:49:44
@abathur:matrix.orgabathurthough I'm also less confident that it isn't a bug/loophole apple will notice and close15:50:32
@pxc:matrix.orgpxcagreed, although Apple is basically inscrutable and liable to break anything at any time15:51:57

Show newer messages


Back to Room ListRoom Version: 9