Skip to content

Commit

Permalink
Remove VcXsrv
Browse files Browse the repository at this point in the history
Beta release v0.3.0
Added demo video
  • Loading branch information
htngr committed Dec 18, 2024
1 parent 5b15198 commit 21327bb
Show file tree
Hide file tree
Showing 13 changed files with 80 additions and 116 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ jobs:
cp result store.tar.gz
nix build .#machine-wsl.config.build.tarball -L
cp result machine.tar.gz
nix build ./build#vcxsrv-bin -L
cp result vcxsrv-installer.exe
# nix build ./build#vcxsrv-bin -L
# cp result vcxsrv-installer.exe
- uses: actions/upload-artifact@v4
with:
name: windows
Expand Down Expand Up @@ -56,11 +56,11 @@ jobs:
mkdir -p "msix/VFS/Common AppData/codchi/"
mv .\msix\*.tar.gz "msix/VFS/Common AppData/codchi/"
.\msix\vcxsrv-installer.exe /S | Out-Null # wait for installer to finish...
mkdir -p "msix/VFS/ProgramFilesX64"
cp -r "${env:ProgramFiles}\VcXsrv" "msix/VFS/ProgramFilesX64"
rm .\msix\vcxsrv-installer.exe
mv .\msix\VFS\ProgramFilesX64\VcXsrv\vcxsrv.exe .\msix\VFS\ProgramFilesX64\VcXsrv\codchi_vcxsrv.exe
# .\msix\vcxsrv-installer.exe /S | Out-Null # wait for installer to finish...
# mkdir -p "msix/VFS/ProgramFilesX64"
# cp -r "${env:ProgramFiles}\VcXsrv" "msix/VFS/ProgramFilesX64"
# rm .\msix\vcxsrv-installer.exe
# mv .\msix\VFS\ProgramFilesX64\VcXsrv\vcxsrv.exe .\msix\VFS\ProgramFilesX64\VcXsrv\codchi_vcxsrv.exe
# - run: |
# reg add "HKCU\ROOT\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" /v "[{ProgramFilesX64}]\VcXsrv\codchi_vcxsrv.exe" /t REG_SZ /d "~ HIGHDPIAWARE"
# reg save "HKCU\ROOT" .\msix\User.dat
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ Codchi is a tool that manages your project's development environment in a reprod
> [!WARNING]
> Codchi is currently in beta and still under active development and testing. Please expect potential bugs and incomplete features. We welcome feedback and contributions to help improve stability and functionality!
## See Codchi in Action
[![YouTube](https://github.com/user-attachments/assets/ac67405a-9963-405e-8849-4d2cd2d90f4d)](https://www.youtube.com/watch?v=CBWrj0v-O0c)


## Getting Started

Read [What is Codchi?](https://codchi.dev/introduction/what-is-codchi) for an introduction to Codchi, or directly go to [Installation](https://codchi.dev/introduction/installation).
Expand All @@ -31,7 +35,7 @@ Report bugs, suggest new features, or ask questions via [GitHub Issues](https://

### Professional Support

For professional support, please contact [aformatik](https://www.aformatik.de/kontakt):
For professional support, please contact [aformatik](https://www.aformatik.de/kontakt) or send an email to <codchi [at] aformatik [dot] de>:

- **Feature Requests & Issues**: We offer dedicated assistance for feature requests, bug fixes, and troubleshooting.
- **Training and Consulting**: Need help building a tailored *code machine* for your organization? We provide specialized training and consulting services to help you leverage Codchi to its full potential in your environment.
Expand Down
14 changes: 7 additions & 7 deletions build/msix/AppxManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@
<!-- <DeviceCapability Name="webcam" /> -->
<!-- <DeviceCapability Name="bluetooth" /> -->
</Capabilities>
<Extensions>
<desktop2:Extension Category="windows.firewallRules">
<desktop2:FirewallRules Executable="VFS\ProgramFilesX64\VcXsrv\codchi_vcxsrv.exe">
<desktop2:Rule Direction="in" IPProtocol="TCP" LocalPortMax="6000" LocalPortMin="6000" Profile="all"/>
</desktop2:FirewallRules>
</desktop2:Extension>
</Extensions>
<!-- <Extensions> -->
<!-- <desktop2:Extension Category="windows.firewallRules"> -->
<!-- <desktop2:FirewallRules Executable="VFS\ProgramFilesX64\VcXsrv\codchi_vcxsrv.exe"> -->
<!-- <desktop2:Rule Direction="in" IPProtocol="TCP" LocalPortMax="6000" LocalPortMin="6000" Profile="all"/> -->
<!-- </desktop2:FirewallRules> -->
<!-- </desktop2:Extension> -->
<!-- </Extensions> -->
</Package>
94 changes: 22 additions & 72 deletions codchi/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions codchi/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "codchi"
build = "build/main.rs"
version = "0.2.4"
version = "0.3.0"
edition = "2021"
rust-version = "1.80.0"
resolver = "2"
Expand Down Expand Up @@ -35,7 +35,7 @@ freedesktop_entry_parser = "1.3.0"
indicatif = "0.17.8"
indicatif-log-bridge = "0.2.3"
inquire = "0.7.5"
not-so-human-panic = "1.1.5"
# not-so-human-panic = "1.1.5"
num_enum = "0.7.3"
number_prefix = "0.4.0"
petname = { version = "2.0.2", default-features = false, features = [
Expand All @@ -54,6 +54,7 @@ git-url-parse = "0.4.5"
toml_edit = { version = "0.22.22", features = ["serde"] }
which = "6.0.3"
notify-rust = "4.11.3"
human-panic = "2.0.2"
# clap-help = "1.3.0"
# termimad = "0.30.0"

Expand Down
6 changes: 3 additions & 3 deletions codchi/src/config/codchi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub struct CodchiConfig {

#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
pub struct VcXsrvConfig {
#[serde(default = "def_true")]
#[serde(default = "def_false")]
pub enable: bool,
#[serde(default = "def_false")]
pub tray: bool,
Expand All @@ -29,7 +29,7 @@ pub struct VcXsrvConfig {
impl Default for VcXsrvConfig {
fn default() -> Self {
Self {
enable: true,
enable: false,
tray: false,
}
}
Expand Down Expand Up @@ -152,7 +152,7 @@ vcxsrv.tray = true
assert_eq!(
Ok(CodchiConfig {
vcxsrv: VcXsrvConfig {
enable: true,
enable: false,
tray: true
},
..Default::default()
Expand Down
26 changes: 18 additions & 8 deletions codchi/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,17 @@ pub mod tray;
pub mod util;

fn main() -> anyhow::Result<()> {
not_so_human_panic::setup_panic!();
human_panic::setup_panic!(human_panic::Metadata::new(
env!("CARGO_PKG_NAME"),
format!("{} Commit: {}", env!("CARGO_PKG_VERSION"), env!("CODCHI_GIT_COMMIT"))
)
// .authors("Codchi contributers: <https://github.com/aformatik/codchi>")
// .homepage("https://codchi.dev")
.support("- Create an issue at <https://github.com/aformatik/codchi/issues>
- For professional support contact aformatik: <https://aformatik.de/kontakt/>
Codchi is currently in beta and still under active development and testing. Sometimes it can help to execute the same command 2 or 3 times. In the worst case you should be able to export your machine files with `codchi tar <CODCHI_MACHINE> export.tar`.
"));

let cli = Cli::parse();

Expand All @@ -40,15 +50,15 @@ fn main() -> anyhow::Result<()> {
// preload config
let cfg = CodchiConfig::get();

if !matches!(cli.command, Some(Cmd::Tray {})) && cfg.tray.autostart {
Driver::host()
.start_tray(false)
.trace_err("Failed starting codchi's tray")
.ignore();
}

// process commands without the store commands
match &cli.command {
Some(Cmd::Tray {}) if cfg.tray.autostart => {
Driver::host()
.start_tray(false)
.trace_err("Failed starting codchi's tray")
.ignore();
exit(0);
}
Some(Cmd::Tar { name, target_file }) => {
progress_scope! {
set_progress_status(format!("Exporting files of {name} to {target_file:?}..."));
Expand Down
4 changes: 4 additions & 0 deletions codchi/src/platform/host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,13 @@ pub trait Host: Sized {
if let Some(p) = System::new_all()
.processes_by_name("codchi".as_ref())
.find(|p| {
log::trace!("Found candidate {:?} while searching for {exe:?}", p.cmd());
log::trace!("Found {p:?} while searching for {exe:?}");
p.exe().is_some_and(|p| p == exe) && p.cmd().get(1).is_some_and(|arg| arg == "tray")
})
{

log::trace!("Kill running: {kill_running}. Process: {:?}", p.cmd());
if kill_running {
log::debug!("Killing running tray");
p.kill();
Expand Down
15 changes: 3 additions & 12 deletions codchi/src/platform/windows/wsl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,18 +75,9 @@ pub fn get_wsl_version() -> Result<String> {
pub fn check_wsl() -> Result<()> {
get_api()?;

let version_str = match get_wsl_version() {
Err(e) => {
if let Some(e) = e.root_cause().downcast_ref::<io::Error>() {
if e.kind() == io::ErrorKind::NotFound {
// todo ref docs
bail!("Failed to run wsl.exe. Please install Windows Subsystem for Linux!",)
}
}
Err(e)
}
version => version,
}?;
let version_str = get_wsl_version()
.context("Failed to run wsl.exe. Please install Windows Subsystem for Linux!
See <https://codchi.dev/introduction/installation#prerequisites> for instructions on how to do this.")?;
let version = Version::from(&version_str);

if !(Version::from(WSL_VERSION_MIN)..=Version::from(WSL_VERSION_MAX)).contains(&version) {
Expand Down
2 changes: 2 additions & 0 deletions configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
asvetliakov.vscode-neovim
];
})
pkgs.bashInteractive # fix terminal in VSCode
];
programs.neovim.enable = true;
programs.direnv = {
enable = true;
nix-direnv.enable = true;
Expand Down
Loading

0 comments on commit 21327bb

Please sign in to comment.