diff --git a/.direnv/flake-inputs/9hpficax6bzwhgl622w21pkx39wl6r8w-source b/.direnv/flake-inputs/9hpficax6bzwhgl622w21pkx39wl6r8w-source deleted file mode 120000 index 160e0cf..0000000 --- a/.direnv/flake-inputs/9hpficax6bzwhgl622w21pkx39wl6r8w-source +++ /dev/null @@ -1 +0,0 @@ -/nix/store/9hpficax6bzwhgl622w21pkx39wl6r8w-source \ No newline at end of file diff --git a/.direnv/flake-inputs/r1n51h2kvjxvy04rlgfch87izm58nhcb-source b/.direnv/flake-inputs/r1n51h2kvjxvy04rlgfch87izm58nhcb-source new file mode 120000 index 0000000..9829cc9 --- /dev/null +++ b/.direnv/flake-inputs/r1n51h2kvjxvy04rlgfch87izm58nhcb-source @@ -0,0 +1 @@ +/nix/store/r1n51h2kvjxvy04rlgfch87izm58nhcb-source \ No newline at end of file diff --git a/flake.lock b/flake.lock index af876e5..046608a 100644 --- a/flake.lock +++ b/flake.lock @@ -17,7 +17,7 @@ }, "original": { "type": "tarball", - "url": "https://flakehub.com/f/nix-community/fenix/0.1" + "url": "https://flakehub.com/f/nix-community/fenix/0.1.%2A" } }, "nixpkgs": { @@ -31,7 +31,7 @@ }, "original": { "type": "tarball", - "url": "https://flakehub.com/f/NixOS/nixpkgs/0.1" + "url": "https://flakehub.com/f/NixOS/nixpkgs/0.1.%2A" } }, "root": { diff --git a/flake.nix b/flake.nix index 63b3760..613ae8a 100644 --- a/flake.nix +++ b/flake.nix @@ -2,15 +2,14 @@ description = "A Nix-flake-based Rust development environment"; inputs = { - nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1"; # unstable Nixpkgs + nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1.*"; # unstable fenix = { - url = "https://flakehub.com/f/nix-community/fenix/0.1"; + url = "https://flakehub.com/f/nix-community/fenix/0.1.*"; inputs.nixpkgs.follows = "nixpkgs"; }; }; - outputs = - { self, ... }@inputs: + outputs = { self, nixpkgs, fenix, ... }@inputs: let supportedSystems = [ "x86_64-linux" @@ -18,24 +17,23 @@ "x86_64-darwin" "aarch64-darwin" ]; - forEachSupportedSystem = - f: - inputs.nixpkgs.lib.genAttrs supportedSystems ( - system: + + forEachSupportedSystem = f: + nixpkgs.lib.genAttrs supportedSystems (system: f { - pkgs = import inputs.nixpkgs { + pkgs = import nixpkgs { inherit system; - overlays = [ - inputs.self.overlays.default - ]; + overlays = [ self.overlays.default ]; }; + inherit system; } ); + in { overlays.default = final: prev: { rustToolchain = - with inputs.fenix.packages.${prev.stdenv.hostPlatform.system}; + with fenix.packages.${prev.stdenv.hostPlatform.system}; combine ( with stable; [ @@ -48,47 +46,38 @@ ); }; - packages = forEachSupportedSystem ({ pkgs }: { - default = - pkgs.rustPlatform.buildRustPackage { - pname = "my-rust-project"; # Change to your Cargo.toml [package] name if different - version = "0.1.0"; # Change to your Cargo.toml [package] version + packages = forEachSupportedSystem ({ pkgs, system }: + { + default = pkgs.rustPlatform.buildRustPackage { + pname = "my-rust-project"; # change if needed + version = "0.1.0"; # change if needed src = pkgs.lib.cleanSource ./.; cargoLock = { lockFile = ./Cargo.lock; - # If you have additional lock files (e.g., for alternative registries), add them here }; - nativeBuildInputs = with pkgs; [ - pkg-config - ]; - - buildInputs = with pkgs; [ - openssl - ]; - - # Optional: for faster iterative development, you can copy artifacts from cargo - # doCheck = false; # if you want to skip tests during nix build + nativeBuildInputs = with pkgs; [ pkg-config ]; + buildInputs = with pkgs; [ openssl ]; meta = with pkgs.lib; { description = "My Rust project"; - license = licenses.mit; # Adjust as needed - mainProgram = "whereAmI"; # Optional: name of the main binary for nix run + license = licenses.mit; + mainProgram = "whereAmI"; }; }; - }); + }); - apps = forEachSupportedSystem ({ pkgs }: { - default = { - type = "app"; - program = "${pkgs.default}/bin/whereAmI"; # or self.packages.${pkgs.system}.default - }; - }); + apps = forEachSupportedSystem ({ pkgs, system }: + { + default = { + type = "app"; + program = "${self.packages.${system}.default}/bin/whereAmI"; + }; + }); - devShells = forEachSupportedSystem ( - { pkgs }: + devShells = forEachSupportedSystem ({ pkgs, system }: { default = pkgs.mkShell { packages = with pkgs; [ @@ -100,12 +89,11 @@ cargo-watch rust-analyzer ]; + env = { - # Required by rust-analyzer RUST_SRC_PATH = "${pkgs.rustToolchain}/lib/rustlib/src/rust/library"; }; }; - } - ); + }); }; }