summary refs log tree commit diff
path: root/flake.nix
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--flake.nix74
1 files changed, 74 insertions, 0 deletions
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 0000000..7fda700
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,74 @@
+{
+  description = "Logic table generator on the command line.";
+
+  inputs = {
+    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
+
+    flake-parts.url = "github:hercules-ci/flake-parts";
+
+    nci = {
+      inputs.nixpkgs.follows = "nixpkgs";
+      url = "github:yusdacra/nix-cargo-integration";
+    };
+
+    treefmt-nix.url = "github:numtide/treefmt-nix";
+  };
+
+  outputs = inputs @ {
+    self,
+    flake-parts,
+    nixpkgs,
+    nci,
+    treefmt-nix,
+  }:
+    flake-parts.lib.mkFlake {inherit inputs;} {
+      imports = [
+        nci.flakeModule
+        treefmt-nix.flakeModule
+      ];
+
+      systems = [
+        "x86_64-linux"
+      ];
+
+      perSystem = {
+        config,
+        pkgs,
+        system,
+        lib,
+        ...
+      }: let
+        crateOutputs = config.nci.outputs."mos6502";
+      in {
+        nci.projects.mos6502.path = ./.;
+
+        # configure crates
+        nci.crates.mos6502 = {
+          depsDrvConfig.env = {
+            RUSTFLAGS = "-A missing-docs";
+          };
+        };
+
+        treefmt = {
+          projectRootFile = "flake.nix";
+          programs = {
+            rustfmt = {
+              enable = true;
+              package = config.nci.toolchains.shell;
+            };
+            taplo.enable = true;
+          };
+        };
+
+        devShells.default = crateOutputs.devShell.overrideAttrs (_: {
+          buildInputs = with pkgs; [
+            bacon
+            gcc
+            mold
+          ];
+        });
+
+        packages.default = crateOutputs.packages.release;
+      };
+    };
+}