66 lines
1.7 KiB
Nix
66 lines
1.7 KiB
Nix
{
|
|
description = "A basic flake with a shell";
|
|
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
|
inputs.flake-utils.url = "github:numtide/flake-utils";
|
|
inputs.naersk.url = "github:nix-community/naersk";
|
|
inputs.rust-overlay.url = "github:oxalica/rust-overlay";
|
|
|
|
outputs =
|
|
{
|
|
self,
|
|
nixpkgs,
|
|
flake-utils,
|
|
naersk,
|
|
rust-overlay,
|
|
}:
|
|
flake-utils.lib.eachDefaultSystem (
|
|
system:
|
|
let
|
|
pkgs = import nixpkgs {
|
|
inherit system;
|
|
overlays = [ (import rust-overlay) ];
|
|
};
|
|
rust = pkgs.rust-bin.stable.latest.default;
|
|
naersk' = pkgs.callPackage naersk {
|
|
cargo = rust;
|
|
rustc = rust;
|
|
};
|
|
libPath =
|
|
with pkgs;
|
|
lib.makeLibraryPath [
|
|
libxkbcommon
|
|
wayland
|
|
vulkan-loader
|
|
];
|
|
in
|
|
{
|
|
devShell = pkgs.mkShell {
|
|
nativeBuildInputs = [ rust ] ++ (with pkgs; [ cargo-watch ]);
|
|
RUST_PATH = "${rust}";
|
|
RUST_DOC_PATH = "${rust}/share/doc/rust/html/std/index.html";
|
|
LD_LIBRARY_PATH = libPath;
|
|
};
|
|
|
|
packages = rec {
|
|
glaurung = default;
|
|
default = naersk'.buildPackage {
|
|
src = ./.;
|
|
nativeBuildInputs = with pkgs; [
|
|
makeWrapper
|
|
copyDesktopItems
|
|
];
|
|
postInstall = ''
|
|
wrapProgram "$out/bin/glaurung" --prefix LD_LIBRARY_PATH : "${libPath}"
|
|
'';
|
|
desktopItems = [
|
|
(pkgs.makeDesktopItem {
|
|
name = "glaurung";
|
|
exec = "glaurung";
|
|
desktopName = "Glaurung";
|
|
})
|
|
];
|
|
};
|
|
};
|
|
}
|
|
);
|
|
}
|