add hm modules: riff

This commit is contained in:
Vivian 2022-12-26 13:02:48 +01:00
parent 205e7de702
commit f91842b292
6 changed files with 79 additions and 45 deletions

View file

@ -0,0 +1,5 @@
{ ... }: {
imports = [
./riff.nix
];
}

View file

@ -0,0 +1,28 @@
{ config, pkgs, lib, inputs, ... }:
with lib;
let cfg = config.programs.riff;
in {
options.programs.riff = {
enable = mkEnableOption "riff";
direnv = mkOption {
type = types.bool;
default = false;
description = ''
Whether to enable direnv support
'';
};
};
config = mkIf cfg.enable {
home.packages = [ inputs.riff.packages.${pkgs.system}.riff ];
xdg.configFile."direnv/lib/riff.sh" = mkIf cfg.direnv {
executable = true;
text = ''
use_riff() {
watch_file Cargo.toml watch_file Cargo.lock
eval "$(riff --offline print-dev-env)"
}
'';
};
};
}