Add nix config

This commit is contained in:
Martin
2024-03-25 14:43:39 +01:00
parent 2cdf1bf701
commit a56014849a
14 changed files with 457 additions and 44 deletions

69
config/nix/common.nix Normal file
View File

@ -0,0 +1,69 @@
{ config, pkgs, ... }:
{
imports = [
./user/sh.nix
./user/tmux.nix
./user/git.nix
./user/dev.nix
];
home.packages = with pkgs; [
neovim
# # It is sometimes useful to fine-tune packages, for example, by applying
# # overrides. You can do that directly here, just don't forget the
# # parentheses. Maybe you want to install Nerd Fonts with a limited number of
# # fonts?
# (pkgs.nerdfonts.override { fonts = [ "FantasqueSansMono" ]; })
# # You can also create simple shell scripts directly inside your
# # configuration. For example, this adds a command 'my-hello' to your
# # environment:
# (pkgs.writeShellScriptBin "my-hello" ''
# echo "Hello, ${config.home.username}!"
# '')
];
# Home Manager is pretty good at managing dotfiles. The primary way to manage
# plain files is through 'home.file'.
home.file = {
# # Building this configuration will create a copy of 'dotfiles/screenrc' in
# # the Nix store. Activating the configuration will then make '~/.screenrc' a
# # symlink to the Nix store copy.
# ".screenrc".source = dotfiles/screenrc;
# # You can also set the file content immediately.
# ".gradle/gradle.properties".text = ''
# org.gradle.console=verbose
# org.gradle.daemon.idletimeout=3600000
# '';
};
# Home Manager can also manage your environment variables through
# 'home.sessionVariables'. If you don't want to manage your shell through Home
# Manager then you have to manually source 'hm-session-vars.sh' located at
# either
#
# ~/.nix-profile/etc/profile.d/hm-session-vars.sh
#
# or
#
# ~/.local/state/nix/profiles/profile/etc/profile.d/hm-session-vars.sh
#
# or
#
# /etc/profiles/per-user/moustachioed/etc/profile.d/hm-session-vars.sh
#
home.sessionVariables = {
EDITOR = "nvim";
};
home.shellAliases = {
vim = "nvim";
};
news.display = "silent";
programs.home-manager.enable = true;
}

48
config/nix/flake.lock generated Normal file
View File

@ -0,0 +1,48 @@
{
"nodes": {
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1711133180,
"narHash": "sha256-WJOahf+6115+GMl3wUfURu8fszuNeJLv9qAWFQl3Vmo=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "1c2c5e4cabba4c43504ef0f8cc3f3dfa284e2dbb",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1711163522,
"narHash": "sha256-YN/Ciidm+A0fmJPWlHBGvVkcarYWSC+s3NTPk/P+q3c=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "44d0940ea560dee511026a53f0e2e2cde489b4d4",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"home-manager": "home-manager",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

38
config/nix/flake.nix Normal file
View File

@ -0,0 +1,38 @@
{
description = "Home Manager configuration of moustachioed";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { nixpkgs, home-manager, ... }:
let
system = "x86_64-darwin";
pkgs = nixpkgs.legacyPackages.${system};
in {
homeConfigurations = {
"moustachioed" = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = [
./user/profiles/moustachioedBook.nix
./common.nix
./user/task.nix
];
};
"work" = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = [
./user/profiles/work.nix
./common.nix
./user/task.nix
];
};
};
};
}

11
config/nix/user/dev.nix Normal file
View File

@ -0,0 +1,11 @@
{ config, pkgs, ... }:
{
programs.direnv = {
enable = true;
enableZshIntegration = true;
nix-direnv.enable = true;
};
programs.ripgrep.enable = true;
}

27
config/nix/user/git.nix Normal file
View File

@ -0,0 +1,27 @@
{ config, pkgs, ... }:
{
programs.git = {
enable = true;
aliases = {
st = "status";
ci = "commit";
co = "checkout";
br = "branch";
pl = "pull";
ps = "push";
mno =" merge --no-ff";
lg = "log --color --graph --pretty=format:'%cred%h%creset -%c(yellow)%d%creset %s %cgreen(%cr)%c(bold blue)<%an>%creset' --abbrev-commit";
};
difftastic.enable = true;
extraConfig = {
core = {
editor = "nvim";
};
push.default = "matching";
};
};
}

View File

@ -0,0 +1,13 @@
{ config, pkgs, ... }:
{
home.username = "moustachioed";
home.homeDirectory = "/Users/moustachioed";
home.stateVersion = "23.11"; # Please read the comment before changing.
programs.git = {
userName = "Martin";
userEmail = "git@pander-on.de";
};
}

View File

@ -0,0 +1,13 @@
{ config, pkgs, ... }:
{
home.username = "moustachioed";
home.homeDirectory = "/Users/moustachioed";
home.stateVersion = "23.11"; # Please read the comment before changing.
programs.git = {
userName = "Martin Pander";
userEmail = "martin.pander@knowtion.de";
};
}

73
config/nix/user/sh.nix Normal file
View File

@ -0,0 +1,73 @@
{ config, pkgs, ... }:
{
programs.zsh = {
enable = true;
enableCompletion = true;
autosuggestion.enable = true;
syntaxHighlighting.enable = true;
history.size = 500000;
#history.path = "${config.xdg.dataHome}/zsh/history";
prezto = {
enable = true;
caseSensitive = true;
color = true;
editor = {
dotExpansion = true;
keymap = "vi";
};
pmodules = [
"environment"
"terminal"
"editor"
"history"
"directory"
"spectrum"
"utility"
"completion"
"syntax-highlighting"
"history-substring-search"
"prompt"
"git"
];
prompt.theme = "minimal";
syntaxHighlighting.highlighters = [
"main"
"brackets"
"pattern"
"line"
"cursor"
"root"
];
tmux = {
autoStartLocal = true;
itermIntegration = true;
};
};
initExtra = ''
HISTCONTROL='erasedups:ignoreboth'
HISTIGNORE='&:[ ]*:exit:ls:bg:fg:history:clear'
unsetopt beep
'';
};
programs.fzf = {
enable = true;
enableZshIntegration = true;
};
programs.lsd = {
enable = true;
enableAliases = true;
};
programs.bat.enable = true;
programs.ripgrep.enable = true;
home.packages = with pkgs; [
du-dust
#nerdfonts
];
}

16
config/nix/user/task.nix Normal file
View File

@ -0,0 +1,16 @@
{config, pkgs, ...}:
{
programs.taskwarrior = {
enable = true;
};
home.packages = with pkgs; [
taskwarrior-tui
];
home.shellAliases = {
t = "task";
tt = "taskwarrior-tui";
};
}

58
config/nix/user/tmux.nix Normal file
View File

@ -0,0 +1,58 @@
{ config, pkgs, ... }:
{
programs.tmux = {
enable = true;
shortcut = "a";
mouse = true;
keyMode = "vi";
escapeTime = 0;
extraConfig = ''
set -g display-time 1500
unbind S
bind S command-prompt "switch -t %1"
bind-key -n M-K switch-client -p
bind-key -n M-J switch-client -n
bind-key -n M-L next-window
bind-key -n M-H previous-window
bind '"' split-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
bind c new-window -a -c "#{pane_current_path}"
#######################################
# status line
#######################################
set -g status-justify centre
set -g status-left "#[bg=#808080,fg=#ffffff,bold] #S #[default]#[bg=#BCBCBC] #{-30:pane_title} "
set -g status-left-length 40
set -g status-right "#[bg=#BCBCBC] %H:%M #[bg=#808080,fg=#ffffff] %d.%m.%y "
# setw -g window-status-format " #W#F "
# setw -g window-status-current-format " #W#F "
setw -g window-status-format " #W "
setw -g window-status-current-format " #W "
setw -g window-status-separator ""
#######################################
# colors, taken from vim-lucius
#######################################
set -g status-style "bg=#DADADA,fg=#000000"
setw -g window-status-style "bg=#BCBCBC,fg=#000000"
setw -g window-status-current-style "bg=#808080,fg=#ffffff"
setw -g window-status-activity-style "bg=#AFD7AF,fg=#000000"
setw -g window-status-bell-style "bg=#AFD7AF,fg=#000000"
#setw -g window-status-content-style "bg=#AFD7AF,fg=#000000"
set -g pane-active-border-style "bg=#eeeeee,fg=#006699"
set -g pane-border-style "bg=#eeeeee,fg=#999999"
'';
};
}

View File

@ -152,13 +152,13 @@ zstyle ':prezto:module:syntax-highlighting' highlighters \
#
# Auto start a session when Zsh is launched in a local terminal.
# zstyle ':prezto:module:tmux:auto-start' local 'yes'
zstyle ':prezto:module:tmux:auto-start' local 'yes'
# Auto start a session when Zsh is launched in a SSH connection.
# zstyle ':prezto:module:tmux:auto-start' remote 'yes'
zstyle ':prezto:module:tmux:auto-start' remote 'yes'
# Integrate with iTerm2.
# zstyle ':prezto:module:tmux:iterm' integrate 'yes'
zstyle ':prezto:module:tmux:iterm' integrate 'yes'
#
# Completion

View File

@ -41,6 +41,6 @@ export PATH="$HOME/bin:/usr/local/bin:$PATH"
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
unalias rm
alias open='nautilus . &'
#alias open='nautilus . &'
export OPENAI_API_KEY=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