nix-config/darwin/default.nix
2024-05-23 15:02:20 -04:00

114 lines
4 KiB
Nix

{ self, pkgs, hostname, username, platform, stateVersion, outputs, ... /* lib, config */ }: {
imports = [
./${hostname}
./_mixins/users/${username}
];
# List packages installed in system profile. To search by name, run:
# $ nix-env -qaP | grep wget
environment.systemPackages = with pkgs; [
# SYSTEM packages, for all users
direnv
glances
home-manager
];
fonts = {
fontDir.enable = true;
fonts = with pkgs; [
iosevka
font-awesome
(nerdfonts.override {
fonts = [
"FiraCode"
];
})
];
};
# Auto upgrade nix package and the daemon service.
services.nix-daemon.enable = true;
nix.package = pkgs.nix;
# Necessary for using flakes on this system.
nix.settings.experimental-features = "nix-command flakes";
nixpkgs = {
# You can add overlays here
overlays = [
# Add overlays your own flake exports (from overlays and pkgs dir):
outputs.overlays.additions
outputs.overlays.modifications
outputs.overlays.unstable-packages
outputs.overlays.trunk-packages
];
};
# Create /etc/zshrc that loads the nix-darwin environment.
programs.zsh.enable = false; # default shell on catalina
programs = {
fish = {
enable = true;
interactiveShellInit = ''
set fish_cursor_default block blink
set fish_cursor_insert line blink
set fish_cursor_replace_one underscore blink
set fish_cursor_visual block
set -U fish_color_autosuggestion brblack
set -U fish_color_cancel -r
set -U fish_color_command green
set -U fish_color_comment brblack
set -U fish_color_cwd brgreen
set -U fish_color_cwd_root brred
set -U fish_color_end brmagenta
set -U fish_color_error red
set -U fish_color_escape brcyan
set -U fish_color_history_current --bold
set -U fish_color_host normal
set -U fish_color_match --background=brblue
set -U fish_color_normal normal
set -U fish_color_operator cyan
set -U fish_color_param blue
set -U fish_color_quote yellow
set -U fish_color_redirection magenta
set -U fish_color_search_match bryellow '--background=brblack'
set -U fish_color_selection white --bold '--background=brblack'
set -U fish_color_status red
set -U fish_color_user brwhite
set -U fish_color_valid_path --underline
set -U fish_pager_color_completion normal
set -U fish_pager_color_description yellow
set -U fish_pager_color_prefix white --bold --underline
set -U fish_pager_color_progress brwhite '--background=cyan'
'';
shellAliases = {
nix-gc = "sudo nix-collect-garbage --delete-older-than 14d";
rebuild-all = "sudo nix-collect-garbage --delete-older-than 14d && darwin-rebuild switch --flake $HOME/ws/nix-config && home-manager switch -b backup --flake $HOME/ws/nix-config";
rebuild-home = "home-manager switch -b backup --flake $HOME/ws/nix-config";
rebuild-host = "darwin-rebuild switch --flake $HOME/ws/nix-config";
rebuild-lock = "pushd $HOME/ws/nix-config && nix flake lock --recreate-lock-file && popd";
# TODO: Support secrets management on macOS
# modify-secret = "agenix -i ~/.ssh/id_rsa -e"; # the path relative to /secrets must be passed
moon = "curl -s wttr.in/Moon";
nano = "vim";
pubip = "curl -s ifconfig.me/ip";
#pubip = "curl -s https://api.ipify.org";
wttr = "curl -s wttr.in && curl -s v2.wttr.in";
wttr-bas = "curl -s wttr.in/detroit && curl -s v2.wttr.in/detroit";
};
};
};
# Set Git commit hash for darwin-version.
system.configurationRevision = self.rev or self.dirtyRev or null;
# Used for backwards compatibility, please read the changelog before changing.
# $ darwin-rebuild changelog
system.stateVersion = stateVersion;
# The platform the configuration will be used on.
nixpkgs.hostPlatform = platform;
}