initial
This commit is contained in:
commit
cb6fa4450a
15 changed files with 3865 additions and 0 deletions
98
flake.nix
Normal file
98
flake.nix
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
{
|
||||
description = "Confetti packaged for Nix/NixOS";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
# optional: pin a Rust toolchain via rust-overlay if you need nightly
|
||||
# rust-overlay.url = "github:oxalica/rust-overlay";
|
||||
};
|
||||
|
||||
outputs =
|
||||
{
|
||||
self,
|
||||
nixpkgs, # , rust-overlay
|
||||
}:
|
||||
let
|
||||
systems = [
|
||||
"x86_64-linux"
|
||||
"aarch64-linux"
|
||||
];
|
||||
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f (import nixpkgs { inherit system; }));
|
||||
in
|
||||
{
|
||||
packages = forAllSystems (
|
||||
pkgs:
|
||||
let
|
||||
lib = pkgs.lib;
|
||||
in
|
||||
{
|
||||
# name it default (and alias to confetti if you like)
|
||||
default = pkgs.rustPlatform.buildRustPackage {
|
||||
pname = "confetti";
|
||||
version = "unstable";
|
||||
src = ./.;
|
||||
cargoHash = "sha256-6lwp5gky+NKhE2IKVI2Qxqe5HT9a8xqWfrJ2e9CK6IE="; # run once to get the real hash
|
||||
|
||||
# NOTE: makeWrapper is needed for wrapProgram
|
||||
nativeBuildInputs = with pkgs; [
|
||||
pkg-config
|
||||
wayland-protocols
|
||||
makeWrapper
|
||||
];
|
||||
|
||||
# These are *runtime* libraries the app needs to load
|
||||
buildInputs = with pkgs; [
|
||||
wayland
|
||||
libxkbcommon
|
||||
vulkan-loader
|
||||
mesa
|
||||
];
|
||||
|
||||
# Ensure the Wayland/Vulkan/libxkbcommon libs are found at runtime
|
||||
postInstall =
|
||||
let
|
||||
libPath = lib.makeLibraryPath [
|
||||
pkgs.wayland
|
||||
pkgs.libxkbcommon
|
||||
pkgs.vulkan-loader
|
||||
pkgs.mesa
|
||||
];
|
||||
in
|
||||
''
|
||||
wrapProgram "$out/bin/confetti" \
|
||||
--prefix LD_LIBRARY_PATH : ${libPath}
|
||||
'';
|
||||
};
|
||||
|
||||
confetti = self.packages.${pkgs.system}.default;
|
||||
}
|
||||
);
|
||||
|
||||
# Expose a runnable `nix run`
|
||||
apps = forAllSystems (pkgs: {
|
||||
default = {
|
||||
type = "app";
|
||||
program = "${self.packages.${pkgs.system}.default}/bin/confetti";
|
||||
};
|
||||
});
|
||||
|
||||
# Nice dev shell for hacking locally (cargo, rustc, system libs)
|
||||
devShells = forAllSystems (pkgs: {
|
||||
default = pkgs.mkShell {
|
||||
nativeBuildInputs = with pkgs; [
|
||||
pkg-config
|
||||
rustc
|
||||
cargo
|
||||
# or: (rust-bin.stable.latest.default) if using rust-overlay
|
||||
wayland-protocols
|
||||
];
|
||||
buildInputs = with pkgs; [
|
||||
wayland
|
||||
libxkbcommon
|
||||
vulkan-loader
|
||||
mesa
|
||||
];
|
||||
};
|
||||
});
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue