Compare commits

...

4 commits

Author SHA1 Message Date
ca2ebd5949 feat: add Windows cross-compilation and release artifacts
All checks were successful
Continuous Integration / Lint, Check & Test (push) Successful in 4m43s
Continuous Integration / Build Package (push) Successful in 5m17s
- Add mkWindowsCraneLib using x86_64-pc-windows-gnu target
- Add mkStreamdWindows using mingw-w64 toolchain for cross-compilation
- Export streamd-windows package from flake
- Add Windows build step and .exe artifact to release workflow
2026-04-13 18:56:22 +02:00
4ded06748b fix: cross-platform compatibility for Windows support
- Use directories::BaseDirs for config path fallback instead of hardcoded Unix path
- Default to notepad on Windows instead of vi for editor commands
- Skip +N line argument for notepad in todo edit (notepad doesn't support it)
2026-04-13 18:56:22 +02:00
10f4ae282a chore(deps): update rust crate clap_complete to v4.6.1
All checks were successful
Continuous Integration / Build Package (push) Successful in 50s
Release / Build and Release (push) Successful in 5s
Continuous Integration / Lint, Check & Test (push) Successful in 1m12s
2026-04-11 00:05:42 +00:00
c2b4fb5160 chore(deps): update rust crate indexmap to v2.14.0
All checks were successful
Release / Build and Release (push) Successful in 6s
Continuous Integration / Build Package (push) Successful in 24s
Continuous Integration / Lint, Check & Test (push) Successful in 44s
2026-04-10 00:06:13 +00:00
7 changed files with 75 additions and 17 deletions

View file

@ -49,12 +49,17 @@ jobs:
if: steps.version.outputs.SKIP != 'true' if: steps.version.outputs.SKIP != 'true'
run: nix build .#streamd-musl -o result-musl run: nix build .#streamd-musl -o result-musl
- name: Build Windows binary
if: steps.version.outputs.SKIP != 'true'
run: nix build .#streamd-windows -o result-windows
- name: Prepare release artifacts - name: Prepare release artifacts
if: steps.version.outputs.SKIP != 'true' if: steps.version.outputs.SKIP != 'true'
run: | run: |
mkdir -p release mkdir -p release
cp result-deb release/streamd_${{ steps.version.outputs.VERSION }}_amd64.deb cp result-deb release/streamd_${{ steps.version.outputs.VERSION }}_amd64.deb
cp result-musl/bin/streamd release/streamd-${{ steps.version.outputs.VERSION }}-linux-x86_64 cp result-musl/bin/streamd release/streamd-${{ steps.version.outputs.VERSION }}-linux-x86_64
cp result-windows/bin/streamd.exe release/streamd-${{ steps.version.outputs.VERSION }}-windows-x86_64.exe
- name: Create release - name: Create release
if: steps.version.outputs.SKIP != 'true' if: steps.version.outputs.SKIP != 'true'

14
Cargo.lock generated
View file

@ -197,9 +197,9 @@ dependencies = [
[[package]] [[package]]
name = "clap_complete" name = "clap_complete"
version = "4.6.0" version = "4.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "19c9f1dde76b736e3681f28cec9d5a61299cbaae0fce80a68e43724ad56031eb" checksum = "406e68b4de5c59cfb8f750a7cbd4d31ae153788b8352167c1e5f4fc26e8c91e9"
dependencies = [ dependencies = [
"clap", "clap",
] ]
@ -351,9 +351,9 @@ dependencies = [
[[package]] [[package]]
name = "hashbrown" name = "hashbrown"
version = "0.16.1" version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" checksum = "4f467dd6dccf739c208452f8014c75c18bb8301b050ad1cfb27153803edb0f51"
[[package]] [[package]]
name = "heck" name = "heck"
@ -393,12 +393,12 @@ checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954"
[[package]] [[package]]
name = "indexmap" name = "indexmap"
version = "2.13.1" version = "2.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "45a8a2b9cb3e0b0c1803dbb0758ffac5de2f425b23c28f518faabd9d805342ff" checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9"
dependencies = [ dependencies = [
"equivalent", "equivalent",
"hashbrown 0.16.1", "hashbrown 0.17.0",
"serde", "serde",
"serde_core", "serde_core",
] ]

View file

@ -132,6 +132,38 @@
in in
craneLib.buildPackage (commonArgs // { inherit cargoArtifacts; }); craneLib.buildPackage (commonArgs // { inherit cargoArtifacts; });
mkWindowsCraneLib =
system:
let
pkgs = mkPkgs system;
toolchain = pkgs.rust-bin.stable.latest.default.override {
targets = [ "x86_64-pc-windows-gnu" ];
};
in
(crane.mkLib pkgs).overrideToolchain toolchain;
mkStreamdWindows =
system:
let
pkgs = mkPkgs system;
pkgsCross = pkgs.pkgsCross.mingwW64;
craneLib = mkWindowsCraneLib system;
commonArgs = {
src = craneLib.path ./.;
pname = "streamd";
inherit version;
strictDeps = true;
CARGO_BUILD_TARGET = "x86_64-pc-windows-gnu";
CC_x86_64_pc_windows_gnu = "${pkgsCross.stdenv.cc}/bin/x86_64-w64-mingw32-gcc";
CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER = "${pkgsCross.stdenv.cc}/bin/x86_64-w64-mingw32-gcc";
nativeBuildInputs = [ pkgsCross.stdenv.cc ];
buildInputs = [ pkgsCross.windows.pthreads ];
doCheck = false;
};
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
in
craneLib.buildPackage (commonArgs // { inherit cargoArtifacts; });
mkStreamdDeb = mkStreamdDeb =
system: system:
let let
@ -181,9 +213,10 @@
streamd = mkStreamd system; streamd = mkStreamd system;
streamd-musl = mkStreamdMusl system; streamd-musl = mkStreamdMusl system;
streamd-deb = mkStreamdDeb system; streamd-deb = mkStreamdDeb system;
streamd-windows = mkStreamdWindows system;
in in
{ {
inherit streamd streamd-musl streamd-deb; inherit streamd streamd-musl streamd-deb streamd-windows;
default = streamd; default = streamd;
} }
); );

View file

@ -67,7 +67,13 @@ pub fn run(number: i32) -> Result<(), StreamdError> {
}; };
if let Some(file_path) = sorted_shards[selected_index].location.get("file") { if let Some(file_path) = sorted_shards[selected_index].location.get("file") {
let editor = std::env::var("EDITOR").unwrap_or_else(|_| "vi".to_string()); let editor = std::env::var("EDITOR").unwrap_or_else(|_| {
if cfg!(windows) {
"notepad".to_string()
} else {
"vi".to_string()
}
});
Command::new(&editor).arg(file_path).status()?; Command::new(&editor).arg(file_path).status()?;
} }

View file

@ -24,7 +24,13 @@ pub fn run() -> Result<(), StreamdError> {
drop(file); drop(file);
// Open in editor // Open in editor
let editor = std::env::var("EDITOR").unwrap_or_else(|_| "vi".to_string()); let editor = std::env::var("EDITOR").unwrap_or_else(|_| {
if cfg!(windows) {
"notepad".to_string()
} else {
"vi".to_string()
}
});
let status = Command::new(&editor).arg(&preliminary_path).status()?; let status = Command::new(&editor).arg(&preliminary_path).status()?;
if !status.success() { if !status.success() {

View file

@ -92,13 +92,19 @@ pub fn run_edit(number: usize) -> Result<(), StreamdError> {
.get("file") .get("file")
.ok_or(StreamdError::MissingFilePath)?; .ok_or(StreamdError::MissingFilePath)?;
let editor = std::env::var("EDITOR").unwrap_or_else(|_| "vi".to_string()); let editor = std::env::var("EDITOR").unwrap_or_else(|_| {
let line_arg = format!("+{}", task.start_line); if cfg!(windows) {
"notepad".to_string()
} else {
"vi".to_string()
}
});
let status = Command::new(&editor) let mut cmd = Command::new(&editor);
.arg(&line_arg) if !editor.to_lowercase().contains("notepad") {
.arg(file_path) cmd.arg(format!("+{}", task.start_line));
.status()?; }
let status = cmd.arg(file_path).status()?;
if !status.success() { if !status.success() {
return Err(StreamdError::IoError(std::io::Error::other( return Err(StreamdError::IoError(std::io::Error::other(

View file

@ -37,8 +37,10 @@ impl Settings {
fn config_path() -> PathBuf { fn config_path() -> PathBuf {
if let Some(proj_dirs) = ProjectDirs::from("", "", "streamd") { if let Some(proj_dirs) = ProjectDirs::from("", "", "streamd") {
proj_dirs.config_dir().join("config.toml") proj_dirs.config_dir().join("config.toml")
} else if let Some(base_dirs) = directories::BaseDirs::new() {
base_dirs.config_dir().join("streamd").join("config.toml")
} else { } else {
PathBuf::from("~/.config/streamd/config.toml") PathBuf::from("streamd_config.toml")
} }
} }
} }