feat: configuring shell & add fish shell
This commit is contained in:
parent
f20e3a6b57
commit
e73cc0c0f5
10 changed files with 130 additions and 22 deletions
|
|
@ -1,8 +1,50 @@
|
||||||
{ pkgs, ... }:
|
{ pkgs, ... }:
|
||||||
|
|
||||||
pkgs.mkShell {
|
let
|
||||||
|
# MCP wrapper script that ensures Python is available for GUI apps
|
||||||
|
mcpNixosWrapper = pkgs.writeShellScriptBin "mcp-nixos-wrapper" ''
|
||||||
|
export PATH="${pkgs.python3}/bin:${pkgs.uv}/bin:$PATH"
|
||||||
|
exec ${pkgs.uv}/bin/uvx mcp-nixos "$@"
|
||||||
|
'';
|
||||||
|
|
||||||
|
# Generate MCP configs for GUI applications
|
||||||
|
mcpConfigForGUI = pkgs.writeText "mcp_settings.json" (builtins.toJSON {
|
||||||
|
mcpServers = {
|
||||||
|
nixos = {
|
||||||
|
type = "stdio";
|
||||||
|
command = "${mcpNixosWrapper}/bin/mcp-nixos-wrapper";
|
||||||
|
args = [ ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
# Script to install MCP configs for Claude Code and Codex
|
||||||
|
installMcpConfigs = pkgs.writeShellScriptBin "install-mcp-configs" ''
|
||||||
|
set -e
|
||||||
|
echo "Installing MCP configurations..."
|
||||||
|
|
||||||
|
mkdir -p "$HOME/.config/claude-code"
|
||||||
|
mkdir -p "$HOME/.config/codex"
|
||||||
|
|
||||||
|
cp ${mcpConfigForGUI} "$HOME/.config/claude-code/mcp_settings.json"
|
||||||
|
cp ${mcpConfigForGUI} "$HOME/.config/codex/mcp_settings.json"
|
||||||
|
|
||||||
|
echo "✓ Installed MCP config to ~/.config/claude-code/mcp_settings.json"
|
||||||
|
echo "✓ Installed MCP config to ~/.config/codex/mcp_settings.json"
|
||||||
|
echo ""
|
||||||
|
echo "Restart Claude Code and Codex to apply changes."
|
||||||
|
'';
|
||||||
|
|
||||||
|
in pkgs.mkShell {
|
||||||
name = "default";
|
name = "default";
|
||||||
packages = with pkgs; [ git nixfmt-classic uv ];
|
packages = with pkgs; [
|
||||||
|
git
|
||||||
|
nixfmt-classic
|
||||||
|
uv
|
||||||
|
python3
|
||||||
|
mcpNixosWrapper
|
||||||
|
installMcpConfigs
|
||||||
|
];
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
export DOTFILES_ROOT="$PWD"
|
export DOTFILES_ROOT="$PWD"
|
||||||
export XDG_CACHE_HOME="$DOTFILES_ROOT/.cache"
|
export XDG_CACHE_HOME="$DOTFILES_ROOT/.cache"
|
||||||
|
|
@ -18,5 +60,8 @@ pkgs.mkShell {
|
||||||
|
|
||||||
echo "Loaded default shell for dotfiles development"
|
echo "Loaded default shell for dotfiles development"
|
||||||
echo "MCP helper alias ready: mcp-nixos"
|
echo "MCP helper alias ready: mcp-nixos"
|
||||||
|
echo ""
|
||||||
|
echo "To install MCP configs for Claude Code and Codex, run:"
|
||||||
|
echo " install-mcp-configs"
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
31
flake.nix
31
flake.nix
|
|
@ -28,7 +28,9 @@
|
||||||
inherit (nixpkgs.lib) genAttrs;
|
inherit (nixpkgs.lib) genAttrs;
|
||||||
lib = nixpkgs.lib;
|
lib = nixpkgs.lib;
|
||||||
|
|
||||||
systems = [ "aarch64-darwin" "x86_64-darwin" ];
|
darwinSystems = [ "aarch64-darwin" "x86_64-darwin" ];
|
||||||
|
linuxSystems = [ "x86_64-linux" "aarch64-linux" ];
|
||||||
|
systems = darwinSystems ++ linuxSystems;
|
||||||
|
|
||||||
forEachSystem = f: genAttrs systems (system: f system);
|
forEachSystem = f: genAttrs systems (system: f system);
|
||||||
|
|
||||||
|
|
@ -46,7 +48,8 @@
|
||||||
config.allowUnfree = true;
|
config.allowUnfree = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
sharedModules = [ ./modules/darwin/system.nix ];
|
sharedDarwinModules = [ ./modules/darwin/system.nix ];
|
||||||
|
sharedNixosModules = [ ./modules/nixos/system.nix ];
|
||||||
|
|
||||||
user = "rasyidanakbar";
|
user = "rasyidanakbar";
|
||||||
|
|
||||||
|
|
@ -56,14 +59,12 @@
|
||||||
in darwin.lib.darwinSystem {
|
in darwin.lib.darwinSystem {
|
||||||
inherit system pkgs;
|
inherit system pkgs;
|
||||||
specialArgs = { inherit inputs overlaysList user; };
|
specialArgs = { inherit inputs overlaysList user; };
|
||||||
modules = sharedModules ++ extraModules ++ [
|
modules = sharedDarwinModules ++ extraModules ++ [
|
||||||
home-manager.darwinModules.home-manager
|
home-manager.darwinModules.home-manager
|
||||||
{
|
{
|
||||||
nix.registry.self.flake = self;
|
nix.registry.self.flake = self;
|
||||||
nixpkgs.overlays = overlaysList;
|
nixpkgs.overlays = overlaysList;
|
||||||
|
|
||||||
users.users.${user}.home = "/Users/${user}";
|
|
||||||
|
|
||||||
home-manager.useGlobalPkgs = true;
|
home-manager.useGlobalPkgs = true;
|
||||||
home-manager.useUserPackages = true;
|
home-manager.useUserPackages = true;
|
||||||
home-manager.backupFileExtension = "backup";
|
home-manager.backupFileExtension = "backup";
|
||||||
|
|
@ -72,8 +73,28 @@
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
mkNixos = { system ? "x86_64-linux", extraModules ? [ ]
|
||||||
|
, homeFile ? ./modules/nixos/home/default.nix }:
|
||||||
|
let pkgs = mkPkgs system;
|
||||||
|
in lib.nixosSystem {
|
||||||
|
inherit system pkgs;
|
||||||
|
specialArgs = { inherit inputs overlaysList user; };
|
||||||
|
modules = sharedNixosModules ++ extraModules ++ [
|
||||||
|
home-manager.nixosModules.home-manager
|
||||||
|
{
|
||||||
|
nix.registry.self.flake = self;
|
||||||
|
nixpkgs.overlays = overlaysList;
|
||||||
|
|
||||||
|
home-manager.useGlobalPkgs = true;
|
||||||
|
home-manager.useUserPackages = true;
|
||||||
|
home-manager.extraSpecialArgs = { inherit inputs user; };
|
||||||
|
home-manager.users.${user} = import homeFile;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
in {
|
in {
|
||||||
darwinConfigurations = { macbook-pro = mkDarwin { }; };
|
darwinConfigurations = { macbook-pro = mkDarwin { }; };
|
||||||
|
nixosConfigurations = { };
|
||||||
|
|
||||||
devShells = forEachSystem (system:
|
devShells = forEachSystem (system:
|
||||||
let
|
let
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,9 @@
|
||||||
{ config, pkgs, lib, ... }: {
|
{ config, pkgs, lib, ... }: {
|
||||||
# Import shared cross-platform home configuration
|
# Import shared cross-platform home configuration
|
||||||
imports =
|
imports = [
|
||||||
[ ../../home/rsydn/base.nix ./programs/aerospace ./programs/ghostty.nix ];
|
../../home/rsydn/base.nix
|
||||||
|
../../home/rsydn/shell/nushell.nix
|
||||||
|
./programs/aerospace
|
||||||
|
./programs/ghostty.nix
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,10 @@
|
||||||
|
|
||||||
environment.shells = [ pkgs.nushell ];
|
environment.shells = [ pkgs.nushell ];
|
||||||
|
|
||||||
users.users.${user}.shell = pkgs.nushell;
|
users.users.${user} = {
|
||||||
|
home = lib.mkDefault "/Users/${user}";
|
||||||
|
shell = pkgs.nushell;
|
||||||
|
};
|
||||||
|
|
||||||
system = {
|
system = {
|
||||||
primaryUser = user;
|
primaryUser = user;
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@
|
||||||
imports = [
|
imports = [
|
||||||
./programs/helix.nix
|
./programs/helix.nix
|
||||||
./programs/neovim.nix
|
./programs/neovim.nix
|
||||||
./shell/nushell.nix
|
|
||||||
./shell/tmux.nix
|
./shell/tmux.nix
|
||||||
./devtools/ai-tools.nix
|
./devtools/ai-tools.nix
|
||||||
./devtools/languages.nix
|
./devtools/languages.nix
|
||||||
|
|
@ -57,7 +56,7 @@
|
||||||
node.enable = true;
|
node.enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
rsydn.secrets = {
|
rsydn.secrets = lib.mkIf pkgs.stdenv.hostPlatform.isDarwin {
|
||||||
enable = lib.mkDefault true;
|
enable = lib.mkDefault true;
|
||||||
defaultSopsFile = ../../../secrets/local-ai-tokens.sops.yaml;
|
defaultSopsFile = ../../../secrets/local-ai-tokens.sops.yaml;
|
||||||
secrets = {
|
secrets = {
|
||||||
|
|
|
||||||
17
modules/home/rsydn/shell/fish.nix
Normal file
17
modules/home/rsydn/shell/fish.nix
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
{ config, pkgs, lib, ... }: {
|
||||||
|
imports = [ ./oh-my-posh ];
|
||||||
|
|
||||||
|
programs.fish = {
|
||||||
|
enable = true;
|
||||||
|
interactiveShellInit = ''
|
||||||
|
set -g fish_greeting ""
|
||||||
|
set -gx EDITOR nvim
|
||||||
|
set -gx VISUAL nvim
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
programs.oh-my-posh.enableFishIntegration = lib.mkDefault true;
|
||||||
|
|
||||||
|
# Ensure fish is available for login shells on Linux hosts.
|
||||||
|
home.packages = lib.mkAfter [ pkgs.fish ];
|
||||||
|
}
|
||||||
|
|
@ -1,8 +1,5 @@
|
||||||
{ config, pkgs, lib, ... }:
|
{ config, pkgs, lib, ... }:
|
||||||
let
|
let
|
||||||
themeName = "capr4n.omp.json";
|
|
||||||
themeSource = ./oh-my-posh/capr4n.omp.json;
|
|
||||||
themeConfigPath = "${config.xdg.configHome}/oh-my-posh/${themeName}";
|
|
||||||
profileBin = "${config.home.profileDirectory}/bin";
|
profileBin = "${config.home.profileDirectory}/bin";
|
||||||
systemBin = "/run/current-system/sw/bin";
|
systemBin = "/run/current-system/sw/bin";
|
||||||
defaultBin = "/nix/var/nix/profiles/default/bin";
|
defaultBin = "/nix/var/nix/profiles/default/bin";
|
||||||
|
|
@ -28,6 +25,8 @@ let
|
||||||
formatPathList = paths:
|
formatPathList = paths:
|
||||||
lib.concatMapStrings (path: " \"${path}\"\n") paths;
|
lib.concatMapStrings (path: " \"${path}\"\n") paths;
|
||||||
in {
|
in {
|
||||||
|
imports = [ ./oh-my-posh ];
|
||||||
|
|
||||||
programs.nushell.enable = lib.mkDefault true;
|
programs.nushell.enable = lib.mkDefault true;
|
||||||
|
|
||||||
programs.nushell.extraConfig = ''
|
programs.nushell.extraConfig = ''
|
||||||
|
|
@ -115,11 +114,5 @@ in {
|
||||||
load-secret "firecrawl-api-key" "FIRECRAWL_API_KEY"
|
load-secret "firecrawl-api-key" "FIRECRAWL_API_KEY"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
programs.oh-my-posh = {
|
programs.oh-my-posh.enableNushellIntegration = lib.mkDefault true;
|
||||||
enable = lib.mkDefault true;
|
|
||||||
enableNushellIntegration = lib.mkDefault true;
|
|
||||||
configFile = themeConfigPath;
|
|
||||||
};
|
|
||||||
|
|
||||||
xdg.configFile."oh-my-posh/${themeName}".source = themeSource;
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
13
modules/home/rsydn/shell/oh-my-posh/default.nix
Normal file
13
modules/home/rsydn/shell/oh-my-posh/default.nix
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
{ config, lib, ... }:
|
||||||
|
let
|
||||||
|
themeName = "capr4n.omp.json";
|
||||||
|
themeSource = ./capr4n.omp.json;
|
||||||
|
themeConfigPath = "${config.xdg.configHome}/oh-my-posh/${themeName}";
|
||||||
|
in {
|
||||||
|
programs.oh-my-posh = {
|
||||||
|
enable = lib.mkDefault true;
|
||||||
|
configFile = themeConfigPath;
|
||||||
|
};
|
||||||
|
|
||||||
|
xdg.configFile."oh-my-posh/${themeName}".source = themeSource;
|
||||||
|
}
|
||||||
3
modules/nixos/home/default.nix
Normal file
3
modules/nixos/home/default.nix
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
{ config, pkgs, lib, ... }: {
|
||||||
|
imports = [ ../../home/rsydn/base.nix ../../home/rsydn/shell/fish.nix ];
|
||||||
|
}
|
||||||
10
modules/nixos/system.nix
Normal file
10
modules/nixos/system.nix
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
{ config, pkgs, lib, user, ... }: {
|
||||||
|
users.users.${user} = {
|
||||||
|
isNormalUser = lib.mkDefault true;
|
||||||
|
extraGroups = lib.mkDefault [ "wheel" "networkmanager" ];
|
||||||
|
home = lib.mkDefault "/home/${user}";
|
||||||
|
shell = lib.mkDefault pkgs.fish;
|
||||||
|
};
|
||||||
|
|
||||||
|
programs.fish.enable = lib.mkDefault true;
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue