Skip to content

Commit cdc3a34

Browse files
authored
Minor macOS code fixups (#1346)
* CreateNixVolume: use constant for darwin-store service label * BootstrapLaunchctlService: remove exit code 37 check This is returned with the message "Operation already in progress". However, `print` doesn't actually start anything, so I highly doubt this can ever trigger. This has existed since the beginning of this file, but I believe it's a relic of some leftover testing with `launchctl load` / `launchctl unload` / `launchctl bootstrap` / `launchctl bootout`, which likely could return this.
1 parent 82a6444 commit cdc3a34

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

src/action/macos/bootstrap_launchctl_service.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ impl BootstrapLaunchctlService {
4141
.await
4242
.map_err(|e| Self::error(ActionErrorKind::command(&command, e)))?;
4343
// We presume that success means it's found
44-
command_output.status.success() || command_output.status.code() == Some(37)
44+
command_output.status.success()
4545
};
4646

4747
let is_disabled = service_is_disabled(DARWIN_LAUNCHD_DOMAIN, &service)

src/action/macos/create_nix_volume.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ use super::{
1919
};
2020

2121
pub const NIX_VOLUME_MOUNTD_DEST: &str = "/Library/LaunchDaemons/org.nixos.darwin-store.plist";
22+
pub const NIX_VOLUME_MOUNTD_NAME: &str = "org.nixos.darwin-store";
2223

2324
/// Create an APFS volume
2425
#[derive(Debug, serde::Deserialize, serde::Serialize, Clone)]
@@ -88,7 +89,7 @@ impl CreateNixVolume {
8889

8990
let setup_volume_daemon = CreateVolumeService::plan(
9091
NIX_VOLUME_MOUNTD_DEST,
91-
"org.nixos.darwin-store",
92+
NIX_VOLUME_MOUNTD_NAME,
9293
name.clone(),
9394
"/nix",
9495
encrypt,
@@ -97,11 +98,11 @@ impl CreateNixVolume {
9798
.map_err(Self::error)?;
9899

99100
let bootstrap_volume =
100-
BootstrapLaunchctlService::plan("org.nixos.darwin-store", NIX_VOLUME_MOUNTD_DEST)
101+
BootstrapLaunchctlService::plan(NIX_VOLUME_MOUNTD_NAME, NIX_VOLUME_MOUNTD_DEST)
101102
.await
102103
.map_err(Self::error)?;
103104
let kickstart_launchctl_service =
104-
KickstartLaunchctlService::plan(DARWIN_LAUNCHD_DOMAIN, "org.nixos.darwin-store")
105+
KickstartLaunchctlService::plan(DARWIN_LAUNCHD_DOMAIN, NIX_VOLUME_MOUNTD_NAME)
105106
.await
106107
.map_err(Self::error)?;
107108
let enable_ownership = EnableOwnership::plan("/nix").await.map_err(Self::error)?;

0 commit comments

Comments
 (0)