kitchen/flake.nix

59 lines
2.4 KiB
Nix
Raw Normal View History

2021-12-31 13:30:27 -05:00
{
description = "kitchen";
2022-01-03 19:13:42 -05:00
# Pin nixpkgs
2022-02-25 19:10:55 -05:00
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
2022-02-25 19:10:55 -05:00
gitignore = { url = "github:hercules-ci/gitignore.nix"; flake = false; };
flake-utils.url = "github:numtide/flake-utils";
2022-03-06 15:16:30 -05:00
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
2022-02-28 14:28:21 -05:00
naersk.url = "github:nix-community/naersk";
flake-compat = { url = github:edolstra/flake-compat; flake = false; };
2022-02-25 19:10:55 -05:00
};
2022-03-06 15:16:30 -05:00
outputs = {self, nixpkgs, flake-utils, rust-overlay, naersk, gitignore, flake-compat}:
2021-12-31 13:30:27 -05:00
let
2022-02-28 14:28:21 -05:00
kitchenGen = (import ./nix/kitchen/default.nix);
2022-02-25 19:10:55 -05:00
kitchenWasmGen = (import ./nix/kitchenWasm/default.nix);
moduleGen = (import ./nix/kitchen/module.nix);
2022-07-21 16:36:14 -04:00
version = "0.2.8";
2021-12-31 13:30:27 -05:00
in
flake-utils.lib.eachDefaultSystem (system:
2022-02-25 19:10:55 -05:00
let
2022-03-06 15:16:30 -05:00
overlays = [ rust-overlay.overlay ];
pkgs = import nixpkgs { inherit system overlays; };
# TODO(jwall): Could this get by with minimal instead?
rust-wasm = pkgs.rust-bin.stable.latest.default.override {
extensions = [ "rust-src" ];
targets = [ "wasm32-unknown-unknown" ];
};
2022-02-28 14:28:21 -05:00
naersk-lib = naersk.lib."${system}";
2022-02-25 19:10:55 -05:00
kitchenWasm = kitchenWasmGen {
inherit pkgs rust-wasm version;
2022-02-25 19:10:55 -05:00
};
2022-02-28 14:28:21 -05:00
kitchen = (kitchenGen {
inherit pkgs version naersk-lib kitchenWasm;
2022-02-28 14:28:21 -05:00
# Because it's a workspace we need the other crates available as source
root = (pkgs.callPackage gitignore { }).gitignoreSource ./.;
});
module = moduleGen {inherit kitchen;};
2022-02-25 19:10:55 -05:00
in
2021-12-31 13:30:27 -05:00
{
2022-02-25 19:10:55 -05:00
packages = {
inherit kitchenWasm
2022-02-28 14:28:21 -05:00
kitchen
2022-02-25 19:10:55 -05:00
;
};
2022-02-28 14:28:21 -05:00
defaultPackage = kitchen;
nixosModules.kitchen = module;
2022-03-06 15:16:30 -05:00
defaultApp = {
type = "app";
program = "${kitchen}/bin/kitchen";
};
2022-05-13 21:30:50 -04:00
devShell = pkgs.mkShell {
2022-07-22 18:17:59 -04:00
buildInputs = [ rust-wasm ] ++ (with pkgs; [wasm-bindgen-cli wasm-pack diesel-cli]);
2022-05-13 21:30:50 -04:00
};
2021-12-31 13:30:27 -05:00
}
);
}