2021-12-26 22:47:16 +03:00
|
|
|
{
|
|
|
|
inputs = {
|
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
2021-12-31 04:18:17 +03:00
|
|
|
|
|
|
|
flake-compat = {
|
|
|
|
url = "github:edolstra/flake-compat";
|
|
|
|
flake = false;
|
|
|
|
};
|
2021-12-30 03:03:39 +03:00
|
|
|
nix-std.url = "github:chessai/nix-std";
|
2021-12-26 22:47:16 +03:00
|
|
|
utils = {
|
|
|
|
url = "github:numtide/flake-utils";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2021-12-30 03:03:39 +03:00
|
|
|
outputs = inputs@{ self, nixpkgs, nix-std, utils, ... }:
|
2021-12-26 22:47:16 +03:00
|
|
|
let
|
2021-12-27 02:32:57 +03:00
|
|
|
myPkgsFor = pkgs: pkgs.callPackages ./pkgs { };
|
2022-01-16 07:21:02 +03:00
|
|
|
|
|
|
|
mkLib = pkgs: import ./lib {
|
|
|
|
inherit (nix-std.lib.serde) fromTOML toTOML;
|
|
|
|
inherit (pkgs) lib newScope;
|
|
|
|
myPkgs = myPkgsFor pkgs;
|
|
|
|
};
|
2021-12-26 22:47:16 +03:00
|
|
|
in
|
|
|
|
{
|
2022-01-16 07:21:02 +03:00
|
|
|
inherit mkLib;
|
|
|
|
|
2021-12-27 02:32:57 +03:00
|
|
|
overlay = final: prev: myPkgsFor final;
|
2022-01-17 01:25:41 +03:00
|
|
|
|
2022-01-17 03:54:55 +03:00
|
|
|
defaultTemplate = self.templates.quick-start;
|
2022-01-17 03:11:11 +03:00
|
|
|
templates = {
|
|
|
|
custom-toolchain = {
|
|
|
|
description = "Build a cargo project with a custom toolchain";
|
|
|
|
path = ./examples/custom-toolchain;
|
|
|
|
};
|
|
|
|
|
2022-01-17 03:54:55 +03:00
|
|
|
quick-start = {
|
2022-01-17 03:11:11 +03:00
|
|
|
description = "Build a cargo project";
|
2022-01-17 03:54:55 +03:00
|
|
|
path = ./examples/quick-start;
|
|
|
|
};
|
|
|
|
|
|
|
|
quick-start-simple = {
|
|
|
|
description = "Build a cargo project without extra checks";
|
|
|
|
path = ./examples/quick-start-simple;
|
2022-01-17 03:11:11 +03:00
|
|
|
};
|
|
|
|
};
|
2021-12-27 02:32:57 +03:00
|
|
|
} // utils.lib.eachDefaultSystem (system:
|
|
|
|
let
|
|
|
|
pkgs = import nixpkgs {
|
|
|
|
inherit system;
|
|
|
|
};
|
|
|
|
|
2021-12-27 03:18:22 +03:00
|
|
|
myPkgs = myPkgsFor pkgs;
|
|
|
|
|
|
|
|
# To override do: lib.overrideScope' (self: super: { ... });
|
2022-01-16 07:21:02 +03:00
|
|
|
lib = mkLib pkgs;
|
2021-12-27 02:32:57 +03:00
|
|
|
|
2021-12-30 06:26:55 +03:00
|
|
|
checks = pkgs.callPackages ./checks {
|
2022-01-04 23:55:36 +03:00
|
|
|
inherit pkgs;
|
2021-12-30 06:26:55 +03:00
|
|
|
myLib = lib;
|
|
|
|
};
|
2021-12-27 02:32:57 +03:00
|
|
|
in
|
|
|
|
{
|
|
|
|
inherit checks lib;
|
|
|
|
|
2021-12-27 03:18:22 +03:00
|
|
|
packages = myPkgs;
|
2021-12-26 22:47:16 +03:00
|
|
|
|
2021-12-27 02:32:57 +03:00
|
|
|
devShell = pkgs.mkShell {
|
2022-01-04 23:55:36 +03:00
|
|
|
nativeBuildInputs = with pkgs; [
|
|
|
|
nixpkgs-fmt
|
|
|
|
];
|
2021-12-27 02:32:57 +03:00
|
|
|
};
|
|
|
|
});
|
2021-12-26 22:47:16 +03:00
|
|
|
}
|