зеркало из
https://github.com/iharh/notes.git
synced 2025-11-01 22:26:09 +02:00
59 строки
2.6 KiB
Plaintext
59 строки
2.6 KiB
Plaintext
https://github.com/DeterminateSystems/nix-installer/blob/main/src/cli/subcommand/install.rs
|
|
? CommonSettings
|
|
https://github.com/DeterminateSystems/nix-installer/blob/main/src/settings.rs
|
|
? InitSystem (None, Launchd, Systemd)
|
|
|
|
pub struct InitSettings {
|
|
pub init: InitSystem,
|
|
...
|
|
/// Start the daemon (if not `--init none`)
|
|
long = "no-start-daemon"
|
|
}
|
|
https://github.com/DeterminateSystems/nix-installer/blob/main/src/planner/linux.rs
|
|
pub struct Linux {
|
|
#[cfg_attr(feature = "cli", clap(flatten))]
|
|
pub settings: CommonSettings,
|
|
#[cfg_attr(feature = "cli", clap(flatten))]
|
|
pub init: InitSettings,
|
|
}
|
|
? start_daemon
|
|
...
|
|
plan.push(
|
|
ConfigureInitService::plan(self.init.init, self.init.start_daemon)
|
|
.await
|
|
https://github.com/DeterminateSystems/nix-installer/blob/main/src/action/common/configure_init_service.rs
|
|
https://github.com/DeterminateSystems/nix-installer/blob/main/src/action/common/configure_init_service.rs#L136
|
|
fn execute_description(&self) -> Vec<ActionDescription> {
|
|
let mut vec = Vec::new();
|
|
match self.init {
|
|
#[cfg(target_os = "linux")]
|
|
InitSystem::Systemd => {
|
|
let mut explanation = vec![
|
|
"Run `systemd-tempfiles --create --prefix=/nix/var/nix`".to_string(),
|
|
format!("Symlink `{SERVICE_SRC}` to `{SERVICE_DEST}`"),
|
|
format!("Symlink `{SOCKET_SRC}` to `{SOCKET_DEST}`"),
|
|
"Run `systemctl daemon-reload`".to_string(),
|
|
];
|
|
if self.start_daemon {
|
|
explanation.push(format!("Run `systemctl enable --now {SOCKET_SRC}`"));
|
|
}
|
|
vec.push(ActionDescription::new(self.tracing_synopsis(), explanation))
|
|
},
|
|
? nix-daemon.service, nix-daemon.socket
|
|
|
|
https://github.com/DeterminateSystems/nix-installer/blob/main/src/action/mod.rs
|
|
https://github.com/DeterminateSystems/nix-installer/blob/main/src/action/common/configure_nix.rs
|
|
https://github.com/DeterminateSystems/nix-installer/blob/main/src/action/common/configure_shell_profile.rs
|
|
https://github.com/DeterminateSystems/nix-installer/blob/main/src/planner/macos.rs
|
|
launchd
|
|
ShellProfileLocations
|
|
https://github.com/DeterminateSystems/nix-installer/blob/main/src/planner/mod.rs#L345
|
|
/etc/zshrc
|
|
/etc/zsh/zshrc
|
|
|
|
# Nix
|
|
if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then
|
|
. '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'
|
|
fi
|
|
# End Nix
|