diff options
| author | Sophie Forrest <57433227+sophieforrest@users.noreply.github.com> | 2024-02-09 02:11:59 +1300 |
|---|---|---|
| committer | Sophie Forrest <57433227+sophieforrest@users.noreply.github.com> | 2024-02-09 02:11:59 +1300 |
| commit | 62bc96992d37a61dfdc4372ae4f76dd239ac72b9 (patch) | |
| tree | 72207f5cbd889974160e50f540cfe600c0bb008f /flake.nix | |
| parent | 0df4bf9f1a30e9de53540f24ebfc25b1d9870065 (diff) | |
chore: add flake
Diffstat (limited to 'flake.nix')
| -rw-r--r-- | flake.nix | 74 |
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; + }; + }; +} |