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

View File

@ -74,11 +74,6 @@ in
programs.jq = { programs.jq = {
enable = true; 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) # nix: Propagates the environment with packages and vars when enter (children of)
# a directory with shell.nix-compatible and .envrc # a directory with shell.nix-compatible and .envrc
programs.direnv = { programs.direnv = {

View File

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