working flake
This commit is contained in:
parent
c23f69ae14
commit
4ddec8eef2
6 changed files with 170 additions and 120 deletions
79
flake.nix
79
flake.nix
|
@ -3,33 +3,46 @@
|
|||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
|
||||
naersk = {
|
||||
url = "github:nix-community/naersk";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
|
||||
outputs =
|
||||
inputs@{ self, nixpkgs }:
|
||||
inputs@{
|
||||
self,
|
||||
nixpkgs,
|
||||
naersk,
|
||||
}:
|
||||
let
|
||||
lib = nixpkgs.lib;
|
||||
forAllSystems = lib.genAttrs lib.systems.flakeExposed;
|
||||
supported-systems = [
|
||||
"x86_64-linux"
|
||||
"aarch64-linux"
|
||||
"aarch64-darwin"
|
||||
"x86_64-darwin"
|
||||
];
|
||||
forAllSystems = lib.genAttrs supported-systems;
|
||||
in
|
||||
rec {
|
||||
packages = forAllSystems (
|
||||
system:
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages."${system}";
|
||||
naersk' = pkgs.callPackage naersk {
|
||||
cargo = pkgs.cargo;
|
||||
rustc = pkgs.rustc;
|
||||
};
|
||||
in
|
||||
{
|
||||
default = pkgs.rustPlatform.buildRustPackage {
|
||||
pname = "servicepoint-simulator";
|
||||
version = "0.0.1";
|
||||
cargoLock = {
|
||||
lockFile = ./Cargo.lock;
|
||||
allowBuiltinFetchGit = true;
|
||||
};
|
||||
|
||||
rec {
|
||||
servicepoint-simulator = naersk'.buildPackage rec {
|
||||
src = ./.;
|
||||
|
||||
nativeBuildInputs = with pkgs; [ pkg-config ];
|
||||
|
||||
nativeBuildInputs = with pkgs; [
|
||||
pkg-config
|
||||
makeWrapper
|
||||
];
|
||||
strictDeps = true;
|
||||
buildInputs =
|
||||
with pkgs;
|
||||
[
|
||||
|
@ -39,18 +52,36 @@
|
|||
++ (lib.optionals pkgs.stdenv.isLinux (
|
||||
with pkgs;
|
||||
[
|
||||
xorg.libxkbfile
|
||||
wayland
|
||||
libxkbcommon
|
||||
libGL
|
||||
|
||||
# WINIT_UNIX_BACKEND=wayland
|
||||
wayland
|
||||
|
||||
# WINIT_UNIX_BACKEND=x11
|
||||
xorg.libXcursor
|
||||
xorg.libXrandr
|
||||
xorg.libXi
|
||||
xorg.libX11
|
||||
xorg.libX11.dev
|
||||
]
|
||||
));
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "";
|
||||
description = "";
|
||||
license = licenses.gpl3;
|
||||
};
|
||||
postInstall = ''
|
||||
wrapProgram $out/bin/servicepoint-simulator \
|
||||
--suffix LD_LIBRARY_PATH : ${lib.makeLibraryPath buildInputs}
|
||||
'';
|
||||
|
||||
#postFixup = ''
|
||||
# patchelf $out/bin/servicepoint-simulator --add-rpath ${pkgs.lib.makeLibraryPath buildInputs}
|
||||
#'';
|
||||
|
||||
#postInstall = ''
|
||||
# patchelf $out/bin/servicepoint-simulator --add-rpath ${pkgs.lib.makeLibraryPath buildInputs}
|
||||
#'';
|
||||
};
|
||||
|
||||
default = servicepoint-simulator;
|
||||
}
|
||||
);
|
||||
|
||||
|
@ -62,13 +93,15 @@
|
|||
pkgs = nixpkgs.legacyPackages."${system}";
|
||||
in
|
||||
{
|
||||
default = pkgs.mkShell {
|
||||
default = pkgs.mkShell rec {
|
||||
inputsFrom = [ self.packages.${system}.default ];
|
||||
packages = with pkgs; [
|
||||
rustfmt
|
||||
cargo-expand
|
||||
];
|
||||
#LD_LIBRARY_PATH="${pkgs.lib.makeLibraryPath buildInputs}";
|
||||
# LD_LIBRARY_PATH = "${pkgs.lib.makeLibraryPath (
|
||||
# builtins.concatMap (d: d.runtimeDependencies) inputsFrom
|
||||
# )}";
|
||||
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue