diff --git a/build/msix/AppxManifest.xml b/build/msix/AppxManifest.xml
index 0d571ab3..8d8f66e0 100755
--- a/build/msix/AppxManifest.xml
+++ b/build/msix/AppxManifest.xml
@@ -51,6 +51,9 @@
+
+
+
diff --git a/build/msix/Assets/StoreLogo.jpg b/build/msix/Assets/StoreLogo.jpg
index ddb212fe..6639e9bf 100644
Binary files a/build/msix/Assets/StoreLogo.jpg and b/build/msix/Assets/StoreLogo.jpg differ
diff --git a/build/msix/Assets/favicon.ico b/build/msix/Assets/favicon.ico
new file mode 100644
index 00000000..3a09f18e
Binary files /dev/null and b/build/msix/Assets/favicon.ico differ
diff --git a/build/msix/Assets/favicon150.png b/build/msix/Assets/favicon150.png
index a4ca0c47..03074c30 100644
Binary files a/build/msix/Assets/favicon150.png and b/build/msix/Assets/favicon150.png differ
diff --git a/build/msix/Assets/favicon150.targetsize-150_altform-unplated.png b/build/msix/Assets/favicon150.targetsize-150_altform-unplated.png
index a4ca0c47..03074c30 100644
Binary files a/build/msix/Assets/favicon150.targetsize-150_altform-unplated.png and b/build/msix/Assets/favicon150.targetsize-150_altform-unplated.png differ
diff --git a/build/msix/Assets/favicon44.png b/build/msix/Assets/favicon44.png
index 2e1a3a78..08c5570c 100644
Binary files a/build/msix/Assets/favicon44.png and b/build/msix/Assets/favicon44.png differ
diff --git a/build/msix/Assets/favicon44.targetsize-44_altform-unplated.png b/build/msix/Assets/favicon44.targetsize-44_altform-unplated.png
index 2e1a3a78..08c5570c 100644
Binary files a/build/msix/Assets/favicon44.targetsize-44_altform-unplated.png and b/build/msix/Assets/favicon44.targetsize-44_altform-unplated.png differ
diff --git a/codchi/Cargo.lock b/codchi/Cargo.lock
index bacada60..cb432dc9 100644
--- a/codchi/Cargo.lock
+++ b/codchi/Cargo.lock
@@ -683,6 +683,7 @@ dependencies = [
"throttle",
"toml_edit 0.22.22",
"tray-icon",
+ "uuid",
"version-compare",
"which",
"windows 0.58.0",
@@ -2955,6 +2956,12 @@ dependencies = [
"digest",
]
+[[package]]
+name = "sha1_smol"
+version = "1.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bbfa15b3dddfee50a0fff136974b3e1bde555604ba463834a7eb7deb6417705d"
+
[[package]]
name = "shared_child"
version = "1.0.1"
@@ -3462,11 +3469,12 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
[[package]]
name = "uuid"
-version = "1.10.0"
+version = "1.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "81dfa00651efa65069b0b6b651f4aaa31ba9e3c3ce0137aaad053604ee7e0314"
+checksum = "f8c5f0a0af699448548ad1a2fbf920fb4bee257eae39953ba95cb84891a0446a"
dependencies = [
"getrandom",
+ "sha1_smol",
]
[[package]]
diff --git a/codchi/Cargo.toml b/codchi/Cargo.toml
index d687a35a..94b52d0b 100644
--- a/codchi/Cargo.toml
+++ b/codchi/Cargo.toml
@@ -75,6 +75,7 @@ windows = { version = "0.58", features = [
] }
wslapi = "0.1.3"
clap_complete_command = { version = "0.6.1", default-features = false }
+uuid = { version = "1.11.0", features = ["v5"] }
[build-dependencies]
clap = { version = "4", features = ["derive", "cargo", "string"] }
diff --git a/codchi/src/platform/host.rs b/codchi/src/platform/host.rs
index 75df328c..7ee9ea49 100644
--- a/codchi/src/platform/host.rs
+++ b/codchi/src/platform/host.rs
@@ -92,7 +92,8 @@ pub trait Host: Sized {
});
}
- Self::write_shortcuts(&machine.config.name, desktop_entries.iter())
+ Self::write_shortcuts(&machine.config.name, desktop_entries.iter())?;
+ Ok(())
}
fn open_terminal(&self, cmd: &[&str]) -> Result<()>;
@@ -137,6 +138,14 @@ pub trait Host: Sized {
#[cfg(target_os = "windows")]
fn start_vcxsrv(&self, kill_running: bool) -> Result<()>;
+
+ fn post_install(_machine_name: &str) -> Result<()> {
+ Ok(())
+ }
+
+ fn post_delete(_machine_name: &str) -> Result<()> {
+ Ok(())
+ }
}
#[derive(Clone, Debug)]
diff --git a/codchi/src/platform/machine.rs b/codchi/src/platform/machine.rs
index 6e5966de..a9ebd767 100644
--- a/codchi/src/platform/machine.rs
+++ b/codchi/src/platform/machine.rs
@@ -337,6 +337,7 @@ git add flake.*
set_progress_status("Updating start menu shortcuts...");
HostImpl::write_machine_shortcuts(self)?;
+ HostImpl::post_install(&self.config.name)?;
hide_progress();
@@ -391,6 +392,7 @@ git add flake.*
set_progress_status("Deleting start menu shortcuts...");
HostImpl::delete_shortcuts(&self.config.name)?;
+ HostImpl::post_delete(&self.config.name)?;
println!("Successfully deleted {}. You might also want to run a garbage collection (`codchi gc`).", self.config.name);
diff --git a/codchi/src/platform/windows/host.rs b/codchi/src/platform/windows/host.rs
index c724617a..68bdc327 100644
--- a/codchi/src/platform/windows/host.rs
+++ b/codchi/src/platform/windows/host.rs
@@ -1,7 +1,7 @@
use crate::{
cli::DEBUG,
config::CodchiConfig,
- consts,
+ consts::{self, APP_NAME},
platform::{DesktopEntry, Host},
util::PathExt,
};
@@ -30,7 +30,7 @@ impl Host for HostImpl {
.join(machine_name)
.cleanup_and_get()?;
- let codchi_exe = env::current_exe()?;
+ // let codchi_exe = env::current_exe()?;
for DesktopEntry {
app_name,
@@ -40,7 +40,7 @@ impl Host for HostImpl {
is_terminal,
} in apps
{
- let mut lnk = ShellLink::new(&codchi_exe)?;
+ let mut lnk = ShellLink::new("codchi.exe")?;
if let Some(ico_path) = icon {
let target = ico_folder.join(format!("{app_name}.ico"));
fs::copy(ico_path, &target)?;
@@ -166,4 +166,73 @@ impl Host for HostImpl {
terms.iter().map(|(term, _)| term).join(", ")
)
}
+
+ fn post_install(machine_name: &str) -> Result<()> {
+ // write json fragments for windows terminal
+ {
+ // from https://learn.microsoft.com/en-us/windows/terminal/json-fragment-extensions#calculating-a-guid-for-a-built-in-profile
+ let guid = {
+ use uuid::Uuid;
+ // Windows Terminal namespace GUID for auto-generated profiles
+ let terminal_namespace_guid =
+ Uuid::parse_str("2bde4a90-d05f-401c-9492-e40884ead1d8")?;
+ let profile_name = consts::machine::machine_name(machine_name);
+
+ let utf16le_bytes: Vec = profile_name
+ .encode_utf16()
+ .flat_map(|unit| unit.to_le_bytes()) // little-endian (BOM-less)
+ .collect();
+
+ Uuid::new_v5(&terminal_namespace_guid, &utf16le_bytes)
+ };
+ let fragment_dir = get_known_folder_path(KnownFolder::LocalAppData)
+ .expect("FOLDERID_LocalAppData missing")
+ .join("Microsoft")
+ .join("Windows Terminal")
+ .join("Fragments")
+ .join(APP_NAME);
+ fragment_dir.get_or_create()?;
+
+ let fragment_path = fragment_dir.join(format!("{machine_name}.json"));
+
+ let codchi_icon = env::current_exe()?
+ .parent()
+ .context("Failed to access codchi.exe install dir.")?
+ .join("Assets")
+ .join("favicon150.png");
+ let codchi_icon = codchi_icon.display();
+
+ fs::write(
+ fragment_path,
+ format!(
+ r#"{{
+ "profiles": [
+ {{
+ "updates": "{{{guid}}}",
+ "commandline": "codchi.exe exec {machine_name}",
+ "name": "Codchi - {machine_name}",
+ "icon": "{codchi_icon}",
+ "startingDirectory": "%USERPROFILE%"
+ }}
+ ]
+}}"#
+ ),
+ )?;
+ }
+
+ Ok(())
+ }
+
+ fn post_delete(machine_name: &str) -> Result<()> {
+ get_known_folder_path(KnownFolder::LocalAppData)
+ .expect("FOLDERID_LocalAppData missing")
+ .join("Microsoft")
+ .join("Windows Terminal")
+ .join("Fragments")
+ .join(APP_NAME)
+ .join(format!("{machine_name}.json"))
+ .remove();
+
+ Ok(())
+ }
}
diff --git a/docs/src/docs/config/misc.md b/docs/src/docs/config/misc.md
index bb2a1ec4..b9fba559 100644
--- a/docs/src/docs/config/misc.md
+++ b/docs/src/docs/config/misc.md
@@ -29,3 +29,17 @@ By default the time zone is UTC inside a code machine. You can change this via
time.timeZone = "Europe/Berlin";
}
```
+
+## Windows Networking
+
+By default WSL configures the `/etc/hosts` and `/etc/resolv.conf` to match the networking settings of the host. Therefore they can't be generated by NixOS / Codchi. While Windows' DNS settings (through `/etc/resolv.conf`) are often neccessary for a working WSL instance, `/etc/hosts` is overridden by Codchi to enable reproducible IP / Domain configuration.
+
+To override this change these options:
+```nix
+{
+ environment.etc = {
+ hosts.enable = true; # /etc/hosts set by Codchi
+ "resolv.conf".enable = false; # /etc/hosts set by WSL
+ };
+}
+```
diff --git a/docs/src/docs/contrib/roadmap.md b/docs/src/docs/contrib/roadmap.md
index fd6c5e45..535c2748 100644
--- a/docs/src/docs/contrib/roadmap.md
+++ b/docs/src/docs/contrib/roadmap.md
@@ -2,16 +2,6 @@
- Docs
- [ ] Demo Video
- - NixOS options
- - [ ] hosts / resolv.conf
- - auto update
- - update available notification / working auto update
-
-
-- MVP Features
- - [ ] Codchi doctor (periodical check)
-
-- [ ] License
- Future
- Custom certs auto adding
@@ -24,10 +14,6 @@
- [ ] Internal Docs / Contrib
- [ ] Uninstalling Codchi, Migrating away
-- Bugs
- - update required with local repos => invalidate nix cache flag?
- - (testing: dont prompt)
-
- open questions:
- WSL
- what happens if store stops and machines runs?