From eac488273331cc295f2657c833d968590d2fe72e Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Tue, 28 Apr 2026 11:31:51 +0300 Subject: [PATCH] nix: get Rust 1.95.0 from `rust-overlay` Signed-off-by: NotAShelf Change-Id: If01588c5e4399ee19bb17485f65a741b6a6a6964 --- flake.lock | 29 +++++++++++++++++++++++++---- flake.nix | 18 ++++++++++++------ nix/package.nix | 13 ++++++++++--- 3 files changed, 47 insertions(+), 13 deletions(-) diff --git a/flake.lock b/flake.lock index e5578c1..b320b66 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1770562336, - "narHash": "sha256-ub1gpAONMFsT/GU2hV6ZWJjur8rJ6kKxdm9IlCT0j84=", + "lastModified": 1776877367, + "narHash": "sha256-EHq1/OX139R1RvBzOJ0aMRT3xnWyqtHBRUBuO1gFzjI=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "d6c71932130818840fc8fe9509cf50be8c64634f", + "rev": "0726a0ecb6d4e08f6adced58726b95db924cef57", "type": "github" }, "original": { @@ -18,7 +18,28 @@ }, "root": { "inputs": { - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs", + "rust-overlay": "rust-overlay" + } + }, + "rust-overlay": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1777346187, + "narHash": "sha256-oVxyGjpiIsrXhWTJVUOs38fZQkLjd0nZGOY9K7Kfot8=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "146e7bf7569b8288f24d41d806b9f584f7cfd5b5", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" } } }, diff --git a/flake.nix b/flake.nix index 90978a2..50d00b9 100644 --- a/flake.nix +++ b/flake.nix @@ -1,25 +1,31 @@ { - description = "A microscopic fetch script in Rust, for NixOS systems"; - inputs.nixpkgs.url = "github:NixOS/nixpkgs?ref=nixos-unstable"; + 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"; + }; + }; outputs = { self, nixpkgs, + rust-overlay, }: let systems = ["x86_64-linux" "aarch64-linux"]; forEachSystem = nixpkgs.lib.genAttrs systems; - pkgsForEach = nixpkgs.legacyPackages; + pkgsForEach = system: nixpkgs.legacyPackages.${system}.extend rust-overlay.overlays.default; in { packages = forEachSystem (system: let - pkgs = pkgsForEach.${system}; + pkgs = pkgsForEach system; in { default = self.packages.${system}.microfetch; microfetch = pkgs.callPackage ./nix/package.nix {}; - microfetch-mold = pkgs.callPackage ./nix/package.nix {useMold = true;}; }); devShells = forEachSystem (system: { - default = pkgsForEach.${system}.callPackage ./nix/shell.nix {}; + default = (pkgsForEach system).callPackage ./nix/shell.nix {}; }); }; } diff --git a/nix/package.nix b/nix/package.nix index 2658d73..1657fd7 100644 --- a/nix/package.nix +++ b/nix/package.nix @@ -1,13 +1,20 @@ { lib, - rustPlatform, + makeRustPlatform, + rust-bin, 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 - rustPlatform.buildRustPackage.override {inherit (llvm) stdenv;} { + rustWithToolchain.buildRustPackage.override {inherit (llvm) stdenv;} { inherit pname version; src = let fs = lib.fileset; @@ -16,9 +23,9 @@ in fs.toSource { root = s; fileset = fs.unions [ + (s + /.cargo) (s + /crates) (s + /microfetch) - (s + /.cargo) (s + /scripts/ld-wrapper) (s + /Cargo.lock) (s + /Cargo.toml)