From ea90b5ce89b9babb4ebc86de523efc7fa9631281 Mon Sep 17 00:00:00 2001 From: Nathan Ringo Date: Mon, 15 Jan 2024 20:39:23 -0600 Subject: Initial commit --- flake.nix | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 flake.nix (limited to 'flake.nix') diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..d55351f --- /dev/null +++ b/flake.nix @@ -0,0 +1,35 @@ +{ + inputs.fenix = { + url = "github:nix-community/fenix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + outputs = { self, fenix, flake-utils, nixpkgs }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = nixpkgs.legacyPackages.${system}; + toolchain = fenix.packages.${system}.stable.withComponents [ + "cargo" + "rustc" + "clippy" + ]; + rust = pkgs.makeRustPlatform { + cargo = toolchain; + rustc = toolchain; + }; + in rec { + devShells.default = pkgs.mkShell { + inputsFrom = builtins.attrValues packages; + nativeBuildInputs = [ pkgs.cargo-watch ]; + }; + + packages.default = + let toml = builtins.fromTOML (builtins.readFile ./Cargo.toml); + in rust.buildRustPackage { + pname = toml.package.name; + version = toml.package.version; + src = ./.; + cargoLock.lockFile = ./Cargo.lock; + }; + }); +} -- cgit v1.2.3