summary refs log tree commit diff
path: root/flake.nix
diff options
context:
space:
mode:
authorVika <vika@fireburn.ru>2024-08-19 21:41:48 +0300
committerVika <vika@fireburn.ru>2024-08-19 21:41:48 +0300
commit2b25e0454c60bb30b9a531b94836ca0d64e6c5e1 (patch)
treee62661a0d36ac32413dfa651dfe4ff85882accfb /flake.nix
Initial Nix & Cargo boilerplate for a Relm4 project
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix61
1 files changed, 61 insertions, 0 deletions
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 0000000..dc30db3
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,61 @@
+{
+  inputs = {
+    flake-utils = {
+      type = "github";
+      owner = "numtide";
+      repo = "flake-utils";
+      ref = "main";
+    };
+    crane = {
+      url = "github:ipetkov/crane";
+      inputs.nixpkgs.follows = "nixpkgs";
+    };
+    nixpkgs = {
+      type = "github";
+      owner = "nixos";
+      repo = "nixpkgs";
+      ref = "nixos-unstable";
+    };
+  };
+  outputs = { self, nixpkgs, flake-utils, crane }: let
+    supportedSystems = ["aarch64-linux" "x86_64-linux"];
+    forAllSystems = f: flake-utils.lib.eachSystem supportedSystems f;
+  in forAllSystems (system: let
+    pkgs = nixpkgs.legacyPackages.${system};
+    crane' = crane.mkLib pkgs;
+
+    bowl = pkgs.callPackage ./default.nix {
+      # XXX may break cross-compilation
+      craneLib = crane';
+    };
+  in {
+    packages = {
+      bowl = bowl;
+      default = self.packages.${system}.bowl;
+    };
+
+    checks = {
+      bowl = self.packages.${system}.bowl;
+
+      deps = self.packages.${system}.bowl.cargoArtifacts;
+      clippy = self.packages.${system}.bowl.clippy;
+    };
+
+    apps.default = flake-utils.lib.mkApp {
+      drv = bowl;
+    };
+
+    devShells.default = crane'.devShell {
+      # Inherit inputs from checks.
+      checks = self.checks.${system};
+
+      # Additional dev-shell environment variables can be set directly
+      # MY_CUSTOM_DEVELOPMENT_VAR = "something else";
+
+      # Extra inputs can be added here; cargo and rustc are provided by default.
+      packages = [
+        pkgs.rust-analyzer
+      ];
+    };
+  }); 
+}