From d84f59d1b3c89fc73813693940aaf11747a42a34 Mon Sep 17 00:00:00 2001 From: Ethan Girouard Date: Tue, 4 Aug 2026 19:58:21 -0400 Subject: [PATCH] Add LICENSE --- LICENSE | 22 +++++++++++++ flake.nix | 9 ++++++ overlay.nix | 92 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 123 insertions(+) create mode 100644 LICENSE create mode 100644 flake.nix create mode 100644 overlay.nix diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..4141755 --- /dev/null +++ b/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright © 2026 Ethan Girouard + + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the “Software”), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..306bdef --- /dev/null +++ b/flake.nix @@ -0,0 +1,9 @@ +{ + outputs = + { + ... + }: + { + overlays.default = import ./overlay.nix; + }; +} diff --git a/overlay.nix b/overlay.nix new file mode 100644 index 0000000..47017b7 --- /dev/null +++ b/overlay.nix @@ -0,0 +1,92 @@ +final: prev: { + rustPlatform = prev.rustPlatform // { + buildDioxusWebApp = prev.lib.extendMkDerivation { + constructDrv = prev.rustPlatform.buildRustPackage; + + excludeDrvArgNames = [ + "extraServerFeatures" + "extraClientFeatures" + "extraServerBundleArgs" + "extraClientBundleArgs" + "serverBundleArgs" + "clientBundleArgs" + ]; + + extendDrvArgs = + finalAttrs: + let + buildTypeFlag = if finalAttrs.cargoBuildType == "release" then "--release" else ""; + defaultFeaturesFlag = + if (finalAttrs.buildNoDefaultFeatures or false) then "--no-default-features" else ""; + in + { + nativeBuildInputs ? [ ], + + extraServerFeatures ? [ ], + extraClientFeatures ? [ ], + + extraServerBundleArgs ? [ ], + extraClientBundleArgs ? [ ], + + serverBundleArgs ? + let + serverFeatures = (finalAttrs.buildFeatures or [ ]) ++ extraServerFeatures; + in + [ + "--server" + "--frozen" + buildTypeFlag + defaultFeaturesFlag + ] + ++ extraServerBundleArgs + ++ (if serverFeatures != [ ] then [ "--features" ] ++ serverFeatures else [ ]), + + clientBundleArgs ? + let + clientFeatures = (finalAttrs.buildFeatures or [ ]) ++ extraClientFeatures; + in + [ + "--web" + "--frozen" + buildTypeFlag + defaultFeaturesFlag + ] + ++ extraClientBundleArgs + ++ (if clientFeatures != [ ] then [ "--features" ] ++ clientFeatures else [ ]), + ... + }: + { + nativeBuildInputs = + with prev; + [ + makeWrapper + dioxus-cli + lld + + ] + ++ (if finalAttrs.cargoBuildType == "release" then [ binaryen ] else [ ]) + ++ nativeBuildInputs; + + buildPhase = '' + runHook preBuild + + dx bundle \ + --out-dir "$out" \ + @server ${builtins.concatStringsSep " " serverBundleArgs} \ + @client ${builtins.concatStringsSep " " clientBundleArgs} + + runHook postBuild + ''; + + installPhase = '' + runHook preInstall + + makeWrapper "$out/server" "$out/bin/${finalAttrs.pname}" \ + --set DIOXUS_PUBLIC_PATH "$out/public" + + runHook postInstall + ''; + }; + }; + }; +}