diff --git a/flake.lock b/flake.lock index 93b7e99..0ad959b 100644 --- a/flake.lock +++ b/flake.lock @@ -584,6 +584,26 @@ "type": "github" } }, + "nix-index-database": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1782030356, + "narHash": "sha256-h4WpMr455AfRub0FXBaon6Vcpe0waUyJ4GivIW6oyd4=", + "owner": "nix-community", + "repo": "nix-index-database", + "rev": "3017088b49efd404f78e3b104f553b97e4af786b", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nix-index-database", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1781454065, @@ -827,6 +847,7 @@ "hardware": "hardware", "home-manager": "home-manager", "hyprland": "hyprland", + "nix-index-database": "nix-index-database", "nixpkgs": "nixpkgs_7", "noctalia": "noctalia", "nvchad-starter": "nvchad-starter", diff --git a/flake.nix b/flake.nix index 0b8e695..2d56315 100644 --- a/flake.nix +++ b/flake.nix @@ -42,6 +42,10 @@ }; spicetify-nix.url = "github:Gerg-L/spicetify-nix"; claude-code.url = "github:sadjow/claude-code-nix"; + nix-index-database = { + url = "github:nix-community/nix-index-database"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; outputs = @@ -94,12 +98,14 @@ { nixosConfigurations = { arrakis = mkNixOS "arrakis"; - desktop = mkNixOS "desktop"; + konishi = mkNixOS "konishi"; }; + # Named "@" so `nh home switch` auto-detects them + # (nh home tries "$USER@$(hostname)", not the bare hostname). homeConfigurations = { - arrakis = mkHome "arrakis" x86; - desktop = mkHome "desktop" x86; + "naps62@arrakis" = mkHome "arrakis" x86; + "naps62@konishi" = mkHome "konishi" x86; }; devShells = diff --git a/home/common/programs/default.nix b/home/common/programs/default.nix index 81a07bc..a0a2bf5 100644 --- a/home/common/programs/default.nix +++ b/home/common/programs/default.nix @@ -8,6 +8,7 @@ imports = [ ../features/mutable-file.nix ./zsh.nix + ./nix.nix ./neovim ./rust.nix ./elixir.nix diff --git a/home/common/programs/dev.nix b/home/common/programs/dev.nix index 3de265a..38406fc 100644 --- a/home/common/programs/dev.nix +++ b/home/common/programs/dev.nix @@ -52,5 +52,10 @@ kicad tea + + just # project command runner + lazydocker # docker TUI + dust # du replacement + duf # df replacement ]; } diff --git a/home/common/programs/git/default.nix b/home/common/programs/git/default.nix index c89f871..41584a3 100644 --- a/home/common/programs/git/default.nix +++ b/home/common/programs/git/default.nix @@ -31,6 +31,9 @@ rb = "rebase"; rbc = "rebase --continue"; w = "commit -am 'wip'"; + # Structural (AST-aware) diff on demand; `git d`/`diff` stays delta. + # Accepts args, e.g. `git dft HEAD~3`. + dft = "!GIT_EXTERNAL_DIFF=difft git diff"; }; init = { defaultBranch = "main"; @@ -70,6 +73,7 @@ home.packages = with pkgs; [ delta + difftastic git-crypt mediainfo tea diff --git a/home/common/programs/nix.nix b/home/common/programs/nix.nix new file mode 100644 index 0000000..d64d0ad --- /dev/null +++ b/home/common/programs/nix.nix @@ -0,0 +1,18 @@ +{ pkgs, inputs, ... }: +{ + imports = [ + # Prebuilt, weekly-updated nix-index database (backs `comma`). + inputs.nix-index-database.homeModules.nix-index + ]; + + # `comma` (`,`) — run any nixpkgs program once without installing it. + programs.nix-index.enable = true; + programs.nix-index-database.comma.enable = true; + + home.packages = with pkgs; [ + nvd # version diff between generations (used by nh) + nix-output-monitor # readable build output (nom; used by nh) + statix # nix linter / antipattern finder + deadnix # finds unused nix bindings + ]; +} diff --git a/home/common/programs/zsh.nix b/home/common/programs/zsh.nix index 3210efa..54e5c0f 100644 --- a/home/common/programs/zsh.nix +++ b/home/common/programs/zsh.nix @@ -22,6 +22,8 @@ ls = "eza"; cat = "bat"; ps = "procs"; + j = "just"; + lzd = "lazydocker"; open = "xdg-open"; o = "xdg-open"; s = "ssh"; @@ -76,6 +78,25 @@ enableZshIntegration = true; }; + programs.zoxide = { + enable = true; + enableZshIntegration = true; + # Replace `cd` with zoxide: `cd` = smart jump, `cdi` = interactive picker. + options = [ "--cmd cd" ]; + }; + + programs.atuin = { + enable = true; + enableZshIntegration = true; + # Local-only history (no account/sync). Atuin owns Ctrl-R; leave the + # up-arrow as normal zsh prefix history. + flags = [ "--disable-up-arrow" ]; + settings = { + auto_sync = false; + update_check = false; + }; + }; + programs.starship = { enable = true; settings = { diff --git a/home/desktop/default.nix b/home/konishi/default.nix similarity index 100% rename from home/desktop/default.nix rename to home/konishi/default.nix diff --git a/home/desktop/monitors.nix b/home/konishi/monitors.nix similarity index 100% rename from home/desktop/monitors.nix rename to home/konishi/monitors.nix diff --git a/hosts/common/global/nix.nix b/hosts/common/global/nix.nix index c91ee81..773a044 100644 --- a/hosts/common/global/nix.nix +++ b/hosts/common/global/nix.nix @@ -18,10 +18,22 @@ ]; warn-dirty = false; }; - gc = { - automatic = true; - options = "--delete-older-than 30d"; + # GC is handled by `nh clean` below (keep-N / keep-since semantics). + # The two are mutually exclusive — nh asserts if nix.gc.automatic is on. + gc.automatic = false; + }; + + # nh: ergonomic nixos-rebuild wrapper. Auto-detects the target from the + # machine hostname (configs are named to match), so `nh os switch` needs + # no host arg. Runs as root, so its `clean` prunes system + user profiles. + programs.nh = { + enable = true; + flake = "/home/naps62/projects/nixos-config"; + clean = { + enable = true; + extraArgs = "--keep 10 --keep-since 7d"; }; }; + nixpkgs.config.allowUnfree = true; } diff --git a/hosts/desktop/default.nix b/hosts/konishi/default.nix similarity index 100% rename from hosts/desktop/default.nix rename to hosts/konishi/default.nix diff --git a/hosts/desktop/hardware-configuration.nix b/hosts/konishi/hardware-configuration.nix similarity index 100% rename from hosts/desktop/hardware-configuration.nix rename to hosts/konishi/hardware-configuration.nix