aboutsummaryrefslogtreecommitdiff
path: root/flake.nix
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2022-11-15 18:13:29 -0800
committerFranck Cuny <franck@fcuny.net>2022-11-15 18:13:29 -0800
commit65994d5b50b94d7b172fff217ad5facd82ce2722 (patch)
tree1fd9ac6ee97bc0b3877d8f631a48c4dbaabb6672 /flake.nix
downloadsendsms-65994d5b50b94d7b172fff217ad5facd82ce2722.tar.gz
meta: initial commit!
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix104
1 files changed, 104 insertions, 0 deletions
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 0000000..5b453f2
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,104 @@
+{
+ description = "A CLI to send SMS with pre-determined messages SMS with pre-determined messa SMS with pre-determine.";
+
+ inputs = {
+ flake-utils.url = "github:numtide/flake-utils";
+ nixpkgs.url = "github:NixOS/nixpkgs";
+ rust-overlay = {
+ url = "github:oxalica/rust-overlay";
+ inputs = {
+ flake-utils.follows = "flake-utils";
+ nixpkgs.follows = "nixpkgs";
+ };
+ };
+ crane = {
+ url = "github:ipetkov/crane";
+ inputs.nixpkgs.follows = "nixpkgs";
+ };
+ pre-commit-hooks = {
+ url = "github:cachix/pre-commit-hooks.nix";
+ inputs = {
+ flake-utils.follows = "flake-utils";
+ nixpkgs.follows = "nixpkgs";
+ };
+ };
+ };
+
+ outputs =
+ { self
+ , flake-utils
+ , nixpkgs
+ , rust-overlay
+ , crane
+ , pre-commit-hooks
+ }:
+
+ flake-utils.lib.eachDefaultSystem
+ (system:
+ let
+ pkgs = import nixpkgs {
+ inherit system;
+ overlays = [ (import rust-overlay) ];
+ };
+ rust-toolchain = (pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml).override {
+ extensions = [ "rust-src" ];
+ };
+
+ craneLib = (crane.mkLib pkgs).overrideScope' (_: _: {
+ cargo = rust-toolchain;
+ clippy = rust-toolchain;
+ rustc = rust-toolchain;
+ rustfmt = rust-toolchain;
+ });
+
+ src = ./.;
+
+ cargoArtifacts = craneLib.buildDepsOnly {
+ inherit src;
+ };
+
+ my-crate = craneLib.buildPackage {
+ inherit cargoArtifacts src;
+ };
+ in
+ {
+ packages.default = my-crate;
+ apps.default = flake-utils.lib.mkApp {
+ drv = my-crate;
+ };
+
+ checks = {
+ pre-commit = pre-commit-hooks.lib.${system}.run {
+ inherit src;
+ hooks = {
+ clippy = {
+ enable = true;
+ entry = pkgs.lib.mkForce "cargo clippy -- -D warnings";
+ };
+ nixpkgs-fmt = {
+ enable = true;
+ };
+ rustfmt = {
+ enable = true;
+ entry = pkgs.lib.mkForce "cargo fmt -- --check --color always";
+ };
+ };
+ };
+ };
+
+ devShell = pkgs.mkShell {
+ nativeBuildInputs = with pkgs; [
+ rust-toolchain
+ cargo-deny
+ rust-analyzer
+ ];
+
+ inherit (self.checks.${system}.pre-commit) shellHook;
+ };
+ })
+ // {
+ overlay = final: prev: {
+ sendsms = self.defaultPackage.${prev.system}.default;
+ };
+ };
+}