chore: nix fmt

This commit is contained in:
Tobias Berger 2024-02-05 21:27:19 +01:00
parent b9108c29b2
commit 1cc53fbfb6
Signed by: toby
GPG key ID: 2D05EFAB764D6A88
3 changed files with 62 additions and 58 deletions

View file

@ -1,32 +1,32 @@
{ pkgs ? import <nixpkgs> { } }:
let manifest = (pkgs.lib.importTOML ./Cargo.toml).package;
packages = with pkgs; [
pkg-config
libGLU
libGL
libxkbcommon
wayland
];
{pkgs ? import <nixpkgs> {}}: let
manifest = (pkgs.lib.importTOML ./Cargo.toml).package;
packages = with pkgs; [
pkg-config
libGLU
libGL
libxkbcommon
wayland
];
in
pkgs.rustPlatform.buildRustPackage rec {
pname = manifest.name;
version = manifest.version;
cargoLock.lockFile = ./Cargo.lock;
src = pkgs.lib.cleanSource ./.;
pkgs.rustPlatform.buildRustPackage {
pname = manifest.name;
version = manifest.version;
cargoLock.lockFile = ./Cargo.lock;
src = pkgs.lib.cleanSource ./.;
meta = {
description = manifest.description ? null;
};
postBuild = ''
patchelf --add-needed libxkbcommon.so target/x86_64-unknown-linux-gnu/release/todoodoo
patchelf --add-needed libwayland-client.so target/x86_64-unknown-linux-gnu/release/todoodoo
patchelf --add-needed libGLU.so target/x86_64-unknown-linux-gnu/release/todoodoo
patchelf --add-needed libEGL.so target/x86_64-unknown-linux-gnu/release/todoodoo
old_rpath=$(patchelf --print-rpath target/x86_64-unknown-linux-gnu/release/todoodoo)
if [[ -z "$old_rpath" ]]; then
patchelf --set-rpath "${pkgs.lib.makeLibraryPath packages}" target/x86_64-unknown-linux-gnu/release/todoodoo
else
patchelf --set-rpath "${pkgs.lib.makeLibraryPath packages}:$old_rpath" target/x86_64-unknown-linux-gnu/release/todoodoo
fi
'';
}
meta = {
description = manifest.description ? null;
};
postBuild = ''
patchelf --add-needed libxkbcommon.so target/x86_64-unknown-linux-gnu/release/todoodoo
patchelf --add-needed libwayland-client.so target/x86_64-unknown-linux-gnu/release/todoodoo
patchelf --add-needed libGLU.so target/x86_64-unknown-linux-gnu/release/todoodoo
patchelf --add-needed libEGL.so target/x86_64-unknown-linux-gnu/release/todoodoo
old_rpath=$(patchelf --print-rpath target/x86_64-unknown-linux-gnu/release/todoodoo)
if [[ -z "$old_rpath" ]]; then
patchelf --set-rpath "${pkgs.lib.makeLibraryPath packages}" target/x86_64-unknown-linux-gnu/release/todoodoo
else
patchelf --set-rpath "${pkgs.lib.makeLibraryPath packages}:$old_rpath" target/x86_64-unknown-linux-gnu/release/todoodoo
fi
'';
}

View file

@ -3,18 +3,20 @@
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
};
outputs = { self, nixpkgs }:
let
supportedSystems = [ "x86_64-linux" ];
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
pkgsFor = nixpkgs.legacyPackages;
in {
packages = forAllSystems (system: {
default = pkgsFor.${system}.callPackage ./default.nix { };
});
devShells = forAllSystems (system: {
default = pkgsFor.${system}.callPackage ./shell.nix { };
});
};
outputs = {
self,
nixpkgs,
}: let
supportedSystems = ["x86_64-linux"];
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
pkgsFor = nixpkgs.legacyPackages;
in {
formatter = forAllSystems (system: pkgsFor.${system}.alejandra);
packages = forAllSystems (system: {
default = pkgsFor.${system}.callPackage ./default.nix {};
});
devShells = forAllSystems (system: {
default = pkgsFor.${system}.callPackage ./shell.nix {};
});
};
}

View file

@ -1,5 +1,8 @@
{ pkgs ? import <nixpkgs> { }, lib }:
let packages = with pkgs; [
{
pkgs ? import <nixpkgs> {},
lib,
}: let
packages = with pkgs; [
rust-analyzer
rustfmt
clippy
@ -12,18 +15,17 @@ let packages = with pkgs; [
libGLU
libGL
libxkbcommon
wayland
];
in
pkgs.mkShell {
# Get dependencies from the main package
inputsFrom = [ (pkgs.callPackage ./default.nix { }) ];
nativeBuildInputs = packages;
buildInputs = packages;
env = {
LIBCLANG_PATH = "${pkgs.libclang.lib}/lib";
LD_LIBRARY_PATH = "${lib.makeLibraryPath packages}";
};
}
pkgs.mkShell {
# Get dependencies from the main package
inputsFrom = [(pkgs.callPackage ./default.nix {})];
nativeBuildInputs = packages;
buildInputs = packages;
env = {
LIBCLANG_PATH = "${pkgs.libclang.lib}/lib";
LD_LIBRARY_PATH = "${lib.makeLibraryPath packages}";
};
}