Make own modules toggleble with enable option
This commit is contained in:
parent
98e36877ba
commit
be015b5a06
|
|
@ -295,11 +295,11 @@
|
|||
"nixpkgs": "nixpkgs_4"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1706470195,
|
||||
"narHash": "sha256-SBdC0Xx7iOxjYKgIlHWfoH6oRIae1CBRZcIRIO5Iymc=",
|
||||
"lastModified": 1706712950,
|
||||
"narHash": "sha256-17TOvi0vKtelaRCZJvDaXk7YTDphqYwUMtxyZmWtAF4=",
|
||||
"ref": "refs/heads/master",
|
||||
"rev": "148f7fe77452628d33cc431421a7819f3365cb03",
|
||||
"revCount": 6,
|
||||
"rev": "edeed6fbbd204fb3eb9bd2a6342a6d142c8b7dac",
|
||||
"revCount": 8,
|
||||
"type": "git",
|
||||
"url": "ssh://gitea@pi1.odie.intranet/odie/neovim-flake"
|
||||
},
|
||||
|
|
|
|||
44
flake.nix
44
flake.nix
|
|
@ -8,12 +8,12 @@
|
|||
home-manager = {
|
||||
url = "github:nix-community/home-manager";
|
||||
};
|
||||
neovim = {
|
||||
url = "git+ssh://gitea@pi1.odie.intranet/odie/neovim-flake";
|
||||
};
|
||||
neovim-nightly-overlay = {
|
||||
url = "github:nix-community/neovim-nightly-overlay";
|
||||
};
|
||||
neovim = {
|
||||
url = "git+ssh://gitea@pi1.odie.intranet/odie/neovim-flake";
|
||||
};
|
||||
};
|
||||
|
||||
outputs = inputs@{ self, nixpkgs, flake-utils, home-manager, ... }:
|
||||
|
|
@ -32,29 +32,26 @@
|
|||
};
|
||||
})
|
||||
] ++ inputOverlays;
|
||||
localLib = {
|
||||
mkPkgs = system:
|
||||
import nixpkgs {
|
||||
inherit system overlays;
|
||||
};
|
||||
mkHomeManagerConfiguration = user: modules: system:
|
||||
{
|
||||
${user} = home-manager.lib.homeManagerConfiguration {
|
||||
pkgs = (localLib.mkPkgs system).unstable; # Home-manager requires 'pkgs' instance
|
||||
extraSpecialArgs = { inherit inputs outputs; };
|
||||
inherit modules;
|
||||
};
|
||||
};
|
||||
};
|
||||
mkPkgs = system:
|
||||
import nixpkgs {
|
||||
inherit system overlays;
|
||||
};
|
||||
in
|
||||
{
|
||||
homeConfigurations = localLib.mkHomeManagerConfiguration "odie" [
|
||||
rec {
|
||||
homeManagerModules = [
|
||||
(import ./modules)
|
||||
] "x86_64-linux";
|
||||
];
|
||||
homeConfigurations = {
|
||||
"odie@asgard" = home-manager.lib.homeManagerConfiguration {
|
||||
pkgs = (mkPkgs "x86_64-linux").unstable;
|
||||
extraSpecialArgs = { inherit inputs outputs; };
|
||||
modules = homeManagerModules;
|
||||
};
|
||||
};
|
||||
packages = flake-utils.lib.eachDefaultSystem
|
||||
(system:
|
||||
let
|
||||
pkgs = localLib.mkPkgs system;
|
||||
pkgs = mkPkgs system;
|
||||
in
|
||||
with pkgs; {
|
||||
inherit (unstable) hello;
|
||||
|
|
@ -62,13 +59,10 @@
|
|||
);
|
||||
} // flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = localLib.mkPkgs system;
|
||||
pkgs = mkPkgs system;
|
||||
in
|
||||
{
|
||||
formatter = pkgs.alejandra;
|
||||
packages = with pkgs; {
|
||||
inherit (unstable) hello;
|
||||
};
|
||||
devShells = {
|
||||
default = pkgs.mkShell {
|
||||
name = "home-manager";
|
||||
|
|
|
|||
|
|
@ -5,32 +5,21 @@
|
|||
language.base = "de_DE.UTF-8";
|
||||
packages = with pkgs; [
|
||||
home-manager
|
||||
#neovim-ide
|
||||
];
|
||||
sessionVariables = {
|
||||
MANPAGER = "sh -c 'col -bx | bat -l man -p'";
|
||||
MANROFFOPT = "-c";
|
||||
};
|
||||
shellAliases = {
|
||||
cat = "bat";
|
||||
};
|
||||
};
|
||||
|
||||
imports = [
|
||||
./shell
|
||||
./neovim.nix
|
||||
./neovim-ide.nix
|
||||
];
|
||||
|
||||
programs = {
|
||||
bat.enable = true;
|
||||
neovim-ide.enable = true;
|
||||
};
|
||||
|
||||
services = {
|
||||
ssh-agent.enable = true;
|
||||
};
|
||||
|
||||
home = {
|
||||
};
|
||||
|
||||
home.stateVersion = "23.05";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
{ pkgs, config, lib, ... }: {
|
||||
options = {
|
||||
programs.neovim-ide.enable = lib.mkEnableOption "neovim-ide";
|
||||
};
|
||||
config = lib.mkIf config.programs.neovim-ide.enable {
|
||||
home = {
|
||||
packages = with pkgs; [ neovim-ide ];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
{ pkgs, ... }: {
|
||||
home = {
|
||||
packages = with pkgs; [ neovim-ide ];
|
||||
};
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
{ config, lib, pkgs, ... }: lib.mkIf config.programs.bat.enable {
|
||||
home = {
|
||||
packages = with pkgs; [
|
||||
bat
|
||||
];
|
||||
sessionVariables = {
|
||||
MANPAGER = "sh -c 'col -bx | bat -l man -p'";
|
||||
MANROFFOPT = "-c";
|
||||
};
|
||||
shellAliases = {
|
||||
cat = "bat";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,6 +1,5 @@
|
|||
_: {
|
||||
{ config, lib, ... }: lib.mkIf config.programs.btop.enable {
|
||||
programs.btop = {
|
||||
enable = true;
|
||||
settings = {
|
||||
color_theme = "Default";
|
||||
theme_background = false;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
_: {
|
||||
{ lib, ... }: with lib; {
|
||||
imports = [
|
||||
./direnv.nix
|
||||
./fzf.nix
|
||||
|
|
@ -11,5 +11,21 @@ _: {
|
|||
./btop.nix
|
||||
./zoxide.nix
|
||||
./ssh.nix
|
||||
./bat.nix
|
||||
];
|
||||
|
||||
programs = {
|
||||
bat.enable = mkDefault true;
|
||||
btop.enable = mkDefault true;
|
||||
direnv.enable = mkDefault true;
|
||||
fzf.enable = mkDefault true;
|
||||
git.enable = mkDefault true;
|
||||
lf.enable = mkDefault true;
|
||||
lsd.enable = mkDefault true;
|
||||
ssh.enable = mkDefault true;
|
||||
starship.enable = mkDefault true;
|
||||
tmux.enable = mkDefault true;
|
||||
zoxide.enable = mkDefault true;
|
||||
zsh.enable = mkDefault true;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
{ pkgs, ... }: {
|
||||
{ pkgs, lib, config, ... }: lib.mkIf config.programs.direnv.enable {
|
||||
programs.direnv = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
enableBashIntegration = true;
|
||||
config = {
|
||||
global = {
|
||||
disable_stdin = true;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
_: {
|
||||
{ config, lib, ... }: lib.mkIf config.programs.fzf.enable {
|
||||
programs = {
|
||||
fzf = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
defaultCommand = "fd --type f";
|
||||
defaultOptions = [
|
||||
|
|
|
|||
|
|
@ -1,14 +1,13 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
{ config
|
||||
, pkgs
|
||||
, lib
|
||||
, ...
|
||||
}: lib.mkIf config.programs.git.enable {
|
||||
home = {
|
||||
packages = with pkgs; [pre-commit];
|
||||
packages = with pkgs; [ pre-commit ];
|
||||
};
|
||||
programs = {
|
||||
git = {
|
||||
enable = true;
|
||||
userName = "Patrick Neff";
|
||||
userEmail = "odie86@gmail.com";
|
||||
extraConfig = {
|
||||
|
|
@ -26,7 +25,7 @@
|
|||
defaultBranch = "master";
|
||||
};
|
||||
};
|
||||
attributes = [];
|
||||
attributes = [ ];
|
||||
ignores = [
|
||||
"# Created by https://www.toptal.com/developers/gitignore/api/vim,linux"
|
||||
"# Edit at https://www.toptal.com/developers/gitignore?templates=vim,linux"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
{pkgs, ...}: {
|
||||
{ pkgs, config, lib, ... }: lib.mkIf config.programs.lf.enable {
|
||||
home = {
|
||||
packages = with pkgs; [
|
||||
chafa
|
||||
|
|
@ -14,7 +14,6 @@
|
|||
};
|
||||
};
|
||||
programs.lf = {
|
||||
enable = true;
|
||||
commands = {
|
||||
get-mime-type = "%xdg-mime query filetype \"$f\"";
|
||||
open = ''
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
_: {
|
||||
{lib, config, ...}: lib.mkIf config.programs.lsd.enable {
|
||||
programs = {
|
||||
lsd = {
|
||||
enable = true;
|
||||
enableAliases = true;
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
{ pkgs, ... }: {
|
||||
{ pkgs, config, lib, ... }: lib.mkIf config.programs.ssh.enable {
|
||||
home.packages = with pkgs; [ tea ];
|
||||
programs = {
|
||||
ssh = {
|
||||
enable = true;
|
||||
addKeysToAgent = "yes";
|
||||
forwardAgent = true;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
{ lib, ... }:
|
||||
{
|
||||
{ lib, config, ... }:
|
||||
lib.mkIf config.programs.starship.enable {
|
||||
programs = {
|
||||
starship = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
settings = {
|
||||
add_newline = false;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
{ pkgs, ... }:
|
||||
{ pkgs, lib, config, ... }:
|
||||
let
|
||||
localLib = pkgs.callPackage ../../lib { };
|
||||
catppuccin = pkgs.callPackage ../../pkgs/tmuxPlugins/catppuccin.nix {
|
||||
|
|
@ -6,82 +6,86 @@ let
|
|||
};
|
||||
in
|
||||
{
|
||||
programs.tmux = {
|
||||
enable = true;
|
||||
newSession = true;
|
||||
mouse = true;
|
||||
keyMode = "vi";
|
||||
historyLimit = 10240;
|
||||
clock24 = true;
|
||||
baseIndex = 1;
|
||||
aggressiveResize = true;
|
||||
shortcut = "a";
|
||||
sensibleOnTop = true;
|
||||
escapeTime = 0;
|
||||
tmuxp.enable = true;
|
||||
plugins = with pkgs.tmuxPlugins; [
|
||||
sensible
|
||||
yank
|
||||
{
|
||||
plugin = catppuccin;
|
||||
extraConfig = ''
|
||||
set -g @catppuccin_window_default_text "#W" # use "#W" for application instead of directory
|
||||
set -g @catppuccin_window_current_text "#W" # use "#W" for application instead of directory
|
||||
set -g @catppuccin_window_status_enable "yes"
|
||||
set -g @catppuccin_status_modules_right "directory user host date_time session"
|
||||
'';
|
||||
}
|
||||
better-mouse-mode
|
||||
{
|
||||
plugin = tmux-fzf;
|
||||
extraConfig = ''
|
||||
unbind A
|
||||
TMUX_FZF_LAUNCH_KEY="f"
|
||||
TMUX_FZF_PANE_FORMAT="[#{window_name}] #{pane_current_command} [#{pane_width}x#{pane_height}] [history #{history_size}/#{history_limit}, #{history_bytes} bytes] #{?pane_active,[active],[inactive]}"
|
||||
'';
|
||||
}
|
||||
];
|
||||
extraConfig = ''
|
||||
# Quick pane cycling
|
||||
unbind ^A
|
||||
bind ^A last-window
|
||||
options = {
|
||||
|
||||
#unbind 'Space'
|
||||
#bind 'Space' next-window
|
||||
};
|
||||
config = {
|
||||
programs.tmux = lib.mkIf config.programs.tmux.enable {
|
||||
newSession = true;
|
||||
mouse = true;
|
||||
keyMode = "vi";
|
||||
historyLimit = 10240;
|
||||
clock24 = true;
|
||||
baseIndex = 1;
|
||||
aggressiveResize = true;
|
||||
shortcut = "a";
|
||||
sensibleOnTop = true;
|
||||
escapeTime = 0;
|
||||
tmuxp.enable = true;
|
||||
plugins = with pkgs.tmuxPlugins; [
|
||||
sensible
|
||||
yank
|
||||
{
|
||||
plugin = catppuccin;
|
||||
extraConfig = ''
|
||||
set -g @catppuccin_window_default_text "#W" # use "#W" for application instead of directory
|
||||
set -g @catppuccin_window_current_text "#W" # use "#W" for application instead of directory
|
||||
set -g @catppuccin_window_status_enable "yes"
|
||||
set -g @catppuccin_status_modules_right "directory user host date_time session"
|
||||
'';
|
||||
}
|
||||
better-mouse-mode
|
||||
{
|
||||
plugin = tmux-fzf;
|
||||
extraConfig = ''
|
||||
unbind A
|
||||
TMUX_FZF_LAUNCH_KEY="f"
|
||||
TMUX_FZF_PANE_FORMAT="[#{window_name}] #{pane_current_command} [#{pane_width}x#{pane_height}] [history #{history_size}/#{history_limit}, #{history_bytes} bytes] #{?pane_active,[active],[inactive]}"
|
||||
'';
|
||||
}
|
||||
];
|
||||
extraConfig = ''
|
||||
# Quick pane cycling
|
||||
unbind ^A
|
||||
bind ^A last-window
|
||||
|
||||
bind-key C-s split-window -v
|
||||
bind-key C-v split-window -h
|
||||
#unbind 'Space'
|
||||
#bind 'Space' next-window
|
||||
|
||||
# Open new panes and windows with the current panes path
|
||||
bind c new-window -c "#{pane_current_path}"
|
||||
bind '"' split-window -c "#{pane_current_path}"
|
||||
bind % split-window -h -c "#{pane_current_path}"
|
||||
bind-key C-s split-window -v
|
||||
bind-key C-v split-window -h
|
||||
|
||||
set-option -sa terminal-features ',xterm-256color:RGB'
|
||||
set-option -sa terminal-features ',st-256color:RGB'
|
||||
set-option -sa terminal-features ',xterm-kitty:RGB'
|
||||
# Open new panes and windows with the current panes path
|
||||
bind c new-window -c "#{pane_current_path}"
|
||||
bind '"' split-window -c "#{pane_current_path}"
|
||||
bind % split-window -h -c "#{pane_current_path}"
|
||||
|
||||
is_vim="ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?\.?(view|n?vim?x?)(-wrapped)?(diff)?$'"
|
||||
set-option -sa terminal-features ',xterm-256color:RGB'
|
||||
set-option -sa terminal-features ',st-256color:RGB'
|
||||
set-option -sa terminal-features ',xterm-kitty:RGB'
|
||||
|
||||
bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' { if -F '#{pane_at_left}' "" 'select-pane -L' }
|
||||
bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' { if -F '#{pane_at_bottom}' "" 'select-pane -D' }
|
||||
bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' { if -F '#{pane_at_top}' "" 'select-pane -U' }
|
||||
bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-l' { if -F '#{pane_at_right}' "" 'select-pane -R' }
|
||||
is_vim="ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?\.?(view|n?vim?x?)(-wrapped)?(diff)?$'"
|
||||
|
||||
bind-key -T copy-mode-vi 'C-h' if -F '#{pane_at_left}' "" 'select-pane -L'
|
||||
bind-key -T copy-mode-vi 'C-j' if -F '#{pane_at_bottom}' "" 'select-pane -D'
|
||||
bind-key -T copy-mode-vi 'C-k' if -F '#{pane_at_top}' "" 'select-pane -U'
|
||||
bind-key -T copy-mode-vi 'C-l' if -F '#{pane_at_right}' "" 'select-pane -R'
|
||||
bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' 'select-pane -L'
|
||||
bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' 'select-pane -D'
|
||||
bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' 'select-pane -U'
|
||||
bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-l' 'select-pane -R'
|
||||
|
||||
bind -n 'M-h' if-shell "$is_vim" 'send-keys M-h' 'resize-pane -L 1'
|
||||
bind -n 'M-j' if-shell "$is_vim" 'send-keys M-j' 'resize-pane -D 1'
|
||||
bind -n 'M-k' if-shell "$is_vim" 'send-keys M-k' 'resize-pane -U 1'
|
||||
bind -n 'M-l' if-shell "$is_vim" 'send-keys M-l' 'resize-pane -R 1'
|
||||
bind-key -T copy-mode-vi 'C-h' 'select-pane -L'
|
||||
bind-key -T copy-mode-vi 'C-j' 'select-pane -D'
|
||||
bind-key -T copy-mode-vi 'C-k' 'select-pane -U'
|
||||
bind-key -T copy-mode-vi 'C-l' 'select-pane -R'
|
||||
|
||||
bind-key -T copy-mode-vi M-h resize-pane -L 1
|
||||
bind-key -T copy-mode-vi M-j resize-pane -D 1
|
||||
bind-key -T copy-mode-vi M-k resize-pane -U 1
|
||||
bind-key -T copy-mode-vi M-l resize-pane -R 1
|
||||
'';
|
||||
bind -n 'M-h' if-shell "$is_vim" 'send-keys M-h' 'resize-pane -L 1'
|
||||
bind -n 'M-j' if-shell "$is_vim" 'send-keys M-j' 'resize-pane -D 1'
|
||||
bind -n 'M-k' if-shell "$is_vim" 'send-keys M-k' 'resize-pane -U 1'
|
||||
bind -n 'M-l' if-shell "$is_vim" 'send-keys M-l' 'resize-pane -R 1'
|
||||
|
||||
bind-key -T copy-mode-vi M-h resize-pane -L 1
|
||||
bind-key -T copy-mode-vi M-j resize-pane -D 1
|
||||
bind-key -T copy-mode-vi M-k resize-pane -U 1
|
||||
bind-key -T copy-mode-vi M-l resize-pane -R 1
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
_: {
|
||||
{ config, lib, ... }: lib.mkIf config.programs.zoxide.enable {
|
||||
programs = {
|
||||
zoxide = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
{ config, ... }: {
|
||||
{ config, lib, ... }: lib.mkIf config.programs.zsh.enable {
|
||||
programs = {
|
||||
zsh = {
|
||||
enable = true;
|
||||
defaultKeymap = "emacs";
|
||||
dotDir = ".config/zsh";
|
||||
shellAliases = {
|
||||
|
|
|
|||
Reference in New Issue