componentized alacritty in home-manager

nix-rearch
pegasust 2022-12-10 17:00:49 -07:00
parent a6763a59eb
commit b8d7024b93
9 changed files with 66 additions and 13 deletions

View File

@ -0,0 +1,35 @@
{ config
, proj_root
, myLib
, ...
}:
let
inherit (myLib) fromYaml;
actualConfig = fromYaml (builtins.readFile "${proj_root}//alacritty/alacritty.yml");
cfg = config.base.alacritty;
in
{
options.base.alacritty.font.family = myLib.mkOption {
type = myLib.types.singleLineStr;
default = actualConfig.font.normal.family;
description = ''
The font family for Alacritty
'';
example = "DroidSansMono NF";
};
options.base.alacritty.enable = myLib.mkOption {
type = myLib.types.bool;
default = true;
description = ''
Enables alacritty
'';
example = true;
};
config.programs.alacritty = {
enable = cfg.enable;
settings = actualConfig // {
font.normal.family = cfg.font.family;
};
};
}

View File

@ -0,0 +1,3 @@
{
}

View File

@ -0,0 +1,3 @@
{
}:

View File

@ -0,0 +1,12 @@
{ pkgs
, lib ? pkgs.lib
, ...
}@inputs:
let
_lib = lib // import ../../lib { inherit pkgs lib; };
in
# TODO: Unpollute inputs
inputs // {
proj_root = builtins.toString ./../../..;
myLib = _lib;
}

View File

View File

View File

@ -27,7 +27,8 @@
inherit system overlays;
config = { allowUnfree = true; };
};
lib = (import ../lib { inherit pkgs; lib = pkgs.lib; });
# lib = (import ../lib { inherit pkgs; lib = pkgs.lib; });
mkModuleArgs = import ./base/mkModuleArgs.nix;
in
{
homeConfigurations =
@ -46,8 +47,8 @@
# optionally pass inarguments to module
# we migrate this from in-place modules to allow flexibility
# in this case, we can add "home" to input arglist of home.nix
extraSpecialArgs = {
myLib = lib;
extraSpecialArgs = mkModuleArgs {
inherit pkgs;
myHome = {
username = "hungtr";
homeDirectory = "/home/hungtr";
@ -62,8 +63,8 @@
# optionally pass inarguments to module
# we migrate this from in-place modules to allow flexibility
# in this case, we can add "home" to input arglist of home.nix
extraSpecialArgs = {
myLib = lib;
extraSpecialArgs = mkModuleArgs {
inherit pkgs;
myHome = {
username = "nixos";
homeDirectory = "/home/nixos";
@ -94,9 +95,13 @@
inherit pkgs;
modules = [
./home.nix
./base/alacritty.nix
{
base.alacritty.font.family = "BitstreamVeraSansMono Nerd Font";
}
];
extraSpecialArgs = {
myLib = lib;
extraSpecialArgs = mkModuleArgs {
inherit pkgs;
myHome = {
username = "hwtr";
homeDirectory = "/home/hwtr";

View File

@ -74,11 +74,6 @@ in
programs.jq = {
enable = true;
};
programs.alacritty = myHome.programs.alacritty or {
enable = true;
# settings = myLib.fromYaml (builtins.readFile "${proj_root}/alacritty/alacritty.yml");
settings = fromYaml (builtins.readFile "${proj_root}//alacritty/alacritty.yml");
};
# nix: Propagates the environment with packages and vars when enter (children of)
# a directory with shell.nix-compatible and .envrc
programs.direnv = {

View File

@ -1,5 +1,5 @@
{ pkgs
, lib
, lib ? pkgs.lib
, ... }@flake_import:
let serde = import ./serde { inherit pkgs lib; };
in