mirror of
https://github.com/nmasur/dotfiles
synced 2024-12-24 02:34:52 +00:00
nix shell features for flake, remove channels
This commit is contained in:
parent
df3e8e60d7
commit
8f5522c2c9
@ -21,11 +21,18 @@
|
||||
scrolling.history = 10000;
|
||||
font = { size = 14.0; };
|
||||
key_bindings = [
|
||||
# Used for word completion in fish_user_key_bindings
|
||||
{
|
||||
key = "L";
|
||||
mods = "Control|Shift";
|
||||
chars = "\\x1F";
|
||||
}
|
||||
# Used for searching nixpkgs in fish_user_key_bindings
|
||||
{
|
||||
key = "N";
|
||||
mods = "Control|Shift";
|
||||
chars = "\\x11F";
|
||||
}
|
||||
{
|
||||
key = "K";
|
||||
mods = "Control";
|
||||
|
@ -2,10 +2,10 @@
|
||||
|
||||
imports = [
|
||||
./alacritty.nix
|
||||
./dotfiles.nix
|
||||
./fonts.nix
|
||||
./hammerspoon.nix
|
||||
./homebrew.nix
|
||||
./nixpkgs.nix
|
||||
./system.nix
|
||||
./tmux.nix
|
||||
./user.nix
|
||||
|
@ -16,25 +16,6 @@
|
||||
|
||||
};
|
||||
|
||||
programs.fish = {
|
||||
shellAbbrs = {
|
||||
nr = "rebuild-nixos";
|
||||
nro = "rebuild-nixos offline";
|
||||
};
|
||||
functions = {
|
||||
rebuild-nixos = {
|
||||
body = ''
|
||||
if test "$argv[1]" = "offline"
|
||||
set option "--option substitute false"
|
||||
end
|
||||
git -C ${config.dotfilesPath} add --all
|
||||
commandline -r "doas nixos-rebuild switch $option --flake ${config.dotfilesPath}"
|
||||
commandline --function execute
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -6,6 +6,7 @@
|
||||
./fzf.nix
|
||||
./git.nix
|
||||
./github.nix
|
||||
./nixpkgs.nix
|
||||
./starship.nix
|
||||
./utilities.nix
|
||||
];
|
||||
|
@ -42,17 +42,6 @@
|
||||
body = "pbpaste | jq '.' | pbcopy"; # Need to fix for non-macOS
|
||||
};
|
||||
ls = { body = "${pkgs.exa}/bin/exa $argv"; };
|
||||
nix-shell-run = {
|
||||
body = ''
|
||||
set program $argv[1]
|
||||
if test (count $argv) -ge 1
|
||||
commandline -r "nix run nixpkgs#$program -- $argv[2..-1]"
|
||||
else
|
||||
commandline -r "nix run nixpkgs#$program"
|
||||
end
|
||||
commandline -f execute
|
||||
'';
|
||||
};
|
||||
note = {
|
||||
description = "Edit or create a note";
|
||||
argumentNames = "filename";
|
||||
@ -120,13 +109,6 @@
|
||||
publickey = "ssh-keygen -y -f ~/.ssh/id_rsa > ~/.ssh/id_rsa.pub";
|
||||
forloop = "for i in (seq 1 100)";
|
||||
|
||||
# Nix
|
||||
ns = "nix-shell -p";
|
||||
nsr = "nix-shell-run";
|
||||
nps = "nix repl '<nixpkgs>'";
|
||||
nixo = "man configuration.nix";
|
||||
nixh = "man home-configuration.nix";
|
||||
|
||||
# Docker
|
||||
dc = "$DOTS/bin/docker_cleanup";
|
||||
dr = "docker run --rm -it";
|
||||
@ -145,12 +127,5 @@
|
||||
programs.zoxide.enableFishIntegration = true;
|
||||
programs.fzf.enableFishIntegration = true;
|
||||
|
||||
# Provides "command-not-found" options
|
||||
# Requires activating a manual download
|
||||
programs.nix-index = {
|
||||
enable = true;
|
||||
enableFishIntegration = true;
|
||||
};
|
||||
|
||||
};
|
||||
}
|
||||
|
@ -6,13 +6,15 @@ bind -M insert \ca 'cd ~; and edit; and commandline -a "; cd -"; commandline -f
|
||||
bind -M default \ca 'cd ~; and edit; and commandline -a "; cd -"; commandline -f execute'
|
||||
bind -M insert \ce recent
|
||||
bind -M default \ce recent
|
||||
bind -M insert \cg commandline-git-commits
|
||||
bind -M insert \cG 'commandline -i (git rev-parse --show-toplevel 2>/dev/null || echo ".")'
|
||||
bind -M default \cg commandline-git-commits
|
||||
bind -M insert \cg 'commandline -i (git rev-parse --show-toplevel 2>/dev/null || echo ".")'
|
||||
bind -M insert \cf fcd
|
||||
bind -M default \cf fcd
|
||||
bind -M insert \cp projects
|
||||
bind -M default \cp projects
|
||||
bind -M insert \x1F accept-autosuggestion
|
||||
bind -M default \x1F accept-autosuggestion
|
||||
bind -M insert \cn 'commandline -r "nix run nixpkgs#"'
|
||||
bind -M default \cn 'commandline -r "nix run nixpkgs#"'
|
||||
bind -M insert \cn 'commandline -r "nix run github:NixOS/nixpkgs/nixpkgs-unstable#"'
|
||||
bind -M default \cn 'commandline -r "nix run github:NixOS/nixpkgs/nixpkgs-unstable#"'
|
||||
bind -M insert \x11F nix-fzf
|
||||
bind -M default \x11F nix-fzf
|
||||
|
59
modules/shell/nixpkgs.nix
Normal file
59
modules/shell/nixpkgs.nix
Normal file
@ -0,0 +1,59 @@
|
||||
{ config, pkgs, ... }: {
|
||||
home-manager.users.${config.user} = {
|
||||
|
||||
programs.fish = {
|
||||
shellAbbrs = {
|
||||
ns = "nix-shell -p";
|
||||
nsr = "nix-shell-run";
|
||||
nps = "nix repl '<nixpkgs>'";
|
||||
nixo = "man configuration.nix";
|
||||
nixh = "man home-configuration.nix";
|
||||
nr = "rebuild-nixos";
|
||||
nro = "rebuild-nixos offline";
|
||||
};
|
||||
functions = {
|
||||
nix-shell-run = {
|
||||
body = ''
|
||||
set program $argv[1]
|
||||
if test (count $argv) -ge 2
|
||||
commandline -r "nix run github:NixOS/nixpkgs/nixpkgs-unstable#$program -- $argv[2..-1]"
|
||||
else
|
||||
commandline -r "nix run github:NixOS/nixpkgs/nixpkgs-unstable#$program"
|
||||
end
|
||||
commandline -f execute
|
||||
'';
|
||||
};
|
||||
nix-fzf = {
|
||||
body = ''
|
||||
commandline -i (nix-instantiate --eval --json \
|
||||
-E 'builtins.attrNames (import <nixpkgs> {})' \
|
||||
| jq '.[]' -r | fzf)
|
||||
commandline -f repaint
|
||||
'';
|
||||
};
|
||||
rebuild-nixos = {
|
||||
body = ''
|
||||
if test "$argv[1]" = "offline"
|
||||
set option "--option substitute false"
|
||||
end
|
||||
git -C ${config.dotfilesPath} add --all
|
||||
commandline -r "doas nixos-rebuild switch $option --flake ${config.dotfilesPath}"
|
||||
commandline --function execute
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# Provides "command-not-found" options
|
||||
# Requires activating a manual download
|
||||
programs.nix-index = {
|
||||
enable = true;
|
||||
enableFishIntegration = true;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
# Set system channels for nix-shell
|
||||
nix = { nixPath = [ "nixpkgs=${pkgs.path}" ]; };
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user