diff --git a/flake.lock b/flake.lock index 506a27c..28078f9 100644 --- a/flake.lock +++ b/flake.lock @@ -33,6 +33,27 @@ "type": "github" } }, + "claude-desktop": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1761825061, + "narHash": "sha256-AeRQZKr8+1XQer+WmbwtQaQBy05UDgeNNE7YZjNLuS0=", + "owner": "k3d3", + "repo": "claude-desktop-linux-flake", + "rev": "791cd93cfe216ad06ab740f0fdc142119b1d6ec2", + "type": "github" + }, + "original": { + "owner": "k3d3", + "repo": "claude-desktop-linux-flake", + "type": "github" + } + }, "devenv": { "inputs": { "cachix": "cachix", @@ -113,6 +134,24 @@ "type": "github" } }, + "flake-utils_2": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "git-hooks": { "inputs": { "flake-compat": [ @@ -259,7 +298,7 @@ }, "pumo-system-info": { "inputs": { - "flake-utils": "flake-utils", + "flake-utils": "flake-utils_2", "nixpkgs": [ "nixpkgs" ], @@ -301,6 +340,7 @@ }, "root": { "inputs": { + "claude-desktop": "claude-desktop", "devenv": "devenv", "home-manager": "home-manager", "nix-index-database": "nix-index-database", @@ -367,6 +407,21 @@ "type": "github" } }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "zen-browser": { "inputs": { "nixpkgs": [ diff --git a/flake.nix b/flake.nix index 27bb111..7309ab8 100644 --- a/flake.nix +++ b/flake.nix @@ -34,6 +34,11 @@ inputs.nixpkgs.follows = "nixpkgs"; }; + claude-desktop = { + url = "github:k3d3/claude-desktop-linux-flake"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + zen-browser = { url = "github:youwen5/zen-browser-flake"; inputs.nixpkgs.follows = "nixpkgs"; @@ -83,42 +88,33 @@ ]; }; - homeConfigurations = { + homeConfigurations = let + extraSpecialArgs = {inherit inputs outputs system;}; + pkgs = nixpkgs.legacyPackages.x86_64-linux; + in { "phundrak@alys" = home-manager.lib.homeManagerConfiguration { - pkgs = nixpkgs.legacyPackages.x86_64-linux; - extraSpecialArgs = { - inherit inputs outputs; - }; + inherit extraSpecialArgs pkgs; modules = [ ./users/phundrak/host/alys.nix inputs.sops-nix.homeManagerModules.sops ]; }; "phundrak@marpa" = home-manager.lib.homeManagerConfiguration { - pkgs = nixpkgs.legacyPackages.x86_64-linux; - extraSpecialArgs = { - inherit inputs outputs; - }; + inherit extraSpecialArgs pkgs; modules = [ ./users/phundrak/host/marpa.nix inputs.sops-nix.homeManagerModules.sops ]; }; "phundrak@gampo" = home-manager.lib.homeManagerConfiguration { - pkgs = nixpkgs.legacyPackages.x86_64-linux; - extraSpecialArgs = { - inherit inputs outputs; - }; + inherit extraSpecialArgs pkgs; modules = [ ./users/phundrak/host/gampo.nix inputs.sops-nix.homeManagerModules.sops ]; }; "phundrak@tilo" = home-manager.lib.homeManagerConfiguration { - pkgs = nixpkgs.legacyPackages.x86_64-linux; - extraSpecialArgs = { - inherit inputs outputs; - }; + inherit extraSpecialArgs pkgs; modules = [ ./users/phundrak/host/tilo.nix inputs.sops-nix.homeManagerModules.sops @@ -126,30 +122,32 @@ }; }; - nixosConfigurations = { + nixosConfigurations = let + specialArgs = {inherit inputs outputs;}; + in { alys = nixpkgs.lib.nixosSystem { - specialArgs = {inherit inputs outputs;}; + inherit specialArgs; modules = [ ./hosts/alys/configuration.nix inputs.sops-nix.nixosModules.sops ]; }; gampo = nixpkgs.lib.nixosSystem { - specialArgs = {inherit inputs outputs;}; + inherit specialArgs; modules = [ ./hosts/gampo/configuration.nix inputs.sops-nix.nixosModules.sops ]; }; marpa = nixpkgs.lib.nixosSystem { - specialArgs = {inherit inputs outputs;}; + inherit specialArgs; modules = [ ./hosts/marpa/configuration.nix inputs.sops-nix.nixosModules.sops ]; }; tilo = nixpkgs.lib.nixosSystem { - specialArgs = {inherit inputs outputs;}; + inherit specialArgs; modules = [ ./hosts/tilo/configuration.nix inputs.sops-nix.nixosModules.sops diff --git a/users/modules/dev/ai/claude.nix b/users/modules/dev/ai/claude.nix new file mode 100644 index 0000000..5d623da --- /dev/null +++ b/users/modules/dev/ai/claude.nix @@ -0,0 +1,18 @@ +{ + config, + lib, + inputs, + system, + ... +}: +with lib; let + cfg = config.home.dev.ai.claude; +in { + options.home.dev.ai.claude.enable = mkEnableOption "Enables Claude-related packages"; + config = mkIf cfg.enable { + home.packages = [inputs.claude-desktop.packages.${system}.claude-desktop-with-fhs]; + programs.claude-code = { + inherit (cfg) enable; + }; + }; +} diff --git a/users/modules/dev/ai/default.nix b/users/modules/dev/ai/default.nix new file mode 100644 index 0000000..0bbeed0 --- /dev/null +++ b/users/modules/dev/ai/default.nix @@ -0,0 +1,19 @@ +{ + config, + lib, + ... +}: +with lib; let + cfg = config.home.dev.ai; +in { + imports = [ + ./ollama.nix + ./claude.nix + ]; + + options.home.dev.ai.enable = mkEnableOption "Enables AI features"; + config.home.dev.ai = mkIf cfg.enable { + ollama.enable = mkDefault cfg.enable; + claude.enable = mkDefault cfg.enable; + }; +} diff --git a/users/modules/dev/ollama.nix b/users/modules/dev/ai/ollama.nix similarity index 63% rename from users/modules/dev/ollama.nix rename to users/modules/dev/ai/ollama.nix index 602c27f..567ed43 100644 --- a/users/modules/dev/ollama.nix +++ b/users/modules/dev/ai/ollama.nix @@ -4,20 +4,21 @@ ... }: with lib; let - cfg = config.home.dev.ollama; + cfg = config.home.dev.ai.ollama; in { - options.home.dev.ollama = { + options.home.dev.ai.ollama = { enable = mkEnableOption "Enables Ollama"; gpu = mkOption { - type = types.nullOr types.enum ["none" "amd" "nvidia"]; - example = "amd"; - default = "none"; + type = types.nullOr (types.enum [false "rocm" "cuda"]); + example = "rocm"; + default = null; description = "Which type of GPU should be used for hardware acceleration"; }; }; config.services.ollama = mkIf cfg.enable { inherit (cfg) enable; + acceleration = cfg.gpu; environmentVariables = { OLLAMA_CONTEXT_LENGTH = "8192"; }; diff --git a/users/modules/dev/default.nix b/users/modules/dev/default.nix index 56a595a..74de0d9 100644 --- a/users/modules/dev/default.nix +++ b/users/modules/dev/default.nix @@ -7,8 +7,8 @@ with lib; let cfg = config.home.dev; in { imports = [ + ./ai ./editors - ./ollama.nix ./vcs ]; diff --git a/users/phundrak/home.nix b/users/phundrak/home.nix index 04a7ff9..b65eb2f 100644 --- a/users/phundrak/home.nix +++ b/users/phundrak/home.nix @@ -37,10 +37,7 @@ }; desktop.waybar.style = ./config/waybar/style.css; - dev.ollama = { - enable = true; - gpu = "amd"; - }; + dev.ai.claude.enable = true; fullDesktop = true; shell.fish.enable = true; }; diff --git a/users/phundrak/host/marpa.nix b/users/phundrak/host/marpa.nix index 57b1a26..b48434a 100644 --- a/users/phundrak/host/marpa.nix +++ b/users/phundrak/host/marpa.nix @@ -2,6 +2,10 @@ imports = [../home.nix]; home = { cli.nh.flake = "${config.home.homeDirectory}/.dotfiles"; + dev.ai.ollama = { + enable = true; + gpu = "rocm"; + }; desktop.hyprland.host = "marpa"; phundrak.sshKey = { content = builtins.readFile ../../../keys/id_marpa.pub;