This commit is contained in:
2025-10-19 21:24:19 +01:00
commit 7fb0f64beb
7 changed files with 291 additions and 0 deletions

1
.envrc Normal file
View File

@@ -0,0 +1 @@
use flake

2
.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
/target
.direnv

110
Cargo.lock generated Normal file
View File

@@ -0,0 +1,110 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
[[package]]
name = "bitflags"
version = "2.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2261d10cca569e4643e526d8dc2e62e433cc8aba21ab764233731f8d369bf394"
[[package]]
name = "cc"
version = "1.2.41"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac9fe6cdbb24b6ade63616c0a0688e45bb56732262c158df3c0c4bea4ca47cb7"
dependencies = [
"find-msvc-tools",
"shlex",
]
[[package]]
name = "cmake"
version = "0.1.54"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e7caa3f9de89ddbe2c607f4101924c5abec803763ae9534e4f4d7d8f84aa81f0"
dependencies = [
"cc",
]
[[package]]
name = "cmk"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8fd5de2a10e31b3ec3e8d75e7ccf8281ab3ee55de68f7ab6ffa9e21be8d82f22"
[[package]]
name = "crossbeam-channel"
version = "0.5.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "82b8f8f868b36967f9606790d1903570de9ceaf870a7bf9fbbd3016d636a2cb2"
dependencies = [
"crossbeam-utils",
]
[[package]]
name = "crossbeam-utils"
version = "0.8.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28"
[[package]]
name = "find-msvc-tools"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "52051878f80a721bb68ebfbc930e07b65ba72f2da88968ea5c06fd6ca3d3a127"
[[package]]
name = "fltk"
version = "1.5.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7429b2b1ba9acbcae0baed7299ef790315a599672689197aee8c03ed044fb504"
dependencies = [
"bitflags",
"crossbeam-channel",
"fltk-sys",
"once_cell",
"paste",
"ttf-parser",
]
[[package]]
name = "fltk-sys"
version = "1.5.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "385fb24ba98b69a068c934f953b6b73970ab034db76090c61e12157baf7fb675"
dependencies = [
"cmake",
"cmk",
]
[[package]]
name = "once_cell"
version = "1.21.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
[[package]]
name = "paste"
version = "1.0.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
[[package]]
name = "shlex"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
[[package]]
name = "ttf-parser"
version = "0.25.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2df906b07856748fa3f6e0ad0cbaa047052d4a7dd609e231c4f72cee8c36f31"
[[package]]
name = "ui_testing"
version = "0.1.0"
dependencies = [
"fltk",
]

7
Cargo.toml Normal file
View File

@@ -0,0 +1,7 @@
[package]
name = "ui_testing"
version = "0.1.0"
edition = "2024"
[dependencies]
fltk = { version = "1.5", features = ["use-wayland", "fltk-bundled"] }

63
flake.lock generated Normal file
View File

@@ -0,0 +1,63 @@
{
"nodes": {
"fenix": {
"inputs": {
"nixpkgs": [
"nixpkgs"
],
"rust-analyzer-src": "rust-analyzer-src"
},
"locked": {
"lastModified": 1759301100,
"narHash": "sha256-hmiTEoVAqLnn80UkreCNunnRKPucKvcg5T4/CELEtbw=",
"rev": "0956bc5d1df2ea800010172c6bc4470d9a22cb81",
"revCount": 2408,
"type": "tarball",
"url": "https://api.flakehub.com/f/pinned/nix-community/fenix/0.1.2408%2Brev-0956bc5d1df2ea800010172c6bc4470d9a22cb81/01999edc-854f-7714-9439-7c9ee1181398/source.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://flakehub.com/f/nix-community/fenix/0.1"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1760524057,
"narHash": "sha256-EVAqOteLBFmd7pKkb0+FIUyzTF61VKi7YmvP1tw4nEw=",
"rev": "544961dfcce86422ba200ed9a0b00dd4b1486ec5",
"revCount": 878042,
"type": "tarball",
"url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.1.878042%2Brev-544961dfcce86422ba200ed9a0b00dd4b1486ec5/0199ea66-30cf-75ea-9291-792c21aea771/source.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://flakehub.com/f/NixOS/nixpkgs/0.1"
}
},
"root": {
"inputs": {
"fenix": "fenix",
"nixpkgs": "nixpkgs"
}
},
"rust-analyzer-src": {
"flake": false,
"locked": {
"lastModified": 1759245522,
"narHash": "sha256-H4Hx/EuMJ9qi1WzPV4UG2bbZiDCdREtrtDvYcHr0kmk=",
"owner": "rust-lang",
"repo": "rust-analyzer",
"rev": "a6bc4a4bbe6a65b71cbf76a0cf528c47a8d9f97f",
"type": "github"
},
"original": {
"owner": "rust-lang",
"ref": "nightly",
"repo": "rust-analyzer",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

99
flake.nix Normal file
View File

@@ -0,0 +1,99 @@
{
description = "A Nix-flake-based Rust development environment";
inputs = {
nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1"; # unstable Nixpkgs
fenix = {
url = "https://flakehub.com/f/nix-community/fenix/0.1";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{ self, ... }@inputs:
let
supportedSystems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
forEachSupportedSystem =
f:
inputs.nixpkgs.lib.genAttrs supportedSystems (
system:
f {
pkgs = import inputs.nixpkgs {
inherit system;
overlays = [
inputs.self.overlays.default
];
};
}
);
in
{
overlays.default = final: prev: {
rustToolchain =
with inputs.fenix.packages.${prev.stdenv.hostPlatform.system};
combine (
with stable;
[
clippy
rustc
cargo
rustfmt
rust-src
]
);
};
devShells = forEachSupportedSystem (
{ pkgs }:
{
default = pkgs.mkShellNoCC rec {
packages = with pkgs; [
rustToolchain
openssl
pkg-config # make sure .pc files can be found
cargo-deny
cargo-edit
cargo-watch
rust-analyzer
gcc
cmake
wayland
libxkbcommon
dbus
fontconfig
xorg.libX11 # X11 headers/libs
pango
glib
cairo
libxcursor
libxfixes
xorg.libXinerama
x11basic
];
# export paths so tools like rust-analyzer and native configure scripts can find things
env = {
# Required by rust-analyzer:
RUST_SRC_PATH = "${pkgs.rustToolchain}/lib/rustlib/src/rust/library";
# Make a combined library path from the packages in this shell
LD_LIBRARY_PATH = "${pkgs.lib.makeLibraryPath packages}";
# Some build systems don't pick up NIX_CFLAGS_COMPILE/NIX_LDFLAGS;
# exporting these helps autoconf-based configure scripts:
# NIX_CFLAGS_COMPILE = "${
# pkgs.stdenv.cc.libcxxFlags or ""
# } ${pkgs.lib.makeString ''-I${pkgs.xorg.libX11}/include''}";
# NIX_LDFLAGS = "${pkgs.lib.makeString ''-L${pkgs.xorg.libX11}/lib''}";
};
};
}
);
};
}

9
src/main.rs Normal file
View File

@@ -0,0 +1,9 @@
use fltk::{app, prelude::*, window::Window};
fn main() {
let app = app::App::default();
let mut wind = Window::new(100, 100, 400, 300, "Hello from rust");
wind.end();
wind.show();
app.run().unwrap();
}