summaryrefslogtreecommitdiff
path: root/flake.nix
diff options
context:
space:
mode:
authorNathan Ringo <nathan@remexre.com>2024-11-22 00:11:43 -0600
committerNathan Ringo <nathan@remexre.com>2024-11-22 00:11:43 -0600
commitdd0e6e45c35133ec8a3e2886b7b050484b388d03 (patch)
tree3ea9f5a098fc9c150473942c97e8b07833440803 /flake.nix
Initial commit
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix49
1 files changed, 49 insertions, 0 deletions
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 0000000..0b8ce6b
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,49 @@
+{
+ 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
+ pkgs.sqlx-cli
+ ];
+ };
+
+ 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;
+ };
+ }
+ );
+}