Compare commits

..

6 Commits

Author SHA1 Message Date
cupcakearmy f1bebdcb4e add cocoapods 2024-11-20 18:00:33 +01:00
cupcakearmy 5090638625 update lazyvim 2024-11-20 18:00:26 +01:00
cupcakearmy 90bd763b13 lazyvim config 2024-11-20 14:00:03 +01:00
cupcakearmy f5dfcecb7d add vault 2024-11-20 13:59:55 +01:00
cupcakearmy e0a1f04b0f add readme 2024-11-17 14:19:49 +01:00
cupcakearmy 0e6ea24079 initial push 2024-11-17 14:16:59 +01:00
60 changed files with 3170 additions and 899 deletions
-1
View File
@@ -1 +0,0 @@
secrets/** filter=git-crypt diff=git-crypt
-1
View File
@@ -1 +0,0 @@
.key*
+4 -67
View File
@@ -1,80 +1,17 @@
# Dotfiles with Nix on macOS # Dotfiles with Nix on macOS
<!--toc:start-->
- [Dotfiles with Nix on macOS](#dotfiles-with-nix-on-macos)
- [Installation](#installation)
- [Documentation](#documentation)
- [Crypt](#crypt)
- [CLI](#cli)
- [TODO](#todo)
<!--toc:end-->
## Installation ## Installation
```bash ```bash
# Install nix # Install nix [without the --determinate flag]
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install --determinate curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
# Install brew [for casks] # Install brew [for casks]
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Get repo # Get repo
git clone https://github.com/cupcakearmy/nix-macos ~/.config/dotfiles git clone https://github.com/cupcakearmy/nix-macos ~/.config/nix-darwin
# Unlock (Given that the base64 key is in your clipboard)
nix shell nixpkgs#git nixpkgs#git-crypt nixpkgs#coreutils
pbpaste | base64 --decode > .key
git-crypt unlock .key
# Installation # Installation
# Available hosts can be found in the ./hosts directory nix run nix-darwin -- switch --flake ~/.config/nix-darwin#sflx
sudo nix run nix-darwin -- switch --flake ~/.config/dotfiles#<host>
# After installation simply use the provided alias to rebuild
vai
``` ```
## Documentation
- [nix-darwin](https://daiderd.com/nix-darwin/manual/index.html)
## Crypt
Files under `secrets` are encrypted using `git-crypt`.
```bash
# Save the key, when the repo is unlocked
git-crypt export-key - | base64 > .key.b64
# Decode (Given the base64 key is written to .key.b64)
cat .key.b64 | base64 --decode > .key
git-crypt unlock .key
```
## CLI
The repo also includes a setup that I use on servers which is a toned down version. It lives under `./cli`.
```bash
# Install nix & the CLI
curl -sSL https://raw.githubusercontent.com/cupcakearmy/nix/refs/heads/main/cli/install.sh | bash
```
```
```
## TODO
Stuff that I would like to automate, but have not found a way/time
- Disable the default Spotlight keyboard shortcut. For now manually go to Settings -> Keyboard Shortcuts -> Spotlight -> Untick
- `chsh -s /run/current-system/sw/bin/fish`
- vscodium settings (download `zokugun.sync-settings` -> open repository settings -> paste secrets/configs/vscodium-sync.yaml -> download config)
- browser extensions
- bitwarden
- canvas blocker
- surfshark
- ublock origin
- vimium
+13 -20
View File
@@ -1,37 +1,30 @@
[ [
# Objective See "aldente"
"knockknock"
"lulu"
"oversight"
# Utility
"alt-tab" "alt-tab"
"keka" "keka"
"knockknock"
"lulu"
"kap"
"keycastr" "keycastr"
"raycast" "raycast"
"ghostty" "kitty"
"lihaoyun6/tap/quickrecorder"
"iina"
"shutter-encoder"
# Dev # Dev
"docker"
"sloth" "sloth"
"vscodium" "vscodium"
"visual-studio-code" "httpie"
"utm"
"bruno"
"zed"
# Apps
# Base "arc"
"obsidian"
"figma"
"zen"
"ungoogled-chromium"
"bitwarden" "bitwarden"
"spotify" "spotify"
"vlc"
"slack"
"yubico-authenticator" "yubico-authenticator"
"suspicious-package"
"mediahuman-audio-converter" "mediahuman-audio-converter"
"imageoptim" "imageoptim"
"appcleaner" "appcleaner"
] ]
-48
View File
@@ -1,48 +0,0 @@
{
"nodes": {
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1774715571,
"narHash": "sha256-MMjHif46sc/iLF9JqxBhFaueSPRcjPeP9AiujERH6N0=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "557f5e38ce94ef0f02f05de7ae65057d4b2a89a6",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1774386573,
"narHash": "sha256-4hAV26quOxdC6iyG7kYaZcM3VOskcPUrdCQd/nx8obc=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "46db2e09e1d3f113a13c0d7b81e2f221c63b8ce9",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"home-manager": "home-manager",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}
-42
View File
@@ -1,42 +0,0 @@
{
description = "Server Shell";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{
nixpkgs,
home-manager,
...
}:
let
profiles = import ./profiles.nix;
in
{
homeConfigurations = nixpkgs.lib.genAttrs (builtins.map (p: p.name) profiles) (
profile:
let
p = (nixpkgs.lib.findFirst (p: p.name == profile) null profiles);
system = p.architecture;
pkgs = nixpkgs.legacyPackages.${system};
in
home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = [ ./home.nix ];
extraSpecialArgs = {
username = p.username;
homeDirectory = p.homeDirectory;
name = p.name;
};
}
);
};
}
-24
View File
@@ -1,24 +0,0 @@
{
pkgs,
username,
name,
homeDirectory,
lib,
...
}:
let
common = (import ../common/home.nix) { inherit pkgs; };
overwrite = {
home.username = username;
home.homeDirectory = homeDirectory;
home = {
shellAliases = {
hm = "nix run home-manager/master -- switch --flake github:cupcakearmy/nix?dir=cli#${name} -b backup";
};
# Lists are not recursively updated, need to do by hand
packages = common.home.packages ++ [ ];
};
};
merged = lib.recursiveUpdate common overwrite;
in
merged
-87
View File
@@ -1,87 +0,0 @@
#!/usr/bin/env bash
set -e
echo "=== Nix Home Manager Setup ==="
echo
# Check if Nix is installed
if ! command -v nix &>/dev/null; then
echo "Nix is not installed. Installing Nix..."
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install --determinate
# Source nix profile
if [ -f /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh ]; then
. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
fi
echo "Nix installed successfully!"
echo
else
echo "Nix is already installed."
echo
fi
# Detect architecture
ARCH=$(uname -m)
case "$ARCH" in
x86_64)
ARCH_NAME="x86"
;;
aarch64 | arm64)
ARCH_NAME="arm"
;;
*)
echo "Unsupported architecture: $ARCH"
exit 1
;;
esac
# Detect OS
OS=$(uname -s)
case "$OS" in
Linux)
OS_NAME="linux"
;;
Darwin)
OS_NAME="darwin"
;;
*)
echo "Unsupported OS: $OS"
exit 1
;;
esac
echo "Detected: $ARCH_NAME / $OS_NAME"
echo
# Clear any remaining input and prompt for user
read -t 0.1 -n 10000 discard 2>/dev/null || true
echo "Select user:"
echo "1) root"
read -p "Enter choice [1]: " USER_CHOICE
USER_CHOICE=${USER_CHOICE:-1}
case "$USER_CHOICE" in
1)
USER_NAME="root"
;;
*)
echo "Invalid choice. Defaulting to root."
USER_NAME="root"
;;
esac
# Build flake configuration name
FLAKE_CONFIG="${USER_NAME}_${ARCH_NAME}_${OS_NAME}"
echo
echo "Configuration: $FLAKE_CONFIG"
echo "Running Home Manager..."
echo
# Run home-manager
nix run home-manager/master -- switch --flake "github:cupcakearmy/nix?dir=cli#${FLAKE_CONFIG}" -b backup
echo
echo "=== Setup complete! ==="
-26
View File
@@ -1,26 +0,0 @@
[
{
name = "root_x86_linux";
username = "root";
architecture = "x86_64-linux";
homeDirectory = "/root";
}
{
name = "root_x86_macos";
username = "root";
architecture = "x86_64-darwin";
homeDirectory = "/root";
}
{
name = "root_arm_linux";
username = "root";
architecture = "aarch64-linux";
homeDirectory = "/root";
}
{
name = "root_arm_macos";
username = "root";
architecture = "aarch64-darwin";
homeDirectory = "/root";
}
]
-136
View File
@@ -1,136 +0,0 @@
{
pkgs,
...
}:
{
home.stateVersion = "25.11";
home.packages = with pkgs; [
# Base
tmux
git
git-lfs
git-crypt
gnutar
gnupg
htop
btop
rclone
rename
tree
wget
rsync
moreutils
jq
yq-go
kubectl
croc
asciinema_3
grex
mise
# Rust utils
bat
eza
fd
ripgrep
ripgrep-all
zoxide
uutils-coreutils-noprefix
dust
yazi
starship
ouch
difftastic
# TUI
lazydocker
lazygit
k9s
# Editor
neovim
fzf
# Fonts
nerd-fonts.jetbrains-mono
];
fonts.fontconfig.enable = true;
home = {
sessionVariables = {
EDITOR = "nvim";
};
shellAliases = {
# Rust re-maps
l = "eza -a1lh";
ls = "eza";
cat = "bat";
cd = "z";
cdi = "zi";
# QOL
dc = "docker compose";
dcl = "dc logs -f";
dclt = "dcl --tail 100";
dcln = "dcl --since 1m";
rsync = "rsync -az --info=progress2";
t = "tmux new-session -A -s main";
e = "nvim";
g = "lazygit";
d = "lazydocker";
k = "kubectl";
colima-start = "colima start --cpu 4 --memory 8 --vm-type=vz --vz-rosetta";
};
};
programs = {
home-manager.enable = true;
direnv.enable = true;
zoxide.enable = true;
fish = {
enable = true;
interactiveShellInit = ''
if type -q starship
starship init fish | source
end
if type -q fnm
fnm env --use-on-cd | source
end
if type -q nvs
nvs env --source | source
end
if type -q mise
mise activate 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
# 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";
};
};
}
-106
View File
@@ -1,106 +0,0 @@
{
pkgs,
host,
flake,
lib,
...
}:
{
nix.enable = false;
nix.settings = {
experimental-features = "nix-command flakes";
substituters = [ "https://devenv.cachix.org" ];
trusted-public-keys = [ "devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw=" ];
};
# Set Git commit hash for darwin-version.
system.configurationRevision = flake.rev or flake.dirtyRev or null;
# Used for backwards compatibility, please read the changelog before changing.
# $ darwin-rebuild changelog
system.stateVersion = 5;
nixpkgs.hostPlatform = host.platform;
nixpkgs.config.allowUnfree = true;
# Nix Darwin
# https://daiderd.com/nix-darwin/manual/index.html
system.primaryUser = host.username;
system.defaults = {
# Security
screensaver.askForPassword = true;
screensaver.askForPasswordDelay = 0;
loginwindow.GuestEnabled = false;
# Dock
dock = {
autohide = true;
orientation = "left";
show-recents = false;
persistent-apps = [
"/Applications/Zen.app"
"/Applications/Ghostty.app"
"/Applications/Zed.app"
"/Applications/Spotify.app"
];
persistent-others = [ ];
};
# Finder
finder = {
AppleShowAllExtensions = true;
ShowPathbar = true;
};
# Trackpad
NSGlobalDomain = {
InitialKeyRepeat = 25;
KeyRepeat = 2;
"com.apple.mouse.tapBehavior" = 1;
"com.apple.trackpad.scaling" = 0.875;
};
trackpad = {
Dragging = true;
Clicking = true;
TrackpadRightClick = true;
};
};
# Input devices
system.keyboard = {
enableKeyMapping = true;
remapCapsLockToEscape = true;
};
# Power
power = {
sleep = {
computer = "never";
};
};
# Other
system.startup.chime = false;
users.users.${host.username} = {
home = "/Users/${host.username}";
shell = pkgs.fish;
};
programs.fish.enable = true;
environment.shells = [ pkgs.fish ];
homebrew = {
enable = true;
casks = (import ./cask.nix) ++ (lib.attrByPath [ "extras" "casks" ] [ ] host);
taps = [ "lihaoyun6/tap" ];
global = {
autoUpdate = true;
};
onActivation = {
autoUpdate = true;
upgrade = true;
cleanup = "zap";
};
};
}
-4
View File
@@ -1,4 +0,0 @@
font-family = "JetBrainsMono Nerd Font"
quit-after-last-window-closed=true
theme = "dark:Rose Pine,light:Rose Pine Dawn"
window-save-state = "always"
+4
View File
@@ -0,0 +1,4 @@
[user]
name = cupcakearmy
email = hi@nicco.io
signingkey = 3235314B4D31232F
+4
View File
@@ -0,0 +1,4 @@
[user]
name = Niccolo Borgioli
email = hi@nicco.io
signingkey = 4897ACD13A65977C
+9 -14
View File
@@ -7,26 +7,21 @@
excludesfile = ~/.gitignore_global excludesfile = ~/.gitignore_global
autocrlf = input autocrlf = input
ignorecase=false ignorecase=false
[commit]
gpgsign = false
[includeIf "gitdir:/Users/nicco/"]
path = "~/.dotfiles/files/git/config.personal"
[includeIf "gitdir:/Users/niccoloborgioli/"]
path = "~/.dotfiles/files/git/config.work"
[pull] [pull]
rebase = false rebase = false
[push] [push]
autoSetupRemote = true autoSetupRemote = true
[branch] [branch]
sort = -committerdate sort = -committerdate
[alias] [alias]
fpush = push --force-with-lease fpush = push --force-with-lease
# Signing
[tag]
gpgsign = true
[commit]
gpgsign = true
[gpg]
format = ssh
[include]
path = ~/.gitconfig.local
[diff]
external = difft
File diff suppressed because it is too large Load Diff
-14
View File
@@ -1,14 +0,0 @@
gui:
returnImmediately: true
customCommands:
containers:
- name: "spawn sh"
attach: true
command: 'docker run -it --rm {{ .Container.ID }} sh'
- name: "spawn ash"
attach: true
command: 'docker run -it --rm {{ .Container.ID }} ash'
- name: "spawn bash"
attach: true
command: 'docker run -it --rm {{ .Container.ID }} bash'
-5
View File
@@ -1,5 +0,0 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/jesseduffield/lazygit/master/schema/config.json
git:
pagers:
- externalDiffCommand: difft --color=always
+2 -3
View File
@@ -24,9 +24,8 @@
"lazyvim.plugins.extras.util.dot", "lazyvim.plugins.extras.util.dot",
"lazyvim.plugins.extras.util.startuptime" "lazyvim.plugins.extras.util.startuptime"
], ],
"install_version": 7,
"news": { "news": {
"NEWS.md": "11866" "NEWS.md": "7429"
}, },
"version": 8 "version": 7
} }
+1
View File
@@ -0,0 +1 @@
node_modules
BIN
View File
Binary file not shown.
+106
View File
@@ -0,0 +1,106 @@
[
{
"properties": {
"steps": 8,
"hue": {
"start": 209,
"end": 259,
"curve": "easeOutQuad"
},
"saturation": {
"start": 0.03,
"end": 1,
"rate": 1,
"curve": "easeOutQuad"
},
"brightness": {
"start": 1,
"end": 0.03,
"curve": "easeInQuart"
}
},
"options": {
"minorSteps": [0, 1],
"name": "Main",
"rotation": "clockwise"
}
},
{
"properties": {
"steps": 8,
"hue": {
"start": 0,
"end": 15,
"curve": "easeOutQuad"
},
"saturation": {
"start": 0.75,
"end": 1,
"rate": 1,
"curve": "easeOutQuad"
},
"brightness": {
"start": 1,
"end": 0.2,
"curve": "linear"
}
},
"options": {
"minorSteps": [0, 1],
"name": "Error",
"rotation": "clockwise"
}
},
{
"properties": {
"steps": 8,
"hue": {
"start": 60,
"end": 70,
"curve": "easeOutQuad"
},
"saturation": {
"start": 0.75,
"end": 1,
"rate": 1,
"curve": "easeOutQuad"
},
"brightness": {
"start": 1,
"end": 0.2,
"curve": "linear"
}
},
"options": {
"minorSteps": [0, 1],
"name": "Warning",
"rotation": "clockwise"
}
},
{
"properties": {
"steps": 8,
"hue": {
"start": 122,
"end": 146,
"curve": "easeOutQuad"
},
"saturation": {
"start": 0.75,
"end": 1,
"rate": 1,
"curve": "easeOutQuad"
},
"brightness": {
"start": 1,
"end": 0.2,
"curve": "linear"
}
},
"options": {
"minorSteps": [0, 1],
"name": "Success",
"rotation": "clockwise"
}
}
]
+21
View File
@@ -0,0 +1,21 @@
import color from '@k-vyn/coloralgorithm'
import colors from './colors.json' assert { type: 'json' }
import fs from 'fs'
import yaml from 'yaml'
const offset = 10
const palette = {}
for (const { properties, options } of colors) {
const result = color.generate(properties, options)
const name = result[0].name
for (const color of result[0].colors) {
palette[`${name.toLowerCase()}-${color.step * offset}`] = color.hex
}
}
const configFile = '../main.omp.yaml'
const config = fs.readFileSync(configFile, 'utf8')
// config.palette = palette
const output = yaml.stringify({ palette })
fs.writeFileSync(configFile, config.replace(/palette:(.|\s)*$/, output))
+8
View File
@@ -0,0 +1,8 @@
{
"type": "module",
"main": "index.js",
"dependencies": {
"@k-vyn/coloralgorithm": "^1.0.0",
"yaml": "^2.2.1"
}
}
+159
View File
@@ -0,0 +1,159 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json
palette:
error-0: '#ff4040'
error-10: '#e23629'
error-15: '#d33220'
error-20: '#c52e18'
error-30: '#a8280d'
error-40: '#8a2106'
error-5: '#f03a34'
error-50: '#6d1b02'
error-60: '#501401'
error-70: '#330d00'
main-0: '#f7fbff'
main-10: '#b4cafd'
main-15: '#95a9fc'
main-20: '#7783fa'
main-30: '#5348f4'
main-40: '#4826e8'
main-5: '#d6e6fe'
main-50: '#3e10ca'
main-60: '#22036e'
main-70: '#020008'
success-0: '#40ff46'
success-10: '#29e243'
success-15: '#20d342'
success-20: '#18c541'
success-30: '#0da83d'
success-40: '#068a36'
success-5: '#34f044'
success-50: '#026d2d'
success-60: '#015022'
success-70: '#003316'
warning-0: '#ffff40'
warning-10: '#dae229'
warning-15: '#c8d320'
warning-20: '#b6c518'
warning-30: '#96a80d'
warning-40: '#788a06'
warning-5: '#ecf034'
warning-50: '#5d6d02'
warning-60: '#435001'
warning-70: '#2a3300'
blocks:
- type: prompt
alignment: left
segments:
- leading_diamond:
foreground: p:main-70
background: p:main-5
type: os
style: diamond
- properties:
style: full
template: " \uf0e7 "
foreground: p:main-70
powerline_symbol:
background: p:error-15
type: root
style: powerline
- properties:
style: full
template: ' {{ .Path }} '
foreground: p:main-0
powerline_symbol:
background: p:main-40
type: path
style: powerline
- template: ' {{ .HEAD }} '
foreground: p:main-70
powerline_symbol:
background: p:warning-10
type: git
style: powerline
- type: prompt
alignment: right
segments:
- leading_diamond:
trailing_diamond:
foreground: p:main-70
background: p:main-10
type: python
style: dynamic
- leading_diamond:
trailing_diamond:
foreground: p:main-70
background: p:main-10
type: go
style: dynamic
- leading_diamond:
trailing_diamond:
foreground: p:main-70
background: p:main-10
type: node
style: dynamic
- leading_diamond:
trailing_diamond:
template: '{{ .Context }}{{ if .Namespace }}::{{ .Namespace }}{{ end }}'
foreground: p:main-70
background: p:main-10
type: kubectl
style: dynamic
- leading_diamond:
trailing_diamond:
template: '{{ .Icon }} {{ .Server }}'
foreground: p:main-70
background: p:main-10
type: docker
style: dynamic
- leading_diamond:
trailing_diamond:
foreground: p:main-70
background: p:main-10
type: rust
style: dynamic
- leading_diamond:
trailing_diamond:
foreground: p:main-70
background: p:main-10
type: battery
style: dynamic
- properties:
always_enabled: true
leading_diamond:
template: "{{ if gt .Code 0 }}\uf00d {{ .Code }} {{ .Meaning }}{{ else }}\uf42e{{ end }}"
foreground: p:main-70
type: status
style: diamond
background_templates:
- '{{ if gt .Code 0 }}p:error-0{{ else }}p:main-10{{ end }}'
- properties:
always_enabled: true
style: round
foreground: p:main-70
powerline_symbol:
background: p:main-5
type: executiontime
style: powerline
- properties:
time_format: '15:04:05'
template: ' {{ .CurrentDate | date .Format }} '
foreground: p:main-70
powerline_symbol:
background: p:main-0
type: time
style: powerline
- type: prompt
alignment: left
segments:
- properties:
always_enabled: true
template: ' '
foreground: p:main-15
type: status
style: plain
foreground_templates:
- '{{ if gt .Code 0 }}p:error-15{{ end }}'
newline: true
version: 3
Generated
+10 -10
View File
@@ -7,11 +7,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1779678629, "lastModified": 1731786860,
"narHash": "sha256-gHcIFg0mm+KFsg7iZQt67kni3+qR5U3PhEC9P7vKlZ4=", "narHash": "sha256-130gQ5k8kZlxjBEeLpE+SvWFgSOFgQFeZlqIik7KgtQ=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "612bbe3b405ad5f71d7bf9edecc04b678a061652", "rev": "1bd5616e33c0c54d7a5b37db94160635a9b27aeb",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -27,11 +27,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1779036909, "lastModified": 1731768170,
"narHash": "sha256-zXcwYQGCT6pzinK+1dBB2ekTVtfxGZAapb3Evdcu4fY=", "narHash": "sha256-9Zj2baKY3KaKzs5+nqZgIwr/o/iibhENFxjOnpU+IOU=",
"owner": "LnL7", "owner": "LnL7",
"repo": "nix-darwin", "repo": "nix-darwin",
"rev": "56c666e108467d87d13508936aade6d567f2a501", "rev": "2bcef10f4319f34ddebadb5f37eaa81ca2510730",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -42,17 +42,17 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1779536132, "lastModified": 1731676161,
"narHash": "sha256-q+fF42iv/geEbHfgSzy3tS0FF/EyD6XTZ98E6yxiBO8=", "narHash": "sha256-R0HVwLNR6/a7tonc/7ChJIRB8fJ0dyQmJYH4lOU1Zm0=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "3d8f0f3f72a6cd4d93d0ad13203f2ea1cb7e1456", "rev": "8809585e6937d0b07fc066792c8c9abf9c3fe5c4",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "NixOS", "owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "8809585e6937d0b07fc066792c8c9abf9c3fe5c4",
"type": "github" "type": "github"
} }
}, },
+68 -29
View File
@@ -1,8 +1,10 @@
{ {
description = "Personal Nix configuration"; description = "Example nix-darwin system flake";
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; # https://github.com/LnL7/nix-darwin/issues/1176
# nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
nixpkgs.url = "github:NixOS/nixpkgs/8809585e6937d0b07fc066792c8c9abf9c3fe5c4";
nix-darwin.url = "github:LnL7/nix-darwin"; nix-darwin.url = "github:LnL7/nix-darwin";
nix-darwin.inputs.nixpkgs.follows = "nixpkgs"; nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
@@ -12,40 +14,77 @@
}; };
outputs = outputs =
{ inputs@{
self, self,
nix-darwin, nix-darwin,
nixpkgs, nixpkgs,
home-manager, home-manager,
}: }:
let let
hosts = import ./hosts; configuration =
inherit (builtins) listToAttrs; { pkgs, ... }:
{
nix.settings.experimental-features = "nix-command flakes";
# 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 = 5;
nixpkgs.hostPlatform = "aarch64-darwin";
nixpkgs.config.allowUnfree = true;
# Nix Darwin
# https://daiderd.com/nix-darwin/manual/index.html
environment.systemPackages = [ ];
system.defaults.dock.autohide = true;
system.defaults.dock.orientation = "left";
system.defaults.finder.AppleShowAllExtensions = true;
system.keyboard.enableKeyMapping = true;
system.keyboard.remapCapsLockToEscape = true;
system.defaults.NSGlobalDomain.InitialKeyRepeat = 25;
system.defaults.NSGlobalDomain.KeyRepeat = 2;
system.defaults.NSGlobalDomain."com.apple.mouse.tapBehavior" = 1;
system.defaults.NSGlobalDomain."com.apple.trackpad.scaling" = 0.875;
system.defaults.trackpad.Dragging = true;
users.users."niccoloborgioli" = {
home = "/Users/niccoloborgioli";
shell = pkgs.fish;
};
programs.fish.enable = true;
homebrew.enable = true;
homebrew.casks = import ./cask.nix;
# homebrew.taps = [
# "hashicorp/tap"
# ];
# homebrew.brews = [
# "hashicorp/tap/vault"
# ];
# Home Manager
home-manager.backupFileExtension = "backup";
};
in in
{ {
darwinConfigurations = listToAttrs ( # Build darwin flake using:
map (host: { # $ darwin-rebuild build --flake .#Niccolo-Borgioli-s-MacBook-Pro
name = host.hostName; darwinConfigurations."sflx" = nix-darwin.lib.darwinSystem {
value = nix-darwin.lib.darwinSystem { modules = [
specialArgs = { configuration
inherit host; home-manager.darwinModules.home-manager
flake = self; {
}; home-manager.useGlobalPkgs = true;
modules = [ home-manager.useUserPackages = true;
{ home-manager.users.niccoloborgioli = import ./home.nix;
nixpkgs.overlays = [ (import ./overlay.nix) ]; }
} ];
(import ./darwin.nix) };
home-manager.darwinModules.home-manager
{ # Expose the package set, including overlays, for convenience.
home-manager.backupFileExtension = "backup"; darwinPackages = self.darwinConfigurations."sflx".pkgs;
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.${host.username} = import ./home/home.nix { inherit host; };
}
];
};
}) hosts
);
}; };
} }
+114
View File
@@ -0,0 +1,114 @@
{ config, pkgs, ... }:
{
# https://nix-community.github.io/home-manager
home.stateVersion = "24.11"; # Please read the comment before changing.
programs.home-manager.enable = true;
home.username = "niccoloborgioli";
home.homeDirectory = "/Users/niccoloborgioli";
home.packages = [
pkgs.tmux
pkgs.oh-my-posh
pkgs.git
pkgs.git-lfs
pkgs.git-crypt
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
# 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
# sflx
pkgs.vault
pkgs.cocoapods
(pkgs.nerdfonts.override { fonts = [ "JetBrainsMono" ]; })
];
home.sessionVariables = {
EDITOR = "nvim";
};
home.file = {
".config/omp/config.yaml".source = ./files/omp/config.yaml;
".config/kitty".source = ./files/kitty;
".gitconfig".source = ./files/git/gitconfig;
".gitignore_global".source = ./files/git/gitignore_global;
".config/nvim".source = ./files/nvim;
};
home.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#sflx";
};
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";
};
}
-63
View File
@@ -1,63 +0,0 @@
{ host }:
{
pkgs,
lib,
config,
...
}:
let
common = (import ../common/home.nix) { inherit pkgs; };
overwrite = {
home.username = host.username;
home.homeDirectory = "/Users/${host.username}";
home.packages =
common.home.packages
++ (import ./pkgs.nix { inherit pkgs; })
++ ((lib.attrByPath [ "extras" "pkgs" ] (pkgs: [ ]) host) pkgs);
fonts.fontconfig.enable = true;
home = {
activation.zedConfig = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
mkdir -p ~/.config
if [ ! -L ~/.config/zed ]; then
rm -rf ~/.config/zed
ln -sf ~/.config/dotfiles/secrets/zed ~/.config/zed
fi
'';
file = {
".config/ghostty/config".source = ../files/ghostty/config;
".gitconfig".source = ../files/git/gitconfig;
".gitignore_global".source = ../files/git/gitignore_global;
".gitconfig.local".source = ../secrets/git/config.${host.hostName};
".config/lazygit/config.yml".source = ../files/lazygit/config.yaml;
".config/lazydocker/config.yml".source = ../files/lazydocker/config.yml;
# Secrets
".ssh/config".text = builtins.replaceStrings [ "@SSH_KEY@" ] [ host.sshKey ] (
builtins.readFile ../secrets/ssh/config.template
);
};
shellAliases = {
p = "pnpm";
px = "pnpm -s dlx";
n = "fnm use --install-if-missing";
c = "pwd | pbcopy";
vai = "sudo darwin-rebuild switch --flake ~/.config/dotfiles#${host.hostName}";
clean = "nix-collect-garbage -d";
};
sessionVariables = {
XDG_CONFIG_HOME = "$HOME/.config";
};
};
};
merged = lib.recursiveUpdate common overwrite;
in
merged
-38
View File
@@ -1,38 +0,0 @@
{ pkgs }:
with pkgs;
[
# Base
gh
bfg-repo-cleaner
woff2
# Dev
devenv
nixpacks
posting
opencode
# Editor
nvs
lua
luajitPackages.luarocks
ast-grep
# Language specific
nixfmt-rfc-style
nil
nixd
fnm
bun
zig
uv
ruff
tectonic
tex-fmt
rustup
shfmt
go
# Fonts
karla
]
-26
View File
@@ -1,26 +0,0 @@
{
username = "nicco";
hostName = "1k5";
platform = "aarch64-darwin";
sshKey = "1k5";
extras = {
casks = [
"notion"
"linear-linear"
"miro"
"loom"
"cursor"
];
pkgs =
pkgs: with pkgs; [
docker-client
colima
google-cloud-sdk
gemini-cli
terramate
ffmpeg-full
stripe-cli
];
};
}
-4
View File
@@ -1,4 +0,0 @@
[
(import ./mac14.nix)
(import ./1k5.nix)
]
-32
View File
@@ -1,32 +0,0 @@
{
username = "cupcakearmy";
hostName = "mac14";
platform = "aarch64-darwin";
sshKey = "legba";
extras = {
casks = [
"surfshark"
"signal"
"discord"
"daisydisk"
"bambu-studio"
"cyberduck"
"balenaetcher"
"datagrip"
"transmission"
"steam"
"android-studio"
];
pkgs =
pkgs: with pkgs; [
docker-client
colima
docker-buildx
biome
infisical
ffmpeg
mkcert
];
};
}
-27
View File
@@ -1,27 +0,0 @@
final: prev: {
nvs = prev.buildGoModule rec {
pname = "nvs";
version = "1.10.5";
src = prev.fetchFromGitHub {
owner = "cupcakearmy";
repo = pname;
# tag = "v${version}";
rev = "1700f2751e969b77b7f7ab3cc16a4e0f3955ce14";
sha256 = "sha256-RScXYxkrfLJp1nAgN2YgSRC4mLGK4yXsYjGBrDR00b8=";
};
vendorHash = "sha256-l2FdnXA+vKVRekcIKt1R+MxppraTsmo0b/B7RNqnxjA=";
# Completions
nativeBuildInputs = [ prev.installShellFiles ];
postInstall = ''
export HOME=$TMPDIR
installShellCompletion --cmd nvs \
--bash <($out/bin/nvs completion bash) \
--fish <($out/bin/nvs completion fish) \
--zsh <($out/bin/nvs completion zsh)
'';
};
}
-7
View File
@@ -1,7 +0,0 @@
#!/usr/bin/env bash
set -e
# Set Chromium on exit
FILE="$HOME/Library/Application Support/Chromium/Local State"
jq '.browser.enabled_labs_experiments //= [] | .browser.enabled_labs_experiments |= map(select(startswith("clear-data-on-exit") | not)) + ["clear-data-on-exit@1"]' "$FILE" | sponge "$FILE"
-27
View File
@@ -1,27 +0,0 @@
#!/bin/bash
# Create secrets directory if it doesn't exist
mkdir -p secrets/plist
# Array of app IDs to export
APP_IDS=(
"com.lwouis.alt-tab-macos"
"com.jordanbaird.Ice"
"com.apphousekitchen.aldente-pro.plist"
"com.lihaoyun6.QuickRecorder.plist"
)
# Export each plist
for APP_ID in "${APP_IDS[@]}"; do
echo "Exporting $APP_ID..."
defaults export "$APP_ID" - >"secrets/plist/$APP_ID.plist"
# Check if export was successful
if [ $? -eq 0 ]; then
echo "Successfully exported $APP_ID to secrets/$APP_ID.plist"
else
echo "Failed to export $APP_ID"
fi
done
echo "All exports completed!"
-38
View File
@@ -1,38 +0,0 @@
#!/bin/bash
# Path to the plist directory
PLIST_DIR="secrets/plist"
# Check if the plist directory exists
if [ ! -d "$PLIST_DIR" ]; then
echo "Error: Directory $PLIST_DIR does not exist."
exit 1
fi
# Get all plist files in the directory
PLIST_FILES=("$PLIST_DIR"/*.plist)
# Check if there are any plist files
if [ ${#PLIST_FILES[@]} -eq 0 ] || [ "${PLIST_FILES[0]}" = "$PLIST_DIR/*.plist" ]; then
echo "No plist files found in $PLIST_DIR."
exit 1
fi
# Import each plist
for PLIST_PATH in "${PLIST_FILES[@]}"; do
# Extract app ID from filename (remove path and .plist extension)
FILENAME=$(basename "$PLIST_PATH")
APP_ID="${FILENAME%.plist}"
echo "Importing $APP_ID..."
cat "$PLIST_PATH" | defaults import "$APP_ID" -
# Check if import was successful
if [ $? -eq 0 ]; then
echo "Successfully imported $APP_ID from $PLIST_PATH"
else
echo "Failed to import $APP_ID"
fi
done
echo "All imports completed!"
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.