Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion devenv.lock
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,9 @@
"git-hooks": "git-hooks",
"nix": "nix",
"nixpkgs": "nixpkgs_2",
"pre-commit-hooks": [
"git-hooks"
],
"rust-overlay": "rust-overlay"
}
},
Expand All @@ -271,4 +274,4 @@
},
"root": "root",
"version": 7
}
}
37 changes: 37 additions & 0 deletions flake-module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,45 @@ devenvFlake: { flake-parts-lib, lib, inputs, ... }: {
'';
default = { };
};
options.devenv.git-hooks = {
enable = lib.mkOption {
type = lib.types.bool;
default = (inputs.git-hooks or null) != null;
description = "Enable git-hooks git-hooks.";
};
shell = lib.mkOption {
type = lib.types.str;
default = "default";
description = "Shell name to read git-hooks git-hooks configuration from.";
};
};
options.devenv.treefmt = {
enable = lib.mkOption {
type = lib.types.bool;
default = (inputs.treefmt-nix or null) != null;
description = "Enable treefmt.";
};
shell = lib.mkOption {
type = lib.types.str;
default = "default";
description = "Shell name to read treefmt configuration from.";
};
};

config.devShells = lib.mapAttrs (_name: devenv: devenv.shell) config.devenv.shells;

config.pre-commit.settings =
if config.devenv.git-hooks.enable && builtins.hasAttr config.devenv.git-hooks.shell config.devenv.shells then
config.devenv.shells.${config.devenv.git-hooks.shell}.git-hooks
else
{ };

config.treefmt =
if config.devenv.treefmt.enable && builtins.hasAttr config.devenv.treefmt.shell config.devenv.shells then
config.devenv.shells.${config.devenv.treefmt.shell}.treefmt.config
else
{ };

# Deprecated packages
# These were used to wire up commands in the devenv shim and are no longer necessary.
config.packages =
Expand Down