flakes/wayland stuff

This commit is contained in:
griffi-gh 2024-09-08 12:13:44 +02:00
parent 8202e99c8f
commit db3f7ae7f7
6 changed files with 157 additions and 1 deletions

1
.envrc Normal file
View file

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

1
.gitignore vendored
View file

@ -4,3 +4,4 @@ Cargo.lock
**/*.rs.bk
*.pdb
rustc-ice-*.txt
.direnv

100
flake.lock Normal file
View file

@ -0,0 +1,100 @@
{
"nodes": {
"fenix": {
"inputs": {
"nixpkgs": [
"nixpkgs"
],
"rust-analyzer-src": "rust-analyzer-src"
},
"locked": {
"lastModified": 1725777030,
"narHash": "sha256-mieHgCmdbr/Tok3djbEVnNyLtnxEv5PHngN8wBu+RJA=",
"owner": "nix-community",
"repo": "fenix",
"rev": "7c59cc75e7d2328753b00766ab0a78a075609b25",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "fenix",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1725534445,
"narHash": "sha256-Yd0FK9SkWy+ZPuNqUgmVPXokxDgMJoGuNpMEtkfcf84=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "9bb1e7571aadf31ddb4af77fc64b2d59580f9a39",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"fenix": "fenix",
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
},
"rust-analyzer-src": {
"flake": false,
"locked": {
"lastModified": 1725630423,
"narHash": "sha256-gNCLk3Zg7JlAwmWbVHTH6f3+iqdeQ4fheOotCZy8x5M=",
"owner": "rust-lang",
"repo": "rust-analyzer",
"rev": "08c7bbc2dbe4dcc8968484f1a0e1e6fe7a1d4f6d",
"type": "github"
},
"original": {
"owner": "rust-lang",
"ref": "nightly",
"repo": "rust-analyzer",
"type": "github"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

51
flake.nix Normal file
View file

@ -0,0 +1,51 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, flake-utils, fenix }:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = nixpkgs.legacyPackages.${system};
in {
devShell = pkgs.mkShell.override {
stdenv = if pkgs.stdenv.isLinux then
pkgs.stdenvAdapters.useMoldLinker pkgs.clangStdenv
else
pkgs.clangStdenv;
} rec {
packages = with pkgs; [
(fenix.packages.${system}.complete.withComponents [
"cargo"
"rustc"
"rust-src"
"rustfmt"
"rust-analyzer"
"clippy"
])
pkg-config
cmake
];
buildInputs = with pkgs; [
wayland
xorg.libxcb
libxkbcommon
vulkan-tools
vulkan-headers
vulkan-loader
libGL
xorg.libX11
xorg.libXcursor
xorg.libXi
xorg.libXrandr
glslang
];
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath buildInputs;
# RUSTFLAGS = "-Zthreads=8"; (causes rustc to ICE)
MANGOHUD_DLSYM = "1"; # mangohud glium fix
};
});
}

View file

@ -9,7 +9,7 @@ publish = false
hui = { path = "../hui" }
hui-glium = { path = "../hui-glium" }
hui-winit = { path = "../hui-winit" }
kubi-logging = { git = "https://github.com/griffi-gh/kubi", rev = "c162893fd" }
kubi-logging = { git = "https://github.com/griffi-gh/kubi", rev = "be1e24ba0c9e6d24128e7d0e74bebd8b90c23be7" }
glium = "0.35"
winit = "0.30"
glam = "0.28"

View file

@ -53,6 +53,9 @@ pub fn ui<T>(
WindowEvent::CloseRequested => {
window_target.exit();
},
WindowEvent::Resized(size) => {
display.resize((size.width, size.height));
},
WindowEvent::RedrawRequested => {
let mut frame = display.draw();
frame.clear_color_srgb(0.5, 0.5, 0.5, 1.);