feat: more AI-related tools

This commit is contained in:
Lucien Cartier-Tilet 2025-09-03 11:45:12 +02:00
parent 7eccc1a627
commit e65c27a81f
No known key found for this signature in database
8 changed files with 125 additions and 33 deletions

57
flake.lock generated
View File

@ -33,6 +33,27 @@
"type": "github" "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": { "devenv": {
"inputs": { "inputs": {
"cachix": "cachix", "cachix": "cachix",
@ -113,6 +134,24 @@
"type": "github" "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": { "git-hooks": {
"inputs": { "inputs": {
"flake-compat": [ "flake-compat": [
@ -259,7 +298,7 @@
}, },
"pumo-system-info": { "pumo-system-info": {
"inputs": { "inputs": {
"flake-utils": "flake-utils", "flake-utils": "flake-utils_2",
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"
], ],
@ -301,6 +340,7 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"claude-desktop": "claude-desktop",
"devenv": "devenv", "devenv": "devenv",
"home-manager": "home-manager", "home-manager": "home-manager",
"nix-index-database": "nix-index-database", "nix-index-database": "nix-index-database",
@ -367,6 +407,21 @@
"type": "github" "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": { "zen-browser": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [

View File

@ -34,6 +34,11 @@
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
claude-desktop = {
url = "github:k3d3/claude-desktop-linux-flake";
inputs.nixpkgs.follows = "nixpkgs";
};
zen-browser = { zen-browser = {
url = "github:youwen5/zen-browser-flake"; url = "github:youwen5/zen-browser-flake";
inputs.nixpkgs.follows = "nixpkgs"; 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 { "phundrak@alys" = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.x86_64-linux; inherit extraSpecialArgs pkgs;
extraSpecialArgs = {
inherit inputs outputs;
};
modules = [ modules = [
./users/phundrak/host/alys.nix ./users/phundrak/host/alys.nix
inputs.sops-nix.homeManagerModules.sops inputs.sops-nix.homeManagerModules.sops
]; ];
}; };
"phundrak@marpa" = home-manager.lib.homeManagerConfiguration { "phundrak@marpa" = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.x86_64-linux; inherit extraSpecialArgs pkgs;
extraSpecialArgs = {
inherit inputs outputs;
};
modules = [ modules = [
./users/phundrak/host/marpa.nix ./users/phundrak/host/marpa.nix
inputs.sops-nix.homeManagerModules.sops inputs.sops-nix.homeManagerModules.sops
]; ];
}; };
"phundrak@gampo" = home-manager.lib.homeManagerConfiguration { "phundrak@gampo" = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.x86_64-linux; inherit extraSpecialArgs pkgs;
extraSpecialArgs = {
inherit inputs outputs;
};
modules = [ modules = [
./users/phundrak/host/gampo.nix ./users/phundrak/host/gampo.nix
inputs.sops-nix.homeManagerModules.sops inputs.sops-nix.homeManagerModules.sops
]; ];
}; };
"phundrak@tilo" = home-manager.lib.homeManagerConfiguration { "phundrak@tilo" = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.x86_64-linux; inherit extraSpecialArgs pkgs;
extraSpecialArgs = {
inherit inputs outputs;
};
modules = [ modules = [
./users/phundrak/host/tilo.nix ./users/phundrak/host/tilo.nix
inputs.sops-nix.homeManagerModules.sops inputs.sops-nix.homeManagerModules.sops
@ -126,30 +122,32 @@
}; };
}; };
nixosConfigurations = { nixosConfigurations = let
specialArgs = {inherit inputs outputs;};
in {
alys = nixpkgs.lib.nixosSystem { alys = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs outputs;}; inherit specialArgs;
modules = [ modules = [
./hosts/alys/configuration.nix ./hosts/alys/configuration.nix
inputs.sops-nix.nixosModules.sops inputs.sops-nix.nixosModules.sops
]; ];
}; };
gampo = nixpkgs.lib.nixosSystem { gampo = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs outputs;}; inherit specialArgs;
modules = [ modules = [
./hosts/gampo/configuration.nix ./hosts/gampo/configuration.nix
inputs.sops-nix.nixosModules.sops inputs.sops-nix.nixosModules.sops
]; ];
}; };
marpa = nixpkgs.lib.nixosSystem { marpa = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs outputs;}; inherit specialArgs;
modules = [ modules = [
./hosts/marpa/configuration.nix ./hosts/marpa/configuration.nix
inputs.sops-nix.nixosModules.sops inputs.sops-nix.nixosModules.sops
]; ];
}; };
tilo = nixpkgs.lib.nixosSystem { tilo = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs outputs;}; inherit specialArgs;
modules = [ modules = [
./hosts/tilo/configuration.nix ./hosts/tilo/configuration.nix
inputs.sops-nix.nixosModules.sops inputs.sops-nix.nixosModules.sops

View File

@ -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;
};
};
}

View File

@ -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;
};
}

View File

@ -4,20 +4,21 @@
... ...
}: }:
with lib; let with lib; let
cfg = config.home.dev.ollama; cfg = config.home.dev.ai.ollama;
in { in {
options.home.dev.ollama = { options.home.dev.ai.ollama = {
enable = mkEnableOption "Enables Ollama"; enable = mkEnableOption "Enables Ollama";
gpu = mkOption { gpu = mkOption {
type = types.nullOr types.enum ["none" "amd" "nvidia"]; type = types.nullOr (types.enum [false "rocm" "cuda"]);
example = "amd"; example = "rocm";
default = "none"; default = null;
description = "Which type of GPU should be used for hardware acceleration"; description = "Which type of GPU should be used for hardware acceleration";
}; };
}; };
config.services.ollama = mkIf cfg.enable { config.services.ollama = mkIf cfg.enable {
inherit (cfg) enable; inherit (cfg) enable;
acceleration = cfg.gpu;
environmentVariables = { environmentVariables = {
OLLAMA_CONTEXT_LENGTH = "8192"; OLLAMA_CONTEXT_LENGTH = "8192";
}; };

View File

@ -7,8 +7,8 @@ with lib; let
cfg = config.home.dev; cfg = config.home.dev;
in { in {
imports = [ imports = [
./ai
./editors ./editors
./ollama.nix
./vcs ./vcs
]; ];

View File

@ -37,10 +37,7 @@
}; };
desktop.waybar.style = ./config/waybar/style.css; desktop.waybar.style = ./config/waybar/style.css;
dev.ollama = { dev.ai.claude.enable = true;
enable = true;
gpu = "amd";
};
fullDesktop = true; fullDesktop = true;
shell.fish.enable = true; shell.fish.enable = true;
}; };

View File

@ -2,6 +2,10 @@
imports = [../home.nix]; imports = [../home.nix];
home = { home = {
cli.nh.flake = "${config.home.homeDirectory}/.dotfiles"; cli.nh.flake = "${config.home.homeDirectory}/.dotfiles";
dev.ai.ollama = {
enable = true;
gpu = "rocm";
};
desktop.hyprland.host = "marpa"; desktop.hyprland.host = "marpa";
phundrak.sshKey = { phundrak.sshKey = {
content = builtins.readFile ../../../keys/id_marpa.pub; content = builtins.readFile ../../../keys/id_marpa.pub;