wip nix flake

This commit is contained in:
Vinzenz Schroeter 2024-11-07 23:24:41 +01:00
parent 4e4febb281
commit c23f69ae14
3 changed files with 64 additions and 67 deletions

View file

@ -17,7 +17,9 @@ The screenshot above shows the output of two example projects running in paralle
## Running ## Running
Check out this repository and run `cargo run --release`. With nix flakes: `nix run github:kaesaecracker/servicepoint-simulator`
Without nix: check out this repository and use `cargo run --release`.
## Command line arguments ## Command line arguments

View file

@ -8,37 +8,72 @@
outputs = outputs =
inputs@{ self, nixpkgs }: inputs@{ self, nixpkgs }:
let let
servicepoint-simulator = nixpkgs.legacyPackages.x86_64-linux.rustPlatform.buildRustPackage rec { lib = nixpkgs.lib;
pname = "servicepoint-simulator"; forAllSystems = lib.genAttrs lib.systems.flakeExposed;
version = "0.0.1";
src = ./.; # TODO: src, Cargo.toml etc
buildInputs = [
];
nativeBuildInputs = with nixpkgs.legacyPackages.x86_64-linux; [ pkg-config ];
#cargoSha256 = "sha256-0hfmV4mbr3l86m0X7EMYTOu/b+BjueVEbbyQz0KgOFY=";
cargoLock.lockFile = ./Cargo.lock;
meta = with nixpkgs.stdenv.lib; {
homepage = "";
description = "";
#license = licenses.gplv3;
};
};
in in
rec { rec {
packages.x86_64-linux.default = servicepoint-simulator; packages = forAllSystems (
system:
let
pkgs = nixpkgs.legacyPackages."${system}";
in
{
default = pkgs.rustPlatform.buildRustPackage {
pname = "servicepoint-simulator";
version = "0.0.1";
cargoLock = {
lockFile = ./Cargo.lock;
allowBuiltinFetchGit = true;
};
src = ./.;
nativeBuildInputs = with pkgs; [ pkg-config ];
buildInputs =
with pkgs;
[
xe
lzma
]
++ (lib.optionals pkgs.stdenv.isLinux (
with pkgs;
[
xorg.libxkbfile
wayland
libxkbcommon
]
));
meta = with lib; {
homepage = "";
description = "";
license = licenses.gpl3;
};
};
}
);
legacyPackages = packages; legacyPackages = packages;
devShells.x86_64-linux.default = import ./shell.nix { pkgs = nixpkgs.legacyPackages.x86_64-linux; }; devShells = forAllSystems (
system:
formatter = { let
x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixfmt-rfc-style; pkgs = nixpkgs.legacyPackages."${system}";
aarch64-linux = nixpkgs.legacyPackages.aarch64-linux.nixfmt-rfc-style; in
{
default = pkgs.mkShell {
inputsFrom = [ self.packages.${system}.default ];
packages = with pkgs; [
rustfmt
cargo-expand
];
#LD_LIBRARY_PATH="${pkgs.lib.makeLibraryPath buildInputs}";
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
}; };
}
);
formatter = forAllSystems (system: nixpkgs.legacyPackages."${system}".nixfmt-rfc-style);
}; };
} }

View file

@ -1,40 +0,0 @@
{
pkgs ? import <nixpkgs> { },
}:
let
rust-toolchain = pkgs.symlinkJoin {
name = "rust-toolchain";
paths = with pkgs; [
rustc
cargo
rustPlatform.rustcSrc
rustfmt
clippy
cargo-expand
];
};
in
pkgs.mkShell {
nativeBuildInputs = with pkgs.buildPackages; [
rust-toolchain
pkg-config
xe
lzma
# linux x11 / wayland
libxkbcommon
#xorg.libxkbfile
wayland
];
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath (
with pkgs;
[
wayland
libxkbcommon
]
);
}