add hm modules: riff

This commit is contained in:
Vivian 2022-12-26 13:02:48 +01:00
parent 3c0f89c66a
commit 4b90002e45
6 changed files with 79 additions and 45 deletions

View file

@ -1,13 +1,12 @@
{ inputs, lib, config, ... }: {
# This file deals with everything requiring `inputs`, the rest being delagated to `common.nix`
# this is because we can't import inputs from all contexts as that can lead to infinite recursion.
imports = [
./common.nix
inputs.vault-secrets.nixosModules.vault-secrets
];
imports = [ ./common.nix inputs.vault-secrets.nixosModules.vault-secrets ];
nix.nixPath = [ "nixpkgs=${inputs.nixpkgs}" ];
nix.registry.nixpkgs.flake = inputs.nixpkgs;
nix.registry.nixpkgs.flake = inputs.nixpkgs;
home-manager.sharedModules = [ ./hm-modules ];
vault-secrets = let
inherit (config.networking) domain hostName;

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)"
}
'';
};
};
}