diff options
author | Nathan Ringo <nathan@remexre.com> | 2024-01-15 20:39:23 -0600 |
---|---|---|
committer | Nathan Ringo <nathan@remexre.com> | 2024-01-15 20:39:23 -0600 |
commit | ea90b5ce89b9babb4ebc86de523efc7fa9631281 (patch) | |
tree | 056dfe0a54811157e4354d600c6bfc6dc7878ef4 /flake.nix |
Initial commit
Diffstat (limited to 'flake.nix')
-rw-r--r-- | flake.nix | 35 |
1 files changed, 35 insertions, 0 deletions
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; + }; + }); +} |