This commit is contained in:
2025-10-24 16:06:50 +01:00
parent a2ac2390eb
commit aea0d5e933
3 changed files with 62 additions and 16 deletions

23
flake.lock generated
View File

@@ -53,7 +53,28 @@
"inputs": { "inputs": {
"crane": "crane", "crane": "crane",
"flake-utils": "flake-utils", "flake-utils": "flake-utils",
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs",
"rust-overlay": "rust-overlay"
}
},
"rust-overlay": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1761273263,
"narHash": "sha256-6d6ojnu6A6sVxIjig8OL6E1T8Ge9st3YGgVwg5MOY+Q=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "28405834d4fdd458d28e123fae4db148daecec6f",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
} }
}, },
"systems": { "systems": {

View File

@@ -7,6 +7,10 @@
crane.url = "github:ipetkov/crane"; crane.url = "github:ipetkov/crane";
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
}; };
outputs = outputs =
@@ -15,14 +19,28 @@
nixpkgs, nixpkgs,
crane, crane,
flake-utils, flake-utils,
rust-overlay,
... ...
}: }:
flake-utils.lib.eachDefaultSystem ( flake-utils.lib.eachDefaultSystem (
system: system:
let let
pkgs = nixpkgs.legacyPackages.${system}; pkgs = import nixpkgs {
overlays = [ (import rust-overlay) ];
localSystem = system;
crossSystem = {
config = "x86_64-w64-mingw32";
libc = "msvcrt";
};
};
craneLib = crane.mkLib pkgs; craneLib = crane.mkLib pkgs;
craneLib_wsl = (crane.mkLib pkgs).overrideToolchain (
p:
p.rust-bin.stable.latest.default.override {
targets = [ "x86_64-pc-windows-gnu" ];
}
);
# Common arguments can be set here to avoid repeating them later # Common arguments can be set here to avoid repeating them later
# Note: changes here will rebuild all dependency crates # Note: changes here will rebuild all dependency crates
@@ -49,6 +67,12 @@
# MY_CUSTOM_VAR = "some value"; # MY_CUSTOM_VAR = "some value";
} }
); );
my-crate-wsl = craneLib_wsl.buildPackage (
commonArgs
// {
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
}
);
in in
{ {
checks = { checks = {
@@ -56,6 +80,7 @@
}; };
packages.default = my-crate; packages.default = my-crate;
packages.default-wsl = my-crate-wsl;
apps.default = flake-utils.lib.mkApp { apps.default = flake-utils.lib.mkApp {
drv = my-crate; drv = my-crate;
@@ -70,20 +95,20 @@
# Extra inputs can be added here; cargo and rustc are provided by default. # Extra inputs can be added here; cargo and rustc are provided by default.
packages = with pkgs; [ packages = with pkgs; [
expat # expat
fontconfig # fontconfig
freetype # freetype
freetype.dev # freetype.dev
libGL # libGL
pkg-config # pkg-config
xorg.libX11 # xorg.libX11
xorg.libXcursor # xorg.libXcursor
xorg.libXi # xorg.libXi
xorg.libXrandr # xorg.libXrandr
wayland # wayland
libxkbcommon # libxkbcommon
]; ];
LD_LIBRARY_PATH = "${pkgs.libGL}/lib:${pkgs.fontconfig}/lib:${pkgs.freetype}/lib:${pkgs.vulkan-loader}/lib:${pkgs.wayland}/lib:${pkgs.xorg.libX11}/lib:${pkgs.libxkbcommon}/lib"; # LD_LIBRARY_PATH = "${pkgs.fontconfig}/lib:${pkgs.freetype}/lib:${pkgs.vulkan-loader}/lib:${pkgs.wayland}/lib:${pkgs.xorg.libX11}/lib:${pkgs.libxkbcommon}/lib";
}; };
} }
); );

View File

@@ -11,7 +11,7 @@ pub enum UpdateMessage {
} }
impl Todo { impl Todo {
pub fn view(&self) -> Column<UpdateMessage> { pub fn view(&self) -> Column<'_, UpdateMessage> {
column![text("meow").size(24)] column![text("meow").size(24)]
} }
pub fn update(&mut self, msg: UpdateMessage) { pub fn update(&mut self, msg: UpdateMessage) {