From b43d88c749048b87e7d39a0a8ae45782ae597f76 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Mon, 15 Jun 2026 15:45:13 +0300 Subject: [PATCH] nix: drop nix-overlay; enable `structuredAttrs` & cleanup Signed-off-by: NotAShelf Change-Id: I8dc2910c36075bef0e1c00459d83e5ea6a6a6964 --- flake.nix | 11 ++--------- nix/package.nix | 19 ++++++++----------- nix/shell.nix | 7 ++----- 3 files changed, 12 insertions(+), 25 deletions(-) diff --git a/flake.nix b/flake.nix index 50d00b9..3024a27 100644 --- a/flake.nix +++ b/flake.nix @@ -1,21 +1,14 @@ { description = "Microscopic fetch script in Rust, for NixOS systems"; - inputs = { - nixpkgs.url = "github:NixOS/nixpkgs?ref=nixos-unstable"; - rust-overlay = { - url = "github:oxalica/rust-overlay"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - }; + inputs.nixpkgs.url = "github:NixOS/nixpkgs?ref=nixos-unstable"; outputs = { self, nixpkgs, - rust-overlay, }: let systems = ["x86_64-linux" "aarch64-linux"]; forEachSystem = nixpkgs.lib.genAttrs systems; - pkgsForEach = system: nixpkgs.legacyPackages.${system}.extend rust-overlay.overlays.default; + pkgsForEach = system: nixpkgs.legacyPackages.${system}; in { packages = forEachSystem (system: let pkgs = pkgsForEach system; diff --git a/nix/package.nix b/nix/package.nix index 1657fd7..ba16ffd 100644 --- a/nix/package.nix +++ b/nix/package.nix @@ -1,20 +1,15 @@ { lib, - makeRustPlatform, - rust-bin, + rustPlatform, llvm, }: let pname = "microfetch"; toml = (lib.importTOML ../Cargo.toml).workspace.package; inherit (toml) version; - - toolchain = rust-bin.stable.latest; - rustWithToolchain = makeRustPlatform { - cargo = toolchain.minimal; - rustc = toolchain.minimal; - }; in - rustWithToolchain.buildRustPackage.override {inherit (llvm) stdenv;} { + rustPlatform.buildRustPackage.override {inherit (llvm) stdenv;} (finalAttrs: { + __structuredAttrs = true; + inherit pname version; src = let fs = lib.fileset; @@ -32,16 +27,18 @@ in ]; }; - cargoLock.lockFile = ../Cargo.lock; + cargoLock.lockFile = "${finalAttrs.src}/Cargo.lock"; enableParallelBuilding = true; buildNoDefaultFeatures = true; doCheck = false; + strictDeps = true; meta = { description = "Microscopic fetch script in Rust, for NixOS systems"; homepage = "https://github.com/NotAShelf/microfetch"; license = lib.licenses.gpl3Only; + platforms = lib.platforms.linux; maintainers = [lib.maintainers.NotAShelf]; mainProgram = "microfetch"; }; - } + }) diff --git a/nix/shell.nix b/nix/shell.nix index ae65e10..a43cacb 100644 --- a/nix/shell.nix +++ b/nix/shell.nix @@ -4,11 +4,10 @@ rustc, mold, clang, - rust-analyzer-unwrapped, + rust-analyzer, rustfmt, clippy, taplo, - rustPlatform, gnuplot, }: mkShell { @@ -20,13 +19,11 @@ mkShell { mold clang - rust-analyzer-unwrapped + rust-analyzer (rustfmt.override {asNightly = true;}) clippy taplo gnuplot # for Criterion.rs plots ]; - - env.RUST_SRC_PATH = "${rustPlatform.rustLibSrc}"; }