Simplify flake

This commit is contained in:
Thomas Zahner 2024-11-24 12:22:34 +01:00
parent 772c869323
commit 88b6282493
2 changed files with 35 additions and 75 deletions

View file

@ -1,25 +1,5 @@
{
"nodes": {
"flake-parts": {
"inputs": {
"nixpkgs-lib": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1730504689,
"narHash": "sha256-hgmguH29K2fvs9szpq2r3pz2/8cJd2LPS+b4tfNFCwE=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "506278e768c2a08bec68eb62932193e341f55c90",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1732014248,
@ -54,7 +34,6 @@
},
"root": {
"inputs": {
"flake-parts": "flake-parts",
"nixpkgs": "nixpkgs",
"rust-overlay": "rust-overlay"
}

View file

@ -1,66 +1,47 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-parts = {
url = "github:hercules-ci/flake-parts";
inputs.nixpkgs-lib.follows = "nixpkgs";
};
rust-overlay.url = "github:oxalica/rust-overlay";
};
outputs =
inputs@{ self, flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = [
"x86_64-linux"
"aarch64-linux"
];
perSystem =
{
config,
self',
inputs',
pkgs,
system,
...
}:
{
_module.args.pkgs = import self.inputs.nixpkgs {
inherit system;
overlays = [
(import inputs.rust-overlay)
{
nixpkgs,
rust-overlay,
...
}:
let
system = "x86_64-linux";
pkgs = import nixpkgs {
inherit system;
overlays = [ (import rust-overlay) ];
};
in
{
devShells.${system}.default =
let
rustVersion = "latest"; # using a specific version: "1.62.0"
rust = pkgs.rust-bin.stable.${rustVersion}.default.override {
extensions = [
"rust-src" # for rust-analyzer
"rust-analyzer" # usable by IDEs like zed-editor
"clippy"
];
};
devShells.default =
let
rustVersion = "latest"; # using a specific version: "1.62.0"
rust = pkgs.rust-bin.stable.${rustVersion}.default.override {
extensions = [
"rust-src" # for rust-analyzer
"rust-analyzer" # usable by IDEs like zed-editor
"clippy"
];
};
libPath =
with pkgs;
lib.makeLibraryPath [
pkg-config
openssl
];
in
pkgs.mkShell {
inputsFrom = builtins.attrValues self'.packages;
packages = [
pkgs.pkg-config
pkgs.openssl
rust
];
LD_LIBRARY_PATH = libPath;
RUST_BACKTRACE = 1;
LIBCLANG_PATH = "${pkgs.libclang.lib}/lib";
};
libPath = pkgs.lib.makeLibraryPath [
pkgs.pkg-config
pkgs.openssl
];
in
pkgs.mkShell {
packages = [
pkgs.pkg-config
pkgs.openssl
rust
];
LD_LIBRARY_PATH = libPath;
RUST_BACKTRACE = 1;
LIBCLANG_PATH = "${pkgs.libclang.lib}/lib";
};
};
}