about summary refs log tree commit diff stats
path: root/flake.nix
diff options
context:
space:
mode:
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix84
1 files changed, 84 insertions, 0 deletions
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 0000000..a0c5b0e
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,84 @@
+# rocie - An enterprise grocery management system
+#
+# Copyright (C) 2024 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of Rocie.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
+
+{
+  description = "rocie";
+
+  inputs = {
+    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable-small";
+
+    treefmt-nix = {
+      url = "github:numtide/treefmt-nix";
+      inputs = {
+        nixpkgs.follows = "nixpkgs";
+      };
+    };
+  };
+
+  outputs = {
+    self,
+    nixpkgs,
+    treefmt-nix,
+  }: let
+    system = "x86_64-linux";
+    pkgs = nixpkgs.legacyPackages."${system}";
+
+    buildInputs = [
+    ];
+
+    nativeBuildInputs = [
+    ];
+
+    rocie = pkgs.callPackage ./nix/package.nix {};
+
+    treefmtEval = import ./treefmt.nix {inherit treefmt-nix pkgs;};
+  in {
+    packages."${system}" = {
+      inherit rocie;
+      default = self.packages.${system}.rocie;
+    };
+
+    checks."${system}" = {
+      inherit rocie;
+      formatting = treefmtEval.config.build.check self;
+    };
+
+    formatter."${system}" = treefmtEval.config.build.wrapper;
+
+    devShells."${system}".default = pkgs.mkShell {
+      inherit buildInputs nativeBuildInputs;
+
+      packages = [
+        # rust stuff
+        pkgs.cargo
+        pkgs.clippy
+        pkgs.rustc
+        pkgs.rustfmt
+        pkgs.mold-wrapped
+
+        pkgs.cargo-edit
+        pkgs.cargo-expand
+        pkgs.cargo-flamegraph
+
+        # Releng
+        pkgs.git-bug
+        pkgs.reuse
+        pkgs.cocogitto
+
+        # Perf
+        pkgs.hyperfine
+
+        # Sqlite
+        pkgs.sqlite-interactive
+      ];
+    };
+  };
+}