macos: extract macos option globally

This commit is contained in:
Zynh Ludwig 2024-07-21 12:41:21 -07:00
parent 4dad83e4ae
commit bf3ae9c4d0
4 changed files with 15 additions and 9 deletions

View file

@ -2,11 +2,11 @@
let
cfg = config.snowhawk.alacritty;
macos = config.snowhawk.macos.enable;
in
{
options.snowhawk.alacritty = {
enable = lib.mkEnableOption "alacritty home-manager module";
macos = lib.mkEnableOption "macos specific tweaks";
};
config = lib.mkIf cfg.enable {
@ -15,8 +15,8 @@ in
settings = {
window = {
opacity = 0.98;
decorations = lib.mkIf cfg.macos "buttonless";
option_as_alt = lib.mkIf cfg.macos "Both";
decorations = lib.mkIf macos "buttonless";
option_as_alt = lib.mkIf macos "Both";
};
colors = {
primary.background = "#050505";

View file

@ -2,16 +2,15 @@
let
cfg = config.snowhawk.fish;
macos = config.snowhawk.macos.enable;
in
{
options.snowhawk.fish = {
enable = lib.mkEnableOption "fish";
macos = lib.mkEnableOption "macos specific tweaks";
};
config = lib.mkIf cfg.enable {
programs.bash = lib.mkIf (!cfg.macos) {
programs.bash = lib.mkIf (!macos) {
enable = true;
initExtra = ''
if [[ $(${pkgs.procps}/bin/ps --no-header --pid=$PPID --format=comm) != "fish" && -z ''${BASH_EXECUTION_STRING} ]]
@ -22,7 +21,7 @@ in
'';
};
programs.zsh = lib.mkIf cfg.macos {
programs.zsh = lib.mkIf macos {
enable = true;
initExtra = ''
if [[ $(${pkgs.procps}/bin/ps $(${pkgs.procps}/bin/ps -p $$ -co "ppid=") -co "comm=") != "fish" && -z ''${BASH_EXECUTION_STRING} ]]

7
home/modules/macos.nix Normal file
View file

@ -0,0 +1,7 @@
{ lib, ... }:
{
options.snowhawk.macos = {
enable = lib.mkEnableOption "macos";
};
}

View file

@ -15,9 +15,9 @@
};
snowhawk.alacritty = {
enable = true;
macos = true;
};
snowhawk.fish.macos = true;
snowhawk.macos.enable = true;
programs.alacritty.settings = {
font.size = lib.mkForce 16.0;