Files
project-templates/flake.nix
T

71 lines
1.8 KiB
Nix

{
description = "A collection of templates for various programming languages";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
treefmt-nix = {
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
crane.url = "github:ipetkov/crane";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
cadquery = {
url = "github:vinszent/cq-flake";
# unfortunately dependencies are out of date so this needs it's own nixpkgs
# inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {
self,
flake-parts,
...
} @ inputs:
flake-parts.lib.mkFlake {inherit inputs;} {
imports = [
./cad
./rust
./rust-esp32-c6
inputs.treefmt-nix.flakeModule
flake-parts.flakeModules.flakeModules
# define the flake.templates option
({lib, ...}: {
options.flake.templates = lib.mkOption {
type = lib.types.lazyAttrsOf (lib.types.submodule {
options = {
path = lib.mkOption {type = lib.types.path;};
description = lib.mkOption {type = lib.types.str;};
};
});
default = {};
};
})
];
flake.flakeModule = {
imports = builtins.attrValues (builtins.removeAttrs self.flakeModules ["default"]);
};
systems = ["aarch64-linux" "x86_64-linux" "aarch64-darwin"];
perSystem = {pkgs, ...}: {
treefmt.programs = {
alejandra.enable = true; # nix
taplo.enable = true; # toml
rumdl-check.enable = true; # markdown
rumdl-format.enable = true; # markdown
};
};
};
}