refactoring

This commit is contained in:
Andrei Lazarescu 2025-07-12 12:37:52 +03:00
parent 46581aecdd
commit 8e8ea8b835
Signed by: lazandrei19
SSH Key Fingerprint: SHA256:/KoKmXLdUaBkf6PPceiJzDezV957xmuD7T9TTKsf28Q
22 changed files with 307 additions and 268 deletions

42
flake.lock generated
View File

@ -28,11 +28,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1751638848, "lastModified": 1752265577,
"narHash": "sha256-7HiC6w4ROEbMmKtj5pilnLOJej9HkkfU9wEd5QSTyNo=", "narHash": "sha256-YhnBM3oknReSFTAuc2SMwekwjl9nDd5PUhcar4DsefM=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "7d9e3c35f0d46f82bac791d76260f15f53d83529", "rev": "3976e0507edc9a5f332cb2be93fa20e646d22374",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -65,11 +65,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1751596331, "lastModified": 1751949589,
"narHash": "sha256-7WSzIrw0nCl8iYroj7c//LLsf2zgNEIJNyUSvx4MPLI=", "narHash": "sha256-mgFxAPLWw0Kq+C8P3dRrZrOYEQXOtKuYVlo9xvPntt8=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "472908faa934435cf781ae8fac77291af3d137d3", "rev": "9b008d60392981ad674e04016d25619281550a9d",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -84,15 +84,14 @@
"flake-parts": "flake-parts", "flake-parts": "flake-parts",
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"
], ]
"treefmt-nix": "treefmt-nix"
}, },
"locked": { "locked": {
"lastModified": 1751642422, "lastModified": 1752264610,
"narHash": "sha256-hvYrV5Wu6EwIIVsq9hpnIacrvykgZ7SxgTQ4a465sag=", "narHash": "sha256-wxbq3NFcAQIl06Of7YHSX2/8jD391rvlga5cINX8DRU=",
"owner": "nix-community", "owner": "nix-community",
"repo": "NUR", "repo": "NUR",
"rev": "390876721dd32c9797da8935dd912477c4533311", "rev": "556ac89a1c7d9d65ecd7bd0c07e24dcaccd80293",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -108,27 +107,6 @@
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"nur": "nur" "nur": "nur"
} }
},
"treefmt-nix": {
"inputs": {
"nixpkgs": [
"nur",
"nixpkgs"
]
},
"locked": {
"lastModified": 1733222881,
"narHash": "sha256-JIPcz1PrpXUCbaccEnrcUS8jjEb/1vJbZz5KkobyFdM=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "49717b5af6f80172275d47a418c9719a31a78b53",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "treefmt-nix",
"type": "github"
}
} }
}, },
"root": "root", "root": "root",

246
flake.nix
View File

@ -1,5 +1,5 @@
{ {
description = "Example nix-darwin system flake"; description = "Andrei's nix-darwin system flake";
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
@ -12,243 +12,19 @@
}; };
outputs = { self, nix-darwin, nixpkgs, home-manager, nur, ... }: 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 { darwinConfigurations."Andreis-MacBook-Pro" = nix-darwin.lib.darwinSystem {
specialArgs = { inherit nur; }; specialArgs = { inherit nur; };
modules = [ configuration home-manager.darwinModules.home-manager ]; modules = [
./system
{
nixpkgs.overlays = [ nur.overlays.default ];
home-manager.useGlobalPkgs = true;
home-manager.backupFileExtension = "bak";
home-manager.users.andrei = import ./home/andrei;
}
home-manager.darwinModules.home-manager
];
}; };
}; };
} }

16
home/andrei/default.nix Normal file
View File

@ -0,0 +1,16 @@
{ ... }:
{
imports = [
./direnv.nix
./firefox.nix
./gh.nix
./git.nix
./home.nix
./kitty.nix
./services.nix
./ssh.nix
./vscode.nix
./zsh.nix
];
}

8
home/andrei/direnv.nix Normal file
View File

@ -0,0 +1,8 @@
{
programs.direnv = {
enable = true;
enableZshIntegration = true;
nix-direnv.enable = true;
silent = true;
};
}

33
home/andrei/firefox.nix Normal file
View File

@ -0,0 +1,33 @@
{ pkgs, nur, ... }:
{
programs.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;
};
};
};
}

8
home/andrei/gh.nix Normal file
View File

@ -0,0 +1,8 @@
{
programs.gh = {
enable = true;
settings = {
git_protocol = "ssh";
};
};
}

29
home/andrei/git.nix Normal file
View File

@ -0,0 +1,29 @@
{ pkgs, ... }:
{
programs.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:";
};
};
}

8
home/andrei/home.nix Normal file
View File

@ -0,0 +1,8 @@
{ pkgs, ... }:
{
home = {
packages = [ pkgs.go ];
stateVersion = "25.11";
};
}

17
home/andrei/kitty.nix Normal file
View File

@ -0,0 +1,17 @@
{
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";
};
};
}

5
home/andrei/services.nix Normal file
View File

@ -0,0 +1,5 @@
{
services.ollama = {
enable = true;
};
}

10
home/andrei/ssh.nix Normal file
View File

@ -0,0 +1,10 @@
{
programs.ssh = {
enable = true;
extraConfig = ''
Host *
IdentityAgent "~/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock"
SetEnv TERM=xterm-256color
'';
};
}

30
home/andrei/vscode.nix Normal file
View File

@ -0,0 +1,30 @@
{ pkgs, ... }:
{
programs.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;
};
};
};
}

18
home/andrei/zsh.nix Normal file
View File

@ -0,0 +1,18 @@
{
programs.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"
'';
};
}

14
system/default.nix Normal file
View File

@ -0,0 +1,14 @@
{ ... }:
{
imports = [
./defaults.nix
./fonts.nix
./homebrew.nix
./nix.nix
./programs.nix
./security.nix
./services.nix
./system.nix
];
}

20
system/defaults.nix Normal file
View File

@ -0,0 +1,20 @@
{
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;
};
}

5
system/fonts.nix Normal file
View File

@ -0,0 +1,5 @@
{ pkgs, ... }:
{
fonts.packages = [ pkgs.fira-code pkgs.nerd-fonts.fira-code ];
}

20
system/homebrew.nix Normal file
View File

@ -0,0 +1,20 @@
{ pkgs, ... }:
{
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;
};
};
}

5
system/nix.nix Normal file
View File

@ -0,0 +1,5 @@
{
# Necessary for using flakes on this system.
nix.settings.experimental-features = "nix-command flakes";
nix.settings.warn-dirty = false;
}

5
system/programs.nix Normal file
View File

@ -0,0 +1,5 @@
{
programs = {
_1password-gui.enable = true;
};
}

8
system/security.nix Normal file
View File

@ -0,0 +1,8 @@
{
security.pam.services.sudo_local = {
enable = true;
reattach = true;
touchIdAuth = true;
watchIdAuth = true;
};
}

5
system/services.nix Normal file
View File

@ -0,0 +1,5 @@
{
services = {
tailscale.enable = true;
};
}

21
system/system.nix Normal file
View File

@ -0,0 +1,21 @@
{ self, ... }:
{
# 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";
}