From bdbf892ea15a60c01b9f0ef9c3fa0bf94012f447 Mon Sep 17 00:00:00 2001 From: 0xWheatyz Date: Sun, 15 Mar 2026 23:16:00 -0400 Subject: [PATCH] feat: auto-update Claude Code from nixpkgs-unstable - Add nixpkgs-unstable input for latest Claude Code versions - Remove duplicate home-manager config from configuration.nix (handled by flake) - Remove fetchTarball/fetchGit calls incompatible with pure flake mode - Add shell function to auto-update unstable on nixos-rebuild --- configuration.nix | 55 ++++++----------------------------------------- flake.lock | 19 +++++++++++++++- flake.nix | 15 ++++++++++--- home.nix | 10 +++++++++ 4 files changed, 47 insertions(+), 52 deletions(-) diff --git a/configuration.nix b/configuration.nix index 1b0a2a8..18494f7 100644 --- a/configuration.nix +++ b/configuration.nix @@ -2,27 +2,13 @@ # your system. Help is available in the configuration.nix(5) man page # and in the NixOS manual (accessible by running 'nixos-help'). -{ config, pkgs, ... }: +{ config, pkgs, pkgs-unstable, ... }: -let - # Fetch home-manager - home-manager = builtins.fetchTarball { - url = "https://github.com/nix-community/home-manager/archive/release-25.11.tar.gz"; - }; - - # Fetch kickstart-nvim - kickstart-nvim = builtins.fetchGit { - url = "https://github.com/0xWheatyz/kickstart.nvim"; - ref = "master"; - }; -in { - imports = - [ # Include the results of the hardware scan. - ./hardware-configuration.nix - # Import home-manager module - (import "${home-manager}/nixos") - ]; + imports = [ + ./hardware-configuration.nix + # home-manager is imported via flake.nix + ]; ## Commented out as defined at the end of the page @@ -121,7 +107,7 @@ in code-cursor adwaita-icon-theme obsidian - claude-code + pkgs-unstable.claude-code # Use unstable for latest version ]; # Some programs need SUID wrappers, can be configured further or are @@ -151,34 +137,7 @@ in # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). system.stateVersion = "25.11"; # Did you read the comment? - # Home Manager Configuration - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - home-manager.users.l-wyatt = import ./home.nix; - home-manager.sharedModules = [ - # Kickstart-nvim module - ({ config, lib, pkgs, ... }: { - options.programs.neovim-kickstart = { - enable = lib.mkEnableOption "kickstart.nvim configuration"; - }; - - config = lib.mkIf config.programs.neovim-kickstart.enable { - home.file.".config/nvim" = { - source = kickstart-nvim; - recursive = true; - }; - - home.packages = with pkgs; [ - neovim - ripgrep - fd - gcc - gnumake - git - ]; - }; - }) - ]; + # Home Manager Configuration is handled in flake.nix ### Start of self configuration # Configure grub to provide ubuntu option diff --git a/flake.lock b/flake.lock index 2966895..425c326 100644 --- a/flake.lock +++ b/flake.lock @@ -74,6 +74,22 @@ "type": "github" } }, + "nixpkgs-unstable": { + "locked": { + "lastModified": 1773507054, + "narHash": "sha256-Q8U5VXgrcxmCxPtCCJCIZkcAX3FCZwGh1GNVIXxMND0=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "e80236013dc8b77aa49ca90e7a12d86f5d8d64c9", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs_2": { "locked": { "lastModified": 1772822230, @@ -94,7 +110,8 @@ "inputs": { "home-manager": "home-manager", "kickstart-nvim": "kickstart-nvim", - "nixpkgs": "nixpkgs_2" + "nixpkgs": "nixpkgs_2", + "nixpkgs-unstable": "nixpkgs-unstable" } }, "systems": { diff --git a/flake.nix b/flake.nix index 3857278..6876c4d 100644 --- a/flake.nix +++ b/flake.nix @@ -3,6 +3,7 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11"; + nixpkgs-unstable.url = "github:nixos/nixpkgs/nixpkgs-unstable"; home-manager = { url = "github:nix-community/home-manager/release-25.11"; inputs.nixpkgs.follows = "nixpkgs"; @@ -10,17 +11,25 @@ kickstart-nvim.url = "github:0xWheatyz/kickstart.nvim"; }; - outputs = { self, nixpkgs, home-manager, kickstart-nvim, ... }: { + outputs = { self, nixpkgs, nixpkgs-unstable, home-manager, kickstart-nvim, ... }: + let + system = "x86_64-linux"; + pkgs-unstable = import nixpkgs-unstable { + inherit system; + config.allowUnfree = true; + }; + in { nixosConfigurations = { nixos = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; + inherit system; + specialArgs = { inherit pkgs-unstable; }; modules = [ ./configuration.nix home-manager.nixosModules.home-manager { home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; - home-manager.users.l-wyatt = import /home/l-wyatt/.config/home-manager/home.nix; + home-manager.users.l-wyatt = import ./home.nix; home-manager.extraSpecialArgs = { inherit kickstart-nvim; }; diff --git a/home.nix b/home.nix index f0f8ae8..a89fb1c 100644 --- a/home.nix +++ b/home.nix @@ -70,6 +70,16 @@ initContent = '' export SHELL=$(which zsh) alias nix-shell='nix-shell --run $SHELL' + + # Auto-update nixpkgs-unstable (for claude-code) on rebuild + nixos-rebuild() { + if [[ "$1" == "switch" || "$1" == "boot" || "$1" == "test" ]]; then + echo "Updating nixpkgs-unstable for latest Claude Code..." + nix flake update nixpkgs-unstable --flake /home/l-wyatt/Documents/nixos-configuration + fi + command sudo nixos-rebuild "$@" --flake /home/l-wyatt/Documents/nixos-configuration + } + nix() { if [[ $1 == "develop" ]]; then shift