From 163e37f159b51f8c6f1f46339d8e6e9e35f6f09e Mon Sep 17 00:00:00 2001 From: Muhammad Nauman Raza Date: Mon, 25 Mar 2024 22:46:36 +0000 Subject: [PATCH] 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. --- flake.lock | 51 ++++++--------------------------------------------- flake.nix | 37 +++++++------------------------------ 2 files changed, 13 insertions(+), 75 deletions(-) diff --git a/flake.lock b/flake.lock index 3ca045c..20c662a 100644 --- a/flake.lock +++ b/flake.lock @@ -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, diff --git a/flake.nix b/flake.nix index 986df3f..ee7c209 100644 --- a/flake.nix +++ b/flake.nix @@ -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"; }; } );