add nix build files

This commit is contained in:
2025-04-01 05:40:54 +00:00
parent bd5a1aaae0
commit 5c85efedde
3 changed files with 92 additions and 0 deletions

47
default.nix Normal file
View File

@@ -0,0 +1,47 @@
{
libglvnd,
libxkbcommon,
rustPlatform,
vulkan-loader,
wayland,
}:
rustPlatform.buildRustPackage {
name = "mslicer";
src = ./.;
cargoHash = "sha256-mRbEwxR6bMkybxe7H1dX4Qa1elGiw/lSSz9sSTtp1zw=";
useFetchCargoVendor = true;
buildInputs = [
libglvnd
libxkbcommon
vulkan-loader
wayland
];
NIX_LDFLAGS = [
"--push-state"
"--no-as-needed"
"-lEGL"
"-lvulkan"
"-lwayland-client"
"-lxkbcommon"
"--pop-state"
];
doInstallCheck = true;
installCheckPhase = ''
runHook preInstallCheck
# spot-check the binaries
$out/bin/goo_format --help
# these other binaries can't be invoked w/ interactivity or real data:
test -x $out/bin/mslicer
test -x $out/bin/remote_send
test -x $out/bin/slicer
runHook postInstallCheck
'';
strictDeps = true;
}

26
flake.lock generated Normal file
View File

@@ -0,0 +1,26 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1743315132,
"narHash": "sha256-6hl6L/tRnwubHcA4pfUUtk542wn2Om+D4UnDhlDW9BE=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "52faf482a3889b7619003c0daec593a1912fddc1",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-unstable",
"type": "indirect"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

19
flake.nix Normal file
View File

@@ -0,0 +1,19 @@
{
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
};
outputs = { self, nixpkgs }:
let
system = "x86_64-linux";
pkgs = import nixpkgs {
inherit system;
};
in
{
packages.${system}.default = pkgs.callPackage ./default.nix { };
devShells.${system}.default = with pkgs; mkShell {
inputsFrom = [ self.packages.${system}.default ];
};
};
}