aboutsummaryrefslogtreecommitdiff
path: root/flake.nix
diff options
context:
space:
mode:
authorNathan Ringo <nathan@remexre.com>2024-01-15 20:39:23 -0600
committerNathan Ringo <nathan@remexre.com>2024-01-15 20:39:23 -0600
commitea90b5ce89b9babb4ebc86de523efc7fa9631281 (patch)
tree056dfe0a54811157e4354d600c6bfc6dc7878ef4 /flake.nix
Initial commit
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix35
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;
+ };
+ });
+}