add hm modules: riff
This commit is contained in:
parent
205e7de702
commit
f91842b292
6 changed files with 79 additions and 45 deletions
|
@ -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;
|
||||
|
|
5
nixos/common/hm-modules/default.nix
Normal file
5
nixos/common/hm-modules/default.nix
Normal file
|
@ -0,0 +1,5 @@
|
|||
{ ... }: {
|
||||
imports = [
|
||||
./riff.nix
|
||||
];
|
||||
}
|
28
nixos/common/hm-modules/riff.nix
Normal file
28
nixos/common/hm-modules/riff.nix
Normal 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)"
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
|
@ -21,7 +21,6 @@ in {
|
|||
gcc
|
||||
gimp
|
||||
inputs.comma.packages.${pkgs.system}.default
|
||||
inputs.riff.packages.${pkgs.system}.riff
|
||||
inputs.webcord.packages.${pkgs.system}.default
|
||||
jetbrains.clion
|
||||
jetbrains.idea-ultimate
|
||||
|
@ -36,6 +35,11 @@ in {
|
|||
yt-dlp
|
||||
];
|
||||
|
||||
programs.riff = {
|
||||
enable = true;
|
||||
direnv = true;
|
||||
};
|
||||
|
||||
xdg.mimeApps.enable = true;
|
||||
xdg.mimeApps.defaultApplications = {
|
||||
"text/html" = "firefox.desktop";
|
||||
|
|
|
@ -3,32 +3,31 @@ let
|
|||
inherit (builtins) filter attrValues concatLists;
|
||||
|
||||
# Helper function to resolve what should be imported depending on the type of config (lxc, vm, bare metal)
|
||||
resolve_imports =
|
||||
let
|
||||
# lookup table
|
||||
import_cases = {
|
||||
"lxc" = [
|
||||
"${nixpkgs}/nixos/modules/virtualisation/lxc-container.nix"
|
||||
./common/generic-lxc.nix
|
||||
];
|
||||
"vm" = [
|
||||
./common/generic-vm.nix
|
||||
];
|
||||
"local" = [
|
||||
hyprland.nixosModules.default
|
||||
];
|
||||
};
|
||||
in
|
||||
{ hostname, realm, profile ? hostname, type ? "lxc", ... }: [
|
||||
home-manager.nixosModules.home-manager
|
||||
mailserver.nixosModules.mailserver
|
||||
./common
|
||||
"${./.}/hosts/${realm}/${profile}/configuration.nix"
|
||||
] ++ import_cases.${type};
|
||||
in
|
||||
{
|
||||
resolve_imports = let
|
||||
# lookup table
|
||||
import_cases = {
|
||||
"lxc" = [
|
||||
"${nixpkgs}/nixos/modules/virtualisation/lxc-container.nix"
|
||||
./common/generic-lxc.nix
|
||||
];
|
||||
"vm" = [ ./common/generic-vm.nix ];
|
||||
"local" = [ hyprland.nixosModules.default ];
|
||||
};
|
||||
in { hostname, realm, profile ? hostname, type ? "lxc", ... }:
|
||||
[
|
||||
home-manager.nixosModules.home-manager
|
||||
mailserver.nixosModules.mailserver
|
||||
./common
|
||||
"${./.}/hosts/${realm}/${profile}/configuration.nix"
|
||||
] ++ import_cases.${type};
|
||||
in {
|
||||
# Add to whatever realm a host belong to its list of tags
|
||||
add_realm_to_tags = realm: map ({ tags ? [ ], ... }@host: host // { tags = [ realm ] ++ tags; inherit realm; });
|
||||
add_realm_to_tags = realm:
|
||||
map ({ tags ? [ ], ... }@host:
|
||||
host // {
|
||||
tags = [ realm ] ++ tags;
|
||||
inherit realm;
|
||||
});
|
||||
# Flatten all hosts to a single list
|
||||
flatten_hosts = hosts: concatLists (attrValues hosts);
|
||||
# Filter out all hosts which aren't nixos
|
||||
|
@ -39,8 +38,7 @@ in
|
|||
let
|
||||
# this makes local apply work a bit nicer
|
||||
name = if realm == "thalassa" then hostname else "${hostname}.${realm}";
|
||||
in
|
||||
{
|
||||
in {
|
||||
"${name}" = {
|
||||
imports = resolve_imports host;
|
||||
networking = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue