From 62bc96992d37a61dfdc4372ae4f76dd239ac72b9 Mon Sep 17 00:00:00 2001 From: Sophie Forrest <57433227+sophieforrest@users.noreply.github.com> Date: Fri, 9 Feb 2024 02:11:59 +1300 Subject: chore: add flake --- flake.nix | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 flake.nix (limited to 'flake.nix') 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; + }; + }; +} -- cgit 1.4.1