more darwin cleanup

This commit is contained in:
Noah Masur 2022-06-19 23:44:29 -04:00
parent a8f497e226
commit e22a4f3df2
18 changed files with 116 additions and 103 deletions

View File

@ -39,16 +39,9 @@
globals = { globals = {
user = "noah"; user = "noah";
fullName = "Noah Masur"; fullName = "Noah Masur";
passwordHash =
"$6$PZYiMGmJIIHAepTM$Wx5EqTQ5GApzXx58nvi8azh16pdxrN6Qrv1wunDlzveOgawitWzcIxuj76X9V868fsPi/NOIEO8yVXqwzS9UF.";
gitEmail = "7386960+nmasur@users.noreply.github.com"; gitEmail = "7386960+nmasur@users.noreply.github.com";
mailServer = "noahmasur.com"; mailServer = "noahmasur.com";
dotfilesRepo = "https://github.com/nmasur/dotfiles"; dotfilesRepo = "https://github.com/nmasur/dotfiles";
gui = {
colorscheme = (import ./modules/colorscheme/gruvbox);
wallpaper = "${wallpapers}/gruvbox/road.jpg";
gtk.theme = { name = "Adwaita-dark"; };
};
}; };
# System types to support. # System types to support.
@ -64,8 +57,9 @@
# nix-shell -p nixFlakes # nix-shell -p nixFlakes
# sudo nixos-rebuild switch --flake github:nmasur/dotfiles#desktop # sudo nixos-rebuild switch --flake github:nmasur/dotfiles#desktop
nixosConfigurations = { nixosConfigurations = {
desktop = desktop = import ./hosts/desktop {
import ./hosts/desktop { inherit nixpkgs home-manager nur globals; }; inherit nixpkgs home-manager nur globals wallpapers;
};
}; };
darwinConfigurations = { darwinConfigurations = {

View File

@ -3,10 +3,33 @@
imports = [ ../modules/shell ../modules/editor ../modules/mail/himalaya.nix ]; imports = [ ../modules/shell ../modules/editor ../modules/mail/himalaya.nix ];
options = with lib; { options = with lib; {
user = mkOption {
type = types.str;
description = "Primary user of the system";
};
userDirs = {
# Required to prevent infinite recursion when referenced by himalaya
download = lib.mkOption {
type = lib.types.str;
description = "XDG directory for downloads";
default =
if pkgs.stdenv.isDarwin then "$HOME/Downloads" else "$HOME/downloads";
};
};
gui = {
enable = mkEnableOption {
description = "Enable graphics";
default = false;
};
colorscheme = mkOption {
type = types.attrs;
description = "Base16 color scheme";
};
};
dotfilesPath = mkOption { dotfilesPath = mkOption {
type = types.path; type = types.path;
description = "Path of dotfiles repository."; description = "Path of dotfiles repository.";
default = builtins.toPath "/home/${config.user}/dev/personal/dotfiles"; default = builtins.toPath "$HOME/dev/personal/dotfiles";
}; };
dotfilesRepo = mkOption { dotfilesRepo = mkOption {
type = types.str; type = types.str;
@ -24,9 +47,6 @@
# Enable features in Nix commands # Enable features in Nix commands
nix.extraOptions = "experimental-features = nix-command flakes"; nix.extraOptions = "experimental-features = nix-command flakes";
# Pin a state version to prevent warnings
# system.stateVersion = "22.11";
# Basic common system packages for all devices # Basic common system packages for all devices
environment.systemPackages = with pkgs; [ git vim wget curl ]; environment.systemPackages = with pkgs; [ git vim wget curl ];

View File

@ -1,4 +1,4 @@
{ nixpkgs, home-manager, nur, globals, ... }: { nixpkgs, home-manager, nur, globals, wallpapers, ... }:
# System configuration for my desktop # System configuration for my desktop
nixpkgs.lib.nixosSystem { nixpkgs.lib.nixosSystem {
@ -9,13 +9,21 @@ nixpkgs.lib.nixosSystem {
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager
{ {
networking.hostName = "desktop"; networking.hostName = "desktop";
gui.enable = true;
gui.compositor.enable = true;
nixpkgs.overlays = [ nur.overlay ]; nixpkgs.overlays = [ nur.overlay ];
gaming.steam = true; gaming.steam = true;
gaming.leagueoflegends = true; gaming.leagueoflegends = true;
gaming.legendary = true; gaming.legendary = true;
gui = {
enable = true;
compositor.enable = true;
colorscheme = (import ../modules/colorscheme/gruvbox);
wallpaper = "${wallpapers}/gruvbox/road.jpg";
gtk.theme = { name = "Adwaita-dark"; };
};
passwordHash =
"$6$PZYiMGmJIIHAepTM$Wx5EqTQ5GApzXx58nvi8azh16pdxrN6Qrv1wunDlzveOgawitWzcIxuj76X9V868fsPi/NOIEO8yVXqwzS9UF.";
} }
./hardware-configuration.nix ./hardware-configuration.nix
../common.nix ../common.nix
../../modules/hardware ../../modules/hardware

View File

@ -5,24 +5,17 @@ darwin.lib.darwinSystem {
system = "x86_64-darwin"; system = "x86_64-darwin";
specialArgs = { }; specialArgs = { };
modules = [ modules = [
globals
home-manager.darwinModules.home-manager home-manager.darwinModules.home-manager
{ {
user = "Noah.Masur"; user = "Noah.Masur";
fullName = globals.fullName; gui.enable = true;
gitEmail = globals.gitEmail; gui.colorscheme = (import ../modules/colorscheme/gruvbox);
mailServer = globals.mailServer;
dotfilesRepo = globals.dotfilesRepo;
dotfilesPath = "/Users/Noah.Masur/dev/dotfiles";
gui = {
enable = true;
colorscheme = globals.gui.colorscheme;
};
nixpkgs.overlays = [ nur.overlay ]; nixpkgs.overlays = [ nur.overlay ];
} }
../common.nix ../common.nix
../../modules/darwin ../../modules/darwin
../../modules/applications/alacritty.nix ../../modules/applications/alacritty.nix
../../modules/applications/discord.nix ../../modules/applications/discord.nix
../../modules/applications/obsidian.nix
]; ];
} }

View File

@ -19,15 +19,7 @@
opacity = 1.0; opacity = 1.0;
}; };
scrolling.history = 10000; scrolling.history = 10000;
font = { font = { size = 14.0; };
size = 14.0;
normal = {
family = builtins.head (if pkgs.stdenv.isDarwin then
[ "FiraCode Nerd Font Mono" ]
else
config.fonts.fontconfig.defaultFonts.monospace);
};
};
key_bindings = [ key_bindings = [
{ {
key = "L"; key = "L";

View File

@ -1,34 +1,15 @@
{ lib, ... }: { { ... }: {
imports = [ imports = [
./system.nix
./user.nix
./tmux.nix
./utilities.nix
./hammerspoon.nix
./alacritty.nix ./alacritty.nix
./dotfiles.nix
./fonts.nix
./hammerspoon.nix
./homebrew.nix ./homebrew.nix
./system.nix
./tmux.nix
./user.nix
./utilities.nix
]; ];
options = with lib; {
user = mkOption {
type = types.str;
description = "Primary user of the system";
};
gui = {
enable = mkEnableOption {
description = "Enable graphics";
default = false;
};
colorscheme = mkOption {
type = types.attrs;
description = "Base16 color scheme";
};
};
};
} }

View File

@ -0,0 +1,28 @@
{ config, ... }: {
home-manager.users.${config.user} = {
programs.fish = {
shellAbbrs = {
nr = "rebuild-darwin";
nro = "rebuild-darwin offline";
};
functions = {
rebuild-nixos = {
body = ''
if test "$argv[1]" = "offline"
set option "--option substitute false"
end
pushd ${config.dotfilesPath}
git add --all
popd
commandline -r darwin-rebuild switch $option --flake ${config.dotfilesPath}#macbook
commandline -f execute
'';
};
};
};
};
}

14
modules/darwin/fonts.nix Normal file
View File

@ -0,0 +1,14 @@
{ config, pkgs, ... }: {
home-manager.users.${config.user} = {
home.packages = with pkgs;
[ (nerdfonts.override { fonts = [ "FiraCode" ]; }) ];
programs.alacritty.settings = {
font.normal.family = "FiraCode Nerd Font Mono";
};
};
}

View File

@ -1,5 +1,8 @@
{ config, ... }: { { config, ... }: {
# Homebrew - Mac-specific packages that aren't in Nix
# Requires Homebrew to be installed (works if you rebuild twice)
homebrew = { homebrew = {
enable = true; enable = true;
autoUpdate = false; # Don't update during rebuild autoUpdate = false; # Don't update during rebuild
@ -34,10 +37,10 @@
config.home-manager.users.${config.user}.lib.dag.entryAfter config.home-manager.users.${config.user}.lib.dag.entryAfter
[ "writeBoundary" ] '' [ "writeBoundary" ] ''
if ! xcode-select --version 2>/dev/null; then if ! xcode-select --version 2>/dev/null; then
xcode-select --install $DRY_RUN_CMD xcode-select --install
fi fi
if ! /usr/local/bin/brew --version 2>/dev/null; then if ! /usr/local/bin/brew --version 2>/dev/null; then
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" $DRY_RUN_CMD /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi fi
''; '';

View File

@ -0,0 +1,8 @@
{ ... }: {
networking = {
computerName = "MacBook"; # Host name
hostName = "MacBook";
};
}

View File

@ -5,9 +5,4 @@
shell = pkgs.zsh; # Default shell shell = pkgs.zsh; # Default shell
}; };
#networking = {
# computerName = "MacBook"; # Host name
# hostName = "MacBook";
#};
} }

View File

@ -14,7 +14,6 @@
kubectl kubectl
k9s k9s
noti # Create notifications programmatically noti # Create notifications programmatically
(pkgs.nerdfonts.override { fonts = [ "FiraCode" ]; })
]; ];
}; };

View File

@ -16,16 +16,13 @@
}; };
programs.fish = let programs.fish = {
system = if pkgs.stdenv.isDarwin then "darwin" else "nixos";
sudo = if pkgs.stdenv.isDarwin then "" else "doas";
in {
shellAbbrs = { shellAbbrs = {
nr = "rebuild-${system}"; nr = "rebuild-nixos";
nro = "rebuild-${system} offline"; nro = "rebuild-nixos offline";
}; };
functions = { functions = {
"rebuild-${system}" = { rebuild-nixos = {
body = '' body = ''
if test "$argv[1]" = "offline" if test "$argv[1]" = "offline"
set option "--option substitute false" set option "--option substitute false"
@ -33,8 +30,8 @@
pushd ${config.dotfilesPath} pushd ${config.dotfilesPath}
git add --all git add --all
popd popd
echo "${sudo} ${system}-rebuild switch $option --flake ${config.dotfilesPath}" commandline -r doas nixos-rebuild switch $option --flake ${config.dotfilesPath}
${sudo} ${system}-rebuild switch $option --flake ${config.dotfilesPath} commandline -f execute
''; '';
}; };
}; };

View File

@ -13,10 +13,6 @@
options = with lib; { options = with lib; {
gui = { gui = {
enable = mkEnableOption {
description = "Enable graphics";
default = false;
};
compositor.enable = mkEnableOption { compositor.enable = mkEnableOption {
description = "Enable transparency, blur, shadows"; description = "Enable transparency, blur, shadows";
default = false; default = false;
@ -48,10 +44,6 @@
default = "gnome-themes-extra"; default = "gnome-themes-extra";
}; };
}; };
colorscheme = mkOption {
type = types.attrs;
description = "Base16 color scheme";
};
wallpaper = mkOption { wallpaper = mkOption {
type = types.path; type = types.path;
description = "Wallpaper background image file"; description = "Wallpaper background image file";

View File

@ -20,6 +20,7 @@ in {
}; };
services.polybar.config."bar/main".font-0 = "Hack Nerd Font:size=10;2"; services.polybar.config."bar/main".font-0 = "Hack Nerd Font:size=10;2";
programs.rofi.font = "Hack Nerd Font 14"; programs.rofi.font = "Hack Nerd Font 14";
programs.alacritty.settings.font.normal.family = fontName;
}; };
}; };

View File

@ -39,7 +39,7 @@
himalaya = { himalaya = {
enable = true; enable = true;
settings = { settings = {
downloads-dir = if pkgs.stdenv.isDarwin then "$HOME/Downloads" else config.userDirs.download; downloads-dir = config.userDirs.download;
smtp-insecure = true; smtp-insecure = true;
}; };
}; };

View File

@ -2,4 +2,7 @@
imports = [ ./user.nix ./timezone.nix ./doas.nix ]; imports = [ ./user.nix ./timezone.nix ./doas.nix ];
# Pin a state version to prevent warnings
system.stateVersion = "22.11";
} }

View File

@ -2,26 +2,11 @@
options = { options = {
user = lib.mkOption {
type = lib.types.str;
description = "Primary user of the system";
default = "nixos";
};
passwordHash = lib.mkOption { passwordHash = lib.mkOption {
type = lib.types.str; type = lib.types.str;
description = "Password created with mkpasswd -m sha-512"; description = "Password created with mkpasswd -m sha-512";
}; };
userDirs = {
# Required to prevent infinite recursion when referenced by himalaya
download = lib.mkOption {
type = lib.types.str;
description = "XDG directory for downloads";
default = "$HOME/downloads";
};
};
}; };
config = { config = {