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": { "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": { "flake-utils": {
"locked": { "locked": {
"lastModified": 1659877975, "lastModified": 1659877975,
@ -42,11 +21,11 @@
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"
}, },
"locked": { "locked": {
"lastModified": 1685908677, "lastModified": 1710868679,
"narHash": "sha256-E4zUPEUFyVWjVm45zICaHRpfGepfkE9Z2OECV9HXfA4=", "narHash": "sha256-V1o2bCZdeYKP/0zgVp4EN0KUjMItAMk6J7SvCXUI5IU=",
"owner": "guibou", "owner": "guibou",
"repo": "nixGL", "repo": "nixGL",
"rev": "489d6b095ab9d289fe11af0219a9ff00fe87c7c5", "rev": "d709a8abcde5b01db76ca794280745a43c8662be",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -72,11 +51,11 @@
}, },
"nixpkgs-unstable": { "nixpkgs-unstable": {
"locked": { "locked": {
"lastModified": 1710272261, "lastModified": 1711163522,
"narHash": "sha256-g0bDwXFmTE7uGDOs9HcJsfLFhH7fOsASbAuOzDC+fhQ=", "narHash": "sha256-YN/Ciidm+A0fmJPWlHBGvVkcarYWSC+s3NTPk/P+q3c=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "0ad13a6833440b8e238947e47bea7f11071dc2b2", "rev": "44d0940ea560dee511026a53f0e2e2cde489b4d4",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -88,29 +67,11 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"fenix": "fenix",
"nixgl": "nixgl", "nixgl": "nixgl",
"nixpkgs-unstable": "nixpkgs-unstable", "nixpkgs-unstable": "nixpkgs-unstable",
"utils": "utils" "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": { "systems": {
"locked": { "locked": {
"lastModified": 1681028828, "lastModified": 1681028828,

View file

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