diff options
| author | Simen A. W. Olsen <hello@simenandre.no> | 2026-03-21 18:43:01 +0100 |
|---|---|---|
| committer | Simen A. W. Olsen <hello@simenandre.no> | 2026-03-21 18:43:01 +0100 |
| commit | e08f800b6dc1bc6a6a6127c12b7df72bd219d50b (patch) | |
| tree | d8946586bdda098983322316d02421c57ffb885d | |
| parent | 1fd92fcaf3aadea1e9509f859340f57100218c41 (diff) | |
| download | dotfiles-e08f800b6dc1bc6a6a6127c12b7df72bd219d50b.tar.gz dotfiles-e08f800b6dc1bc6a6a6127c12b7df72bd219d50b.zip | |
use nix
| -rw-r--r-- | flake.lock | 86 | ||||
| -rw-r--r-- | flake.nix | 13 | ||||
| -rw-r--r-- | modules/darwin/default.nix | 15 | ||||
| -rw-r--r-- | modules/darwin/homebrew.nix | 119 | ||||
| -rw-r--r-- | modules/darwin/macos.nix | 3 | ||||
| -rw-r--r-- | modules/home/default.nix | 19 | ||||
| -rw-r--r-- | modules/home/git.nix | 8 | ||||
| -rw-r--r-- | modules/home/lazygit.nix | 20 | ||||
| -rw-r--r-- | modules/home/twm.nix | 37 | ||||
| -rw-r--r-- | modules/nixos/default.nix | 6 |
10 files changed, 239 insertions, 87 deletions
diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..e2f3fe7 --- /dev/null +++ b/flake.lock @@ -0,0 +1,86 @@ +{ + "nodes": { + "config-nvim": { + "flake": false, + "locked": { + "lastModified": 1774097143, + "narHash": "sha256-NTNEkaZa5CdMrsycC+tqqFBUqa2J9r0GTwFWeU3gWog=", + "owner": "simenandre", + "repo": "config.nvim", + "rev": "83cd13c60ba2b8de7b5a50affa0e110c2a608cd6", + "type": "github" + }, + "original": { + "owner": "simenandre", + "repo": "config.nvim", + "type": "github" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1774007980, + "narHash": "sha256-FOnZjElEI8pqqCvB6K/1JRHTE8o4rer8driivTpq2uo=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "9670de2921812bc4e0452f6e3efd8c859696c183", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "nix-darwin": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1773000227, + "narHash": "sha256-zm3ftUQw0MPumYi91HovoGhgyZBlM4o3Zy0LhPNwzXE=", + "owner": "LnL7", + "repo": "nix-darwin", + "rev": "da529ac9e46f25ed5616fd634079a5f3c579135f", + "type": "github" + }, + "original": { + "owner": "LnL7", + "repo": "nix-darwin", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1773840656, + "narHash": "sha256-9tpvMGFteZnd3gRQZFlRCohVpqooygFuy9yjuyRL2C0=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "9cf7092bdd603554bd8b63c216e8943cf9b12512", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "config-nvim": "config-nvim", + "home-manager": "home-manager", + "nix-darwin": "nix-darwin", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} @@ -29,9 +29,10 @@ config-nvim, }: let - homeModules = [ + mkHomeModules = username: [ ./modules/home { + home.username = username; home.file.".config/nvim".source = config-nvim; } ]; @@ -45,7 +46,8 @@ { home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; - home-manager.users.simenandre = { imports = homeModules; }; + home-manager.backupFileExtension = "bak"; + home-manager.users.cobraz = { imports = mkHomeModules "cobraz"; }; } ]; }; @@ -58,19 +60,20 @@ { home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; - home-manager.users.simenandre = { imports = homeModules; }; + home-manager.backupFileExtension = "bak"; + home-manager.users.simenandre = { imports = mkHomeModules "simenandre"; }; } ]; }; homeConfigurations."simenandre" = home-manager.lib.homeManagerConfiguration { pkgs = nixpkgs.legacyPackages."x86_64-linux"; - modules = homeModules; + modules = mkHomeModules "simenandre"; }; homeConfigurations."simenandre@aarch64-linux" = home-manager.lib.homeManagerConfiguration { pkgs = nixpkgs.legacyPackages."aarch64-linux"; - modules = homeModules; + modules = mkHomeModules "simenandre"; }; }; } diff --git a/modules/darwin/default.nix b/modules/darwin/default.nix index 5474b91..5b487ef 100644 --- a/modules/darwin/default.nix +++ b/modules/darwin/default.nix @@ -6,8 +6,8 @@ ./macos.nix ]; - # Enable experimental Nix features - nix.settings.experimental-features = "nix-command flakes"; + # Nix is managed by Determinate installer + nix.enable = false; # Allow unfree packages nixpkgs.config.allowUnfree = true; @@ -15,8 +15,17 @@ # System state version – do not change after first installation system.stateVersion = 5; + # Primary user for system defaults and homebrew + system.primaryUser = "cobraz"; + # Enable Touch ID for sudo - security.pam.enableSudoTouchIdAuth = true; + security.pam.services.sudo_local.touchIdAuth = true; + + # Remap Caps Lock to Escape + system.keyboard = { + enableKeyMapping = true; + remapCapsLockToEscape = true; + }; # Core system packages available to all users environment.systemPackages = with pkgs; [ diff --git a/modules/darwin/homebrew.nix b/modules/darwin/homebrew.nix index 9ac9816..2434d7d 100644 --- a/modules/darwin/homebrew.nix +++ b/modules/darwin/homebrew.nix @@ -11,13 +11,10 @@ }; taps = [ - "bramstein/webfonttools" - "danielgtaylor/restish" "oven-sh/bun" "pulumi/tap" "go-task/tap" "tursodatabase/tap" - "yakitrak/yakitrak" "simenandre/tools" ]; @@ -42,11 +39,7 @@ "openssh" "nmap" "wget" - - # Security and encryption - "gnupg" - "git-secret" - "ssh-copy-id" + "cloudflared" # Compression libraries and tools "lz4" @@ -55,60 +48,58 @@ "libffi" "p7zip" "pigz" - "zopfli" # Programming languages and runtimes "golang" "golangci-lint" - "python@3.11" "rust" "zig" - "pkl" - - # Font tools - "sfnt2woff" - "sfnt2woff-zopfli" - "woff2" + "typst" # JavaScript runtimes and package managers "bun" "pnpm" "volta" - "corepack" "deno" - # REST API clients - "danielgtaylor/restish/restish" - # Version control "git" "git-lfs" + "git-delta" "lazygit" - "microplane" # Search tools "ripgrep" - "ack" "fzf" # JSON/YAML processing tools "jq" "yq" + # Protobuf and gRPC + "protobuf" + "protoc-gen-go" + "protoc-gen-go-grpc" + # Cloud and IaC tools "pulumi" - "crd2pulumi" - "kube2pulumi" "pulumictl" - "tf2pulumi" "azure-cli" "kubectl" "helm" "cilium-cli" "doctl" "flyctl" + "talosctl" + "tektoncd-cli" + "runpodctl" # Container tools + "docker" + "docker-buildx" + "docker-compose" + "docker-completion" + "colima" "podman" "podman-compose" @@ -119,74 +110,74 @@ # Databases and database tools "turso" "libpq" - "sqld" # Terminal tools "pv" "rename" - "rlwrap" "tree" - "screen" - "vbindiff" - "tmate" - "asciinema" - "dasel" "tldr" "starship" "gh" - "claude-code" + "htop" + "opencode" # HTTP and web servers "caddy" "goreleaser" - # Specific toolsets - "whalebrew" - "gd" + # Document and media tools + "pandoc" + "ffmpeg" + "tesseract" "ghostscript" - "rclone" "graphviz" + # Python tools + "pipx" + + # Specific toolsets + "rclone" + # Mac App Store CLI "mas" ]; casks = [ - "spotify" - "slack" - "sonos" - "figma" - "discord" - "grammarly" - "microsoft-remote-desktop" - "postico" - "cyberduck" - "adobe-creative-cloud" + "1password" "1password-cli" - "protonvpn" - "openvpn-connect" - "raycast" - "rectangle" - "google-chrome" - "google-drive" - "karabiner-elements" - "postman" - "ghostty" - "proton-mail" + "arc" + "basictex" "claude" - "font-symbols-only-nerd-font" + "discord" + "elgato-camera-hub" + "figma" "font-jetbrains-mono" - "google-cloud-sdk" - "docker" - "podman-desktop" + "font-symbols-only-nerd-font" + "gcloud-cli" + "ghostty" + "google-chrome" + "google-chrome@canary" + "google-drive" + "libreoffice" + "loom" "microsoft-teams" - "zoom" "obsidian" + "postico" + "proton-mail" + "protonvpn" + "raycast" + "signal" + "slack" + "sonos" + "spotify" + "visual-studio-code" + "zoom" ]; masApps = { - "Outline" = 1356178125; - "Remote Desktop" = 409907375; + "Tailscale" = 1475387142; + "Jojo" = 1659864300; + "reMarkable" = 1276493162; }; }; } diff --git a/modules/darwin/macos.nix b/modules/darwin/macos.nix index 8927903..0dd120a 100644 --- a/modules/darwin/macos.nix +++ b/modules/darwin/macos.nix @@ -65,13 +65,14 @@ Clicking = true; }; + ActivityMonitor = { # Show the main window when launching Activity Monitor OpenMainWindow = true; # Visualize CPU usage in the Activity Monitor Dock icon IconType = 5; # Show all processes in Activity Monitor - ShowCategory = 0; + ShowCategory = 100; # Sort Activity Monitor results by CPU usage SortColumn = "CPUUsage"; SortDirection = 0; diff --git a/modules/home/default.nix b/modules/home/default.nix index 1ff1c19..b9c80e5 100644 --- a/modules/home/default.nix +++ b/modules/home/default.nix @@ -1,4 +1,4 @@ -{ pkgs, lib, ... }: +{ pkgs, lib, config, ... }: { imports = [ @@ -6,12 +6,17 @@ ./ghostty.nix ./starship.nix ./tmux.nix + ./lazygit.nix + ./twm.nix ./zsh.nix ]; home = { - username = "simenandre"; - homeDirectory = if pkgs.stdenv.isDarwin then "/Users/simenandre" else "/home/simenandre"; + homeDirectory = lib.mkForce ( + if pkgs.stdenv.isDarwin + then "/Users/${config.home.username}" + else "/home/${config.home.username}" + ); # Do not change this after the first installation stateVersion = "24.11"; }; @@ -23,10 +28,10 @@ # Let home-manager manage itself programs.home-manager.enable = true; - # Install Claude Code via npm on Linux (on macOS it's managed by Homebrew) - home.activation.installClaudeCode = lib.mkIf (!pkgs.stdenv.isDarwin) - (lib.hm.dag.entryAfter [ "writeBoundary" ] '' + # Install Claude Code via npm + home.activation.installClaudeCode = + lib.hm.dag.entryAfter [ "writeBoundary" ] '' export PATH="${pkgs.nodejs_22}/bin:$PATH" npm install -g @anthropic-ai/claude-code 2>/dev/null || true - ''); + ''; } diff --git a/modules/home/git.nix b/modules/home/git.nix index e79a760..3865e25 100644 --- a/modules/home/git.nix +++ b/modules/home/git.nix @@ -3,15 +3,17 @@ { programs.git = { enable = true; - userName = "Simen A. W. Olsen"; - userEmail = "hello@simenandre.no"; signing = { key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMCyUn5BfmAnd/6xi0X1mYF/+jPOmCS0bpNUePF55gCY"; signByDefault = true; }; - extraConfig = { + settings = { + user = { + name = "Simen A. W. Olsen"; + email = "hello@simenandre.no"; + }; apply.whitespace = "fix"; core = { trustctime = false; diff --git a/modules/home/lazygit.nix b/modules/home/lazygit.nix new file mode 100644 index 0000000..da8996a --- /dev/null +++ b/modules/home/lazygit.nix @@ -0,0 +1,20 @@ +{ ... }: + +{ + home.file.".config/lazygit/config.yml".text = '' + git: + pagers: + - colorArg: always + pager: delta --dark --paging=never + customCommands: + - key: "C" + context: "files" + description: "Generate commit message with Claude Code" + command: > + git diff --staged | $HOME/.local/bin/claude -p 'Generate a concise git commit message for these staged changes. + Output ONLY the raw commit message with no markdown, no code blocks, no backticks, no explanations. + Use conventional commit format.' --model haiku --output-format text > /tmp/commit_msg && + GIT_EDITOR=nvim git commit -e -F /tmp/commit_msg + output: terminal + ''; +} diff --git a/modules/home/twm.nix b/modules/home/twm.nix new file mode 100644 index 0000000..cebfc6e --- /dev/null +++ b/modules/home/twm.nix @@ -0,0 +1,37 @@ +{ config, ... }: + +{ + home.file.".config/twm/twm.yaml".text = '' + search_paths: + - ${config.home.homeDirectory}/ghq + - ~/.config/nvim/ + + exclude_path_components: + - .git + - .direnv + - node_modules + - venv + - target + + workspace_definitions: + - name: catchall + default_layout: catchall-dev + + - name: go + has_all_files: + - go.mod + - go.sum + + - name: docker-compose + has_any_file: + - docker-compose.yml + - docker-compose.yaml + has_all_files: + - Dockerfile + - .git + + - name: pulumi + has_all_files: + - Pulumi.yaml + ''; +} diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix index 155601a..f005dbd 100644 --- a/modules/nixos/default.nix +++ b/modules/nixos/default.nix @@ -1,9 +1,7 @@ -{ pkgs, ... }: +{ pkgs, lib, ... }: { - imports = [ - ./hardware-configuration.nix - ]; + imports = [ ] ++ lib.optional (builtins.pathExists ./hardware-configuration.nix) ./hardware-configuration.nix; # Enable experimental Nix features nix.settings.experimental-features = "nix-command flakes"; |
