mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-04-23 17:28:33 +02:00
feat: simplify flake.nix
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
{ pkgs, ... }:
|
||||
|
||||
{pkgs, ...}:
|
||||
###########################################################
|
||||
#
|
||||
# Alacritty Configuration
|
||||
#
|
||||
#
|
||||
# Useful Hot Keys for macOS:
|
||||
# 1. Multi-Window: `command + N`
|
||||
# 2. Increase Font Size: `command + =` | `command + +`
|
||||
@@ -18,80 +17,84 @@
|
||||
# Note: Alacritty do not have support for Tabs, and any graphic protocol.
|
||||
#
|
||||
###########################################################
|
||||
|
||||
{
|
||||
programs.alacritty = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
xdg.configFile."alacritty/alacritty.yml".text = ''
|
||||
import:
|
||||
# all alacritty themes can be found at
|
||||
# https://github.com/alacritty/alacritty-theme
|
||||
- ~/.config/alacritty/theme_catppuccino.yml
|
||||
|
||||
window:
|
||||
# Background opacity
|
||||
#
|
||||
# Window opacity as a floating point number from `0.0` to `1.0`.
|
||||
# The value `0.0` is completely transparent and `1.0` is opaque.
|
||||
opacity: 0.95
|
||||
|
||||
# Startup Mode (changes require restart)
|
||||
#
|
||||
# Values for `startup_mode`:
|
||||
# - Windowed
|
||||
# - Maximized
|
||||
# - Fullscreen
|
||||
#
|
||||
# Values for `startup_mode` (macOS only):
|
||||
# - SimpleFullscreen
|
||||
startup_mode: Windowed
|
||||
|
||||
# Allow terminal applications to change Alacritty's window title.
|
||||
dynamic_title: true
|
||||
|
||||
# Make `Option` key behave as `Alt` (macOS only):
|
||||
# - OnlyLeft
|
||||
# - OnlyRight
|
||||
# - Both
|
||||
# - None (default)
|
||||
option_as_alt: Both
|
||||
|
||||
scrolling:
|
||||
# Maximum number of lines in the scrollback buffer.
|
||||
# Specifying '0' will disable scrolling.
|
||||
history: 10000
|
||||
|
||||
# Scrolling distance multiplier.
|
||||
#multiplier: 3
|
||||
|
||||
# Font configuration
|
||||
font:
|
||||
# Normal (roman) font face
|
||||
bold:
|
||||
family: JetBrainsMono Nerd Font
|
||||
italic:
|
||||
family: JetBrainsMono Nerd Font
|
||||
normal:
|
||||
family: JetBrainsMono Nerd Font
|
||||
bold_italic:
|
||||
# Font family
|
||||
#
|
||||
# If the bold italic family is not specified, it will fall back to the
|
||||
# value specified for the normal font.
|
||||
family: JetBrainsMono Nerd Font
|
||||
'' + (if pkgs.stdenv.isDarwin then ''
|
||||
# Point size
|
||||
size: 14
|
||||
shell: # force nushell as default shell on macOS
|
||||
program: /run/current-system/sw/bin/nu
|
||||
'' else ''
|
||||
# holder identation
|
||||
# Point size
|
||||
size: 13
|
||||
'');
|
||||
xdg.configFile."alacritty/alacritty.yml".text =
|
||||
''
|
||||
import:
|
||||
# all alacritty themes can be found at
|
||||
# https://github.com/alacritty/alacritty-theme
|
||||
- ~/.config/alacritty/theme_catppuccino.yml
|
||||
|
||||
window:
|
||||
# Background opacity
|
||||
#
|
||||
# Window opacity as a floating point number from `0.0` to `1.0`.
|
||||
# The value `0.0` is completely transparent and `1.0` is opaque.
|
||||
opacity: 0.95
|
||||
|
||||
# Startup Mode (changes require restart)
|
||||
#
|
||||
# Values for `startup_mode`:
|
||||
# - Windowed
|
||||
# - Maximized
|
||||
# - Fullscreen
|
||||
#
|
||||
# Values for `startup_mode` (macOS only):
|
||||
# - SimpleFullscreen
|
||||
startup_mode: Windowed
|
||||
|
||||
# Allow terminal applications to change Alacritty's window title.
|
||||
dynamic_title: true
|
||||
|
||||
# Make `Option` key behave as `Alt` (macOS only):
|
||||
# - OnlyLeft
|
||||
# - OnlyRight
|
||||
# - Both
|
||||
# - None (default)
|
||||
option_as_alt: Both
|
||||
|
||||
scrolling:
|
||||
# Maximum number of lines in the scrollback buffer.
|
||||
# Specifying '0' will disable scrolling.
|
||||
history: 10000
|
||||
|
||||
# Scrolling distance multiplier.
|
||||
#multiplier: 3
|
||||
|
||||
# Font configuration
|
||||
font:
|
||||
# Normal (roman) font face
|
||||
bold:
|
||||
family: JetBrainsMono Nerd Font
|
||||
italic:
|
||||
family: JetBrainsMono Nerd Font
|
||||
normal:
|
||||
family: JetBrainsMono Nerd Font
|
||||
bold_italic:
|
||||
# Font family
|
||||
#
|
||||
# If the bold italic family is not specified, it will fall back to the
|
||||
# value specified for the normal font.
|
||||
family: JetBrainsMono Nerd Font
|
||||
''
|
||||
+ (
|
||||
if pkgs.stdenv.isDarwin
|
||||
then ''
|
||||
# Point size
|
||||
size: 14
|
||||
shell: # force nushell as default shell on macOS
|
||||
program: /run/current-system/sw/bin/nu
|
||||
''
|
||||
else ''
|
||||
# holder identation
|
||||
# Point size
|
||||
size: 13
|
||||
''
|
||||
);
|
||||
|
||||
xdg.configFile."alacritty/theme_catppuccino.yml".source = ./theme_catppuccino.yml;
|
||||
}
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
{ ... }:
|
||||
{
|
||||
{...}: {
|
||||
imports = [
|
||||
./alacritty
|
||||
../server
|
||||
./neovim
|
||||
|
||||
|
||||
./development.nix
|
||||
./kitty.nix
|
||||
./media.nix
|
||||
./shell.nix
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
{ pkgs, pkgs-unstable, ... }:
|
||||
|
||||
{
|
||||
pkgs,
|
||||
pkgs-unstable,
|
||||
...
|
||||
}: {
|
||||
#############################################################
|
||||
#
|
||||
# Basic settings for development environment
|
||||
#
|
||||
#
|
||||
# Please avoid to install language specific packages here(globally),
|
||||
# instead, install them independently using dev-templates:
|
||||
# https://github.com/the-nix-way/dev-templates
|
||||
@@ -36,13 +38,14 @@
|
||||
gnumake # used by this repo, to simplify the deployment
|
||||
|
||||
# python
|
||||
(python311.withPackages (ps: with ps; [
|
||||
ipython
|
||||
pandas
|
||||
requests
|
||||
pyquery
|
||||
pyyaml
|
||||
]))
|
||||
(python311.withPackages (ps:
|
||||
with ps; [
|
||||
ipython
|
||||
pandas
|
||||
requests
|
||||
pyquery
|
||||
pyyaml
|
||||
]))
|
||||
|
||||
# db related
|
||||
dbeaver
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
{ lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
###########################################################
|
||||
#
|
||||
# Kitty Configuration
|
||||
#
|
||||
#
|
||||
# Useful Hot Keys for macOS:
|
||||
# 1. New Tab: `command + t`
|
||||
# 2. Close Tab: `command + w`
|
||||
@@ -28,20 +31,29 @@
|
||||
font = {
|
||||
name = "JetBrainsMono Nerd Font";
|
||||
# use different font size on macOS
|
||||
size = if pkgs.stdenv.isDarwin then 14 else 13;
|
||||
size =
|
||||
if pkgs.stdenv.isDarwin
|
||||
then 14
|
||||
else 13;
|
||||
};
|
||||
|
||||
settings = {
|
||||
background_opacity = "0.95";
|
||||
macos_option_as_alt = true; # Option key acts as Alt on macOS
|
||||
scrollback_lines = 10000;
|
||||
enable_audio_bell = false;
|
||||
} // (if pkgs.stdenv.isDarwin then {
|
||||
# macOS specific settings, force kitty to use nushell as default shell
|
||||
shell = "/run/current-system/sw/bin/nu";
|
||||
} else {});
|
||||
settings =
|
||||
{
|
||||
background_opacity = "0.95";
|
||||
macos_option_as_alt = true; # Option key acts as Alt on macOS
|
||||
scrollback_lines = 10000;
|
||||
enable_audio_bell = false;
|
||||
}
|
||||
// (
|
||||
if pkgs.stdenv.isDarwin
|
||||
then {
|
||||
# macOS specific settings, force kitty to use nushell as default shell
|
||||
shell = "/run/current-system/sw/bin/nu";
|
||||
}
|
||||
else {}
|
||||
);
|
||||
|
||||
# macOS specific settings
|
||||
darwinLaunchOptions = [ "--start-as=fullscreen" ];
|
||||
darwinLaunchOptions = ["--start-as=fullscreen"];
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{ pkgs
|
||||
, config
|
||||
, ...
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
# processing audio/video
|
||||
{
|
||||
@@ -8,7 +9,7 @@
|
||||
ffmpeg-full
|
||||
|
||||
# images
|
||||
viu # Terminal image viewer with native support for iTerm and Kitty
|
||||
viu # Terminal image viewer with native support for iTerm and Kitty
|
||||
imagemagick
|
||||
graphviz
|
||||
];
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
{ pkgs, astronvim, ... }:
|
||||
|
||||
{
|
||||
pkgs,
|
||||
astronvim,
|
||||
...
|
||||
}:
|
||||
###############################################################################
|
||||
#
|
||||
# AstroNvim's configuration and all its dependencies
|
||||
@@ -70,7 +73,7 @@
|
||||
#
|
||||
# Joining a Selection of Lines With Space: `:join`
|
||||
# Joining without spaces: `:join!`
|
||||
#
|
||||
#
|
||||
# Toggle text's case: `~`
|
||||
# Convert to uppercase: `U`
|
||||
# Convert to lowercase: `u`
|
||||
@@ -93,7 +96,7 @@
|
||||
"nvim" = {
|
||||
# update AstroNvim
|
||||
onChange = "${pkgs.neovim}/bin/nvim --headless +quitall";
|
||||
source = astronvim;
|
||||
source = astronvim;
|
||||
};
|
||||
# my cusotom astronvim config, astronvim will load it after base config
|
||||
# https://github.com/AstroNvim/AstroNvim/blob/v3.32.0/lua/astronvim/bootstrap.lua#L15-L16
|
||||
@@ -117,16 +120,15 @@
|
||||
|
||||
viAlias = false;
|
||||
vimAlias = true;
|
||||
|
||||
|
||||
withPython3 = true;
|
||||
withNodeJs = true;
|
||||
extraPackages = [];
|
||||
|
||||
# currently we use lazy.nvim as neovim's package manager, so comment this one.
|
||||
plugins = with pkgs.vimPlugins;[
|
||||
plugins = with pkgs.vimPlugins; [
|
||||
# search all the plugins using https://search.nixos.org/packages
|
||||
luasnip
|
||||
|
||||
];
|
||||
};
|
||||
};
|
||||
@@ -144,14 +146,14 @@
|
||||
|
||||
#-- python
|
||||
nodePackages.pyright # python language server
|
||||
python311Packages.black # python formatter
|
||||
python311Packages.black # python formatter
|
||||
python311Packages.ruff-lsp
|
||||
|
||||
|
||||
#-- rust
|
||||
rust-analyzer
|
||||
cargo # rust package manager
|
||||
cargo # rust package manager
|
||||
rustfmt
|
||||
|
||||
|
||||
#-- zig
|
||||
zls
|
||||
|
||||
@@ -159,18 +161,18 @@
|
||||
nil
|
||||
rnix-lsp
|
||||
# nixd
|
||||
statix # Lints and suggestions for the nix programming language
|
||||
deadnix # Find and remove unused code in .nix source files
|
||||
alejandra # Nix Code Formatter
|
||||
statix # Lints and suggestions for the nix programming language
|
||||
deadnix # Find and remove unused code in .nix source files
|
||||
alejandra # Nix Code Formatter
|
||||
|
||||
#-- golang
|
||||
go
|
||||
gomodifytags
|
||||
iferr # generate error handling code for go
|
||||
impl # generate function implementation for go
|
||||
gotools # contains tools like: godoc, goimports, etc.
|
||||
gopls # go language server
|
||||
delve # go debugger
|
||||
iferr # generate error handling code for go
|
||||
impl # generate function implementation for go
|
||||
gotools # contains tools like: godoc, goimports, etc.
|
||||
gopls # go language server
|
||||
delve # go debugger
|
||||
|
||||
#-- lua
|
||||
stylua
|
||||
@@ -180,7 +182,7 @@
|
||||
nodePackages.bash-language-server
|
||||
shellcheck
|
||||
shfmt
|
||||
|
||||
|
||||
#-- javascript/typescript --#
|
||||
nodePackages.typescript
|
||||
nodePackages.typescript-language-server
|
||||
@@ -194,26 +196,25 @@
|
||||
terraform-ls
|
||||
jsonnet
|
||||
jsonnet-language-server
|
||||
hadolint # Dockerfile linter
|
||||
hadolint # Dockerfile linter
|
||||
|
||||
#-- Others
|
||||
taplo # TOML language server / formatter / validator
|
||||
taplo # TOML language server / formatter / validator
|
||||
nodePackages.yaml-language-server
|
||||
sqlfluff # SQL linter
|
||||
actionlint # GitHub Actions linter
|
||||
buf # protoc plugin for linting and formatting
|
||||
proselint # English prose linter
|
||||
sqlfluff # SQL linter
|
||||
actionlint # GitHub Actions linter
|
||||
buf # protoc plugin for linting and formatting
|
||||
proselint # English prose linter
|
||||
|
||||
#-- Misc
|
||||
tree-sitter # common language parser/highlighter
|
||||
nodePackages.prettier # common code formatter
|
||||
marksman # language server for markdown
|
||||
glow # markdown previewer
|
||||
tree-sitter # common language parser/highlighter
|
||||
nodePackages.prettier # common code formatter
|
||||
marksman # language server for markdown
|
||||
glow # markdown previewer
|
||||
|
||||
#-- Optional Requirements:
|
||||
gdu # disk usage analyzer, required by AstroNvim
|
||||
ripgrep # fast search tool, required by AstroNvim's '<leader>fw'(<leader> is space key)
|
||||
gdu # disk usage analyzer, required by AstroNvim
|
||||
ripgrep # fast search tool, required by AstroNvim's '<leader>fw'(<leader> is space key)
|
||||
];
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
|
||||
{ ... }: {
|
||||
{...}: {
|
||||
programs.bash = {
|
||||
# load the alias file for work
|
||||
bashrcExtra = ''
|
||||
@@ -22,5 +21,4 @@
|
||||
source /etc/agenix/alias-for-work.nushell
|
||||
'';
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{ ... }: {
|
||||
{...}: {
|
||||
programs.bash = {
|
||||
enable = true;
|
||||
enableCompletion = true;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
{ ... }:
|
||||
{
|
||||
# a cat(1) clone with syntax highlighting and Git integration.
|
||||
{...}: {
|
||||
# a cat(1) clone with syntax highlighting and Git integration.
|
||||
programs.bat = {
|
||||
enable = true;
|
||||
config = {
|
||||
@@ -12,6 +11,4 @@
|
||||
Catppuccin-mocha = builtins.readFile ./Catppuccin-mocha.tmTheme;
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
{pkgs, ...}: {
|
||||
home.packages = with pkgs; [
|
||||
neofetch
|
||||
nnn # terminal file manager
|
||||
@@ -20,12 +18,12 @@
|
||||
# networking tools
|
||||
mtr # A network diagnostic tool
|
||||
iperf3
|
||||
dnsutils # `dig` + `nslookup`
|
||||
dnsutils # `dig` + `nslookup`
|
||||
ldns # replacement of `dig`, it provide the command `drill`
|
||||
aria2 # A lightweight multi-protocol & multi-source command-line download utility
|
||||
socat # replacement of openbsd-netcat
|
||||
nmap # A utility for network discovery and security auditing
|
||||
ipcalc # it is a calculator for the IPv4/v6 addresses
|
||||
ipcalc # it is a calculator for the IPv4/v6 addresses
|
||||
|
||||
# misc
|
||||
cowsay
|
||||
@@ -40,7 +38,7 @@
|
||||
gnupg
|
||||
|
||||
# nix related
|
||||
#
|
||||
#
|
||||
# it provides the command `nom` works just like `nix
|
||||
# with more details log output
|
||||
nix-output-monitor
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
{ ... }:
|
||||
{
|
||||
{...}: {
|
||||
imports = [
|
||||
./bat
|
||||
./nushell
|
||||
@@ -11,5 +10,4 @@
|
||||
./git.nix
|
||||
./starship.nix
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
{ config
|
||||
, lib
|
||||
, pkgs
|
||||
, ...
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
# `programs.git` will generate the config file: ~/.config/git/config
|
||||
# to make git use this config file, `~/.gitconfig` should not exist!
|
||||
#
|
||||
# https://git-scm.com/docs/git-config#Documentation/git-config.txt---global
|
||||
home.activation.removeExistingGitconfig = lib.hm.dag.entryBefore [ "checkLinkTargets" ] ''
|
||||
home.activation.removeExistingGitconfig = lib.hm.dag.entryBefore ["checkLinkTargets"] ''
|
||||
rm -f ~/.gitconfig
|
||||
'';
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
{ ... }: {
|
||||
{...}: {
|
||||
programs.nushell = {
|
||||
enable = true;
|
||||
configFile.source = ./config.nu;
|
||||
|
||||
# home-manager will merge the cotent in `environmentVariables` with the `envFile.source`
|
||||
# but basically, I set all environment variables via the shell-independent way, so I don't need to use those two options
|
||||
#
|
||||
#
|
||||
# envFile.source = ./env.nu;
|
||||
# environmentVariables = { FOO="bar"; };
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{ ... }: {
|
||||
{...}: {
|
||||
programs.starship = {
|
||||
enable = true;
|
||||
|
||||
|
||||
@@ -1,16 +1,13 @@
|
||||
{ pkgs, ... }:
|
||||
|
||||
let
|
||||
{pkgs, ...}: let
|
||||
buildTmuxPlugin = pkgs.tmuxPlugins.mkTmuxPlugin;
|
||||
in
|
||||
{
|
||||
in {
|
||||
draculaTheme = buildTmuxPlugin {
|
||||
pluginName = "dracula";
|
||||
version = "v2.2.0";
|
||||
src = builtins.fetchTarball {
|
||||
name = "dracula-tmux-v2.2.0";
|
||||
url = "https://github.com/dracula/tmux/archive/refs/tags/v2.2.0.tar.gz";
|
||||
name = "dracula-tmux-v2.2.0";
|
||||
url = "https://github.com/dracula/tmux/archive/refs/tags/v2.2.0.tar.gz";
|
||||
sha256 = "sha256:0v2k994yy4xx2iw8qxg7qphw46gq2qmg496i3a3h9b6jgwxqm7zn";
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,24 +1,25 @@
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
let
|
||||
plugins = pkgs.tmuxPlugins // pkgs.callPackage ./custom-plugins.nix {};
|
||||
in
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
plugins = pkgs.tmuxPlugins // pkgs.callPackage ./custom-plugins.nix {};
|
||||
in {
|
||||
programs.tmux = {
|
||||
enable = true;
|
||||
shell = "${pkgs.nushell}/bin/nu";
|
||||
|
||||
# Resize the window to the size of the smallest session for which it is the current window.
|
||||
#
|
||||
#
|
||||
aggressiveResize = true;
|
||||
|
||||
# https://github.com/tmux-plugins/tmux-sensible
|
||||
# tmux-sensible overwrites default tmux shortcuts, makes them more sane.
|
||||
sensibleOnTop = true;
|
||||
|
||||
|
||||
# extraConfig = builtins.readFile ./tmux.conf;
|
||||
# keyMode = "vi"; # default is emacs
|
||||
|
||||
|
||||
baseIndex = 1; # start index from 1
|
||||
escapeTime = 0; # do not wait for escape key
|
||||
terminal = "xterm-256color";
|
||||
@@ -31,8 +32,8 @@ in
|
||||
plugin = continuum;
|
||||
extraConfig = ''
|
||||
set -g @continuum-save-interval '15'
|
||||
|
||||
# Option to display current status of tmux continuum in tmux status line.
|
||||
|
||||
# Option to display current status of tmux continuum in tmux status line.
|
||||
set -g status-right 'Continuum status: #{continuum_status}'
|
||||
'';
|
||||
}
|
||||
@@ -41,7 +42,7 @@ in
|
||||
# Manually persists tmux environment across system restarts.
|
||||
# prefix + Ctrl-s - save
|
||||
# prefix + Ctrl-r - restore
|
||||
#
|
||||
#
|
||||
plugin = resurrect;
|
||||
# Restore Neovim sessions
|
||||
extraConfig = "set -g @resurrect-strategy-nvim 'session'";
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
{ ... }:
|
||||
|
||||
{
|
||||
{...}: {
|
||||
programs.zellij = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user