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 = {
user = "noah";
fullName = "Noah Masur";
passwordHash =
"$6$PZYiMGmJIIHAepTM$Wx5EqTQ5GApzXx58nvi8azh16pdxrN6Qrv1wunDlzveOgawitWzcIxuj76X9V868fsPi/NOIEO8yVXqwzS9UF.";
gitEmail = "7386960+nmasur@users.noreply.github.com";
mailServer = "noahmasur.com";
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.
@ -64,8 +57,9 @@
# nix-shell -p nixFlakes
# sudo nixos-rebuild switch --flake github:nmasur/dotfiles#desktop
nixosConfigurations = {
desktop =
import ./hosts/desktop { inherit nixpkgs home-manager nur globals; };
desktop = import ./hosts/desktop {
inherit nixpkgs home-manager nur globals wallpapers;
};
};
darwinConfigurations = {

View File

@ -3,10 +3,33 @@
imports = [ ../modules/shell ../modules/editor ../modules/mail/himalaya.nix ];
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 {
type = types.path;
description = "Path of dotfiles repository.";
default = builtins.toPath "/home/${config.user}/dev/personal/dotfiles";
default = builtins.toPath "$HOME/dev/personal/dotfiles";
};
dotfilesRepo = mkOption {
type = types.str;
@ -24,9 +47,6 @@
# Enable features in Nix commands
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
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
nixpkgs.lib.nixosSystem {
@ -9,13 +9,21 @@ nixpkgs.lib.nixosSystem {
home-manager.nixosModules.home-manager
{
networking.hostName = "desktop";
gui.enable = true;
gui.compositor.enable = true;
nixpkgs.overlays = [ nur.overlay ];
gaming.steam = true;
gaming.leagueoflegends = 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
../common.nix
../../modules/hardware

View File

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

View File

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

View File

@ -1,34 +1,15 @@
{ lib, ... }: {
{ ... }: {
imports = [
./system.nix
./user.nix
./tmux.nix
./utilities.nix
./hammerspoon.nix
./alacritty.nix
./dotfiles.nix
./fonts.nix
./hammerspoon.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, ... }: {
# Homebrew - Mac-specific packages that aren't in Nix
# Requires Homebrew to be installed (works if you rebuild twice)
homebrew = {
enable = true;
autoUpdate = false; # Don't update during rebuild
@ -34,10 +37,10 @@
config.home-manager.users.${config.user}.lib.dag.entryAfter
[ "writeBoundary" ] ''
if ! xcode-select --version 2>/dev/null; then
xcode-select --install
$DRY_RUN_CMD xcode-select --install
fi
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
'';

View File

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

View File

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

View File

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

View File

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

View File

@ -13,10 +13,6 @@
options = with lib; {
gui = {
enable = mkEnableOption {
description = "Enable graphics";
default = false;
};
compositor.enable = mkEnableOption {
description = "Enable transparency, blur, shadows";
default = false;
@ -48,10 +44,6 @@
default = "gnome-themes-extra";
};
};
colorscheme = mkOption {
type = types.attrs;
description = "Base16 color scheme";
};
wallpaper = mkOption {
type = types.path;
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";
programs.rofi.font = "Hack Nerd Font 14";
programs.alacritty.settings.font.normal.family = fontName;
};
};

View File

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

View File

@ -2,4 +2,7 @@
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 = {
user = lib.mkOption {
type = lib.types.str;
description = "Primary user of the system";
default = "nixos";
};
passwordHash = lib.mkOption {
type = lib.types.str;
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 = {