wip nix flake

This commit is contained in:
Vinzenz Schroeter 2024-11-07 20:18:49 +01:00
parent b3e6ad1fc5
commit 373b823285
4 changed files with 97 additions and 3 deletions

2
.envrc
View file

@ -1 +1 @@
use nix
use flake

27
flake.lock Normal file
View file

@ -0,0 +1,27 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1730883749,
"narHash": "sha256-mwrFF0vElHJP8X3pFCByJR365Q2463ATp2qGIrDUdlE=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "dba414932936fde69f0606b4f1d87c5bc0003ede",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-24.05",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

41
flake.nix Normal file
View file

@ -0,0 +1,41 @@
{
description = "Flake for servicepoint-simulator";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
};
outputs =
inputs@{ self, nixpkgs }:
rec {
packages.hello = nixpkgs.rustPlatform.buildRustPackage rec {
pname = "servicepoint-simulator";
version = "0.0.1";
src = [ ]; # TODO: src, Cargo.toml etc
buildInputs = [
];
nativeBuildInputs = with nixpkgs.legacyPackages.x86_64-linux; [ pkgconfig ];
cargoSha256 = "sha256-0hfmV4mbr3l86m0X7EMYTOu/b+BjueVEbbyQz0KgOFY=";
meta = with nixpkgs.stdenv.lib; {
homepage = "";
description = "";
#license = licenses.gplv3;
};
legacyPackages = packages;
defaultPackage = packages.hello;
};
devShells.x86_64-linux.default = import ./shell.nix { pkgs = nixpkgs.legacyPackages.x86_64-linux; };
formatter = {
x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixfmt-rfc-style;
aarch64-linux = nixpkgs.legacyPackages.aarch64-linux.nixfmt-rfc-style;
};
};
}

View file

@ -1,14 +1,40 @@
{pkgs ? import <nixpkgs> {}}:
{
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; [
rustc cargo gcc rustfmt clippy
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
]
);
}