Skip to content

Commit

Permalink
nix: switch to dioxus-desktop-template
Browse files Browse the repository at this point in the history
  • Loading branch information
srid committed Oct 6, 2023
1 parent c20bc2d commit 714b207
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 55 deletions.
34 changes: 17 additions & 17 deletions flake.lock

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

6 changes: 3 additions & 3 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
process-compose-flake.url = "github:Platonic-Systems/process-compose-flake";
cargo-doc-live.url = "github:srid/cargo-doc-live";

leptos-fullstack.url = "github:srid/leptos-fullstack";
leptos-fullstack.flake = false;
dioxus-desktop-template.url = "github:srid/dioxus-desktop-template";
dioxus-desktop-template.flake = false;
};

outputs = inputs:
Expand All @@ -30,7 +30,7 @@
inputs.treefmt-nix.flakeModule
inputs.process-compose-flake.flakeModule
inputs.cargo-doc-live.flakeModule
(inputs.leptos-fullstack + /nix/flake-module.nix)
(inputs.dioxus-desktop-template + /nix/flake-module.nix)
./rust.nix
./e2e/flake-module.nix
];
Expand Down
70 changes: 35 additions & 35 deletions rust.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Nix module for the Rust part of the project
#
# This uses https://github.com/srid/leptos-fullstack/blob/master/nix/flake-module.nix
# This uses https://github.com/srid/dioxus-desktop-template/blob/master/nix/flake-module.nix
{
perSystem = { config, self', pkgs, lib, system, ... }:
let
Expand All @@ -14,49 +14,50 @@
]);
in
{
leptos-fullstack.overrideCraneArgs = oa:
let
# 'cargo leptos test' doesn't run tests for all crates in the
# workspace. We do it here.
run-test = pkgs.writeShellApplication {
name = "run-test";
text = ''
set -xe
dioxus-desktop = {
inherit rustBuildInputs;
overrideCraneArgs = oa:
let
# 'cargo leptos test' doesn't run tests for all crates in the
# workspace. We do it here.
run-test = pkgs.writeShellApplication {
name = "run-test";
text = ''
set -xe
${oa.cargoTestCommand}
${oa.cargoTestCommand or ""}
# Disable tests on macOS for https://github.com/garnix-io/issues/issues/69
# If/when we move to Jenkins, this won't be necessary.
${if !pkgs.stdenv.isDarwin
then ''
# Run `cargo test` using the same settings as `cargo leptos test`
# In particular: target-dir and features
cargo test --target-dir=target/server --no-default-features --features=ssr
cargo test --target-dir=target/front --no-default-features --features=hydrate
''
else ""
}
'';
# Disable tests on macOS for https://github.com/garnix-io/issues/issues/69
# If/when we move to Jenkins, this won't be necessary.
${if !pkgs.stdenv.isDarwin
then ''
# Run `cargo test` using the same settings as `cargo leptos test`
# In particular: target-dir and features
cargo test --target-dir=target/server --no-default-features --features=ssr
cargo test --target-dir=target/front --no-default-features --features=hydrate
''
else ""
}
'';
};
in
{
nativeBuildInputs = (oa.nativeBuildInputs or [ ]) ++ [
pkgs.nix # cargo tests need nix
];
cargoTestCommand = lib.getExe run-test;
meta.description = "WIP: nix-browser";
};
in
{
nativeBuildInputs = (oa.nativeBuildInputs or [ ]) ++ [
pkgs.nix # cargo tests need nix
];
buildInputs = (oa.buildInputs or [ ]) ++ rustBuildInputs;
cargoTestCommand = lib.getExe run-test;
meta.description = "WIP: nix-browser";
};
};

packages = {
default = self'.packages.nix-browser;
nix-health = config.leptos-fullstack.craneLib.buildPackage {
inherit (config.leptos-fullstack) src;
nix-health = config.dioxus-desktop-template.craneLib.buildPackage {
inherit (config.dioxus-desktop-template) src;
pname = "nix-health";
nativeBuildInputs = [
pkgs.nix # cargo tests need nix
];
buildInputs = rustBuildInputs;
cargoExtraArgs = "-p nix_health --features ssr";
# Disable tests on macOS for https://github.com/garnix-io/issues/issues/69
# If/when we move to Jenkins, this won't be necessary.
Expand All @@ -74,7 +75,6 @@
cargo-nextest
config.process-compose.cargo-doc-live.outputs.package
];
buildInputs = rustBuildInputs;
shellHook = ''
echo
echo "🍎🍎 Run 'just <recipe>' to get started"
Expand Down

0 comments on commit 714b207

Please sign in to comment.