This commit is contained in:
Morten Olsen
2025-12-27 00:02:02 +01:00
parent e384cc4829
commit 7f087bc39e
16 changed files with 257 additions and 213 deletions

24
flake.lock generated
View File

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

View File

@@ -28,19 +28,22 @@
}; };
}; };
outputs = { outputs =
{
self, self,
nixpkgs, nixpkgs,
home-manager, home-manager,
nix-darwin, nix-darwin,
... ...
} @ inputs: let }@inputs:
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
@@ -58,7 +61,9 @@
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
@@ -84,7 +89,9 @@
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
@@ -97,19 +104,27 @@
}; };
# Development shell for working on this repository # Development shell for working on this repository
devShells = let devShells =
systems = ["aarch64-darwin" "x86_64-darwin"]; let
systems = [
"aarch64-darwin"
"x86_64-darwin"
];
forAllSystems = nixpkgs.lib.genAttrs systems; forAllSystems = nixpkgs.lib.genAttrs systems;
in in
forAllSystems (system: let forAllSystems (
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,7 +9,8 @@
username, username,
inputs, inputs,
... ...
}: { }:
{
# Import shared modules # Import shared modules
imports = [ imports = [
inputs.zen-browser.homeModules.beta inputs.zen-browser.homeModules.beta
@@ -32,7 +33,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
username = username; inherit 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,7 +7,8 @@
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,7 +7,8 @@
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,7 +8,8 @@
lib, lib,
username, username,
... ...
}: { }:
{
# Import darwin modules # Import darwin modules
imports = [ imports = [
../../modules/darwin/system.nix ../../modules/darwin/system.nix

View File

@@ -9,9 +9,11 @@
pkgs, pkgs,
... ...
}: }:
with lib; let with lib;
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";
@@ -127,7 +129,11 @@ in {
# Cleanup behavior # Cleanup behavior
cleanup = mkOption { cleanup = mkOption {
type = types.enum ["none" "uninstall" "zap"]; type = types.enum [
"none"
"uninstall"
"zap"
];
default = "zap"; default = "zap";
description = '' description = ''
Cleanup behavior for Homebrew packages: Cleanup behavior for Homebrew packages:
@@ -150,7 +156,7 @@ in {
# Upgrade outdated packages # Upgrade outdated packages
upgrade = true; upgrade = true;
# Cleanup behavior for unmanaged packages # Cleanup behavior for unmanaged packages
cleanup = cfg.cleanup; inherit (cfg) cleanup;
}; };
# Global settings # Global settings
@@ -162,26 +168,18 @@ in {
}; };
# Taps (third-party repositories) # Taps (third-party repositories)
taps = cfg.taps; inherit (cfg) taps;
# Formulae (CLI tools from Homebrew) # Formulae (CLI tools from Homebrew)
brews = cfg.brews; inherit (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.enablePersonal ++ (if cfg.casks.enableWork then cfg.casks.work else [ ]);
then cfg.casks.personal
else []
)
++ (
if cfg.casks.enableWork
then cfg.casks.work
else []
);
}; };
}; };
} }

View File

@@ -5,12 +5,16 @@
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 = ["nix-command" "flakes"]; experimental-features = [
"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;
@@ -35,7 +39,6 @@
DisableConsoleAccess = true; DisableConsoleAccess = true;
}; };
dock = { dock = {
autohide = true; autohide = true;
autohide-delay = 0.0; autohide-delay = 0.0;

View File

@@ -7,9 +7,11 @@
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";
@@ -29,7 +31,6 @@ in {
}; };
}; };
jellyfin-tui = { jellyfin-tui = {
enable = lib.mkOption { enable = lib.mkOption {
type = lib.types.bool; type = lib.types.bool;
@@ -66,12 +67,16 @@ 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 = let policies =
mkExtensionSettings = builtins.mapAttrs (_: pluginId: { let
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;

View File

@@ -13,15 +13,18 @@
lib, lib,
... ...
}: }:
with lib; let with lib;
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
@@ -35,12 +38,17 @@ with lib; 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 != {}) (concatStringsSep "\n" (mapAttrsToList (name: value: '' ${optionalString (urlRewrites != { }) (
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";
@@ -102,8 +110,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 {
email = cfg.personal.email; inherit (cfg.personal) email;
signingKey = cfg.personal.signingKey; inherit (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/";
@@ -115,8 +123,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 {
email = cfg.private.email; inherit (cfg.private) email;
signingKey = cfg.private.signingKey; inherit (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/";
@@ -128,8 +136,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 {
email = cfg.zeronorth.email; inherit (cfg.zeronorth) email;
signingKey = cfg.zeronorth.signingKey; inherit (cfg.zeronorth) signingKey;
urlRewrites = { urlRewrites = {
"git@github-zeronorth:" = "https://github.com/"; "git@github-zeronorth:" = "https://github.com/";
}; };

View File

@@ -11,9 +11,11 @@
lib, lib,
... ...
}: }:
with lib; let with lib;
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";
@@ -36,7 +38,8 @@ in {
}; };
includes = mkOption { includes = mkOption {
type = types.listOf (types.submodule { type = types.listOf (
types.submodule {
options = { options = {
condition = mkOption { condition = mkOption {
type = types.str; type = types.str;
@@ -49,8 +52,9 @@ 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";
}; };
}; };
@@ -88,8 +92,8 @@ in {
# Conditional includes for project-specific configurations # Conditional includes for project-specific configurations
includes = map (inc: { includes = map (inc: {
condition = inc.condition; inherit (inc) condition;
path = inc.path; inherit (inc) path;
}) cfg.includes; }) cfg.includes;
# All git settings using the new unified settings option # All git settings using the new unified settings option

View File

@@ -9,7 +9,8 @@
pkgs, pkgs,
lib, lib,
... ...
}: { }:
{
home.packages = with pkgs; [ home.packages = with pkgs; [
# ======================================================================== # ========================================================================
# Shell Tools # Shell Tools
@@ -88,7 +89,7 @@
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 kubeseal
kubebuilder kubebuilder

View File

@@ -13,7 +13,8 @@
pkgs, pkgs,
lib, lib,
... ...
}: { }:
{
# ========================================================================== # ==========================================================================
# Zsh Configuration # Zsh Configuration
# ========================================================================== # ==========================================================================

View File

@@ -8,9 +8,11 @@
lib, lib,
... ...
}: }:
with lib; let with lib;
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";
@@ -65,7 +67,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,7 +7,8 @@
pkgs, pkgs,
lib, lib,
... ...
}: { }:
{
programs.tmux = { programs.tmux = {
enable = true; enable = true;
@@ -116,6 +117,8 @@
# 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
''; '';
}; };
} }