mirror of
https://gitlab.com/rensa-nix/devtools.git
synced 2025-12-12 22:30:07 +01:00
chore: initial commit
This commit is contained in:
commit
db488d8f41
26 changed files with 1077 additions and 0 deletions
59
lib/modules/cocogitto.nix
Normal file
59
lib/modules/cocogitto.nix
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
{
|
||||
lib,
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkEnableOption mkOption mkIf types;
|
||||
cfg = config.cocogitto;
|
||||
|
||||
# we need a newer version than in nixpkgs, since the PR which adds `--config`
|
||||
# didn't land in a release yet
|
||||
cocogitto = pkgs.cocogitto.overrideAttrs (_prev: {
|
||||
version = "2025-09-11";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "oknozor";
|
||||
repo = "cocogitto";
|
||||
rev = "031cc238cb3e3e8aa3a525c1df089c3e70020efc";
|
||||
hash = "sha256-fyhugacBLJPMqHWxoxBTFhIE3wHDB9xdrqJYzJc36I0=";
|
||||
};
|
||||
});
|
||||
|
||||
configFile = (pkgs.formats.toml {}).generate "cog.toml" cfg.config;
|
||||
cogAlias = pkgs.writeTextFile {
|
||||
name = "cog-alias";
|
||||
destination = "/bin/${cfg.alias}";
|
||||
executable = true;
|
||||
text =
|
||||
# sh
|
||||
''
|
||||
${cocogitto}/bin/cog --config "${configFile}" ''${@:1}
|
||||
'';
|
||||
};
|
||||
in {
|
||||
options.cocogitto = {
|
||||
enable =
|
||||
mkEnableOption "Cocogitto"
|
||||
// {
|
||||
default = cfg.config != {};
|
||||
};
|
||||
alias = mkOption {
|
||||
type = types.str;
|
||||
default = "cog";
|
||||
description = ''
|
||||
Alias for `cog`.
|
||||
'';
|
||||
};
|
||||
config = mkOption {
|
||||
type = types.attrs;
|
||||
default = {};
|
||||
description = ''
|
||||
Configure cocogitto here.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
packages = [cogAlias];
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue