kitchen/flake.nix

78 lines
3.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 = {
2022-08-07 16:24:47 -04:00
url = "github:oxalica/rust-overlay?ref=stable";
2022-03-06 15:16:30 -05:00
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);
2023-02-04 12:30:02 -05:00
version = "0.2.22";
2021-12-31 13:30:27 -05:00
in
flake-utils.lib.eachDefaultSystem (system:
2022-02-25 19:10:55 -05:00
let
2022-08-07 16:24:47 -04:00
overlays = [ rust-overlay.overlays.default ];
2022-03-06 15:16:30 -05:00
pkgs = import nixpkgs { inherit system overlays; };
2022-10-11 16:49:12 -04:00
rust-wasm = pkgs.rust-bin.stable."1.64.0".default.override {
2022-03-06 15:16:30 -05:00
extensions = [ "rust-src" ];
2022-08-07 16:24:47 -04:00
# Add wasm32 as an extra target besides the native target.
2022-03-06 15:16:30 -05:00
targets = [ "wasm32-unknown-unknown" ];
};
2022-08-07 16:24:47 -04:00
# make sure to use our rust-wasm build target as the rust toolchain
# in naersk.
naersk-lib = pkgs.callPackage naersk {
rustc = rust-wasm;
cargo = rust-wasm;
};
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 {
2022-08-07 16:24:47 -04:00
inherit pkgs version naersk-lib kitchenWasm rust-wasm;
2022-02-28 14:28:21 -05:00
# Because it's a workspace we need the other crates available as source
2022-10-11 16:49:12 -04:00
# TODO(jwall): gitignoreSource is broken right now due to being impure.
#root = (pkgs.callPackage gitignore { }).gitignoreSource ./.;
root = ./.;
2022-02-28 14:28:21 -05:00
});
kitchenWasmDebug = kitchenWasmGen {
inherit pkgs rust-wasm version;
features = "--features debug_logs";
};
kitchenDebug = (kitchenGen {
inherit pkgs version naersk-lib rust-wasm;
kitchenWasm = kitchenWasmDebug;
# Because it's a workspace we need the other crates available as source
# TODO(jwall): gitignoreSource is broken right now due to being impure.
#root = (pkgs.callPackage gitignore { }).gitignoreSource ./.;
root = ./.;
});
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
kitchenWasmDebug
kitchenDebug
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-08-30 17:31:35 -04:00
devShell = pkgs.callPackage ./nix/devShell/default.nix { inherit rust-wasm; };
2021-12-31 13:30:27 -05:00
}
);
}