dotfiles/flake.nix
2025-07-11 23:29:18 +03:00

255 lines
8.4 KiB
Nix

{
description = "Example nix-darwin system flake";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
nix-darwin.url = "github:nix-darwin/nix-darwin/master";
nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
home-manager.url = "github:nix-community/home-manager/master";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
nur.url = "github:nix-community/NUR";
nur.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, nix-darwin, nixpkgs, home-manager, nur, ... }:
let
configuration = { pkgs, nur, ... }: {
nixpkgs.overlays = [ nur.overlays.default ];
# List packages installed in system profile. To search by name, run:
# $ nix-env -qaP | grep wget
environment.systemPackages = [];
# Necessary for using flakes on this system.
nix.settings.experimental-features = "nix-command flakes";
nix.settings.warn-dirty = false;
# 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 = 6;
# The platform the configuration will be used on.
nixpkgs.hostPlatform = "aarch64-darwin";
nixpkgs.config = { allowUnfree = true; };
users.users.andrei = {
home = "/Users/andrei";
name = "andrei";
};
system.primaryUser = "andrei";
system.defaults.dock = {
tilesize = 40;
show-recents = false;
persistent-apps = [
];
};
system.defaults.finder = {
FXDefaultSearchScope = "SCcf";
FXEnableExtensionChangeWarning = false;
FXRemoveOldTrashItems = true;
};
system.defaults.NSGlobalDomain = {
NSAutomaticCapitalizationEnabled = false;
NSAutomaticSpellingCorrectionEnabled = false;
"com.apple.mouse.tapBehavior" = 1;
};
fonts.packages = [ pkgs.fira-code pkgs.nerd-fonts.fira-code ];
homebrew = {
enable = true;
brews = [ "asdf" "libyaml" "libpq" "k9s"
{
name = "postgresql@17";
restart_service = "changed";
}
];
casks = [ "raycast" "firefox" "slack" "google-chrome" "cursor" "qbittorrent" "vlc" "obsidian" ];
onActivation = {
cleanup = "zap";
};
global = {
autoUpdate = false;
};
};
programs = {
_1password-gui.enable = true;
};
security.pam.services.sudo_local = {
enable = true;
reattach = true;
touchIdAuth = true;
watchIdAuth = true;
};
services = {
tailscale.enable = true;
};
home-manager.useGlobalPkgs = true;
home-manager.backupFileExtension = "bak";
home-manager.users.andrei = {
home.packages = [ pkgs.go];
home.stateVersion = "25.11";
programs = {
kitty = {
enable = true;
font = {
name = "FiraCode Nerd Font Mono";
size = 16;
};
settings = {
disable_ligatures = "never";
confirm_os_window_close = 0;
};
shellIntegration.enableZshIntegration = true;
keybindings = {
"cmd+u" = "kitten hints --type url";
};
};
firefox = {
enable = true;
package = null;
profiles.default = {
isDefault = true;
extensions = {
force = true;
packages = with pkgs.nur.repos.rycee.firefox-addons; [
ublock-origin
onepassword-password-manager
sponsorblock
imagus
reddit-enhancement-suite
react-devtools
];
settings = {};
};
settings = {
"extensions.autoDisableScopes" = 0;
"full-screen-api.transition-duration.enter" = 0;
"full-screen-api.transition-duration.exit" = 0;
"full-screen-api.warning.timeout" = 0;
"browser.fullscreen.exit_on_escape" = false;
"browser.tabs.closeWindowWithLastTab" = false;
"browser.ctrlTab.sortByRecentlyUsed" = true;
"browser.startup.page" = 3;
};
};
};
vscode = {
enable = true;
mutableExtensionsDir = false;
profiles.default = {
enableExtensionUpdateCheck = true;
enableUpdateCheck = true;
extensions = [
pkgs.vscode-extensions.ms-vscode-remote.remote-ssh
pkgs.vscode-extensions.ms-vscode-remote.remote-ssh-edit
pkgs.vscode-extensions.jnoortheen.nix-ide
pkgs.vscode-extensions.ms-dotnettools.csdevkit
pkgs.vscode-extensions.ms-dotnettools.csharp
pkgs.vscode-extensions.ms-dotnettools.vscode-dotnet-runtime
pkgs.vscode-extensions.shopify.ruby-lsp
pkgs.vscode-extensions.castwide.solargraph
];
userSettings = {
"editor.fontSize" = 16;
"editor.fontFamily" = "'FiraCode Nerd Font Mono'";
"editor.fontLigatures" = true;
"security.workspace.trust.enabled" = false;
"remote.SSH.enableAgentForwarding" = true;
"git.enableSmartCommit" = true;
};
};
};
ssh = {
enable = true;
extraConfig = ''
Host *
IdentityAgent "~/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock"
SetEnv TERM=xterm-256color
'';
};
direnv = {
enable = true;
enableZshIntegration = true;
nix-direnv.enable = true;
silent = true;
};
zsh = {
enable = true;
enableCompletion = true;
enableVteIntegration = true;
autocd = true;
autosuggestion = {
enable = true;
};
syntaxHighlighting = {
enable = true;
};
envExtra = ''
# Add asdf shims to PATH
export PATH="$HOME/.asdf/shims:$PATH"
'';
};
git = {
enable = true;
package = pkgs.gitFull;
aliases = {};
lfs.enable = true;
userEmail = "lazarescu.andrei19@gmail.com";
userName = "Andrei Lazarescu";
extraConfig = {
user.signingkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFkft5uSiWODIKIBGFPSCRktDEaxYPbudDUYlYyj53w/";
gpg.format = "ssh";
gpg.ssh.program = "/Applications/1Password.app/Contents/MacOS/op-ssh-sign";
commit.gpgSign = true;
advice = {
addEmptyPathspec = false;
pushNonFastForward = false;
statusHints = false;
};
init.defaultBranch = "main";
pull.rebase = true;
push.autoSetupRemote = true;
"url \"git@github.com:\"".insteadOf = "gh:";
"url \"git@gitlab.com:\"".insteadOf = "gl:";
"url \"git@git.lazarescu.xyz:2222/lazandrei19/\"".insteadOf = "lz:";
};
};
gh = {
enable = true;
settings = {
git_protocol = "ssh";
};
};
};
services = {
ollama = {
enable = true;
};
};
};
};
in
{
# Build darwin flake using:
# $ darwin-rebuild build --flake .#Andreis-MacBook-Pro
darwinConfigurations."Andreis-MacBook-Pro" = nix-darwin.lib.darwinSystem {
specialArgs = { inherit nur; };
modules = [ configuration home-manager.darwinModules.home-manager ];
};
};
}