mirror of
https://github.com/cupcakearmy/nix-macos.git
synced 2025-04-09 23:52:58 +00:00
multi host
This commit is contained in:
parent
4c0a3b5794
commit
646aaeefe4
1
cask.nix
1
cask.nix
@ -19,6 +19,7 @@
|
|||||||
"hoppscotch"
|
"hoppscotch"
|
||||||
"tailscale"
|
"tailscale"
|
||||||
"utm"
|
"utm"
|
||||||
|
"balenaetcher"
|
||||||
|
|
||||||
# Apps
|
# Apps
|
||||||
"figma"
|
"figma"
|
||||||
|
18
flake.lock
generated
18
flake.lock
generated
@ -7,11 +7,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1737461688,
|
"lastModified": 1737762889,
|
||||||
"narHash": "sha256-zQCFe5FcSSGzY3qauAAHZcPt7Ej4WSGo78ShSTCSBvU=",
|
"narHash": "sha256-5HGG09bh/Yx0JA8wtBMAzt0HMCL1bYZ93x4IqzVExio=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "home-manager",
|
"repo": "home-manager",
|
||||||
"rev": "bb14224f51ae4caed12a7b26f245d042c8cf8553",
|
"rev": "daf04c5950b676f47a794300657f1d3d14c1a120",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@ -27,11 +27,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1737423230,
|
"lastModified": 1737504076,
|
||||||
"narHash": "sha256-WEOiNmkcmlaeXy2HGW1PYxYmCPiHdsI7a7SpjhBYxRg=",
|
"narHash": "sha256-/B4XJnzYU/6K1ZZOBIgsa3K4pqDJrnC2579c44c+4rI=",
|
||||||
"owner": "LnL7",
|
"owner": "LnL7",
|
||||||
"repo": "nix-darwin",
|
"repo": "nix-darwin",
|
||||||
"rev": "46d0fa4ded0a7532f19870f9bbedaf62269fe3f7",
|
"rev": "65cc1fa8e36ceff067daf6cfb142331f02f524d3",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@ -42,11 +42,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1737370608,
|
"lastModified": 1737879851,
|
||||||
"narHash": "sha256-hFA6SmioeqvGW/XvZa9bxniAeulksCOcj3kokdNT/YE=",
|
"narHash": "sha256-H+FXIKj//kmFHTTW4DFeOjR7F1z2/3eb2iwN6Me4YZk=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "300081d0cc72df578b02d914df941b8ec62240e6",
|
"rev": "5d3221fd57cc442a1a522a15eb5f58230f45a304",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
29
flake.nix
29
flake.nix
@ -19,6 +19,8 @@
|
|||||||
home-manager,
|
home-manager,
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
|
name = "mbp";
|
||||||
|
hosts = import ./hosts;
|
||||||
configuration =
|
configuration =
|
||||||
{ pkgs, ... }:
|
{ pkgs, ... }:
|
||||||
{
|
{
|
||||||
@ -35,7 +37,6 @@
|
|||||||
|
|
||||||
# Nix Darwin
|
# Nix Darwin
|
||||||
# https://daiderd.com/nix-darwin/manual/index.html
|
# https://daiderd.com/nix-darwin/manual/index.html
|
||||||
environment.systemPackages = [ ];
|
|
||||||
|
|
||||||
# Security
|
# Security
|
||||||
system.defaults.screensaver.askForPassword = true;
|
system.defaults.screensaver.askForPassword = true;
|
||||||
@ -77,21 +78,29 @@
|
|||||||
};
|
};
|
||||||
programs.fish.enable = true;
|
programs.fish.enable = true;
|
||||||
|
|
||||||
homebrew.enable = true;
|
homebrew = {
|
||||||
homebrew.casks = import ./cask.nix;
|
enable = true;
|
||||||
homebrew.taps = [ "lihaoyun6/tap" ];
|
casks = import ./cask.nix;
|
||||||
homebrew.onActivation.autoUpdate = true;
|
taps = [ "lihaoyun6/tap" ];
|
||||||
homebrew.onActivation.cleanup = "zap";
|
onActivation = {
|
||||||
|
autoUpdate = true;
|
||||||
|
cleanup = "zap";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
# Home Manager
|
# Home Manager
|
||||||
home-manager.backupFileExtension = "backup";
|
home-manager.backupFileExtension = "backup";
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
# Build darwin flake using:
|
darwinConfigurations."${name}" = nix-darwin.lib.darwinSystem {
|
||||||
# $ darwin-rebuild build --flake .#Niccolo-Borgioli-s-MacBook-Pro
|
|
||||||
darwinConfigurations."mbp" = nix-darwin.lib.darwinSystem {
|
|
||||||
modules = [
|
modules = [
|
||||||
|
(
|
||||||
|
{ config, ... }:
|
||||||
|
{
|
||||||
|
config._module.args = { inherit hosts; };
|
||||||
|
}
|
||||||
|
)
|
||||||
configuration
|
configuration
|
||||||
home-manager.darwinModules.home-manager
|
home-manager.darwinModules.home-manager
|
||||||
{
|
{
|
||||||
@ -103,6 +112,6 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
# Expose the package set, including overlays, for convenience.
|
# Expose the package set, including overlays, for convenience.
|
||||||
darwinPackages = self.darwinConfigurations."mbp".pkgs;
|
# darwinPackages = self.darwinConfigurations."${name}".pkgs;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
182
home.nix
182
home.nix
@ -1,132 +1,82 @@
|
|||||||
{ config, pkgs, ... }:
|
{ pkgs, ... }@args:
|
||||||
|
|
||||||
{
|
{
|
||||||
# https://nix-community.github.io/home-manager
|
# https://nix-community.github.io/home-manager
|
||||||
home.stateVersion = "24.11"; # Please read the comment before changing.
|
home.stateVersion = "25.05"; # Please read the comment before changing.
|
||||||
programs.home-manager.enable = true;
|
programs.home-manager.enable = true;
|
||||||
|
|
||||||
home.username = "niccoloborgioli";
|
home.username = "niccoloborgioli";
|
||||||
home.homeDirectory = "/Users/niccoloborgioli";
|
home.homeDirectory = "/Users/niccoloborgioli";
|
||||||
|
|
||||||
home.packages = [
|
home.packages =
|
||||||
pkgs.tmux
|
[ ] ++ (import ./home/shared.nix { inherit pkgs; }) ++ (import ./home/sflx.nix { inherit pkgs; });
|
||||||
pkgs.oh-my-posh
|
|
||||||
pkgs.git
|
|
||||||
pkgs.git-lfs
|
|
||||||
pkgs.git-crypt
|
|
||||||
pkgs.bfg-repo-cleaner
|
|
||||||
pkgs.gnutar
|
|
||||||
pkgs.gnupg
|
|
||||||
pkgs.htop
|
|
||||||
pkgs.rclone
|
|
||||||
pkgs.rename
|
|
||||||
pkgs.tmux
|
|
||||||
pkgs.tree
|
|
||||||
pkgs.wget
|
|
||||||
pkgs.woff2
|
|
||||||
pkgs.bat
|
|
||||||
pkgs.rsync
|
|
||||||
pkgs.direnv
|
|
||||||
pkgs.zoxide
|
|
||||||
pkgs.devenv
|
|
||||||
#pkgs.bitwarden-cli
|
|
||||||
|
|
||||||
# Editor
|
|
||||||
pkgs.neovim
|
|
||||||
pkgs.fzf
|
|
||||||
pkgs.lazygit
|
|
||||||
pkgs.lua
|
|
||||||
pkgs.luajitPackages.luarocks
|
|
||||||
pkgs.ast-grep
|
|
||||||
pkgs.ripgrep
|
|
||||||
|
|
||||||
# Language specific
|
|
||||||
pkgs.nixfmt-rfc-style
|
|
||||||
pkgs.fnm
|
|
||||||
pkgs.bun
|
|
||||||
pkgs.deno
|
|
||||||
pkgs.zig
|
|
||||||
pkgs.uv
|
|
||||||
pkgs.ruff
|
|
||||||
pkgs.tectonic
|
|
||||||
pkgs.tex-fmt
|
|
||||||
pkgs.rustup
|
|
||||||
|
|
||||||
# Codding
|
|
||||||
pkgs.nixpacks
|
|
||||||
|
|
||||||
# sflx
|
|
||||||
pkgs.vault
|
|
||||||
pkgs.cocoapods
|
|
||||||
pkgs.phrase-cli
|
|
||||||
pkgs.boundary
|
|
||||||
|
|
||||||
pkgs.nerd-fonts.jetbrains-mono
|
|
||||||
];
|
|
||||||
|
|
||||||
fonts.fontconfig.enable = true;
|
fonts.fontconfig.enable = true;
|
||||||
|
|
||||||
home.sessionVariables = {
|
home = {
|
||||||
EDITOR = "nvim";
|
sessionVariables = {
|
||||||
|
EDITOR = "nvim";
|
||||||
|
};
|
||||||
|
|
||||||
|
file = {
|
||||||
|
".config/omp/config.yaml".source = ./files/omp/config.yaml;
|
||||||
|
".config/ghostty/config".source = ./files/ghostty/config;
|
||||||
|
".gitconfig".source = ./files/git/gitconfig;
|
||||||
|
".gitignore_global".source = ./files/git/gitignore_global;
|
||||||
|
".config/nvim".source = ./files/nvim;
|
||||||
|
};
|
||||||
|
|
||||||
|
shellAliases = {
|
||||||
|
l = "ls -hal";
|
||||||
|
dc = "docker compose";
|
||||||
|
rsync = "rsync -az --info=progress2";
|
||||||
|
t = "tmux new-session -A -s main";
|
||||||
|
e = "nvim";
|
||||||
|
hms = "home-manager switch --flake ~/nix#root -b backup";
|
||||||
|
snd = "darwin-rebuild switch --flake ~/.config/nix-darwin#mbp";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
home.file = {
|
programs = {
|
||||||
".config/omp/config.yaml".source = ./files/omp/config.yaml;
|
fish = {
|
||||||
".config/ghostty/config".source = ./files/ghostty/config;
|
enable = true;
|
||||||
".gitconfig".source = ./files/git/gitconfig;
|
interactiveShellInit = ''
|
||||||
".gitignore_global".source = ./files/git/gitignore_global;
|
if type -q oh-my-posh
|
||||||
".config/nvim".source = ./files/nvim;
|
oh-my-posh init fish --config ~/.config/omp/config.yaml | source
|
||||||
};
|
end
|
||||||
|
if type -q fnm
|
||||||
|
fnm env --use-on-cd | source
|
||||||
|
end
|
||||||
|
if type -q direnv
|
||||||
|
direnv hook fish | source
|
||||||
|
end
|
||||||
|
if type -q zoxide
|
||||||
|
zoxide init fish | source
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
bash = {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
tmux = {
|
||||||
|
enable = true;
|
||||||
|
clock24 = true;
|
||||||
|
mouse = true;
|
||||||
|
extraConfig = ''
|
||||||
|
# switch panes using Alt-arrow without prefix
|
||||||
|
bind -n M-Left select-pane -L
|
||||||
|
bind -n M-Right select-pane -R
|
||||||
|
bind -n M-Up select-pane -U
|
||||||
|
bind -n M-Down select-pane -D
|
||||||
|
|
||||||
home.shellAliases = {
|
# switch panes using jkhl
|
||||||
l = "ls -hal";
|
bind h select-pane -L
|
||||||
dc = "docker compose";
|
bind l select-pane -R
|
||||||
rsync = "rsync -az --info=progress2";
|
bind j select-pane -U
|
||||||
t = "tmux new-session -A -s main";
|
bind k select-pane -D
|
||||||
e = "nvim";
|
'';
|
||||||
hms = "home-manager switch --flake ~/nix#root -b backup";
|
shell = "${pkgs.fish}/bin/fish";
|
||||||
snd = "darwin-rebuild switch --flake ~/.config/nix-darwin#mbp";
|
terminal = "tmux-256color";
|
||||||
};
|
};
|
||||||
|
|
||||||
programs.fish = {
|
|
||||||
enable = true;
|
|
||||||
interactiveShellInit = ''
|
|
||||||
if type -q oh-my-posh
|
|
||||||
oh-my-posh init fish --config ~/.config/omp/config.yaml | source
|
|
||||||
end
|
|
||||||
if type -q fnm
|
|
||||||
fnm env --use-on-cd | source
|
|
||||||
end
|
|
||||||
if type -q direnv
|
|
||||||
direnv hook fish | source
|
|
||||||
end
|
|
||||||
if type -q zoxide
|
|
||||||
zoxide init fish | source
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
programs.bash = {
|
|
||||||
enable = true;
|
|
||||||
};
|
|
||||||
programs.tmux = {
|
|
||||||
enable = true;
|
|
||||||
clock24 = true;
|
|
||||||
mouse = true;
|
|
||||||
extraConfig = ''
|
|
||||||
# switch panes using Alt-arrow without prefix
|
|
||||||
bind -n M-Left select-pane -L
|
|
||||||
bind -n M-Right select-pane -R
|
|
||||||
bind -n M-Up select-pane -U
|
|
||||||
bind -n M-Down select-pane -D
|
|
||||||
|
|
||||||
# switch panes using jkhl
|
|
||||||
bind h select-pane -L
|
|
||||||
bind l select-pane -R
|
|
||||||
bind j select-pane -U
|
|
||||||
bind k select-pane -D
|
|
||||||
'';
|
|
||||||
shell = "${pkgs.fish}/bin/fish";
|
|
||||||
terminal = "tmux-256color";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
8
home/sflx.nix
Normal file
8
home/sflx.nix
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{ pkgs }:
|
||||||
|
with pkgs;
|
||||||
|
[
|
||||||
|
vault
|
||||||
|
cocoapods
|
||||||
|
phrase-cli
|
||||||
|
boundary
|
||||||
|
]
|
54
home/shared.nix
Normal file
54
home/shared.nix
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
{ pkgs }:
|
||||||
|
with pkgs;
|
||||||
|
[
|
||||||
|
# Base
|
||||||
|
tmux
|
||||||
|
oh-my-posh
|
||||||
|
git
|
||||||
|
git-lfs
|
||||||
|
git-crypt
|
||||||
|
bfg-repo-cleaner
|
||||||
|
gnutar
|
||||||
|
gnupg
|
||||||
|
htop
|
||||||
|
rclone
|
||||||
|
rename
|
||||||
|
tmux
|
||||||
|
tree
|
||||||
|
wget
|
||||||
|
woff2
|
||||||
|
bat
|
||||||
|
rsync
|
||||||
|
zoxide
|
||||||
|
#bitwarden-cli
|
||||||
|
|
||||||
|
# Dev
|
||||||
|
devenv
|
||||||
|
direnv
|
||||||
|
nixpacks
|
||||||
|
ollama
|
||||||
|
|
||||||
|
# Editor
|
||||||
|
neovim
|
||||||
|
fzf
|
||||||
|
lazygit
|
||||||
|
lua
|
||||||
|
luajitPackages.luarocks
|
||||||
|
ast-grep
|
||||||
|
ripgrep
|
||||||
|
|
||||||
|
# Language specific
|
||||||
|
nixfmt-rfc-style
|
||||||
|
fnm
|
||||||
|
bun
|
||||||
|
deno
|
||||||
|
zig
|
||||||
|
uv
|
||||||
|
ruff
|
||||||
|
tectonic
|
||||||
|
tex-fmt
|
||||||
|
rustup
|
||||||
|
|
||||||
|
# Fonts
|
||||||
|
nerd-fonts.jetbrains-mono
|
||||||
|
]
|
4
hosts/default.nix
Normal file
4
hosts/default.nix
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
[
|
||||||
|
(import ./mac14.nix)
|
||||||
|
(import ./mac16.nix)
|
||||||
|
]
|
5
hosts/mac14.nix
Normal file
5
hosts/mac14.nix
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
username = "cupcakearmy";
|
||||||
|
hostName = "mac14";
|
||||||
|
system = "aarch64-darwin";
|
||||||
|
}
|
5
hosts/mac16.nix
Normal file
5
hosts/mac16.nix
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
username = "niccoloborgioli";
|
||||||
|
hostName = "mac16";
|
||||||
|
system = "aarch64-darwin";
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user