forked from jan-leila/nix-config
set up nix mcp server
This commit is contained in:
parent
0d2a3e26a8
commit
0d57fb08b1
5 changed files with 140 additions and 4 deletions
|
@ -62,7 +62,6 @@ nix multi user, multi system, configuration with `sops` secret management, `home
|
||||||
- Create Tor guard/relay server
|
- Create Tor guard/relay server
|
||||||
- migrate away from flakes and move to npins
|
- migrate away from flakes and move to npins
|
||||||
- whisper
|
- whisper
|
||||||
- nix mcp
|
|
||||||
- zfs encryption FIDO2 2fa (look into shavee)
|
- zfs encryption FIDO2 2fa (look into shavee)
|
||||||
- Secure Boot - https://github.com/nix-community/lanzaboote
|
- Secure Boot - https://github.com/nix-community/lanzaboote
|
||||||
- rotate sops encryption keys periodically (and somehow sync between devices?)
|
- rotate sops encryption keys periodically (and somehow sync between devices?)
|
||||||
|
|
|
@ -68,7 +68,10 @@ in {
|
||||||
go.enable = true;
|
go.enable = true;
|
||||||
|
|
||||||
# claude development
|
# claude development
|
||||||
claudeDev.enable = ai-tooling-enabled;
|
claudeDev = lib.mkIf ai-tooling-enabled {
|
||||||
|
enable = true;
|
||||||
|
mcp.nixos.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
# misc extensions
|
# misc extensions
|
||||||
evenBetterToml.enable = true;
|
evenBetterToml.enable = true;
|
||||||
|
|
94
flake.lock
generated
94
flake.lock
generated
|
@ -1,5 +1,23 @@
|
||||||
{
|
{
|
||||||
"nodes": {
|
"nodes": {
|
||||||
|
"devshell": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1741473158,
|
||||||
|
"narHash": "sha256-kWNaq6wQUbUMlPgw8Y+9/9wP0F8SHkjy24/mN3UAppg=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "devshell",
|
||||||
|
"rev": "7c9e793ebe66bcba8292989a68c0419b737a22a0",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "devshell",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"disko": {
|
"disko": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
|
@ -75,6 +93,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"
|
||||||
|
}
|
||||||
|
},
|
||||||
"home-manager": {
|
"home-manager": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
|
@ -110,6 +146,28 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"mcp-nixos": {
|
||||||
|
"inputs": {
|
||||||
|
"devshell": "devshell",
|
||||||
|
"flake-utils": "flake-utils",
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1755372538,
|
||||||
|
"narHash": "sha256-iWhsf1Myk6RyQ7IuNf4bWI3Sqq9pgmhKvEisCXtkxyw=",
|
||||||
|
"owner": "utensils",
|
||||||
|
"repo": "mcp-nixos",
|
||||||
|
"rev": "46b4d4d3d6421bfbadc415532ef74433871e1cda",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "utensils",
|
||||||
|
"repo": "mcp-nixos",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"nix-darwin": {
|
"nix-darwin": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
|
@ -153,7 +211,7 @@
|
||||||
},
|
},
|
||||||
"nix-vscode-extensions": {
|
"nix-vscode-extensions": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-utils": "flake-utils",
|
"flake-utils": "flake-utils_2",
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"nixpkgs"
|
"nixpkgs"
|
||||||
]
|
]
|
||||||
|
@ -189,6 +247,22 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1722073938,
|
||||||
|
"narHash": "sha256-OpX0StkL8vpXyWOGUD6G+MA26wAXK6SpT94kLJXo6B4=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "e36e9f57337d0ff0cf77aceb58af4c805472bfae",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixpkgs-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs_2": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1755615617,
|
"lastModified": 1755615617,
|
||||||
"narHash": "sha256-HMwfAJBdrr8wXAkbGhtcby1zGFvs+StOp19xNsbqdOg=",
|
"narHash": "sha256-HMwfAJBdrr8wXAkbGhtcby1zGFvs+StOp19xNsbqdOg=",
|
||||||
|
@ -211,11 +285,12 @@
|
||||||
"flake-compat": "flake-compat",
|
"flake-compat": "flake-compat",
|
||||||
"home-manager": "home-manager",
|
"home-manager": "home-manager",
|
||||||
"impermanence": "impermanence",
|
"impermanence": "impermanence",
|
||||||
|
"mcp-nixos": "mcp-nixos",
|
||||||
"nix-darwin": "nix-darwin",
|
"nix-darwin": "nix-darwin",
|
||||||
"nix-syncthing": "nix-syncthing",
|
"nix-syncthing": "nix-syncthing",
|
||||||
"nix-vscode-extensions": "nix-vscode-extensions",
|
"nix-vscode-extensions": "nix-vscode-extensions",
|
||||||
"nixos-hardware": "nixos-hardware",
|
"nixos-hardware": "nixos-hardware",
|
||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": "nixpkgs_2",
|
||||||
"secrets": "secrets",
|
"secrets": "secrets",
|
||||||
"sops-nix": "sops-nix",
|
"sops-nix": "sops-nix",
|
||||||
"steam-fetcher": "steam-fetcher"
|
"steam-fetcher": "steam-fetcher"
|
||||||
|
@ -291,6 +366,21 @@
|
||||||
"repo": "default",
|
"repo": "default",
|
||||||
"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"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"root": "root",
|
"root": "root",
|
||||||
|
|
|
@ -76,6 +76,12 @@
|
||||||
url = "github:nix-community/steam-fetcher";
|
url = "github:nix-community/steam-fetcher";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# MCP NixOS server for Claude Dev
|
||||||
|
mcp-nixos = {
|
||||||
|
url = "github:utensils/mcp-nixos";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = {
|
outputs = {
|
||||||
|
@ -157,6 +163,8 @@
|
||||||
disko
|
disko
|
||||||
# for viewing dconf entries
|
# for viewing dconf entries
|
||||||
dconf-editor
|
dconf-editor
|
||||||
|
# for MCP NixOS server support in development
|
||||||
|
inputs.mcp-nixos.packages.${system}.default
|
||||||
];
|
];
|
||||||
|
|
||||||
SOPS_AGE_KEY_DIRECTORY = import ./const/sops_age_key_directory.nix;
|
SOPS_AGE_KEY_DIRECTORY = import ./const/sops_age_key_directory.nix;
|
||||||
|
|
|
@ -2,10 +2,27 @@
|
||||||
lib,
|
lib,
|
||||||
pkgs,
|
pkgs,
|
||||||
config,
|
config,
|
||||||
|
inputs,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
pkgsRepositories = pkgs.nix-vscode-extensions.forVSCodeVersion config.programs.vscode.package.version;
|
pkgsRepositories = pkgs.nix-vscode-extensions.forVSCodeVersion config.programs.vscode.package.version;
|
||||||
pkgsRepository = pkgsRepositories.open-vsx;
|
pkgsRepository = pkgsRepositories.open-vsx;
|
||||||
|
|
||||||
|
mcp-nixos = inputs.mcp-nixos.packages.${pkgs.stdenv.hostPlatform.system}.default;
|
||||||
|
|
||||||
|
anyProfileHasMcpNixos = lib.any (
|
||||||
|
profile:
|
||||||
|
profile.extraExtensions.claudeDev.enable
|
||||||
|
&& profile.extraExtensions.claudeDev.mcp.nixos.enable
|
||||||
|
) (lib.attrValues config.programs.vscode.profiles);
|
||||||
|
|
||||||
|
mcpServersConfig = lib.mkMerge [
|
||||||
|
(lib.mkIf anyProfileHasMcpNixos {
|
||||||
|
nixos = {
|
||||||
|
command = "${mcp-nixos}/bin/mcp-nixos";
|
||||||
|
};
|
||||||
|
})
|
||||||
|
];
|
||||||
in {
|
in {
|
||||||
options.programs.vscode.profiles = lib.mkOption {
|
options.programs.vscode.profiles = lib.mkOption {
|
||||||
type = lib.types.attrsOf (lib.types.submodule ({config, ...}: {
|
type = lib.types.attrsOf (lib.types.submodule ({config, ...}: {
|
||||||
|
@ -15,6 +32,12 @@ in {
|
||||||
extension = lib.mkPackageOption pkgsRepository "claude-dev" {
|
extension = lib.mkPackageOption pkgsRepository "claude-dev" {
|
||||||
default = ["saoudrizwan" "claude-dev"];
|
default = ["saoudrizwan" "claude-dev"];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
mcp = {
|
||||||
|
nixos = {
|
||||||
|
enable = lib.mkEnableOption "enable NixOS MCP server for Claude Dev";
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
config = lib.mkIf config.extraExtensions.claudeDev.enable {
|
config = lib.mkIf config.extraExtensions.claudeDev.enable {
|
||||||
|
@ -24,4 +47,17 @@ in {
|
||||||
};
|
};
|
||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf anyProfileHasMcpNixos {
|
||||||
|
home.file."${config.xdg.configHome}/VSCodium/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json" = {
|
||||||
|
text = builtins.toJSON {
|
||||||
|
mcpServers = mcpServersConfig;
|
||||||
|
};
|
||||||
|
force = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
home.packages = [
|
||||||
|
mcp-nixos
|
||||||
|
];
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue