summary refs log tree commit diff stats
path: root/flake.nix
diff options
context:
space:
mode:
authorSoispha <soispha@vhack.eu>2023-06-18 16:32:47 +0200
committerSoispha <soispha@vhack.eu>2023-06-18 16:32:47 +0200
commit369bf07cbb36d8e72025014bfd4ddc52d9049fde (patch)
tree545b32762ec8af521484f6c520dc568edaf8a2f7 /flake.nix
downloadlpm-369bf07cbb36d8e72025014bfd4ddc52d9049fde.tar.gz
lpm-369bf07cbb36d8e72025014bfd4ddc52d9049fde.zip
Chore: Initial commit
Diffstat (limited to '')
-rw-r--r--flake.nix87
1 files changed, 87 insertions, 0 deletions
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 0000000..c3234ee
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,87 @@
+{
+  description = "LaTeX project manager";
+
+  inputs = {
+    nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
+
+    # inputs for following
+    systems = {
+      url = "github:nix-systems/x86_64-linux"; # only evaluate for this system
+    };
+    flake-compat = {
+      url = "github:edolstra/flake-compat";
+      flake = false;
+    };
+    crane = {
+      url = "github:ipetkov/crane";
+      inputs = {
+        nixpkgs.follows = "nixpkgs";
+        flake-compat.follows = "flake-compat";
+        flake-utils.follows = "flake-utils";
+        rust-overlay.follows = "rust-overlay";
+      };
+    };
+    flake-utils = {
+      url = "github:numtide/flake-utils";
+      inputs = {
+        systems.follows = "systems";
+      };
+    };
+    rust-overlay = {
+      url = "github:oxalica/rust-overlay";
+      inputs = {
+        nixpkgs.follows = "nixpkgs";
+        flake-utils.follows = "flake-utils";
+      };
+    };
+  };
+
+  outputs = {
+    self,
+    nixpkgs,
+    crane,
+    flake-utils,
+    rust-overlay,
+    ...
+  }:
+    flake-utils.lib.eachDefaultSystem (system: let
+      pkgs = import nixpkgs {
+        inherit system;
+        overlays = [(import rust-overlay)];
+      };
+
+      #rust-nightly = pkgs.rust-bin.selectLatestNightlyWith (toolchain: toolchain.default);
+      rust-stable = pkgs.rust-bin.stable.latest.default;
+
+      craneLib = (crane.mkLib pkgs).overrideToolchain rust-stable;
+
+      craneBuild = craneLib.buildPackage {
+        src = craneLib.cleanCargoSource ./.;
+
+        doCheck = true;
+      };
+    in {
+      packages.default = craneBuild;
+
+      app.default = {
+        type = "app";
+        program = "${self.packages.${system}.default}/bin/lpm";
+      };
+
+      devShells.default = pkgs.mkShell {
+        packages = with pkgs; [
+          nil
+          alejandra
+          statix
+          ltex-ls
+          cocogitto
+
+          rust-stable
+          rust-analyzer
+          cargo-edit
+        ];
+      };
+    });
+}
+# vim: ts=2
+