Changes
32 changed files (+1061/-799)
-
essentials/default.nix (deleted)
-
@@ -1,25 +0,0 @@# Essential modules: every machine should include this module. # Should covers everything from admin task to daily usages. # Other modules assumes this is included. { catppuccinTheme }: { ... }: { xdg = { enable = true; }; imports = [ ( import ./tools.nix { inherit catppuccinTheme; } ) ( import ./neovim.nix { inherit catppuccinTheme; } ) ( import ./tmux.nix { inherit catppuccinTheme; } ) ./zsh.nix ]; }
-
-
essentials/neovim.nix (deleted)
-
@@ -1,83 +0,0 @@{ catppuccinTheme }: { config , pkgs , ... }: { programs = { neovim = { enable = true; defaultEditor = true; extraLuaConfig = '' -- Display absolute line numbers vim.wo.number = true -- Disable insane mouse hijacking vim.opt.mouse = "" ''; plugins = with pkgs.vimPlugins; [ { plugin = nvim-tree-lua; type = "lua"; config = '' vim.g.loaded_netrw = 1 vim.g.loaded_netrwPlugin = 1 require("nvim-tree").setup({ renderer = { icons = { show = { file = false, folder = false, folder_arrow = false, git = false, modified = false, }, }, }, filters = { custom = { -- Fossil checkout state file "^\\.fslckout", }, }, }) ''; } { plugin = indent-blankline-nvim; type = "lua"; config = '' require("indent_blankline").setup({ -- Without those set, the plugin displays fake indentation char_blankline = "", space_char_blankline = "", }) ''; } { plugin = catppuccin-nvim; type = "lua"; config = '' vim.o.termguicolors = true require("catppuccin").setup({ flavour = "${catppuccinTheme}", transparent_background = true, integrations = { indent_blankline = { enabled = true, }, cmp = true, lsp_trouble = true, }, }) vim.cmd.colorscheme "catppuccin" ''; } ]; }; }; }
-
-
-
@@ -1,11 +1,6 @@{ catppuccinTheme }: { config , pkgs , ... }: { { config, pkgs, ... }: { programs = { tmux = { enable = true; keyMode = "vi"; # Ctrl+t
-
@@ -26,17 +21,6 @@ # NOTE: Without this, there will be a lag after hitting ESC (e.g. exiting insert mode)# https://github.com/neovim/neovim/wiki/FAQ#esc-in-tmux-or-gnu-screen-is-delayed escapeTime = 10; plugins = [ { plugin = pkgs.tmuxPlugins.catppuccin; extraConfig = '' set -g @plugin 'catppuccin/tmux' set -g @catppuccin_flavour '${catppuccinTheme}' set -g @catppuccin_no_patched_fonts_theme_enabled on ''; } ]; # True Color options: # https://gist.github.com/andersevenrud/015e61af2fd264371032763d4ed965b6 extraConfig = ''
-
@@ -64,3 +48,4 @@ '';}; }; }
-
-
essentials/tools.nix (deleted)
-
@@ -1,102 +0,0 @@{ catppuccinTheme }: { config , pkgs , ... }: { home.packages = [ # Must-have networking CLI tool # https://curl.se/ pkgs.curl # A generator for LS_COLORS with support for multiple color themes # https://github.com/sharkdp/vivid pkgs.vivid ]; # Programs available via Home Manager programs = { zsh = { # Colourise exa, ls, lf, etc... # This needs to be done in .zshrc: in Crostini, `home.sessionVariables` # cannot invoke `vivid` binary. Probably evaluation timing? initExtra = '' export LS_COLORS="$(vivid generate catppuccin-${catppuccinTheme})" ''; }; # A modern replacement for ls. # https://the.exa.website/ exa = { enable = true; # Whether to enable recommended exa aliases (ls, ll…). enableAliases = true; extraOptions = [ "--long" "--all" ]; }; # A terminal file manager written in Go with a heavy inspiration from ranger file manager. # https://github.com/gokcehan/lf lf = let # Linux: xdg-open # macOS: open openCommand = if pkgs.stdenv.isLinux then "xdg-open" else "open"; in { enable = true; commands = { # Open text files with nvim open = '' ''${{ case $(file --mime-type -Lb $f) in text/*) nvim $fx;; *) for f in $fx; do ${openCommand} $f > /dev/null 2> /dev/null & done;; esac }} ''; }; }; # JSON view/query tool # https://github.com/jqlang/jq jq = { enable = true; }; # Colourful `cat` # https://github.com/sharkdp/bat bat = { enable = true; themes = { "catppuccin-${catppuccinTheme}" = builtins.readFile ( pkgs.fetchFromGitHub { owner = "catppuccin"; repo = "bat"; rev = "ba4d16880d63e656acced2b7d4e034e4a93f74b1"; sha256 = "1g2r6j33f4zys853i1c5gnwcdbwb6xv5w6pazfdslxf69904lrg9"; } + "/Catppuccin-${catppuccinTheme}.tmTheme" ); }; config = { theme = "catppuccin-${catppuccinTheme}"; }; }; # `top` alternative # https://htop.dev/ htop = { enable = true; }; }; }
-
-
essentials/zsh.nix (deleted)
-
@@ -1,70 +0,0 @@{ config , pkgs , ... }: { programs = { zsh = { enable = true; # The default base keymap to use. defaultKeymap = "viins"; # Enable zsh completion. Don’t forget to add enableCompletion = true; # Options related to commands history configuration. history = { # Do not enter command lines into the history list if they are duplicates of the previous event. ignoreDups = true; # Save timestamp into the history file. extended = true; # Number of history lines to keep. size = 1000; }; initExtra = '' # Activate colors module in order to colourise prompt autoload -Uz colors colors # Branch character (for readability) CH_BRANCH=$'\ue0a0' function custom-prompt() { echo -e " %f%k%b''${1}%1d ''${vcs_info_msg_0_}%k%f%b %{$fg[black]%}%# %{$fg_no_bold[white]%}" } # VCS autoload -Uz vcs_info precmd () { vcs_info } zstyle ":vcs_info:git:*" check-for-changes true zstyle ":vcs_info:git:*" stagedstr "%{$fg[green]%}*" zstyle ":vcs_info:git:*" unstagedstr "%{$fg[red]%}*" zstyle ":vcs_info:*" formats "%{$fg[white]%}''${CH_BRANCH} %b%c%u%{$fg[white]%}" zstyle ":vcs_info:*" actionformats "[%b|%a]" function zle-line-init zle-keymap-select { case $KEYMAP in vicmd) PROMPT=$(custom-prompt "%{$fg[green]%}") ;; main|viins) PROMPT=$(custom-prompt "%{$fg[blue]%}") ;; esac zle reset-prompt } zle -N zle-line-init zle -N zle-keymap-select ''; }; }; }
-
-
-
@@ -0,0 +1,84 @@{ config, lib, pkgs, ... }: { imports = [ ./platform.nix ./neovim.nix ./tmux.nix ./zsh.nix ]; config = { home.packages = [ # Must-have networking CLI tool # https://curl.se/ pkgs.curl ]; # Programs available via Home Manager programs = { # For fallback purpose. bash = { enable = true; }; # A modern replacement for ls. # https://the.exa.website/ exa = { enable = true; # Whether to enable recommended exa aliases (ls, ll…). enableAliases = true; extraOptions = [ "--long" "--all" ]; }; # A terminal file manager written in Go with a heavy inspiration from ranger file manager. # https://github.com/gokcehan/lf lf = let # Linux: xdg-open # macOS: open openCommand = if pkgs.stdenv.isLinux then "xdg-open" else "open"; in { enable = true; commands = { # Open text files with nvim open = '' ''${{ case $(file --mime-type -Lb $f) in text/*) nvim $fx;; *) for f in $fx; do ${openCommand} $f > /dev/null 2> /dev/null & done;; esac }} ''; }; }; # JSON view/query tool # https://github.com/jqlang/jq jq = { enable = true; }; # Colourful `cat` # https://github.com/sharkdp/bat bat = { enable = true; }; # `top` alternative # https://htop.dev/ htop = { enable = true; }; }; }; }
-
-
-
@@ -0,0 +1,61 @@{ config, pkgs, ... }: { config = { programs = { neovim = { enable = true; defaultEditor = true; extraLuaConfig = '' -- Display absolute line numbers vim.wo.number = true -- Disable insane mouse hijacking vim.opt.mouse = "" ''; plugins = with pkgs.vimPlugins; [ { plugin = nvim-tree-lua; type = "lua"; config = '' vim.g.loaded_netrw = 1 vim.g.loaded_netrwPlugin = 1 require("nvim-tree").setup({ renderer = { icons = { show = { file = false, folder = false, folder_arrow = false, git = false, modified = false, }, }, }, filters = { custom = { -- Fossil checkout state file "^\\.fslckout", }, }, }) ''; } { plugin = indent-blankline-nvim; type = "lua"; config = '' require("indent_blankline").setup({ -- Without those set, the plugin displays fake indentation char_blankline = "", space_char_blankline = "", }) ''; } ]; }; }; }; }
-
-
-
@@ -0,0 +1,26 @@# Platform specifc configurations { config, lib, pkgs, ... }: { config = { # https://github.com/NixOS/nix/issues/3616 # Every macOS updates overwrite /etc/zshrc and that breaks Nix initialisation. # This is a workaround for it so that I no longer need to manually edit the file. # https://github.com/NixOS/nix/issues/3616#issuecomment-1655785404 programs.zsh = lib.mkIf (pkgs.stdenv.isDarwin && config.programs.zsh.enable) { initExtraFirst = '' if [[ ! $(command -v nix) && -e "/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh" ]]; then source "/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh" fi ''; }; xdg = lib.mkIf pkgs.stdenv.isLinux { enable = true; }; # I'm not sure this changes behaviour in a meaningful way. targets.genericLinux = lib.mkIf pkgs.stdenv.isLinux { enable = true; }; }; }
-
-
features/basics/zsh.nix (new)
-
@@ -0,0 +1,119 @@{ config , lib , pkgs , ... }: let cfg = config.features.basics.zsh; in { options = { features.basics.zsh.theme = { text = lib.mkOption { type = lib.types.nonEmptyStr; default = "%{$fg[white]%}"; }; vi.insert = lib.mkOption { type = lib.types.nonEmptyStr; default = "%{$fg[blue]%}"; }; vi.normal = lib.mkOption { type = lib.types.nonEmptyStr; default = "%{$fg[green]%}"; }; vcs = { info = lib.mkOption { type = lib.types.nonEmptyStr; default = "%{$fg[white]%}"; }; staged = lib.mkOption { type = lib.types.nonEmptyStr; default = "%{$fg[green]%}"; }; unstaged = lib.mkOption { type = lib.types.nonEmptyStr; default = "%{$fg[red]%}"; }; }; symbol = lib.mkOption { type = lib.types.nonEmptyStr; default = "%{$fg[black]%}"; }; }; }; config = { programs = { zsh = { enable = true; # The default base keymap to use. defaultKeymap = "viins"; # Enable zsh completion. Don’t forget to add enableCompletion = true; # Options related to commands history configuration. history = { # Do not enter command lines into the history list if they are duplicates of the previous event. ignoreDups = true; # Save timestamp into the history file. extended = true; # Number of history lines to keep. size = 1000; }; initExtra = with cfg.theme; '' # Activate colors module in order to colourise prompt autoload -Uz colors colors # Branch character (for readability) CH_BRANCH=$'\ue0a0' function custom-prompt() { echo -e " %f%k%b''${1}%1d ''${vcs_info_msg_0_}%k%f%b ${symbol}%# ${text}" } # VCS autoload -Uz vcs_info precmd () { vcs_info } zstyle ":vcs_info:git:*" check-for-changes true zstyle ":vcs_info:git:*" stagedstr "${vcs.staged}*" zstyle ":vcs_info:git:*" unstagedstr "${vcs.unstaged}*" zstyle ":vcs_info:*" formats "${vcs.info}''${CH_BRANCH} %b%c%u${text}" zstyle ":vcs_info:*" actionformats "[%b|%a]" function zle-line-init zle-keymap-select { case $KEYMAP in vicmd) PROMPT=$(custom-prompt "${vi.normal}") ;; main|viins) PROMPT=$(custom-prompt "${vi.insert}") ;; esac zle reset-prompt } zle -N zle-line-init zle -N zle-keymap-select ''; }; }; }; }
-
-
features/default.nix (new)
-
@@ -0,0 +1,11 @@{ imports = [ ./home ./scm ./identity ./basics ./gui ./wayland-de ./dev ]; }
-
-
features/dev/default.nix (new)
-
@@ -0,0 +1,23 @@# Development related configurations { config, lib, ... }: let cfg = config.features.dev; in { options = { features.dev = { enable = lib.mkEnableOption "Development"; }; }; imports = [ ./lsp.nix ]; config = { # Runtime Executor (asdf-plugin compatible) # https://github.com/jdxcode/rtx programs.rtx = lib.mkIf cfg.enable { enable = true; }; }; }
-
-
features/dev/lsp.nix (new)
-
@@ -0,0 +1,204 @@{ config, lib, pkgs, ... }: let cfg = config.features.dev.lsp; ls = lib.types.submodule { options = { name = lib.mkOption { type = lib.types.nonEmptyStr; description = "Language Server Name"; }; rootDirPattern = lib.mkOption { type = lib.types.nullOr lib.types.nonEmptyStr; default = null; }; singleFileSupport = lib.mkOption { type = lib.types.bool; default = false; }; }; }; lsToSetupStmt = c: let rootDir = if (c.rootDirPattern != null) then "root_dir = lspconfig.util.root_pattern('${c.rootDirPattern}')," else ""; in '' lspconfig.${c.name}.setup { ${rootDir} single_file_support = ${if c.singleFileSupport then "true" else "false"}, capabilities = capabilities, } ''; in { options = { features.dev.lsp = { enable = lib.mkEnableOption "LSP"; langs = lib.mkOption { type = lib.types.listOf ls; default = [ ]; }; elm = lib.mkOption { type = ls; default = { name = "elmls"; }; }; typescript = lib.mkOption { type = ls; default = { name = "tsserver"; rootDirPattern = "tsconfig.json"; }; }; deno = lib.mkOption { type = ls; default = { name = "denols"; rootDirPattern = "deno.json"; }; }; css = lib.mkOption { type = ls; default = { name = "cssls"; singleFileSupport = true; }; }; html = lib.mkOption { type = ls; default = { name = "html"; singleFileSupport = true; }; }; }; }; config = { programs = lib.mkIf (config.features.dev.enable && cfg.enable) { neovim = lib.mkIf config.programs.neovim.enable { plugins = with pkgs.vimPlugins; [ { plugin = cmp-nvim-lsp; } { plugin = nvim-lspconfig; type = "lua"; config = builtins.concatStringsSep "\n" ( [ '' -- Based on https://github.com/neovim/nvim-lspconfig#suggested-configuration local capabilities = require("cmp_nvim_lsp").default_capabilities() local lspconfig = require("lspconfig") '' ] ++ (builtins.map lsToSetupStmt cfg.langs) ++ [ '' -- LSP key mappings vim.api.nvim_create_autocmd("LspAttach", { group = vim.api.nvim_create_augroup("UserLspConfig", {}), callback = function(ev) local opts = { buffer = ev.buf } vim.keymap.set("n", "K", vim.lsp.buf.hover, opts) end, }) -- Hover style vim.lsp.handlers["textDocument/hover"] = vim.lsp.with( vim.lsp.handlers.hover, { border = "single", } ) '' ] ); } { plugin = nvim-cmp; type = "lua"; config = '' local cmp = require("cmp") cmp.setup({ window = { completion = cmp.config.window.bordered(), documentation = cmp.config.window.bordered(), }, mapping = cmp.mapping.preset.insert({ ["<CR>"] = cmp.mapping.confirm { behavior = cmp.ConfirmBehavior.Replace, select = true, }, ["<Tab>"] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_next_item() return end fallback() end, { "i", "s" }), ["<S-Tab>"] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_prev_item() return end fallback() end, { "i", "s" }), }), sources = { { name = "nvim_lsp" } }, }) ''; } { plugin = trouble-nvim; type = "lua"; config = '' require("trouble").setup({ icons = false, mode = "document_diagnostics", auto_open = true, auto_close = true, signs = { error = "error", warning = "warn", hint = "hint", information = "info" }, }) ''; } ]; }; }; }; }
-
-
features/gui/default.nix (new)
-
@@ -0,0 +1,10 @@{ config, lib, ... }: { options = { features.gui.enable = lib.mkEnableOption "GUI"; }; imports = [ ./kitty.nix ]; }
-
-
features/gui/kitty.nix (new)
-
@@ -0,0 +1,57 @@# The fast, feature-rich, GPU based terminal emulator # https://sw.kovidgoyal.net/kitty/ { config, lib, ... }: { config = { programs = let in { kitty = lib.mkIf config.features.gui.enable { enable = lib.mkDefault true; font = { name = "Dank Mono"; size = 16; }; # Kitty's customisability is top-notch. keybindings = { "kitty_mod+t" = "new_tab_with_cwd"; "kitty_mod+n" = "new_window_with_cwd"; "kitty_mod+r" = "start_resizing_window"; "kitty_mod+s" = "swap_with_window"; "kitty_mod+f" = "focus_visible_window"; "kitty_mod+k" = "neighboring_window top"; "kitty_mod+h" = "neighboring_window left"; "kitty_mod+j" = "neighboring_window down"; "kitty_mod+l" = "neighboring_window right"; "kitty_mod+a" = "next_layout"; }; settings = { # Bell enable_audio_bell = false; # Background background_opacity = "0.9"; # Layouts enabled_layouts = "fat,tall,grid,horizontal,vertical,splits"; # Tabs tab_bar_edge = "top"; tab_bar_style = "powerline"; }; shellIntegration = { enableBashIntegration = true; enableZshIntegration = true; }; }; }; }; }
-
-
-
@@ -0,0 +1,48 @@# Home Manager stuffs { pkgs, lib, config, ... }: let cfg = config.features.home; in { options.features.home = { username = lib.mkOption { type = lib.types.nonEmptyStr; description = '' System user name used to login to the machine. ''; }; timezone = lib.mkOption { type = lib.types.nullOr lib.types.nonEmptyStr; default = null; description = '' Machine's timezone. Ideally this should be a mutable machine state considering it being variable property. However, in some environment or program couldn't pick up the value without explicitly specifiying in Nix config. This is to make very sure everything works. ''; }; }; config = let homeDir = if pkgs.stdenv.isDarwin then "/Users" else "/home"; username = cfg.username; in { home = { inherit username; homeDirectory = "${homeDir}/${username}"; sessionVariables = lib.mkIf (cfg.timezone != null) { TZ = cfg.timezone; }; }; }; }
-
-
-
@@ -0,0 +1,65 @@{ lib, pkgs, config, ... }: let cfg = config.features.identity; in { options = { features.identity = { name = lib.mkOption { type = lib.types.nullOr lib.types.nonEmptyStr; default = null; description = '' Your name, prefebly publicly distinguishable. ''; }; email = lib.mkOption { type = lib.types.nullOr lib.types.nonEmptyStr; default = null; description = '' Email address. ''; }; gpgSigningKeyId = lib.mkOption { type = lib.types.nullOr lib.types.nonEmptyStr; default = null; description = '' A key ID of a signing key (primary or subkey). This is a **key ID**, which is visible to public. Do not put key signature here. ''; }; }; }; config = { programs = { gpg = { enable = cfg.gpgSigningKeyId != null; }; }; services.gpg-agent = { enable = cfg.gpgSigningKeyId != null && pkgs.stdenv.isLinux; enableZshIntegration = config.programs.zsh.enable; # 1day defaultCacheTtl = 86400; defaultCacheTtlSsh = 86400; # 30days maxCacheTtl = 2592000; maxCacheTtlSsh = 2592000; pinentryFlavor = "curses"; }; }; }
-
-
features/scm/default.nix (new)
-
@@ -0,0 +1,56 @@{ pkgs, lib, config, ... }: let cfg = config.features.scm; in { options = { features.scm = { enable = lib.mkEnableOption "SCM"; }; }; config = lib.mkIf cfg.enable { programs.git = { enable = true; userName = config.features.identity.name; userEmail = config.features.identity.email; signing = if (config.features.identity.gpgSigningKeyId != null) then { key = config.features.identity.gpgSigningKeyId; signByDefault = true; } else null; extraConfig = { core = { editor = if config.programs.neovim.enable then "nvim" else "vim"; }; init = { defaultBranch = "master"; }; }; ignores = let # Swap file nvim = if config.programs.neovim.enable then [ ".*.swp" ] else [ ]; # https://github.com/github/gitignore/blob/main/Global/macOS.gitignore darwin = if pkgs.stdenv.isDarwin then [ ".DS_Store" ".AppleDouble" ".LSOverride" "Icon" ] else [ ]; in nvim ++ darwin; }; home.packages = [ pkgs.fossil ]; }; }
-
-
-
@@ -0,0 +1,11 @@# Wayland Desktop Environment { lib, ... }: { options = { features.wayland-de.enable = lib.mkEnableOption "WaylandDE"; }; imports = [ ./foot.nix ]; }
-
-
-
@@ -0,0 +1,42 @@{ config, lib, pkgs, ... }: { programs = lib.mkIf config.features.wayland-de.enable { zsh = { # Let Zsh tell Foot a current working directory # https://codeberg.org/dnkl/foot/wiki#user-content-spawning-new-terminal-instances-in-the-current-working-directory initExtra = '' function osc7-pwd() { emulate -L zsh # also sets localoptions for us setopt extendedglob local LC_ALL=C printf '\e]7;file://%s%s\e\' $HOST ''${PWD//(#m)([^@-Za-z&-;_~])/%''${(l:2::0:)$(([##16]#MATCH))}} } function chpwd-osc7-pwd() { (( ZSH_SUBSHELL )) || osc7-pwd } autoload -Uz add-zsh-hook add-zsh-hook -Uz chpwd chpwd-osc7-pwd ''; }; # A fast, lightweight and minimalistic Wayland terminal emulator # https://codeberg.org/dnkl/foot foot = { enable = true; server.enable = true; settings = { main = { font = "monospace:size=10"; }; colors = { alpha = 0.9; }; }; }; }; }
-
-
-
@@ -17,71 +17,64 @@ , home-manager, }: let # Catppuccin pallet, one of: "latte", "frappe", "macchiato", "mocha" catppuccinTheme = "mocha"; # Pre-defined modules mods = { essentials = import ./essentials { inherit catppuccinTheme; }; scm = import ./scm { username = "Shota FUJI"; email = "pockawoooh@gmail.com"; gpgKeyId = "5E5148973E291363"; }; wayland-de = import ./wayland-de { inherit catppuccinTheme; }; webdev = ./webdev; macos = import ./macos { inherit catppuccinTheme; }; }; mkHomeConfiguration = { # Platform (e.g. x86_64-linux) system , # OS username username , # Modules to include modules ? [ mods.essentials ] , # Timezone of the machine timezone ? "Asia/Tokyo" , , # Machine specific module setting module ? { } , # Color theme theme ? ./themes/catppuccin }: let isDarwin = (builtins.match ".*-darwin$" system) != null; homeDir = if isDarwin then "/Users" else "/home"; in home-manager.lib.homeManagerConfiguration { home-manager.lib.homeManagerConfiguration rec { pkgs = nixpkgs.legacyPackages.${system}; modules = [ { home = rec { inherit username; homeDirectory = "${homeDir}/${username}"; stateVersion = "23.11"; sessionVariables = { TZ = timezone; }; }; ./features ({ config, ... }: { # Turn off Home Manager news bs news.display = "silent"; } ] ++ modules; home.stateVersion = "23.11"; # One of: "latte", "frappe", "macchiato", "mocha" themes.catppuccin.flavor = "mocha"; features = nixpkgs.lib.mkDefault { identity = { name = "Shota FUJI"; email = "pockawoooh@gmail.com"; gpgSigningKeyId = "5E5148973E291363"; }; scm.enable = true; home = { username = "pocka"; timezone = "Asia/Tokyo"; }; dev = { enable = true; lsp = { enable = true; langs = with config.features.dev.lsp; [ elm typescript deno css html ]; }; }; }; }) module theme ]; }; availableSystems = [
-
@@ -93,43 +86,36 @@ {homeConfigurations = { dev-linux = mkHomeConfiguration { system = "x86_64-linux"; username = "pocka"; modules = [ mods.essentials mods.scm mods.webdev mods.wayland-de ]; module = { features.wayland-de.enable = true; }; }; pixelbook = mkHomeConfiguration { system = "x86_64-linux"; username = "pockawoooh"; modules = [ mods.essentials mods.scm mods.webdev ]; module = { features.home.username = "pockawoooh"; # ChromeOS has neither tiling wm nor useful terminal emulator programs.tmux.enable = true; }; }; scm-server = mkHomeConfiguration { system = "x86_64-linux"; username = "pocka"; modules = [ mods.essentials mods.scm ]; module = { # Basically controlled over SSH programs.tmux.enable = true; features.dev.enable = false; }; }; mbp-m1 = mkHomeConfiguration { system = "aarch64-darwin"; username = "pocka"; modules = [ mods.essentials mods.scm mods.webdev mods.macos ]; module = { features.gui.enable = true; }; }; };
-
-
macos/default.nix (deleted)
-
@@ -1,7 +0,0 @@# macOS specific configurations. { catppuccinTheme }: { imports = [ ./os-update-workaround.nix (import ./kitty.nix { inherit catppuccinTheme; }) ]; }
-
-
macos/kitty.nix (deleted)
-
@@ -1,69 +0,0 @@{ catppuccinTheme }: { pkgs , lib , ... }: { programs = let # Convert the input string's first character to upper case. # Example: "foo" -> "Foo" toCapital = with lib; str: let len = builtins.stringLength str; head = strings.toUpper (builtins.substring 0 1 str); tail = builtins.substring 1 (len - 1) str; in head + tail; in { # The fast, feature-rich, GPU based terminal emulator # https://sw.kovidgoyal.net/kitty/ kitty = { enable = true; font = { name = "Dank Mono"; size = 16; }; # Kitty's customisability is top-notch. keybindings = { "kitty_mod+t" = "new_tab_with_cwd"; "kitty_mod+n" = "new_window_with_cwd"; "kitty_mod+r" = "start_resizing_window"; "kitty_mod+s" = "swap_with_window"; "kitty_mod+f" = "focus_visible_window"; "kitty_mod+k" = "neighboring_window top"; "kitty_mod+h" = "neighboring_window left"; "kitty_mod+j" = "neighboring_window down"; "kitty_mod+l" = "neighboring_window right"; "kitty_mod+a" = "next_layout"; }; settings = { # Bell enable_audio_bell = false; # Background background_opacity = "0.9"; # Layouts enabled_layouts = "fat,tall,grid,horizontal,vertical,splits"; # Tabs tab_bar_edge = "top"; tab_bar_style = "powerline"; }; shellIntegration = { enableBashIntegration = true; enableZshIntegration = true; }; theme = "Catppuccin-${toCapital catppuccinTheme}"; }; }; }
-
-
macos/os-update-workaround.nix (deleted)
-
@@ -1,13 +0,0 @@{ # https://github.com/NixOS/nix/issues/3616 # Every macOS updates overwrite /etc/zshrc and that breaks Nix initialisation. # This is a workaround for it so that I no longer need to manually edit the file. # https://github.com/NixOS/nix/issues/3616#issuecomment-1655785404 programs.zsh = { initExtraFirst = '' if [[ ! $(command -v nix) && -e "/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh" ]]; then source "/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh" fi ''; }; }
-
-
scm/default.nix (deleted)
-
@@ -1,15 +0,0 @@# SCM module: SCM/VCS tools and their configurations. { username , email , gpgKeyId ? null , }: { ... }: { imports = [ ( import ./git.nix { inherit username email gpgKeyId; } ) ./fossil.nix ]; }
-
-
scm/fossil.nix (deleted)
-
@@ -1,6 +0,0 @@{ config , pkgs , ... }: { home.packages = with pkgs; [ fossil ]; }
-
-
scm/git.nix (deleted)
-
@@ -1,69 +0,0 @@{ username , email , gpgKeyId , }: { config , pkgs , lib , ... }: { programs = { # Install GnuPG when key ID is provided gpg = lib.mkIf (gpgKeyId != null) { enable = true; }; git = { enable = true; userName = username; userEmail = email; # Enable signing when key ID is provided signing = lib.mkIf (gpgKeyId != null) { key = gpgKeyId; signByDefault = true; }; extraConfig = { core = { editor = "nvim"; }; init = { defaultBranch = "master"; }; }; ignores = [ # vim swap file ".*.swp" # macOS junk # https://github.com/github/gitignore/blob/main/Global/macOS.gitignore ".DS_Store" ".AppleDouble" ".LSOverride" "Icon" ]; }; }; services = { gpg-agent = lib.mkIf pkgs.stdenv.isLinux { enable = true; enableZshIntegration = true; # 1day defaultCacheTtl = 86400; defaultCacheTtlSsh = 86400; # 30days maxCacheTtl = 2592000; maxCacheTtlSsh = 2592000; pinentryFlavor = "curses"; }; }; }
-
-
-
@@ -0,0 +1,177 @@{ config, lib, pkgs, ... }: let cfg = config.themes.catppuccin; in { options = { themes.catppuccin.flavor = lib.mkOption { type = lib.types.enum [ "latte" "frappe" "macchiato" "mocha" ]; default = "mocha"; description = '' Specify which Catppuccin _flavor_ (color palette) to use. ''; }; }; config = let json = builtins.fromJSON (builtins.readFile ( pkgs.fetchFromGitHub { owner = "catppuccin"; repo = "palette"; rev = "205dd54c6158b7648621cf9fd00e91f03888ce7e"; sha256 = "y14fd8lvnG9hNY6CRU0JgxWouexEw91aIEMkr1NaM/4="; } + "/palette.json" )); flavor = json."${cfg.flavor}"; in { features.basics.zsh.theme = let zshFg = hex: "%F{${hex}}"; in { text = zshFg flavor.text.hex; vi.insert = zshFg flavor.blue.hex; vi.normal = zshFg flavor.green.hex; vcs.info = zshFg flavor.subtext0.hex; vcs.staged = zshFg flavor.green.hex; vcs.unstaged = zshFg flavor.red.hex; symbol = zshFg flavor.overlay0.hex; }; home.packages = [ # A generator for LS_COLORS with support for multiple color themes # https://github.com/sharkdp/vivid pkgs.vivid ]; # Colourise exa, ls, lf, etc... # This needs to be done in .zshrc: in Crostini, `home.sessionVariables` # cannot invoke `vivid` binary. Probably evaluation timing? programs.zsh.initExtra = '' export LS_COLORS="$(vivid generate catppuccin-${cfg.flavor})" ''; programs.bat = lib.mkIf config.programs.bat.enable { themes = { "catppuccin-${cfg.flavor}" = builtins.readFile ( pkgs.fetchFromGitHub { owner = "catppuccin"; repo = "bat"; rev = "ba4d16880d63e656acced2b7d4e034e4a93f74b1"; sha256 = "1g2r6j33f4zys853i1c5gnwcdbwb6xv5w6pazfdslxf69904lrg9"; } + "/Catppuccin-${cfg.flavor}.tmTheme" ); }; config = { theme = "catppuccin-${cfg.flavor}"; }; }; programs.tmux.plugins = [ { plugin = pkgs.tmuxPlugins.catppuccin; extraConfig = '' set -g @plugin 'catppuccin/tmux' set -g @catppuccin_flavour '${cfg.flavor}' set -g @catppuccin_no_patched_fonts_theme_enabled on ''; } ]; programs.neovim = { plugins = [ { plugin = pkgs.vimPlugins.catppuccin-nvim; type = "lua"; config = let lspIntegration = if config.features.dev.lsp.enable then "true" else "false"; in '' vim.o.termguicolors = true require("catppuccin").setup({ flavour = "${cfg.flavor}", transparent_background = true, integrations = { indent_blankline = { enabled = true, }, cmp = ${lspIntegration}, lsp_trouble = ${lspIntegration}, }, }) vim.cmd.colorscheme "catppuccin" ''; } ]; }; programs.kitty = let # Convert the input string's first character to upper case. # Example: "foo" -> "Foo" toCapital = with lib; str: let len = builtins.stringLength str; head = strings.toUpper (builtins.substring 0 1 str); tail = builtins.substring 1 (len - 1) str; in head + tail; in { theme = "Catppuccin-${toCapital cfg.flavor}"; }; programs.foot = let toFootHex = hex: lib.strings.removePrefix "#" hex; fg = toFootHex flavor.surface0.hex; bg = toFootHex flavor.text.hex; in { settings.main = { include = "${config.xdg.configHome}/foot/theme.conf"; cursor = { # Foot by default invert fg/bg for cursor. However, this makes # cursor on indent_blankline's indent char/spaces barely visible. color = "${fg} ${bg}"; }; }; }; xdg.configFile."foot/theme.conf" = lib.mkIf config.programs.foot.enable { text = builtins.readFile ( pkgs.fetchFromGitHub { owner = "catppuccin"; repo = "foot"; rev = "009cd57bd3491c65bb718a269951719f94224eb7"; sha256 = "0f0r8d4rn54gibrzfhiy4yr8bi7c8j18ggp1y9lyidc1dmy9kvw0"; } + "/catppuccin-${cfg.flavor}.conf" ); }; }; }
-
-
wayland-de/default.nix (deleted)
-
@@ -1,21 +0,0 @@# Wayland Desktop Environment { catppuccinTheme }: { ... }: { # I'm not sure this changes behaviour in a meaningful way. targets.genericLinux = { enable = true; }; # Update ~/.profile too. # https://github.com/nix-community/home-manager/issues/1439 programs.bash = { enable = true; }; imports = [ ( import ./foot.nix { inherit catppuccinTheme; } ) ]; }
-
-
wayland-de/foot.nix (deleted)
-
@@ -1,85 +0,0 @@{ catppuccinTheme }: { config , pkgs , ... }: { programs = let # Config file of catppuccin/foot is ini file: Nix can't parse that. # To workaround, manually fetch palette JSON and use its token. catppuccinPalette = (builtins.fromJSON (builtins.readFile ( pkgs.fetchFromGitHub { owner = "catppuccin"; repo = "palette"; rev = "205dd54c6158b7648621cf9fd00e91f03888ce7e"; sha256 = "y14fd8lvnG9hNY6CRU0JgxWouexEw91aIEMkr1NaM/4="; } + "/palette.json" )))."${catppuccinTheme}"; fg = builtins.substring 1 6 catppuccinPalette.surface0.hex; bg = builtins.substring 1 6 catppuccinPalette.text.hex; in { zsh = { # Let Zsh tell Foot a current working directory # https://codeberg.org/dnkl/foot/wiki#user-content-spawning-new-terminal-instances-in-the-current-working-directory initExtra = '' function osc7-pwd() { emulate -L zsh # also sets localoptions for us setopt extendedglob local LC_ALL=C printf '\e]7;file://%s%s\e\' $HOST ''${PWD//(#m)([^@-Za-z&-;_~])/%''${(l:2::0:)$(([##16]#MATCH))}} } function chpwd-osc7-pwd() { (( ZSH_SUBSHELL )) || osc7-pwd } autoload -Uz add-zsh-hook add-zsh-hook -Uz chpwd chpwd-osc7-pwd ''; }; # A fast, lightweight and minimalistic Wayland terminal emulator # https://codeberg.org/dnkl/foot foot = { enable = true; server.enable = true; settings = { main = { include = "${config.xdg.configHome}/foot/theme.conf"; font = "monospace:size=10"; }; cursor = { # Foot by default invert fg/bg for cursor. However, this makes # cursor on indent_blankline's indent char/spaces barely visible. color = "${fg} ${bg}"; }; colors = { alpha = 0.9; }; }; }; }; xdg = { configFile."foot/theme.conf" = { text = builtins.readFile ( pkgs.fetchFromGitHub { owner = "catppuccin"; repo = "foot"; rev = "009cd57bd3491c65bb718a269951719f94224eb7"; sha256 = "0f0r8d4rn54gibrzfhiy4yr8bi7c8j18ggp1y9lyidc1dmy9kvw0"; } + "/catppuccin-${catppuccinTheme}.conf" ); }; }; }
-
-
webdev/default.nix (deleted)
-
@@ -1,6 +0,0 @@{ ... }: { imports = [ ./neovim.nix ./rtx.nix ]; }
-
-
webdev/neovim.nix (deleted)
-
@@ -1,125 +0,0 @@# Language specific tools are not configured in this file because # these tools are project specific. Each project should have Flake # file (provided by the project or manually created by a user). { config , pkgs , ... }: { programs = { neovim = { plugins = with pkgs.vimPlugins; [ { plugin = cmp-nvim-lsp; } { plugin = nvim-lspconfig; type = "lua"; config = '' -- Based on https://github.com/neovim/nvim-lspconfig#suggested-configuration local capabilities = require("cmp_nvim_lsp").default_capabilities() local lspconfig = require("lspconfig") -- Elm lspconfig.elmls.setup { capabilities = capabilities, } -- TypeScript lspconfig.tsserver.setup { root_dir = lspconfig.util.root_pattern("tsconfig.json"), single_file_support = false, capabilities = capabilities, } -- Deno lspconfig.denols.setup { root_dir = lspconfig.util.root_pattern("deno.json"), capabilities = capabilities, } -- CSS lspconfig.cssls.setup { capabilities = capabilities, } -- HTML lspconfig.html.setup { capabilities = capabilities, } -- LSP key mappings vim.api.nvim_create_autocmd("LspAttach", { group = vim.api.nvim_create_augroup("UserLspConfig", {}), callback = function(ev) local opts = { buffer = ev.buf } vim.keymap.set("n", "K", vim.lsp.buf.hover, opts) end, }) -- Hover style vim.lsp.handlers["textDocument/hover"] = vim.lsp.with( vim.lsp.handlers.hover, { border = "single", } ) ''; } { plugin = nvim-cmp; type = "lua"; config = '' local cmp = require("cmp") cmp.setup({ window = { completion = cmp.config.window.bordered(), documentation = cmp.config.window.bordered(), }, mapping = cmp.mapping.preset.insert({ ["<CR>"] = cmp.mapping.confirm { behavior = cmp.ConfirmBehavior.Replace, select = true, }, ["<Tab>"] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_next_item() return end fallback() end, { "i", "s" }), ["<S-Tab>"] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_prev_item() return end fallback() end, { "i", "s" }), }), sources = { { name = "nvim_lsp" } }, }) ''; } { plugin = trouble-nvim; type = "lua"; config = '' require("trouble").setup({ icons = false, mode = "document_diagnostics", auto_open = true, auto_close = true, signs = { error = "error", warning = "warn", hint = "hint", information = "info" }, }) ''; } ]; }; }; }
-
-
webdev/rtx.nix (deleted)
-
@@ -1,7 +0,0 @@{ # Runtime Executor (asdf-plugin compatible) # https://github.com/jdxcode/rtx programs.rtx = { enable = true; }; }
-