@@ -29,7 +29,7 @@ const rootError = "warning: installing Nix as root is not supported by this scri
29
29
30
30
// Install runs the install script for Nix. daemon has 3 states
31
31
// nil is unset. false is --no-daemon. true is --daemon.
32
- func Install (writer io.Writer , daemon * bool ) error {
32
+ func Install (writer io.Writer , daemon func () * bool ) error {
33
33
if isRoot () && build .OS () == build .OSWSL {
34
34
return usererr .New ("Nix cannot be installed as root on WSL. Please run as a normal user with sudo access." )
35
35
}
@@ -44,11 +44,15 @@ func Install(writer io.Writer, daemon *bool) error {
44
44
// Should we pin version? Or just trust detsys
45
45
installScript = "curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install"
46
46
if isLinuxWithoutSystemd () {
47
+ ux .Fwarningf (
48
+ writer ,
49
+ "Could not detect systemd on your system. Installing Nix in root only mode (--init none).\n " ,
50
+ )
47
51
installScript += " linux --init none"
48
52
}
49
53
installScript += " --no-confirm"
50
54
} else if daemon != nil {
51
- if * daemon {
55
+ if * daemon () {
52
56
installScript += " -- --daemon"
53
57
} else {
54
58
installScript += " -- --no-daemon"
@@ -165,7 +169,7 @@ func EnsureNixInstalled(writer io.Writer, withDaemonFunc func() *bool) (err erro
165
169
fmt .Scanln () //nolint:errcheck
166
170
}
167
171
168
- if err = Install (writer , withDaemonFunc () ); err != nil {
172
+ if err = Install (writer , withDaemonFunc ); err != nil {
169
173
return err
170
174
}
171
175
0 commit comments