format everything

This commit is contained in:
Ray Andrew 2025-04-05 16:34:08 -05:00
parent fa4919f87e
commit 0fbad1d781
Signed by: rayandrew
SSH key fingerprint: SHA256:XYrYrxF0Z3A72n8P/p6mqPRNQZT22F88XcLsG+kX4xw
33 changed files with 1034 additions and 859 deletions

View file

@ -1,4 +1,9 @@
{ pkgs, lib, config, ... }:
{
pkgs,
lib,
config,
...
}:
{
options.custom = with lib; {
@ -39,7 +44,8 @@
script = pkgs.writeText "ghostty.applescript" ''
do shell script "open -n -a Ghostty"
'';
in "exec-and-forget osascript ${script}";
in
"exec-and-forget osascript ${script}";
alt-shift-f = "fullscreen";
alt-p = "layout floating tiling";

View file

@ -6,7 +6,8 @@
system,
host,
...
}: {
}:
{
imports = [
./aerospace.nix
./homebrew.nix
@ -53,10 +54,13 @@
# networking.hostId = builtins.substring 0 8 (builtins.hashString "md5" config.networking.hostName);
# networking.networkmanager.enable = true;
environment.systemPackages = with pkgs; [
environment.systemPackages =
with pkgs;
[
vim
htop
] ++ (lib.attrValues config.custom.shell.packages);
]
++ (lib.attrValues config.custom.shell.packages);
system.stateVersion = 6;
};

View file

@ -1,5 +1,25 @@
{ pkgs, user, inputs, ... }:
{
config,
lib,
pkgs,
user,
inputs,
...
}:
{
options.custom.brew = with lib; {
zen-browser = mkEnableOption "Enable Zen Browser";
webex = mkEnableOption "Enable Webe";
zoom = mkEnableOption "Enable Zoom";
slack = mkEnableOption "Enable Slack";
ghostty = mkEnableOption "Enable Ghostty";
ms-office = mkEnableOption "Enable MS Office";
ms-teams = mkEnableOption "Enable MS Teams";
spotify = mkEnableOption "Enable Spotify";
};
config = lib.mkMerge [
{
nix-homebrew = {
inherit user;
@ -12,7 +32,6 @@
};
mutableTaps = false;
};
homebrew = {
enable = true;
onActivation = {
@ -22,13 +41,47 @@
global = {
brewfile = true;
};
casks = [
"zen-browser"
"webex"
"slack"
"zoom"
"spotify"
"ghostty"
];
};
}
(lib.mkIf config.custom.brew.zen-browser {
homebrew.casks = [
"zen-browser"
];
})
(lib.mkIf config.custom.brew.webex {
homebrew.casks = [
"webex"
];
})
(lib.mkIf config.custom.brew.slack {
homebrew.casks = [
"slack"
];
})
(lib.mkIf config.custom.brew.zoom {
homebrew.casks = [
"zoom"
];
})
(lib.mkIf config.custom.brew.spotify {
homebrew.casks = [
"spotify"
];
})
(lib.mkIf config.custom.brew.ghostty {
homebrew.casks = [
"ghostty"
];
})
(lib.mkIf config.custom.brew.ms-office {
homebrew.casks = [
"microsoft-office"
];
})
(lib.mkIf config.custom.brew.ms-teams {
homebrew.casks = [
"microsoft-teams"
];
})
];
}

View file

@ -36,13 +36,15 @@
homebrew-createzap.flake = false;
};
outputs = {
outputs =
{
self,
nixpkgs,
home-manager,
treefmt-nix,
...
} @ inputs: let
}@inputs:
let
inherit (self) outputs;
user = "rayandrew";
lib = nixpkgs.lib;
@ -61,15 +63,26 @@
# call with forAllSystems (commonArgs: function body)
forAllSystems =
fn:
lib.genAttrs [
lib.genAttrs
[
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
] (system: fn (commonArgs // { inherit system; pkgs = import inputs.nixpkgs {
]
(
system:
fn (
commonArgs
// {
inherit system;
pkgs = import inputs.nixpkgs {
inherit system;
config.allowUnfree = true;
}; }));
};
}
)
);
treefmtEval = forAllSystems (
{ pkgs, ... }:
treefmt-nix.lib.evalModule pkgs {
@ -78,8 +91,9 @@
settings.global.excludes = [ "flake.lock" ];
}
);
in (import ./hosts commonArgs) //
{
in
(import ./hosts commonArgs)
// {
checks = forAllSystems (
{
pkgs,

View file

@ -6,7 +6,8 @@
system,
dots,
...
}: {
}:
{
imports = [
./email
./emacs

View file

@ -5,7 +5,8 @@
config,
dots,
...
}: {
}:
{
options.custom = with lib; {
emacs = {
enable = mkEnableOption "Enable emacs";

View file

@ -65,9 +65,11 @@
};
};
accounts.email = let
accounts.email =
let
cat = lib.getExe' pkgs.coreutils "cat";
in rec {
in
rec {
maildirBasePath = "${home-dir}/mail";
accounts = lib.mkMerge ([
{

View file

@ -20,11 +20,14 @@ in
};
config = lib.mkIf (config.custom.email.enable && config.custom.email.neomutt) {
xsession.windowManager.i3.config = let
xsession.windowManager.i3.config =
let
i3config = config.xsession.windowManager.i3.config;
in {
in
{
keybindings = lib.mkOptionDefault {
"${i3config.modifier}+m" = "exec --no-startup-id ${i3config.terminal} -e ${config.programs.neomutt.package}/bin/neomutt";
"${i3config.modifier}+m" =
"exec --no-startup-id ${i3config.terminal} -e ${config.programs.neomutt.package}/bin/neomutt";
};
};

View file

@ -15,9 +15,12 @@
};
config = lib.mkIf config.custom.gui.ghostty.enable {
home.packages = lib.mkIf pkgs.stdenv.isLinux (with pkgs; [
home.packages = lib.mkIf pkgs.stdenv.isLinux (
with pkgs;
[
inputs.ghostty.packages."${system}".default
]);
]
);
xdg.configFile."ghostty/config".text = ''
gtk-single-instance = true
gtk-titlebar = false

View file

@ -25,50 +25,16 @@
darwin = {
enable = mkEnableOption "Enable Darwin-only GUI";
};
vscode = {
enable = mkEnableOption "Enable VSCode";
};
config = lib.mkIf config.custom.gui.default.enable {
dconf.settings = {
"org/gnome/desktop/interface" = {
color-scheme = "prefer-dark";
show-battery-percentage = true;
clock-format = "12h";
firefox = {
enable = mkEnableOption "Enable Firefox";
};
};
programs.vscode = {
enable = true;
package = pkgs.vscode;
profiles.default = {
extensions = with pkgs.vscode-extensions; [
bbenoist.nix
ms-python.python
ms-vscode-remote.remote-ssh
] ++ pkgs.vscode-utils.extensionsFromVscodeMarketplace [
config = lib.mkMerge [
{
name = "remote-ssh-edit";
publisher = "ms-vscode-remote";
version = "0.87.0";
sha256 = "sha256-yeX6RAJl07d+SuYyGQFLZNcUzVKAsmPFyTKEn+y3GuM=";
}
];
};
};
programs.firefox = {
enable = true;
# package = lib.mkIf custom.gui.darwin.enable pkgs.firefox-bin or pkgs.firefox;
package = if config.custom.gui.darwin.enable then pkgs.firefox-bin else pkgs.firefox;
};
home.sessionVariables = lib.mkIf config.custom.gui.darwin.enable {
MOZ_LEGACY_PROFILES = "1";
};
# launchd.user.envVariables = lib.mkIf config.custom.gui.darwin.enable {
# MOZ_LEGACY_PROFILES = "1";
# };
home.packages = with pkgs; [
# globalprotect-openconnect
# firefox
@ -86,12 +52,64 @@
nerd-fonts.droid-sans-mono
nerd-fonts.space-mono
nerd-fonts.dejavu-sans-mono
];
}
(lib.mkIf config.custom.gui.default.enable {
dconf.settings = {
"org/gnome/desktop/interface" = {
color-scheme = "prefer-dark";
show-battery-percentage = true;
clock-format = "12h";
};
};
})
(lib.mkIf config.custom.gui.vscode.enable {
programs.vscode = {
enable = true;
package = pkgs.vscode;
profiles.default = {
extensions =
with pkgs.vscode-extensions;
[
bbenoist.nix
ms-python.python
ms-vscode-remote.remote-ssh
]
++ lib.optionals config.custom.gui.darwin.enable [
++ pkgs.vscode-utils.extensionsFromVscodeMarketplace [
{
name = "remote-ssh-edit";
publisher = "ms-vscode-remote";
version = "0.87.0";
sha256 = "sha256-yeX6RAJl07d+SuYyGQFLZNcUzVKAsmPFyTKEn+y3GuM=";
}
];
};
};
})
(lib.mkIf config.custom.gui.firefox.enable {
programs.firefox = {
enable = true;
# package = lib.mkIf custom.gui.darwin.enable pkgs.firefox-bin or pkgs.firefox;
package = if config.custom.gui.darwin.enable then pkgs.firefox-bin else pkgs.firefox;
};
home.sessionVariables = lib.mkIf config.custom.gui.darwin.enable {
MOZ_LEGACY_PROFILES = "1";
};
})
(lib.mkIf config.custom.gui.darwin.enable {
home.packages = with pkgs; [
raycast
custom.whatsapp-for-mac
]
++ lib.optionals config.custom.gui.linux.enable [
];
})
(lib.mkIf config.custom.gui.linux.enable {
home.packages = with pkgs; [
zotero
zoom-us
spotify
@ -110,31 +128,6 @@
quickemu
gf # debugger
];
gtk = {
enable = true;
theme = {
name = "Adwaita-dark";
package = pkgs.gnome-themes-extra;
};
};
qt = {
enable = config.custom.gui.linux.enable;
platformTheme.name = "adwaita";
style.name = "adwaita-dark";
};
services.redshift = {
enable = config.custom.gui.linux.enable;
# provider = "geoclue2";
provider = "manual";
# madison
latitude = "43.07305000";
longitude = "-89.40123000";
# chicago
# latitude = "41.85003000";
# longitude = "-87.65005000";
};
};
})
];
}

View file

@ -114,10 +114,14 @@
# "${modifier}+Shift+minus" = "move scratchpad";
# "${modifier}+minus" = "scratchpad show";
# media
"XF86AudioRaiseVolume" = "exec --no-startup-id ${pactl} set-sink-volume @DEFAULT_SINK@ +1% && ${refresh_i3status}";
"XF86AudioLowerVolume" = "exec --no-startup-id ${pactl} set-sink-volume @DEFAULT_SINK@ -1% && ${refresh_i3status}";
"XF86AudioMute" = "exec --no-startup-id ${pactl} set-sink-mute @DEFAULT_SINK@ toggle && ${refresh_i3status}";
"XF86AudioMicMute" = "exec --no-startup-id ${pactl} set-source-mute @DEFAULT_SOURCE@ toggle && ${refresh_i3status}";
"XF86AudioRaiseVolume" =
"exec --no-startup-id ${pactl} set-sink-volume @DEFAULT_SINK@ +1% && ${refresh_i3status}";
"XF86AudioLowerVolume" =
"exec --no-startup-id ${pactl} set-sink-volume @DEFAULT_SINK@ -1% && ${refresh_i3status}";
"XF86AudioMute" =
"exec --no-startup-id ${pactl} set-sink-mute @DEFAULT_SINK@ toggle && ${refresh_i3status}";
"XF86AudioMicMute" =
"exec --no-startup-id ${pactl} set-source-mute @DEFAULT_SOURCE@ toggle && ${refresh_i3status}";
"XF86AudioPlay" = "exec --no-startup-id ${playerctl} play-pause";
"XF86AudioPause" = "exec --no-startup-id ${playerctl} play-pause";
"XF86AudioNext" = "exec --no-startup-id ${playerctl} next";
@ -126,8 +130,10 @@
"XF86MonBrightnessUp" = "exec --no-startup-id ${light} s +10%";
"XF86MonBrightnessDown" = "exec --no-startup-id ${light} s 10%-";
# screenshot
"${modifier}+o" = "exec --no-startup-id ${maim} -s ~/Pictures/screenshots/$(date +%Y-%m-%d-%H-%M-%S).png";
"${modifier}+Shift+o" = "exec --no-startup-id ${maim} -s | ${clipboard} -selection clipboard -t image/png";
"${modifier}+o" =
"exec --no-startup-id ${maim} -s ~/Pictures/screenshots/$(date +%Y-%m-%d-%H-%M-%S).png";
"${modifier}+Shift+o" =
"exec --no-startup-id ${maim} -s | ${clipboard} -selection clipboard -t image/png";
# others
"${modifier}+space" = "exec --no-startup-id ${dmenu}";
"${modifier}+b" = "exec --no-startup-id ${terminal} -e ${yazi}";
@ -138,7 +144,8 @@
"${modifier}+w" = null;
"${modifier}+d" = null;
};
modes = let
modes =
let
exitMode = {
"Escape" = "mode default";
"Return" = "mode default";

View file

@ -9,7 +9,8 @@
hm,
host,
...
}: {
}:
{
imports = [
];
@ -17,14 +18,22 @@
nix.enable = false;
users.users = {
${user} = {
users.users.${user} = {
home = "/Users/${user}";
};
};
custom = {
aerospace.enable = true;
brew = {
zen-browser = true;
webex = true;
slack = true;
zoom = true;
spotify = true;
ghostty = true;
ms-office = true;
ms-teams = true;
};
};
hm.custom = {
@ -34,6 +43,8 @@
default.enable = true;
darwin.enable = true;
ghostty.enable = true;
firefox.enable = true;
vscode.enable = true;
};
};
}

View file

@ -41,7 +41,9 @@ let
./${host}/hardware.nix
../nixos
../overlays
({config, ...}: {
(
{ config, ... }:
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
@ -61,13 +63,17 @@ let
] ++ lib.optional (builtins.pathExists ./${host}/home.nix) ./${host}/home.nix;
};
};
})
}
)
# alias for home-manager
(lib.mkAliasOptionModule [ "hm" ] [
(lib.mkAliasOptionModule
[ "hm" ]
[
"home-manager"
"users"
user
])
]
)
inputs.home-manager.nixosModules.home-manager
inputs.sops-nix.nixosModules.sops
];
@ -106,7 +112,9 @@ let
modules = [
./${host}
../darwin
({config, ...}: {
(
{ config, ... }:
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
@ -127,13 +135,17 @@ let
] ++ lib.optional (builtins.pathExists ./${host}/home.nix) ./${host}/home.nix;
};
};
})
}
)
# alias for home-manager
(lib.mkAliasOptionModule [ "hm" ] [
(lib.mkAliasOptionModule
[ "hm" ]
[
"home-manager"
"users"
user
])
]
)
inputs.home-manager.darwinModules.home-manager
inputs.mac-app-util.darwinModules.default
inputs.nix-homebrew.darwinModules.nix-homebrew

View file

@ -9,7 +9,8 @@
hm,
host,
...
}: {
}:
{
imports = [
./hardware.nix
];
@ -38,7 +39,12 @@
initialPassword = "abc123";
isNormalUser = true;
openssh.authorizedKeys.keys = [ ];
extraGroups = ["wheel" "video" "audio" "networkmanager"];
extraGroups = [
"wheel"
"video"
"audio"
"networkmanager"
];
};
};

View file

@ -1,14 +1,27 @@
{ config, lib, pkgs, modulesPath, inputs, ... }:
{
config,
lib,
pkgs,
modulesPath,
inputs,
...
}:
{
boot.loader.systemd-boot.enable = true;
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
./disko.nix
inputs.nixos-hardware.nixosModules.system76
];
boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "usbhid" "sd_mod" "sdhci_pci" ];
boot.initrd.availableKernelModules = [
"nvme"
"xhci_pci"
"usbhid"
"sd_mod"
"sdhci_pci"
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];

View file

@ -9,7 +9,8 @@
hm,
host,
...
}: {
}:
{
imports = [
./hardware.nix
];
@ -39,7 +40,12 @@
initialPassword = "abc123";
isNormalUser = true;
openssh.authorizedKeys.keys = [ ];
extraGroups = ["wheel" "video" "audio" "networkmanager"];
extraGroups = [
"wheel"
"video"
"audio"
"networkmanager"
];
};
};

View file

@ -1,14 +1,28 @@
{ config, lib, pkgs, modulesPath, inputs, ... }:
{
config,
lib,
pkgs,
modulesPath,
inputs,
...
}:
{
boot.loader.systemd-boot.enable = true;
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
./disko.nix
inputs.nixos-hardware.nixosModules.framework-13-7040-amd
];
boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "thunderbolt" "usb_storage" "usbhid" "sd_mod" ];
boot.initrd.availableKernelModules = [
"nvme"
"xhci_pci"
"thunderbolt"
"usb_storage"
"usbhid"
"sd_mod"
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];

View file

@ -6,7 +6,8 @@
system,
host,
...
}: {
}:
{
imports = [
./1password.nix
./audio.nix
@ -84,10 +85,13 @@
};
};
environment.systemPackages = with pkgs; [
environment.systemPackages =
with pkgs;
[
vim
htop
] ++ (lib.attrValues config.custom.shell.packages);
]
++ (lib.attrValues config.custom.shell.packages);
system.stateVersion = "25.05";
};

View file

@ -21,14 +21,14 @@
};
};
config = lib.mkIf config.custom.keyd.enable {
environment.systemPackages = with pkgs; [
keyd
];
users.groups.keyd = { };
services.keyd = let
services.keyd =
let
commonSettings = {
main = {
capslock = "layer(capslock)";
@ -40,7 +40,8 @@
};
"capslock:C" = { };
};
in {
in
{
enable = true;
keyboards = {
default = {

View file

@ -1,7 +1,8 @@
{
inputs,
...
}: _: prev: {
}:
_: prev: {
# include nixpkgs stable
stable = import inputs.nixpkgs-stable {
inherit (prev.pkgs) system;

View file

@ -1,4 +1,13 @@
{ lib, stdenv, fetchFromGitHub, nim, libX11, libXrandr, libGL, nim-1_0 }:
{
lib,
stdenv,
fetchFromGitHub,
nim,
libX11,
libXrandr,
libGL,
nim-1_0,
}:
let
x11-nim = fetchFromGitHub {
@ -13,7 +22,8 @@ let
rev = "8e2e098f82dc5eefd874488c37b5830233cd18f4";
sha256 = "sha256-v3bMDobYQZqX0anBFIUfZx5q5/vxTHO6PDtKQlf5mgU=";
};
in stdenv.mkDerivation rec {
in
stdenv.mkDerivation rec {
pname = "boomer";
version = "unstable-2024-02-08";
src = fetchFromGitHub {
@ -22,11 +32,23 @@ in stdenv.mkDerivation rec {
rev = "dfd4e1f5514e2a9d7c7a6429c1c0642c2021e792";
sha256 = "sha256-o65/VVxttriA5Qqt35lLKkWIZYS7T4VBBuYdAIGUmx8=";
};
buildInputs = [ nim-1_0 libX11 libXrandr libGL ];
buildInputs = [
nim-1_0
libX11
libXrandr
libGL
];
buildPhase = ''
HOME=$TMPDIR
nim -p:${x11-nim}/ -p:${opengl-nim}/src c -d:release src/boomer.nim
'';
installPhase = "install -Dt $out/bin src/boomer";
fixupPhase = "patchelf --set-rpath ${lib.makeLibraryPath [stdenv.cc.cc libX11 libXrandr libGL]} $out/bin/boomer";
fixupPhase = "patchelf --set-rpath ${
lib.makeLibraryPath [
stdenv.cc.cc
libX11
libXrandr
libGL
]
} $out/bin/boomer";
}

View file

@ -5,7 +5,8 @@
}:
let
inherit (pkgs) lib callPackage;
in rec {
in
rec {
minimal-emacs-d = callPackage ./minimal-emacs-d { };
boomer = callPackage ./boomer { };
nh = callPackage ./nh { };

View file

@ -1,4 +1,8 @@
{ lib, stdenv, pkgs }:
{
lib,
stdenv,
pkgs,
}:
let
pre-early-init = ./pre-early-init.el;

View file

@ -34,15 +34,10 @@ stdenvNoCC.mkDerivation rec {
sourceRoot = ".";
installPhase =
''
''
''''
+ lib.optionalString fonts ''
mkdir -p $out/share/fonts/truetype
cp ./Library/Fonts/${
if full
then "*"
else "SF-Pro.ttf"
} $out/share/fonts/truetype
cp ./Library/Fonts/${if full then "*" else "SF-Pro.ttf"} $out/share/fonts/truetype
''
+ lib.optionalString app ''
mkdir -p $out/Applications
@ -51,13 +46,11 @@ stdenvNoCC.mkDerivation rec {
meta = {
description =
if app
then "Tool that provides consistent, highly configurable symbols for apps"
else "Fonts from SF Symbols";
if app then
"Tool that provides consistent, highly configurable symbols for apps"
else
"Fonts from SF Symbols";
homepage = "https://developer.apple.com/sf-symbols/";
platforms =
if app
then lib.platforms.darwin
else lib.platforms.all;
platforms = if app then lib.platforms.darwin else lib.platforms.all;
};
}