flake!: cleanup and remove Rust from devShell

Users will now have to use a Rust toolchain provided outside of this repository. However, this project's specific depdencies, such as mold and clang, are provided in the `nix develop` environment.
This commit is contained in:
Muhammad Nauman Raza 2024-03-25 22:46:36 +00:00
parent b1c72edb2f
commit 163e37f159
Signed by: devraza
GPG key ID: 91EAD6081011574B
2 changed files with 13 additions and 75 deletions

View file

@ -1,26 +1,5 @@
{
"nodes": {
"fenix": {
"inputs": {
"nixpkgs": [
"nixpkgs-unstable"
],
"rust-analyzer-src": "rust-analyzer-src"
},
"locked": {
"lastModified": 1710483719,
"narHash": "sha256-Ev/hJ59IAA3dWfTB3CWxMv/V/owO1yKyq0nwsek/d9o=",
"owner": "nix-community",
"repo": "fenix",
"rev": "d0439c495e5cd13ff252ade520ca620f52abb40b",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "fenix",
"type": "github"
}
},
"flake-utils": {
"locked": {
"lastModified": 1659877975,
@ -42,11 +21,11 @@
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1685908677,
"narHash": "sha256-E4zUPEUFyVWjVm45zICaHRpfGepfkE9Z2OECV9HXfA4=",
"lastModified": 1710868679,
"narHash": "sha256-V1o2bCZdeYKP/0zgVp4EN0KUjMItAMk6J7SvCXUI5IU=",
"owner": "guibou",
"repo": "nixGL",
"rev": "489d6b095ab9d289fe11af0219a9ff00fe87c7c5",
"rev": "d709a8abcde5b01db76ca794280745a43c8662be",
"type": "github"
},
"original": {
@ -72,11 +51,11 @@
},
"nixpkgs-unstable": {
"locked": {
"lastModified": 1710272261,
"narHash": "sha256-g0bDwXFmTE7uGDOs9HcJsfLFhH7fOsASbAuOzDC+fhQ=",
"lastModified": 1711163522,
"narHash": "sha256-YN/Ciidm+A0fmJPWlHBGvVkcarYWSC+s3NTPk/P+q3c=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "0ad13a6833440b8e238947e47bea7f11071dc2b2",
"rev": "44d0940ea560dee511026a53f0e2e2cde489b4d4",
"type": "github"
},
"original": {
@ -88,29 +67,11 @@
},
"root": {
"inputs": {
"fenix": "fenix",
"nixgl": "nixgl",
"nixpkgs-unstable": "nixpkgs-unstable",
"utils": "utils"
}
},
"rust-analyzer-src": {
"flake": false,
"locked": {
"lastModified": 1710430493,
"narHash": "sha256-KfmUsf/d62ANcFhSTR3BDIpk2ww0AcxXdi9lpZJ5UtQ=",
"owner": "rust-lang",
"repo": "rust-analyzer",
"rev": "14558af15ee3d471bf8f4212f7609ae1f9647bc5",
"type": "github"
},
"original": {
"owner": "rust-lang",
"ref": "nightly",
"repo": "rust-analyzer",
"type": "github"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,

View file

@ -2,10 +2,6 @@
description = "Rust development environment for Ambition using fenix";
inputs = {
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs-unstable";
};
utils.url = "github:numtide/flake-utils";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
nixgl.url = "github:guibou/nixGL";
@ -15,7 +11,6 @@
self,
nixpkgs-unstable,
utils,
fenix,
nixgl,
...
}:
@ -24,26 +19,17 @@
system: let
pkgs = import nixpkgs-unstable {
inherit system;
overlays = [fenix.overlays.default nixgl.overlay];
overlays = [nixgl.overlay];
};
toolchain = pkgs.fenix.complete;
in rec
{
# Executed by `nix build`
packages.default =
(pkgs.makeRustPlatform {
# Use nightly rustc and cargo provided by fenix for building
inherit (toolchain) cargo rustc;
})
.buildRustPackage {
pname = "ambition";
version = "0.4.0";
src = ./.;
cargoLock.lockFile = ./Cargo.lock;
# For other makeRustPlatform features see:
# https://github.com/NixOS/nixpkgs/blob/master/doc/languages-frameworks/rust.section.md#cargo-features-cargo-features
};
packages.default = pkgs.rustPlatform.buildRustPackage {
pname = "ambition";
version = "0.4.0";
src = ./.;
cargoLock.lockFile = ./Cargo.lock;
};
# Executed by `nix run`
apps.default = utils.lib.mkApp {drv = packages.default;};
@ -56,25 +42,16 @@
pkgs.alsa-lib
pkgs.libxkbcommon
]}"'';
# Use nightly cargo & rustc provided by fenix. Add for packages for the dev shell here
buildInputs = with pkgs; [
(with toolchain; [
cargo rustc rust-src clippy rustfmt # rust components
])
xorg.libX11 xorg.libXcursor xorg.libXi xorg.libXrandr # To use the x11 feature
libxkbcommon # To use the wayland feature
udev alsa-lib vulkan-loader
pkgs.nixgl.nixVulkanIntel
mold
clang
pkg-config
tokei
];
# Specify the rust-src path (many editors rely on this)
RUST_SRC_PATH = "${toolchain.rust-src}/lib/rustlib/src/rust/library";
};
}
);