chore: remove nix mentions from rust

This commit is contained in:
Keisuke Hirata 2026-05-30 12:10:37 +09:00
parent b981bbd87b
commit 2533a3d5d3
No known key found for this signature in database
2 changed files with 15 additions and 16 deletions

View File

@ -99,11 +99,7 @@ impl ProfileSelector {
{ {
return Self::source_named(source, name); return Self::source_named(source, name);
} }
if raw.contains('/') if raw.contains('/') || raw.starts_with('.') || raw.ends_with(".lua") {
|| raw.starts_with('.')
|| raw.ends_with(".lua")
|| raw.ends_with(".nix")
{
Self::path(raw) Self::path(raw)
} else { } else {
Self::named(raw) Self::named(raw)
@ -382,8 +378,15 @@ impl ProfileResolver {
.map(str::to_string); .map(str::to_string);
match extension.as_deref() { match extension.as_deref() {
Some("lua") => {} Some("lua") => {}
Some("nix") => return Err(ProfileError::UnsupportedProfileType { path: absolute_path, message: "Nix profile files are no longer supported; use a Lua profile or --manifest for a complete Manifest".into() }), other => {
other => return Err(ProfileError::UnsupportedProfileType { path: absolute_path, message: format!("unsupported profile extension {}; Lua profiles must end in .lua", other.map_or("<none>".to_string(), |s| format!(".{s}"))) }), return Err(ProfileError::UnsupportedProfileType {
path: absolute_path,
message: format!(
"unsupported profile extension {}; Lua profiles must end in .lua",
other.map_or("<none>".to_string(), |s| format!(".{s}"))
),
});
}
} }
let profile_dir = absolute_path let profile_dir = absolute_path
.parent() .parent()
@ -1230,10 +1233,6 @@ mod tests {
ProfileSelector::parse_cli("./coder.lua"), ProfileSelector::parse_cli("./coder.lua"),
ProfileSelector::Path { .. } ProfileSelector::Path { .. }
)); ));
assert!(matches!(
ProfileSelector::parse_cli("./legacy.nix"),
ProfileSelector::Path { .. }
));
assert_eq!( assert_eq!(
ProfileSelector::parse_cli("project:coder"), ProfileSelector::parse_cli("project:coder"),
ProfileSelector::source_named(ProfileRegistrySource::Project, "coder") ProfileSelector::source_named(ProfileRegistrySource::Project, "coder")
@ -1443,9 +1442,9 @@ return profile {
); );
} }
#[test] #[test]
fn unsupported_nix_profile_has_clear_diagnostic() { fn unsupported_profile_extension_has_clear_diagnostic() {
let tmp = TempDir::new().unwrap(); let tmp = TempDir::new().unwrap();
let path = write_profile(tmp.path(), "legacy.nix", "{}"); let path = write_profile(tmp.path(), "legacy.txt", "{}");
let err = ProfileResolver::new() let err = ProfileResolver::new()
.with_workspace_base(tmp.path()) .with_workspace_base(tmp.path())
.resolve( .resolve(
@ -1454,7 +1453,7 @@ return profile {
) )
.unwrap_err(); .unwrap_err();
assert!(matches!(err, ProfileError::UnsupportedProfileType { .. })); assert!(matches!(err, ProfileError::UnsupportedProfileType { .. }));
assert!(err.to_string().contains("--manifest")); assert!(err.to_string().contains("Lua profiles must end in .lua"));
} }
#[test] #[test]
fn for_cwd_reads_profiles_toml_and_ignores_manifest_profiles() { fn for_cwd_reads_profiles_toml_and_ignores_manifest_profiles() {

View File

@ -126,8 +126,8 @@ fn point_pod_command_at_true() {
} }
} }
/// `/bin/true` only exists on FHS-compliant systems. On Nix, resolve it /// `/bin/true` only exists on FHS-compliant systems. Resolve it via PATH
/// via PATH so the tests work regardless of distro. /// so the tests work regardless of distro.
fn which_true() -> String { fn which_true() -> String {
for dir in std::env::var_os("PATH") for dir in std::env::var_os("PATH")
.map(|p| std::env::split_paths(&p).collect::<Vec<_>>()) .map(|p| std::env::split_paths(&p).collect::<Vec<_>>())