From 505031fac988fb75c6aed5fbe8c705739dce69f3 Mon Sep 17 00:00:00 2001 From: jakka Date: Thu, 6 Nov 2025 14:12:47 +0300 Subject: edited flake and gitignore --- flake.nix | 63 +++++++++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 41 insertions(+), 22 deletions(-) (limited to 'flake.nix') diff --git a/flake.nix b/flake.nix index 9335cc4..69e985c 100644 --- a/flake.nix +++ b/flake.nix @@ -1,8 +1,17 @@ { inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; - rust-overlay.url = "github:oxalica/rust-overlay"; + nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05"; flake-utils.url = "github:numtide/flake-utils"; + + rust-overlay = { + url = "github:oxalica/rust-overlay"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + naersk = { + url = "github:nix-community/naersk"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; outputs = @@ -10,6 +19,7 @@ self, nixpkgs, rust-overlay, + naersk, flake-utils, ... }: @@ -18,31 +28,40 @@ let overlays = [ (import rust-overlay) ]; pkgs = import nixpkgs { inherit system overlays; }; - in - { - devShells.default = - with pkgs; - mkShell { - buildInputs = [ - glibc - gcc - lldb - openssl - pkg-config - musl - rust-bin.stable.latest.default - rust-analyzer - nixd - nixfmt-rfc-style - ]; - }; - - rust-bin.stable.latest.default.override = { + rustToolchain = pkgs.rust-bin.stable.latest.default.override { + extensions = [ + "rust-src" + "rust-analyzer" + ]; targets = [ "x86_64-unknown-linux-gnu" "x86_64-unknown-linux-musl" ]; }; + + naersk-lib = pkgs.callPackage naersk { + cargo = rustToolchain; + rustc = rustToolchain; + }; + in + { + devShells.default = pkgs.mkShell { + buildInputs = with pkgs; [ rustToolchain ]; + RUST_SRC_PATH = "${rustToolchain}/lib/rustlib/src/rust/library"; + }; + + checks = { + build = self.packages.${system}.default; + }; + + packages.default = naersk-lib.buildPackage { + src = ./.; + + buildInputs = with pkgs; [ + openssl + glibc + ]; + }; } ); } -- cgit v1.3.1