Compare commits

3 Commits

Author SHA1 Message Date
Morten Olsen
20548f94cd add argocd 2025-12-16 20:26:49 +01:00
Morten Olsen
8cd490ad3b added zen browser 2025-12-16 20:22:35 +01:00
Morten Olsen
4ca7376a20 improved system setup 2025-12-16 19:58:34 +01:00
17 changed files with 218 additions and 452 deletions

24
flake.lock generated
View File

@@ -7,11 +7,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1766682973, "lastModified": 1765682243,
"narHash": "sha256-GKO35onS711ThCxwWcfuvbIBKXwriahGqs+WZuJ3v9E=", "narHash": "sha256-yeCxFV/905Wr91yKt5zrVvK6O2CVXWRMSrxqlAZnLp0=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "91cdb0e2d574c64fae80d221f4bf09d5592e9ec2", "rev": "58bf3ecb2d0bba7bdf363fc8a6c4d49b4d509d03",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -27,11 +27,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1766784396, "lastModified": 1765684049,
"narHash": "sha256-rIlgatT0JtwxsEpzq+UrrIJCRfVAXgbYPzose1DmAcM=", "narHash": "sha256-svCS2r984qEowMT0y3kCrsD/m0J6zaF5I/UusS7QaH0=",
"owner": "LnL7", "owner": "LnL7",
"repo": "nix-darwin", "repo": "nix-darwin",
"rev": "f0c8e1f6feb562b5db09cee9fb566a2f989e6b55", "rev": "9b628e171bfaea1a3d1edf31eee46251e0fe4a33",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -42,11 +42,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1766747458, "lastModified": 1765644376,
"narHash": "sha256-m63jjuo/ygo8ztkCziYh5OOIbTSXUDkKbqw3Vuqu4a4=", "narHash": "sha256-yqHBL2wYGwjGL2GUF2w3tofWl8qO9tZEuI4wSqbCrtE=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "c633f572eded8c4f3c75b8010129854ed404a6ce", "rev": "23735a82a828372c4ef92c660864e82fbe2f5fbe",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -74,11 +74,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1766697593, "lastModified": 1765895443,
"narHash": "sha256-mGZBEN67mxeOsBhplBRLm6L+y++8jU46EEUYgemG1aQ=", "narHash": "sha256-yftYGV0skUwV5neT1BJrs7RRbXPKozQTzC7d9c7kEFs=",
"owner": "0xc000022070", "owner": "0xc000022070",
"repo": "zen-browser-flake", "repo": "zen-browser-flake",
"rev": "98d8f48ba80a4b6e3b56addad850d57132301075", "rev": "bc7dfff92cb7919dfb213ea78c11ea0a4d265a56",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@@ -28,22 +28,19 @@
}; };
}; };
outputs = outputs = {
{
self, self,
nixpkgs, nixpkgs,
home-manager, home-manager,
nix-darwin, nix-darwin,
... ...
}@inputs: } @ inputs: let
let
# Default username - can be overridden per-host if needed # Default username - can be overridden per-host if needed
username = "alice"; username = "alice";
# Common special args passed to all modules # Common special args passed to all modules
specialArgs = { inherit inputs username; }; specialArgs = {inherit inputs username;};
in in {
{
# Darwin (macOS) system configurations # Darwin (macOS) system configurations
darwinConfigurations = { darwinConfigurations = {
# Personal machine configuration # Personal machine configuration
@@ -61,9 +58,7 @@
useGlobalPkgs = true; useGlobalPkgs = true;
useUserPackages = true; useUserPackages = true;
extraSpecialArgs = specialArgs; extraSpecialArgs = specialArgs;
users.${username} = users.${username} = {...}: {
{ ... }:
{
imports = [ imports = [
./home ./home
./home/personal.nix ./home/personal.nix
@@ -89,9 +84,7 @@
useGlobalPkgs = true; useGlobalPkgs = true;
useUserPackages = true; useUserPackages = true;
extraSpecialArgs = specialArgs; extraSpecialArgs = specialArgs;
users.${username} = users.${username} = {...}: {
{ ... }:
{
imports = [ imports = [
./home ./home
./home/work.nix ./home/work.nix
@@ -104,27 +97,19 @@
}; };
# Development shell for working on this repository # Development shell for working on this repository
devShells = devShells = let
let systems = ["aarch64-darwin" "x86_64-darwin"];
systems = [
"aarch64-darwin"
"x86_64-darwin"
];
forAllSystems = nixpkgs.lib.genAttrs systems; forAllSystems = nixpkgs.lib.genAttrs systems;
in in
forAllSystems ( forAllSystems (system: let
system:
let
pkgs = nixpkgs.legacyPackages.${system}; pkgs = nixpkgs.legacyPackages.${system};
in in {
{
default = pkgs.mkShell { default = pkgs.mkShell {
packages = with pkgs; [ packages = with pkgs; [
nixfmt-rfc-style nixfmt-rfc-style
nil # Nix LSP nil # Nix LSP
]; ];
}; };
} });
);
}; };
} }

View File

@@ -9,8 +9,7 @@
username, username,
inputs, inputs,
... ...
}: }: {
{
# Import shared modules # Import shared modules
imports = [ imports = [
inputs.zen-browser.homeModules.beta inputs.zen-browser.homeModules.beta
@@ -33,7 +32,7 @@
home = { home = {
# Home Manager needs a bit of information about you and the paths it should manage # Home Manager needs a bit of information about you and the paths it should manage
inherit username; username = username;
homeDirectory = "/Users/${username}"; homeDirectory = "/Users/${username}";
# This value determines the Home Manager release that your configuration is # This value determines the Home Manager release that your configuration is

View File

@@ -7,8 +7,7 @@
pkgs, pkgs,
lib, lib,
... ...
}: }: {
{
# Import personal-specific modules # Import personal-specific modules
imports = [ imports = [
../modules/home/git.nix ../modules/home/git.nix

View File

@@ -7,8 +7,7 @@
pkgs, pkgs,
lib, lib,
... ...
}: }: {
{
# Import work-specific modules # Import work-specific modules
imports = [ imports = [
../modules/home/git.nix ../modules/home/git.nix

View File

@@ -8,14 +8,14 @@
lib, lib,
username, username,
... ...
}: }: {
{
# Import darwin modules # Import darwin modules
imports = [ imports = [
../../modules/darwin/system.nix ../../modules/darwin/system.nix
../../modules/darwin/homebrew.nix ../../modules/darwin/homebrew.nix
]; ];
# System-level programs # System-level programs
programs = { programs = {
# Enable zsh as it's the default macOS shell # Enable zsh as it's the default macOS shell

View File

@@ -8,8 +8,7 @@
lib, lib,
username, username,
... ...
}: }: {
{
# Import darwin modules # Import darwin modules
imports = [ imports = [
../../modules/darwin/system.nix ../../modules/darwin/system.nix

View File

@@ -1,2 +0,0 @@
[tools]
rust = "latest"

View File

@@ -9,11 +9,9 @@
pkgs, pkgs,
... ...
}: }:
with lib; with lib; let
let
cfg = config.modules.homebrew; cfg = config.modules.homebrew;
in in {
{
options.modules.homebrew = { options.modules.homebrew = {
enable = mkEnableOption "Homebrew management via nix-darwin"; enable = mkEnableOption "Homebrew management via nix-darwin";
@@ -25,16 +23,13 @@ in
# Password management # Password management
"1password" "1password"
"1password-cli" "1password-cli"
"bitwarden"
# Terminal & Development # Terminal & Development
"ghostty" "ghostty"
"dbeaver-community" "dbeaver-community"
"visual-studio-code"
# Window management # Window management
"aerospace" "aerospace"
"claude-code"
# Productivity # Productivity
"raycast" "raycast"
@@ -47,8 +42,6 @@ in
# Networking & IoT # Networking & IoT
"localsend" "localsend"
"home-assistant" "home-assistant"
"cursor-cli"
]; ];
description = "Homebrew casks to install on all machines"; description = "Homebrew casks to install on all machines";
}; };
@@ -66,7 +59,6 @@ in
# Communication # Communication
"signal" "signal"
"thunderbird"
# Gaming # Gaming
"steam" "steam"
@@ -111,6 +103,7 @@ in
"fluxcd/tap/flux" "fluxcd/tap/flux"
"sst/tap/opencode" "sst/tap/opencode"
"tree-sitter-cli" "tree-sitter-cli"
"borders"
]; ];
description = "Homebrew formulae to install (for packages not in nixpkgs)"; description = "Homebrew formulae to install (for packages not in nixpkgs)";
}; };
@@ -130,11 +123,7 @@ in
# Cleanup behavior # Cleanup behavior
cleanup = mkOption { cleanup = mkOption {
type = types.enum [ type = types.enum ["none" "uninstall" "zap"];
"none"
"uninstall"
"zap"
];
default = "zap"; default = "zap";
description = '' description = ''
Cleanup behavior for Homebrew packages: Cleanup behavior for Homebrew packages:
@@ -157,7 +146,7 @@ in
# Upgrade outdated packages # Upgrade outdated packages
upgrade = true; upgrade = true;
# Cleanup behavior for unmanaged packages # Cleanup behavior for unmanaged packages
inherit (cfg) cleanup; cleanup = cfg.cleanup;
}; };
# Global settings # Global settings
@@ -169,18 +158,26 @@ in
}; };
# Taps (third-party repositories) # Taps (third-party repositories)
inherit (cfg) taps; taps = cfg.taps;
# Formulae (CLI tools from Homebrew) # Formulae (CLI tools from Homebrew)
inherit (cfg) brews; brews = cfg.brews;
caskArgs.no_quarantine = true; caskArgs.no_quarantine = true;
# Casks (GUI applications) # Casks (GUI applications)
casks = casks =
cfg.casks.shared cfg.casks.shared
++ (if cfg.casks.enablePersonal then cfg.casks.personal else [ ]) ++ (
++ (if cfg.casks.enableWork then cfg.casks.work else [ ]); if cfg.casks.enablePersonal
then cfg.casks.personal
else []
)
++ (
if cfg.casks.enableWork
then cfg.casks.work
else []
);
}; };
}; };
} }

View File

@@ -5,16 +5,12 @@
lib, lib,
username, username,
... ...
}: }: {
{
# Nix configuration # Nix configuration
nix = { nix = {
settings = { settings = {
# Enable flakes and new nix command # Enable flakes and new nix command
experimental-features = [ experimental-features = ["nix-command" "flakes"];
"nix-command"
"flakes"
];
# Avoid unwanted garbage collection when using nix-direnv # Avoid unwanted garbage collection when using nix-direnv
keep-outputs = true; keep-outputs = true;
keep-derivations = true; keep-derivations = true;
@@ -39,6 +35,7 @@
DisableConsoleAccess = true; DisableConsoleAccess = true;
}; };
dock = { dock = {
autohide = true; autohide = true;
autohide-delay = 0.0; autohide-delay = 0.0;

View File

@@ -7,11 +7,9 @@
pkgs, pkgs,
lib, lib,
... ...
}: }: let
let
cfg = config.modules.apps; cfg = config.modules.apps;
in in {
{
options.modules.apps = { options.modules.apps = {
enable = lib.mkEnableOption "application configurations"; enable = lib.mkEnableOption "application configurations";
@@ -31,6 +29,7 @@ in
}; };
}; };
jellyfin-tui = { jellyfin-tui = {
enable = lib.mkOption { enable = lib.mkOption {
type = lib.types.bool; type = lib.types.bool;
@@ -67,16 +66,12 @@ in
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
programs.zen-browser = lib.mkIf cfg.zen-browser.enable { programs.zen-browser = lib.mkIf cfg.zen-browser.enable {
enable = true; enable = true;
policies = policies = let
let mkExtensionSettings = builtins.mapAttrs (_: pluginId: {
mkExtensionSettings = builtins.mapAttrs (
_: pluginId: {
install_url = "https://addons.mozilla.org/firefox/downloads/latest/${pluginId}/latest.xpi"; install_url = "https://addons.mozilla.org/firefox/downloads/latest/${pluginId}/latest.xpi";
installation_mode = "force_installed"; installation_mode = "force_installed";
} });
); in {
in
{
AutofillAddressEnabled = true; AutofillAddressEnabled = true;
AutofillCreditCardEnabled = false; AutofillCreditCardEnabled = false;
DisableAppUpdate = true; DisableAppUpdate = true;
@@ -95,8 +90,7 @@ in
}; };
ExtensionSettings = mkExtensionSettings { ExtensionSettings = mkExtensionSettings {
#"78272b6fa58f4a1abaac99321d503a20@proton.me" = "proton-pass"; "78272b6fa58f4a1abaac99321d503a20@proton.me" = "proton-pass";
"{446900e4-71c2-419f-a6a7-df9c091e268b}" = "bitwarden-password-manager";
"{d7742d87-e61d-4b78-b8a1-b469842139fa}" = "vimium-ff"; "{d7742d87-e61d-4b78-b8a1-b469842139fa}" = "vimium-ff";
"readeck@readeck.com" = "readeck"; "readeck@readeck.com" = "readeck";
"@testpilot-containers" = "multi-account-containers"; "@testpilot-containers" = "multi-account-containers";

View File

@@ -13,18 +13,15 @@
lib, lib,
... ...
}: }:
with lib; with lib; let
let
cfg = config.modules.gitFiles; cfg = config.modules.gitFiles;
# Helper function to generate gitconfig content # Helper function to generate gitconfig content
mkGitConfig = mkGitConfig = {
{
email, email,
signingKey, signingKey,
urlRewrites ? { }, urlRewrites ? {},
}: }: ''
''
[user] [user]
email = ${email} email = ${email}
name = Morten Olsen name = Morten Olsen
@@ -38,17 +35,12 @@ let
[gpg "ssh"] [gpg "ssh"]
program = "/Applications/1Password.app/Contents/MacOS/op-ssh-sign" program = "/Applications/1Password.app/Contents/MacOS/op-ssh-sign"
${optionalString (urlRewrites != { }) ( ${optionalString (urlRewrites != {}) (concatStringsSep "\n" (mapAttrsToList (name: value: ''
concatStringsSep "\n" (
mapAttrsToList (name: value: ''
[url "${name}"] [url "${name}"]
insteadOf = ${value}'') urlRewrites insteadOf = ${value}'') urlRewrites))}
)
)}
''; '';
in in {
{
options.modules.gitFiles = { options.modules.gitFiles = {
enable = mkEnableOption "Project-specific git configuration files"; enable = mkEnableOption "Project-specific git configuration files";
@@ -110,8 +102,8 @@ in
# Used on personal machine for all projects under ~/Projects/ # Used on personal machine for all projects under ~/Projects/
(mkIf cfg.personal.enable { (mkIf cfg.personal.enable {
"Projects/.gitconfig".text = mkGitConfig { "Projects/.gitconfig".text = mkGitConfig {
inherit (cfg.personal) email; email = cfg.personal.email;
inherit (cfg.personal) signingKey; signingKey = cfg.personal.signingKey;
urlRewrites = { urlRewrites = {
"ssh://git@ssh-gitea.olsen.cloud:2205/" = "https://gitea.olsen.cloud/"; "ssh://git@ssh-gitea.olsen.cloud:2205/" = "https://gitea.olsen.cloud/";
"git@github-private:" = "https://github.com/"; "git@github-private:" = "https://github.com/";
@@ -123,8 +115,8 @@ in
# Used on work machine for personal projects under ~/Projects/private/ # Used on work machine for personal projects under ~/Projects/private/
(mkIf cfg.private.enable { (mkIf cfg.private.enable {
"Projects/private/.gitconfig".text = mkGitConfig { "Projects/private/.gitconfig".text = mkGitConfig {
inherit (cfg.private) email; email = cfg.private.email;
inherit (cfg.private) signingKey; signingKey = cfg.private.signingKey;
urlRewrites = { urlRewrites = {
"ssh://git@ssh-gitea.olsen.cloud:2205/" = "https://gitea.olsen.cloud/"; "ssh://git@ssh-gitea.olsen.cloud:2205/" = "https://gitea.olsen.cloud/";
"git@github-private:" = "https://github.com/"; "git@github-private:" = "https://github.com/";
@@ -136,8 +128,8 @@ in
# Used on work machine for work projects under ~/Projects/zeronorth/ # Used on work machine for work projects under ~/Projects/zeronorth/
(mkIf cfg.zeronorth.enable { (mkIf cfg.zeronorth.enable {
"Projects/zeronorth/.gitconfig".text = mkGitConfig { "Projects/zeronorth/.gitconfig".text = mkGitConfig {
inherit (cfg.zeronorth) email; email = cfg.zeronorth.email;
inherit (cfg.zeronorth) signingKey; signingKey = cfg.zeronorth.signingKey;
urlRewrites = { urlRewrites = {
"git@github-zeronorth:" = "https://github.com/"; "git@github-zeronorth:" = "https://github.com/";
}; };

View File

@@ -11,11 +11,9 @@
lib, lib,
... ...
}: }:
with lib; with lib; let
let
cfg = config.modules.git; cfg = config.modules.git;
in in {
{
options.modules.git = { options.modules.git = {
enable = mkEnableOption "Git configuration"; enable = mkEnableOption "Git configuration";
@@ -38,8 +36,7 @@ in
}; };
includes = mkOption { includes = mkOption {
type = types.listOf ( type = types.listOf (types.submodule {
types.submodule {
options = { options = {
condition = mkOption { condition = mkOption {
type = types.str; type = types.str;
@@ -52,9 +49,8 @@ in
example = "~/Projects/.gitconfig"; example = "~/Projects/.gitconfig";
}; };
}; };
} });
); default = [];
default = [ ];
description = "List of conditional includes for project-specific git configurations"; description = "List of conditional includes for project-specific git configurations";
}; };
}; };
@@ -92,8 +88,8 @@ in
# Conditional includes for project-specific configurations # Conditional includes for project-specific configurations
includes = map (inc: { includes = map (inc: {
inherit (inc) condition; condition = inc.condition;
inherit (inc) path; path = inc.path;
}) cfg.includes; }) cfg.includes;
# All git settings using the new unified settings option # All git settings using the new unified settings option
@@ -125,57 +121,6 @@ in
autoSetupRemote = true; autoSetupRemote = true;
}; };
# Rebase settings
rebase = {
autoStash = true;
updateRefs = true;
};
# Rerere (Reuse Recorded Resolution) - automatically reuse conflict resolutions
rerere = {
enabled = true;
};
# Color settings
color = {
ui = "auto";
branch = "auto";
diff = "auto";
status = "auto";
};
# Diff settings
diff = {
compactionHeuristic = true;
algorithm = "patience";
colorMoved = "default";
};
# Merge settings
merge = {
conflictStyle = "zdiff3";
};
# Fetch settings
fetch = {
prune = true;
showForcedUpdates = true;
};
# Advice settings (disable annoying messages)
advice = {
detachedHead = false;
statusHints = true;
addIgnoredFile = false;
};
# Blame settings
blame = {
colorLines = true;
markUnblamables = true;
markUnblamableLines = true;
};
# GPG/SSH signing settings # GPG/SSH signing settings
gpg = { gpg = {
format = "ssh"; format = "ssh";
@@ -210,112 +155,18 @@ in
# Aliases # Aliases
alias = { alias = {
# Log and history aliases
# =====
# Pretty graph log with GPG info
history = "log --graph --color --pretty=format:\"%C(yellow)%H%C(green)%d%C(reset)%n%x20%cd%n%x20%cn%C(blue)%x20(%ce)%x20%C(cyan)[gpg:%GK%x20%G?]%C(reset)%n%x20%s%n\"";
graph = "log --graph --color --pretty=format:\"%C(yellow)%H%C(green)%d%C(reset)%n%x20%cd%n%x20%cn%C(blue)%x20(%ce)%x20%C(cyan)[gpg:%GK%x20%G?]%C(reset)%n%x20%s%n\""; graph = "log --graph --color --pretty=format:\"%C(yellow)%H%C(green)%d%C(reset)%n%x20%cd%n%x20%cn%C(blue)%x20(%ce)%x20%C(cyan)[gpg:%GK%x20%G?]%C(reset)%n%x20%s%n\"";
# One-line log
ll = "log --oneline"; ll = "log --oneline";
# Last commit with stats
last = "log -1 --stat";
# Status and branch aliases
# =====
# Short branch status
st = "status -sb"; st = "status -sb";
# Formatted local branches
local-branches = "branch --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(contents:subject) %(color:green)(%(committerdate:relative)) [%(authorname)]' --sort=-committerdate";
# Formatted remote branches
remote-branches = "branch --remote --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(contents:subject) %(color:green)(%(committerdate:relative)) [%(authorname)]' --sort=-committerdate";
# Create and switch to new branch
new-branch = "!f() { git checkout -b \"$1\"; }; f";
# Switch branch (interactive with fzf)
switch-branch = "!f() { branch=$(git branch --format='%(refname:short)' | fzf --height 40%); [ -n \"$branch\" ] && git checkout \"$branch\"; }; f";
# Delete branch (with confirmation)
delete-branch = "!f() { git branch -d \"$1\" 2>/dev/null || git branch -D \"$1\"; }; f";
# Commit aliases
# =====
# Commit with message
cm = "commit -m"; cm = "commit -m";
# Amend last commit without editing message
amend = "commit --amend --no-edit";
append = "commit --amend --no-edit"; append = "commit --amend --no-edit";
# Stage all and amend to last commit
fix = "!git add . && git commit --amend --no-edit";
# Stage all, amend, and safely force push with lease and force-if-includes
fck = "!f() { git add . && git commit --amend --no-edit && git push --force-with-lease --force-if-includes; }; f";
# Stage all, commit with message, and push
save = "!f() { git add --all && git commit -m \"$*\" && git push; }; f";
# Fixup workflow aliases
# =====
# Interactive fixup: pick commit with fzf, stage all, create fixup
fix-commit = "!f() { commit=$(git log --oneline --color=always | fzf --ansi --height 40% | awk '{print $1}'); [ -n \"$commit\" ] && git add . && git commit --fixup=\"$commit\"; }; f";
apply-fixes = "!f() { upstream=$(git rev-parse --abbrev-ref --symbolic-full-name @{upstream} 2>/dev/null); if [ -n \"$upstream\" ]; then git rebase -i --autosquash \"$upstream\"; elif git show-ref --verify --quiet refs/remotes/origin/main; then git rebase -i --autosquash origin/main; elif git show-ref --verify --quiet refs/remotes/origin/master; then git rebase -i --autosquash origin/master; elif git show-ref --verify --quiet refs/heads/main; then git rebase -i --autosquash main; elif git show-ref --verify --quiet refs/heads/master; then git rebase -i --autosquash master; else first_commit=$(git rev-list --reverse HEAD | head -1); if [ -n \"$first_commit\" ]; then base=$(git rev-parse \"$first_commit^\" 2>/dev/null); if [ -n \"$base\" ] && [ \"$base\" != \"$first_commit\" ]; then git rebase -i --autosquash \"$base\"; else echo \"Could not determine base. Usage: git apply-fixes <base-branch>\"; fi; else echo \"No base branch found. Usage: git apply-fixes <base-branch>\"; fi; fi; }; f";
# Squash all commits unique to current branch (auto-detects default branch)
cleanup = "!f() { default=$(git remote show origin 2>/dev/null | sed -n '/HEAD branch/s/.*: //p' || echo \"main\"); if ! git show-ref --verify --quiet \"refs/remotes/origin/$default\"; then default=\"master\"; fi; if git show-ref --verify --quiet \"refs/remotes/origin/$default\"; then base=$(git merge-base HEAD \"origin/$default\"); git rebase -i \"$base\"; else echo \"Could not find default branch (main/master). Usage: git squash-all <base-branch>\"; fi; }; f";
squash-all = "!f() { default=$(git remote show origin 2>/dev/null | sed -n '/HEAD branch/s/.*: //p' || echo \"main\"); if ! git show-ref --verify --quiet \"refs/remotes/origin/$default\"; then default=\"master\"; fi; if git show-ref --verify --quiet \"refs/remotes/origin/$default\"; then base=$(git merge-base HEAD \"origin/$default\"); git rebase -i \"$base\"; else echo \"Could not find default branch (main/master). Usage: git squash-all <base-branch>\"; fi; }; f";
# Staging aliases
# =====
# Stage all files
stage-all = "add --all";
# Unstage all staged files
unstage = "reset HEAD --";
# Interactive staging with fzf
stage = "!f() { git status -s | fzf --multi --ansi --height 40% | awk '{print $2}' | xargs git add; }; f";
# Undo and reset aliases
# =====
# Interactive undo: pick state from reflog, show diff, confirm before hard reset
undo = "!f() { target=$(git reflog --color=always --date=relative --format=\"%C(yellow)%h%C(reset) %C(cyan)%gd%C(reset) %C(green)%gs%C(reset)\" | fzf --ansi --height 40% --header=\"Select a state to reset to\" | awk '{print $1}'); if [ -n \"$target\" ]; then echo \"\n=== Diff between HEAD and selected state ===\n\"; git diff --color=always HEAD \"$target\"; echo \"\n=== This will discard all changes above ===\n\"; read -p \"Reset to $target? (y/N): \" confirm; if [ \"$confirm\" = \"y\" ] || [ \"$confirm\" = \"Y\" ]; then git reset --hard \"$target\"; else echo \"Reset cancelled.\"; fi; fi; }; f";
# Remote operations aliases
# =====
# Fetch from all remotes
fetch-all = "fetch --all";
# Pull latest changes
pull-latest = "!f() { default=$(git remote show origin 2>/dev/null | sed -n '/HEAD branch/s/.*: //p' || echo \"main\"); if ! git show-ref --verify --quiet \"refs/remotes/origin/$default\"; then default=\"master\"; fi; git pull origin \"$default\"; }; f";
# Push and set upstream
push-new = "!f() { git push -u origin $(git rev-parse --abbrev-ref HEAD); }; f";
# Update from main/master (rebase)
update-from-main = "!f() { default=$(git remote show origin 2>/dev/null | sed -n '/HEAD branch/s/.*: //p' || echo \"main\"); if ! git show-ref --verify --quiet \"refs/remotes/origin/$default\"; then default=\"master\"; fi; git fetch origin && git rebase \"origin/$default\"; }; f";
# Stash aliases
# =====
# Save current changes to stash
stash-save = "stash push -m";
# Apply and remove stash (interactive with fzf)
stash-pop = "!f() { stash=$(git stash list --color=always | fzf --ansi --height 40% | awk -F: '{print $1}'); [ -n \"$stash\" ] && git stash pop \"$stash\"; }; f";
# List stashes
stash-list = "stash list";
# Workflow aliases
# =====
# Create new feature branch from main/master
new-feature = "!f() { default=$(git remote show origin 2>/dev/null | sed -n '/HEAD branch/s/.*: //p' || echo \"main\"); if ! git show-ref --verify --quiet \"refs/remotes/origin/$default\"; then default=\"master\"; fi; git fetch origin && git checkout -b \"$1\" \"origin/$default\"; }; f";
# Compare current branch with another branch
compare = "!f() { git diff \"$1\"..HEAD; }; f";
# Other aliases
# =====
# Initialize and update submodules
sobmodules = "submodule update --init --recursive"; sobmodules = "submodule update --init --recursive";
# Diff tool using nvimdiff
df = "difftool -t nvimdiff -y"; df = "difftool -t nvimdiff -y";
last = "log -1 --stat";
br = "branch --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(contents:subject) %(color:green)(%(committerdate:relative)) [%(authorname)]' --sort=-committerdate";
brr = "branch --remote --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(contents:subject) %(color:green)(%(committerdate:relative)) [%(authorname)]' --sort=-committerdate";
undo = "reset HEAD~1 --mixed";
unstage = "reset HEAD --";
}; };
}; };
}; };

View File

@@ -9,8 +9,7 @@
pkgs, pkgs,
lib, lib,
... ...
}: }: {
{
home.packages = with pkgs; [ home.packages = with pkgs; [
# ======================================================================== # ========================================================================
# Shell Tools # Shell Tools
@@ -64,6 +63,7 @@
# Languages and Runtimes # Languages and Runtimes
nodejs_22 # Node.js LTS (replaces NVM) nodejs_22 # Node.js LTS (replaces NVM)
deno # JavaScript/TypeScript runtime deno # JavaScript/TypeScript runtime
rustup # Rust toolchain manager
python313 # Python 3.13 python313 # Python 3.13
# pyenv is configured in shell.nix # pyenv is configured in shell.nix
uv # Fast Python package installer uv # Fast Python package installer
@@ -89,11 +89,8 @@
k9s # Kubernetes TUI k9s # Kubernetes TUI
istioctl # Istio service mesh CLI istioctl # Istio service mesh CLI
fluxcd # GitOps toolkit fluxcd # GitOps toolkit
popeye popeye #
argocd argocd
kubeseal
kubebuilder
kind
# ======================================================================== # ========================================================================
# Infrastructure and Cloud Tools # Infrastructure and Cloud Tools
@@ -115,7 +112,6 @@
age # Modern encryption tool age # Modern encryption tool
sops # Secrets management sops # Secrets management
rustscan # The Modern Port Scanner. Find ports quickly (3 seconds at its fastest). nmap alternative. rustscan # The Modern Port Scanner. Find ports quickly (3 seconds at its fastest). nmap alternative.
bitwarden-cli
# ======================================================================== # ========================================================================
# Miscellaneous Tools # Miscellaneous Tools
@@ -131,19 +127,12 @@
mob mob
zsh-fast-syntax-highlighting zsh-fast-syntax-highlighting
jellyfin-tui jellyfin-tui
mpv
# ======================================================================== # ========================================================================
# Nix Tools # Nix Tools
# ======================================================================== # ========================================================================
nixfmt-rfc-style # Nix code formatter nixfmt-rfc-style # Nix code formatter
nil # Nix language server nil # Nix language server
# ========================================================================
# AAI tools
# ========================================================================
gemini-cli
opencode
]; ];
# ======================================================================== # ========================================================================
@@ -193,30 +182,4 @@
programs.lazygit = { programs.lazygit = {
enable = true; enable = true;
}; };
programs.k9s = {
enable = true;
plugins = {
"edit-secret" = {
shortCut = "Ctrl-X";
confirm = false;
description = "Edit Decoded Secret";
scopes = [ "secrets" ];
command = "sh";
background = false;
args = [
"-c"
''
tempfile=$(mktemp);
secret=$(kubectl get secrets --context $CONTEXT --namespace $NAMESPACE $NAME -o json);
printf '%s\n' $secret | jq '.data | map_values(@base64d)' > $tempfile;
vim $tempfile;
secret_data=$(cat $tempfile | jq -c '. | map_values(@base64)');
rm $tempfile;
printf '%s\n' $secret | jq -r --argjson secret_data "$secret_data" '.data = $secret_data' | kubectl apply -f -;
''
];
};
};
};
} }

View File

@@ -13,8 +13,7 @@
pkgs, pkgs,
lib, lib,
... ...
}: }: {
{
# ========================================================================== # ==========================================================================
# Zsh Configuration # Zsh Configuration
# ========================================================================== # ==========================================================================
@@ -273,7 +272,6 @@
${pkgs.mise}/bin/mise use --global bun@latest ${pkgs.mise}/bin/mise use --global bun@latest
${pkgs.mise}/bin/mise use --global deno@latest ${pkgs.mise}/bin/mise use --global deno@latest
${pkgs.mise}/bin/mise use --global uv@latest ${pkgs.mise}/bin/mise use --global uv@latest
${pkgs.mise}/bin/mise use --global rust@latest
''; '';
programs.nushell = { programs.nushell = {

View File

@@ -8,11 +8,9 @@
lib, lib,
... ...
}: }:
with lib; with lib; let
let
cfg = config.modules.ssh; cfg = config.modules.ssh;
in in {
{
options.modules.ssh = { options.modules.ssh = {
enable = mkEnableOption "SSH configuration"; enable = mkEnableOption "SSH configuration";
@@ -67,7 +65,7 @@ in
enableDefaultConfig = false; enableDefaultConfig = false;
# Include colima SSH config for container access # Include colima SSH config for container access
includes = [ "~/.colima/ssh_config" ]; includes = ["~/.colima/ssh_config"];
# 1Password SSH agent integration (macOS) # 1Password SSH agent integration (macOS)
extraConfig = '' extraConfig = ''

View File

@@ -7,8 +7,7 @@
pkgs, pkgs,
lib, lib,
... ...
}: }: {
{
programs.tmux = { programs.tmux = {
enable = true; enable = true;
@@ -117,8 +116,6 @@
# Utils - lazygit popup # Utils - lazygit popup
bind -r g display-popup -d '#{pane_current_path}' -w80% -h80% -E lazygit bind -r g display-popup -d '#{pane_current_path}' -w80% -h80% -E lazygit
bind -r o display-popup -d '#{pane_current_path}' -w80% -h80% -E yazi
bind -r p display-popup -d '#{pane_current_path}' -w80% -h80% -E $SHELL
''; '';
}; };
} }