fix my shit ahh flake
This commit is contained in:
parent
25465a9f48
commit
4508aeab76
2 changed files with 78 additions and 64 deletions
39
flake.lock
generated
39
flake.lock
generated
|
|
@ -1,26 +1,5 @@
|
||||||
{
|
{
|
||||||
"nodes": {
|
"nodes": {
|
||||||
"fenix": {
|
|
||||||
"inputs": {
|
|
||||||
"nixpkgs": [
|
|
||||||
"nixpkgs"
|
|
||||||
],
|
|
||||||
"rust-analyzer-src": "rust-analyzer-src"
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1773299640,
|
|
||||||
"narHash": "sha256-kTsZ5xGZqaeJ8jWsfZNACo/VsW3riVuIQEPWVGiqWKM=",
|
|
||||||
"owner": "nix-community",
|
|
||||||
"repo": "fenix",
|
|
||||||
"rev": "8ac78ff968869cd05d9cb42fbf63bdbc6851ec19",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "nix-community",
|
|
||||||
"repo": "fenix",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1773222311,
|
"lastModified": 1773222311,
|
||||||
|
|
@ -39,28 +18,10 @@
|
||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"fenix": "fenix",
|
|
||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": "nixpkgs",
|
||||||
"systems": "systems"
|
"systems": "systems"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"rust-analyzer-src": {
|
|
||||||
"flake": false,
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1773194001,
|
|
||||||
"narHash": "sha256-50PPXBtH2xfKuNfQfUNOyuIFgZPEz5QVertQWS2MQJE=",
|
|
||||||
"owner": "rust-lang",
|
|
||||||
"repo": "rust-analyzer",
|
|
||||||
"rev": "8ed3cca4d30610fd0d3c1179c85418de2dc0a7c1",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "rust-lang",
|
|
||||||
"ref": "nightly",
|
|
||||||
"repo": "rust-analyzer",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"systems": {
|
"systems": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1681028828,
|
"lastModified": 1681028828,
|
||||||
|
|
|
||||||
103
flake.nix
103
flake.nix
|
|
@ -4,9 +4,6 @@
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
|
||||||
systems.url = "github:nix-systems/default";
|
systems.url = "github:nix-systems/default";
|
||||||
|
|
||||||
fenix.url = "github:nix-community/fenix";
|
|
||||||
fenix.inputs.nixpkgs.follows = "nixpkgs";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = {
|
outputs = {
|
||||||
|
|
@ -38,36 +35,92 @@
|
||||||
|
|
||||||
devShells = forAllSystems (
|
devShells = forAllSystems (
|
||||||
{
|
{
|
||||||
system,
|
|
||||||
pkgs,
|
pkgs,
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
default = pkgs.mkShell rec {
|
default = let
|
||||||
shell = "${pkgs.bash}/bin/bash";
|
nixForBindings = pkgs.nixVersions.nix_2_32;
|
||||||
strictDeps = true;
|
inherit (pkgs.rustc) llvmPackages;
|
||||||
|
in
|
||||||
|
pkgs.mkShell rec {
|
||||||
|
name = "nixide";
|
||||||
|
shell = "${pkgs.bash}/bin/bash";
|
||||||
|
strictDeps = true;
|
||||||
|
|
||||||
packages = with pkgs; [
|
# packages we need at runtime
|
||||||
cargo
|
packages = with pkgs; [
|
||||||
rustc
|
rustc
|
||||||
inputs.fenix.packages.${system}.complete.rustfmt
|
llvmPackages.lld
|
||||||
];
|
lldb
|
||||||
|
|
||||||
# packages we should be able to link against
|
cargo
|
||||||
buildInputs = with pkgs; [
|
# cargo-c
|
||||||
# pipewire.dev
|
cargo-llvm-cov
|
||||||
# libxkbcommon
|
cargo-nextest
|
||||||
# wayland
|
|
||||||
];
|
|
||||||
|
|
||||||
# packages we run at build time / shellHook
|
rust-analyzer-unwrapped
|
||||||
nativeBuildInputs = with pkgs; [
|
(rustfmt.override {asNightly = true;})
|
||||||
pkg-config
|
clippy
|
||||||
rustPlatform.bindgenHook
|
taplo
|
||||||
];
|
];
|
||||||
|
|
||||||
LD_LIBRARY_PATH = "$LD_LIBRARY_PATH:${builtins.toString (lib.makeLibraryPath buildInputs)}";
|
# packages we need at build time
|
||||||
};
|
nativeBuildInputs = with pkgs; [
|
||||||
|
pkg-config
|
||||||
|
glibc.dev
|
||||||
|
nixForBindings.dev
|
||||||
|
|
||||||
|
rustPlatform.bindgenHook
|
||||||
|
];
|
||||||
|
|
||||||
|
# packages we link against
|
||||||
|
buildInputs = with pkgs; [
|
||||||
|
stdenv.cc
|
||||||
|
|
||||||
|
nixForBindings
|
||||||
|
];
|
||||||
|
|
||||||
|
# bindgen uses clang to generate bindings, but it doesn't know where to
|
||||||
|
# find our stdenv cc's headers, so when it's gcc, we need to tell it.
|
||||||
|
postConfigure = lib.optionalString pkgs.stdenv.cc.isGNU ''
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
# REF: https://github.com/nixops4/nix-bindings-rust/blob/main/bindgen-gcc.sh
|
||||||
|
# Rust bindgen uses Clang to generate bindings, but that means that it can't
|
||||||
|
# find the "system" or compiler headers when the stdenv compiler is GCC.
|
||||||
|
# This script tells it where to find them.
|
||||||
|
|
||||||
|
echo "Extending BINDGEN_EXTRA_CLANG_ARGS with system include paths..." 2>&1
|
||||||
|
BINDGEN_EXTRA_CLANG_ARGS="$${BINDGEN_EXTRA_CLANG_ARGS:-}"
|
||||||
|
export BINDGEN_EXTRA_CLANG_ARGS
|
||||||
|
include_paths=$(
|
||||||
|
echo | $NIX_CC_UNWRAPPED -v -E -x c - 2>&1 \
|
||||||
|
| awk '/#include <...> search starts here:/{flag=1;next} \
|
||||||
|
/End of search list./{flag=0} \
|
||||||
|
flag==1 {print $1}'
|
||||||
|
)
|
||||||
|
for path in $include_paths; do
|
||||||
|
echo " - $path" 2>&1
|
||||||
|
BINDGEN_EXTRA_CLANG_ARGS="$BINDGEN_EXTRA_CLANG_ARGS -I$path"
|
||||||
|
done
|
||||||
|
'';
|
||||||
|
shellHook = postConfigure;
|
||||||
|
|
||||||
|
env = let
|
||||||
|
inherit (llvmPackages) llvm libclang;
|
||||||
|
in {
|
||||||
|
LD_LIBRARY_PATH = "$LD_LIBRARY_PATH:${builtins.toString (lib.makeLibraryPath buildInputs)}";
|
||||||
|
LIBCLANG_PATH = "${libclang.lib}/lib";
|
||||||
|
|
||||||
|
RUST_SRC_PATH = "${pkgs.rustPlatform.rustLibSrc}";
|
||||||
|
BINDGEN_EXTRA_CLANG_ARGS = "--sysroot=${pkgs.glibc.dev}";
|
||||||
|
|
||||||
|
# `cargo-llvm-cov` reads these environment variables to find these binaries,
|
||||||
|
# which are needed to run the tests
|
||||||
|
LLVM_COV = "${llvm}/bin/llvm-cov";
|
||||||
|
LLVM_PROFDATA = "${llvm}/bin/llvm-profdata";
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue