diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e43b0f9 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.DS_Store diff --git a/Justfile b/Justfile new file mode 100644 index 0000000..c810611 --- /dev/null +++ b/Justfile @@ -0,0 +1,86 @@ +# just is a command runner, Justfile is very similar to Makefile, but simpler. + +# TODO update hostname here! +hostname := "fenrir" + +# List all the just commands +default: + @just --list + +############################################################################ +# +# Darwin related commands +# +############################################################################ + +# TODO Feel free to remove this target if you don't need a proxy to speed up the build process +[group('desktop')] +darwin-set-proxy: + sudo python3 scripts/darwin_set_proxy.py + +[group('desktop')] +darwin: darwin-set-proxy + nix build .#darwinConfigurations.{{hostname}}.system \ + --extra-experimental-features 'nix-command flakes' + + sudo -E ./result/sw/bin/darwin-rebuild switch --flake .#{{hostname}} + +[group('desktop')] +darwin-debug: darwin-set-proxy + nix build .#darwinConfigurations.{{hostname}}.system --show-trace --verbose \ + --extra-experimental-features 'nix-command flakes' + + sudo -E ./result/sw/bin/darwin-rebuild switch --flake .#{{hostname}} --show-trace --verbose + +############################################################################ +# +# nix related commands +# +############################################################################ + +# Update all the flake inputs +[group('nix')] +up: + nix flake update + +# Update specific input +# Usage: just upp nixpkgs +[group('nix')] +upp input: + nix flake update {{input}} + +# List all generations of the system profile +[group('nix')] +history: + nix profile history --profile /nix/var/nix/profiles/system + +# Open a nix shell with the flake +[group('nix')] +repl: + nix repl -f flake:nixpkgs + +# remove all generations older than 7 days +# on darwin, you may need to switch to root user to run this command +[group('nix')] +clean: + sudo nix profile wipe-history --profile /nix/var/nix/profiles/system --older-than 7d + +# Garbage collect all unused nix store entries +[group('nix')] +gc: + # garbage collect all unused nix store entries(system-wide) + sudo nix-collect-garbage --delete-older-than 7d + # garbage collect all unused nix store entries(for the user - home-manager) + # https://github.com/NixOS/nix/issues/8508 + nix-collect-garbage --delete-older-than 7d + +[group('nix')] +fmt: + # format the nix files in this repo + nix fmt + +# Show all the auto gc roots in the nix store +[group('nix')] +gcroot: + ls -al /nix/var/nix/gcroots/auto/ + diff --git a/flake.nix b/flake.nix index 84db232..50e4403 100644 --- a/flake.nix +++ b/flake.nix @@ -2,34 +2,47 @@ description = "Nix for Poby's MacOS"; nixConfig = { - substituters = [ "https://cache.nixos.org" ]; + substituters = ["https://cache.nixos.org"]; }; inputs = let - stableVersion = "25.11"; # FIXME to bump to latest stable version + stableVersion = "25.11"; # FIXME to bump to latest stable version in { # nixpkgs-darwin.url = "github:nixos/nixpkgs/nixpkgs-unstable"; # comment out for unstable version nixpkgs-darwin.url = "github:nixos/nixpkgs/nixpkgs-${stableVersion}-darwin"; + home-manager = { + url = "github:nix-community/home-manager/release-25.11"; + inputs.nixpkgs.follows = "nixpkgs-darwin"; + }; darwin = { url = "github:lnl7/nix-darwin/nix-darwin-${stableVersion}"; inputs.nixpkgs.follows = "nixpkgs-darwin"; }; + + # NVF for neovim + nvf = { + url = "github:notashelf/nvf"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; outputs = inputs @ { self, nixpkgs, darwin, + home-manager, + nvf, ... }: let - username = "poby"; system = "aarch64-darwin"; - hostname = "fenrir"; # TODO break down to multiple hosts + username = "poby"; + useremail = "smg981024@gmail.com"; + hostname = "fenrir"; # TODO break down to multiple hosts specialArgs = inputs // { - inherit username hostname; + inherit username useremail hostname; }; in { darwinConfigurations."${hostname}" = darwin.lib.darwinSystem { @@ -39,6 +52,16 @@ ./modules/system.nix ./modules/apps.nix ./modules/host-users.nix + + nvf.darwinModules.default + + home-manager.darwinModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.extraSpecialArgs = specialArgs; + home-manager.users.${username} = import ./home; + } ]; }; formatter.${system} = nixpkgs.legacyPackages.${system}.alejandra; diff --git a/home/core.nix b/home/core.nix new file mode 100644 index 0000000..460ac07 --- /dev/null +++ b/home/core.nix @@ -0,0 +1,58 @@ +{pkgs, ...}: { + home.packages = with pkgs; [ + # archives + zip + xz + unzip + p7zip + (pkgs.writeShellApplication { + name = "ns"; + runtimeInputs = with pkgs; [ + fzf + nix-search-tv + ]; + text = builtins.readFile "${pkgs.nix-search-tv.src}/nixpkgs.sh"; + }) + # utils + + 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 + + # misc + cowsay + file + which + tree + gnused + gnutar + gawk + zstd + caddy + gnupg + + # productivity + glow # markdown previewer in terminal + ]; + + programs = { + # terminal file manager + yazi = { + enable = true; + enableZshIntegration = true; + settings = { + manager = { + show_hidden = true; + sort_dir_first = true; + }; + }; + }; + + # skim provides a single executable: sk. + # Basically anywhere you would want to use grep, try sk instead. + skim = { + enable = true; + enableBashIntegration = true; + }; + }; +} diff --git a/home/default.nix b/home/default.nix new file mode 100755 index 0000000..d2039f0 --- /dev/null +++ b/home/default.nix @@ -0,0 +1,41 @@ +{ + pkgs, + username, + ... +}: { + imports = [ + ./fd.nix + ./fzf.nix + ./gh.nix + ./git.nix + ./nvf + ./ripgrep.nix + ./starship.nix + ./zoxide.nix + ./zsh.nix + ./eza.nix + ./jq.nix + ]; + + home = { + username = username; + homeDirectory = "/Users/${username}"; + stateVersion = "25.11"; + + packages = with pkgs; [ + tree + yq-go + # nix-search-tv + (writeShellApplication { + name = "ns"; + runtimeInputs = with pkgs; [ + fzf + nix-search-tv + ]; + text = builtins.readFile "${pkgs.nix-search-tv.src}/nixpkgs.sh"; + }) + ]; + }; + + programs.home-manager.enable = true; +} diff --git a/home/eza.nix b/home/eza.nix new file mode 100644 index 0000000..02ca600 --- /dev/null +++ b/home/eza.nix @@ -0,0 +1,10 @@ +{ + programs.eza = { + enable = true; + color = "auto"; + git = true; + icons = "auto"; + enableZshIntegration = true; + enableBashIntegration = true; + }; +} diff --git a/home/fd.nix b/home/fd.nix new file mode 100755 index 0000000..dd938e4 --- /dev/null +++ b/home/fd.nix @@ -0,0 +1,7 @@ +{ + programs.fd = { + enable = true; + ignores = [ ".git/" ]; + hidden = true; + }; +} diff --git a/home/fzf.nix b/home/fzf.nix new file mode 100755 index 0000000..b79ed72 --- /dev/null +++ b/home/fzf.nix @@ -0,0 +1,7 @@ +{ + programs.fzf = { + enable = true; + enableZshIntegration = true; + enableBashIntegration = true; + }; +} diff --git a/home/gh.nix b/home/gh.nix new file mode 100755 index 0000000..b922f10 --- /dev/null +++ b/home/gh.nix @@ -0,0 +1,3 @@ +{ + programs.gh.enable = true; +} diff --git a/home/git.nix b/home/git.nix new file mode 100755 index 0000000..dad9f9b --- /dev/null +++ b/home/git.nix @@ -0,0 +1,15 @@ +{ + programs.git = { + enable = true; + settings = { + user = { + name = "Poby"; + email = "87608318+smg1024@users.noreply.github.com"; + }; + init.defaultBranch = "master"; + push = { + autoSetupRemote = true; + }; + }; + }; +} diff --git a/home/jq.nix b/home/jq.nix new file mode 100644 index 0000000..825fbf2 --- /dev/null +++ b/home/jq.nix @@ -0,0 +1,3 @@ +{ + programs.jq.enable = true; +} diff --git a/home/nvf/appearance/theme.nix b/home/nvf/appearance/theme.nix new file mode 100755 index 0000000..ce1b691 --- /dev/null +++ b/home/nvf/appearance/theme.nix @@ -0,0 +1,6 @@ +{ + # theme + enable = true; + name = "tokyonight"; + style = "night"; +} diff --git a/home/nvf/core/augroups.nix b/home/nvf/core/augroups.nix new file mode 100755 index 0000000..36fd071 --- /dev/null +++ b/home/nvf/core/augroups.nix @@ -0,0 +1,11 @@ +[ + # augroups + { + enable = true; + name = "LastCursorGroup"; + } + { + enable = true; + name = "HighlightYank"; + } +] diff --git a/home/nvf/core/autocmds.nix b/home/nvf/core/autocmds.nix new file mode 100755 index 0000000..ff9fdda --- /dev/null +++ b/home/nvf/core/autocmds.nix @@ -0,0 +1,33 @@ +{lib, ...}: [ + # autocmds + { + enable = true; + event = ["BufReadPost"]; + desc = "Return to last cursor position"; + group = "LastCursorGroup"; + callback = lib.generators.mkLuaInline '' + function() + local mark = vim.api.nvim_buf_get_mark(0, '"') + local line_count = vim.api.nvim_buf_line_count(0) + if mark[1] > 0 and mark[1] <= line_count then + pcall(vim.api.nvim_win_set_cursor, 0, mark) + end + end + ''; + } + { + enable = true; + event = ["TextYankPost"]; + desc = "Highlight yanks on copy"; + group = "HighlightYank"; + pattern = ["*"]; + callback = lib.generators.mkLuaInline '' + function() + vim.hl.on_yank({ + higroup = "IncSearch", + timeout = 250, + }) + end + ''; + } +] diff --git a/home/nvf/core/clipboard.nix b/home/nvf/core/clipboard.nix new file mode 100755 index 0000000..2fe1a81 --- /dev/null +++ b/home/nvf/core/clipboard.nix @@ -0,0 +1,8 @@ +{ + # clipboard + enable = true; + registers = "unnamedplus"; + providers = { + wl-copy.enable = true; + }; +} diff --git a/home/nvf/core/keymaps.nix b/home/nvf/core/keymaps.nix new file mode 100755 index 0000000..9af6a8b --- /dev/null +++ b/home/nvf/core/keymaps.nix @@ -0,0 +1,81 @@ +[ + # Keymaps + { + key = "ff"; + mode = "n"; + action = "FzfLua files"; + desc = "[F]ind files"; + } + { + key = "fg"; + mode = "n"; + action = "FzfLua live_grep_native"; + desc = "Live [G]rep"; + } + { + key = ""; + mode = "n"; + action = "FzfLua buffers"; + desc = "Buffers"; + } + { + key = "fh"; + mode = "n"; + action = "FzfLua help_tags"; + desc = "[H]elp Tags"; + } + { + key = "fx"; + mode = "n"; + action = "FzfLua diagnostics_document"; + desc = "Diagnostics Document"; + } + { + key = "fX"; + mode = "n"; + action = "FzfLua diagnostics_workspace"; + desc = "Diagnostics Workspace"; + } + { + key = "fs"; + mode = "n"; + action = "FzfLua lsp_document_symbols"; + desc = "Document [S]ymbols"; + } + { + key = "fS"; + mode = "n"; + action = "FzfLua lsp_workspace_symbols"; + desc = "Workspace [S]ymbols"; + } + { + key = "fk"; + mode = "n"; + action = "FzfLua keymaps"; + desc = "[K]eymaps"; + } + { + key = "fb"; + mode = "n"; + action = "FzfLua builtin"; + desc = "[B]uiltin FZF"; + } + { + key = "fr"; + mode = "n"; + action = "FzfLua resume"; + desc = "[R]esume"; + } + { + key = "fo"; + mode = "n"; + action = "FzfLua oldfiles"; + desc = "[O]ld Files"; + } + { + key = "-"; + mode = "n"; + action = "Oil --float"; + desc = "Open Current Directory"; + } +] diff --git a/home/nvf/core/options.nix b/home/nvf/core/options.nix new file mode 100755 index 0000000..705da07 --- /dev/null +++ b/home/nvf/core/options.nix @@ -0,0 +1,12 @@ +{ + # options + cursorlineopt = "line"; + wrap = false; + cmdheight = 1; + tabstop = 2; + shiftwidth = 2; + autoindent = true; + termguicolors = true; + splitbelow = true; + splitright = true; +} diff --git a/home/nvf/core/spellcheck.nix b/home/nvf/core/spellcheck.nix new file mode 100755 index 0000000..ff77048 --- /dev/null +++ b/home/nvf/core/spellcheck.nix @@ -0,0 +1,5 @@ +{ + # spellcheck + enable = true; + languages = [ "en" ]; +} diff --git a/home/nvf/core/undoFile.nix b/home/nvf/core/undoFile.nix new file mode 100755 index 0000000..4c5dbd1 --- /dev/null +++ b/home/nvf/core/undoFile.nix @@ -0,0 +1,4 @@ +{ + # undoFile + enable = true; +} diff --git a/home/nvf/default.nix b/home/nvf/default.nix new file mode 100755 index 0000000..29a34dd --- /dev/null +++ b/home/nvf/default.nix @@ -0,0 +1,43 @@ +{lib, ...}: let + options = import ./core/options.nix; + autocmds = import ./core/autocmds.nix {inherit lib;}; + augroups = import ./core/augroups.nix; + keymaps = import ./core/keymaps.nix; + fzf-lua = import ./plugins/fzf-lua.nix; + mini = import ./plugins/mini.nix; + utility = import ./plugins/utility.nix; + binds = import ./plugins/binds.nix; + terminal = import ./plugins/terminal.nix; + theme = import ./appearance/theme.nix; + lsp = import ./lsp/lsp.nix; + treesitter = import ./lsp/treesitter.nix; + autocomplete = import ./lsp/autocomplete.nix; + languages = import ./lsp/languages; +in { + programs.nvf = { + enable = true; + + settings = { + vim = { + inherit + options + autocmds + augroups + keymaps + fzf-lua + mini + utility + binds + terminal + theme + lsp + treesitter + autocomplete + languages + ; + searchCase = "smart"; + hideSearchHighlight = true; + }; + }; + }; +} diff --git a/home/nvf/lsp/autocomplete.nix b/home/nvf/lsp/autocomplete.nix new file mode 100755 index 0000000..3c467f5 --- /dev/null +++ b/home/nvf/lsp/autocomplete.nix @@ -0,0 +1,22 @@ +{ + # autocomplete + blink-cmp = { + enable = true; + friendly-snippets.enable = true; + setupOpts = { + keymap.preset = "default"; + cmdline = { + keymap.preset = "default"; + }; + completion = { + documentation = { + auto_show = true; + auto_show_delay_ms = 1000; + }; + }; + }; + sourcePlugins = { + emoji.enable = true; + }; + }; +} diff --git a/home/nvf/lsp/languages/bash.nix b/home/nvf/lsp/languages/bash.nix new file mode 100755 index 0000000..2205f03 --- /dev/null +++ b/home/nvf/lsp/languages/bash.nix @@ -0,0 +1,17 @@ +{ + # bash + enable = true; + extraDiagnostics = { + enable = true; + types = ["shellcheck"]; + }; + format = { + enable = true; + type = ["shfmt"]; + }; + lsp = { + enable = true; + servers = ["bash-ls"]; + }; + treesitter.enable = true; +} diff --git a/home/nvf/lsp/languages/default.nix b/home/nvf/lsp/languages/default.nix new file mode 100755 index 0000000..b67cb8b --- /dev/null +++ b/home/nvf/lsp/languages/default.nix @@ -0,0 +1,19 @@ +let + nix = import ./nix.nix; + python = import ./python.nix; + lua = import ./lua.nix; + bash = import ./bash.nix; + markdown = import ./markdown.nix; + html = import ./html.nix; + yaml = import ./yaml.nix; +in { + inherit + nix + python + lua + bash + markdown + html + yaml + ; +} diff --git a/home/nvf/lsp/languages/html.nix b/home/nvf/lsp/languages/html.nix new file mode 100755 index 0000000..c0d3a7b --- /dev/null +++ b/home/nvf/lsp/languages/html.nix @@ -0,0 +1,23 @@ +{ + # html + enable = true; + extraDiagnostics = { + enable = true; + types = ["htmlhint"]; + }; + format = { + enable = true; + type = [ + "superhtml" + "prettierd" + ]; + }; + lsp = { + enable = true; + servers = ["superhtml"]; + }; + treesitter = { + enable = true; + autotagHtml = true; + }; +} diff --git a/home/nvf/lsp/languages/lua.nix b/home/nvf/lsp/languages/lua.nix new file mode 100755 index 0000000..57c7de0 --- /dev/null +++ b/home/nvf/lsp/languages/lua.nix @@ -0,0 +1,17 @@ +{ + # lua + enable = true; + extraDiagnostics = { + enable = true; + types = ["luacheck"]; + }; + format = { + enable = true; + type = ["stylua"]; + }; + lsp = { + enable = true; + servers = ["lua-language-server"]; + }; + treesitter.enable = true; +} diff --git a/home/nvf/lsp/languages/markdown.nix b/home/nvf/lsp/languages/markdown.nix new file mode 100755 index 0000000..958bfff --- /dev/null +++ b/home/nvf/lsp/languages/markdown.nix @@ -0,0 +1,30 @@ +{ + # markdown + enable = true; + extensions = { + render-markdown-nvim = { + enable = true; + setupOpts = { + checkbox = { + checked.scope_highlight = "@markup.strikethrough"; + }; + }; + }; + }; + extraDiagnostics = { + enable = true; + types = ["markdownlint-cli2"]; + }; + format = { + enable = true; + type = [ + "prettierd" + "deno_fmt" + ]; + }; + lsp = { + enable = true; + servers = ["marksman"]; + }; + treesitter.enable = true; +} diff --git a/home/nvf/lsp/languages/nix.nix b/home/nvf/lsp/languages/nix.nix new file mode 100755 index 0000000..8c9976b --- /dev/null +++ b/home/nvf/lsp/languages/nix.nix @@ -0,0 +1,23 @@ +{ + # nix + enable = true; + extraDiagnostics = { + enable = true; + types = [ + "deadnix" + "statix" + ]; + }; + format = { + enable = true; + type = [ + "alejandra" + "nixfmt" + ]; + }; + lsp = { + enable = true; + servers = ["nil"]; + }; + treesitter.enable = true; +} diff --git a/home/nvf/lsp/languages/python.nix b/home/nvf/lsp/languages/python.nix new file mode 100755 index 0000000..13bcf1b --- /dev/null +++ b/home/nvf/lsp/languages/python.nix @@ -0,0 +1,13 @@ +{ + # python + enable = true; + format = { + enable = true; + type = ["ruff"]; + }; + lsp = { + enable = true; + servers = ["pyright"]; + }; + treesitter.enable = true; +} diff --git a/home/nvf/lsp/languages/yaml.nix b/home/nvf/lsp/languages/yaml.nix new file mode 100755 index 0000000..43fb599 --- /dev/null +++ b/home/nvf/lsp/languages/yaml.nix @@ -0,0 +1,9 @@ +{ + # yaml + enable = true; + lsp = { + enable = true; + servers = ["yaml-language-server"]; + }; + treesitter.enable = true; +} diff --git a/home/nvf/lsp/lsp.nix b/home/nvf/lsp/lsp.nix new file mode 100755 index 0000000..adfac12 --- /dev/null +++ b/home/nvf/lsp/lsp.nix @@ -0,0 +1,7 @@ +{ + # lsp + enable = true; + inlayHints.enable = true; + lspconfig.enable = true; + formatOnSave = true; +} diff --git a/home/nvf/lsp/treesitter.nix b/home/nvf/lsp/treesitter.nix new file mode 100755 index 0000000..41e9087 --- /dev/null +++ b/home/nvf/lsp/treesitter.nix @@ -0,0 +1,9 @@ +{ + # treesitter + enable = true; + fold = true; + highlight = { + enable = true; + }; + indent.enable = true; +} diff --git a/home/nvf/plugins/binds.nix b/home/nvf/plugins/binds.nix new file mode 100755 index 0000000..b169725 --- /dev/null +++ b/home/nvf/plugins/binds.nix @@ -0,0 +1,10 @@ +{ + # binds + whichKey = { + enable = true; + register = { + "f" = "+FZF"; + "l" = "+Language"; + }; + }; +} diff --git a/home/nvf/plugins/fzf-lua.nix b/home/nvf/plugins/fzf-lua.nix new file mode 100755 index 0000000..f463c4a --- /dev/null +++ b/home/nvf/plugins/fzf-lua.nix @@ -0,0 +1,6 @@ +{ + # fzf-lua + enable = true; + profile = "default"; + setupOpts = {}; +} diff --git a/home/nvf/plugins/mini.nix b/home/nvf/plugins/mini.nix new file mode 100755 index 0000000..2606209 --- /dev/null +++ b/home/nvf/plugins/mini.nix @@ -0,0 +1,14 @@ +{ + # mini + statusline.enable = true; + ai.enable = true; + bufremove.enable = true; + comment.enable = true; + pairs.enable = true; + cursorword.enable = true; + icons.enable = true; + move.enable = true; + surround.enable = true; + indentscope.enable = true; + trailspace.enable = true; +} diff --git a/home/nvf/plugins/terminal.nix b/home/nvf/plugins/terminal.nix new file mode 100755 index 0000000..10910cd --- /dev/null +++ b/home/nvf/plugins/terminal.nix @@ -0,0 +1,21 @@ +{ + # terminal + toggleterm = { + enable = true; + setupOpts = { + direction = "horizontal"; + size = 6; + }; + mappings = { + open = "tt"; + }; + + # lazygit + lazygit = { + enable = true; + mappings = { + open = "gg"; + }; + }; + }; +} diff --git a/home/nvf/plugins/utility.nix b/home/nvf/plugins/utility.nix new file mode 100755 index 0000000..421e29c --- /dev/null +++ b/home/nvf/plugins/utility.nix @@ -0,0 +1,11 @@ +{ + # utility + oil-nvim = { + enable = true; + gitStatus.enable = true; + setupOpts = { + view_options.show_hidden = true; + }; + }; + sleuth.enable = true; +} diff --git a/home/ripgrep.nix b/home/ripgrep.nix new file mode 100755 index 0000000..34cc7c5 --- /dev/null +++ b/home/ripgrep.nix @@ -0,0 +1,3 @@ +{ + programs.ripgrep.enable = true; +} diff --git a/home/starship.nix b/home/starship.nix new file mode 100755 index 0000000..2b977ab --- /dev/null +++ b/home/starship.nix @@ -0,0 +1,14 @@ +{ + programs.starship = { + enable = true; + enableZshIntegration = true; + enableBashIntegration = true; + + settings = { + character = { + success_symbol = "[›](bold green)"; + error_symbol = "[›](bold red)"; + }; + }; + }; +} diff --git a/home/zoxide.nix b/home/zoxide.nix new file mode 100755 index 0000000..ac54e8f --- /dev/null +++ b/home/zoxide.nix @@ -0,0 +1,8 @@ +{ + programs.zoxide = { + enable = true; + enableZshIntegration = true; + enableBashIntegration = true; + options = ["--cmd j"]; + }; +} diff --git a/home/zsh.nix b/home/zsh.nix new file mode 100755 index 0000000..40edcdb --- /dev/null +++ b/home/zsh.nix @@ -0,0 +1,36 @@ +{ + programs.zsh = { + enable = true; + + enableCompletion = true; + autosuggestion.enable = true; + syntaxHighlighting.enable = true; + + history = { + size = 10000; + save = 10000; + }; + + shellAliases = { + poby = "echo my name is poby"; + nrs = "sudo nixos-rebuild switch --flake ~/nixos#$(hostname)"; + nrt = "sudo nixos-rebuild test --flake ~/nixos#$(hostname)"; + hms = "home-manager switch -b backup --flake ~/nixos#$(whoami)"; + }; + + sessionVariables = { + EDITOR = "nvim"; + }; + + oh-my-zsh = { + enable = true; + theme = "robbyrussell"; + plugins = [ + "git" + "history" + "zoxide" + "eza" + ]; + }; + }; +} diff --git a/modules/apps.nix b/modules/apps.nix index 0881f28..77b5802 100644 --- a/modules/apps.nix +++ b/modules/apps.nix @@ -1,11 +1,12 @@ -{ pkgs, ... }: { +{pkgs, ...}: { + nixpkgs.config.allowUnfree = true; environment.systemPackages = with pkgs; [ git + neovim just # use Justfile to simplify nix-darwin's commands - vim - curl ]; + environment.variables.EDITOR = "nvim"; homebrew = { enable = true; @@ -22,7 +23,7 @@ Bitwarden = 1352778147; }; - taps = [ ]; + taps = []; # WARNING only include those not in nixpkgs brews = [ diff --git a/modules/host-users.nix b/modules/host-users.nix index 0276164..c29c73b 100644 --- a/modules/host-users.nix +++ b/modules/host-users.nix @@ -1,5 +1,8 @@ -{ username, hostname, ... }: { + username, + hostname, + ... +}: { networking.hostName = hostname; networking.computerName = hostname; @@ -8,5 +11,5 @@ description = username; }; - nix.settings.trusted-users = [ username ]; + nix.settings.trusted-users = [username]; } diff --git a/modules/nix-core.nix b/modules/nix-core.nix index 5463f09..d85af49 100644 --- a/modules/nix-core.nix +++ b/modules/nix-core.nix @@ -1,17 +1,20 @@ -{ pkgs, lib, ... }: { + pkgs, + lib, + ... +}: { nix = { enable = true; package = pkgs.nix; settings = { - experimental-features = [ "nix-command" "flakes" ]; - substituters = [ "https://nix-community.cachix.org" ]; + experimental-features = ["nix-command" "flakes"]; + substituters = ["https://nix-community.cachix.org"]; trusted-public-keys = [ "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" ]; builders-user-substitutes = true; - auto-optimise-store = false; # issue https://github.com/NixOS/nix/issues/7273 + auto-optimise-store = false; # issue https://github.com/NixOS/nix/issues/7273 }; }; diff --git a/modules/system.nix b/modules/system.nix index 70e914f..2ce74b2 100644 --- a/modules/system.nix +++ b/modules/system.nix @@ -1,6 +1,12 @@ -{ pkgs, config, username, hostname, ... }: - { + pkgs, + config, + username, + hostname, + ... +}: { + time.timeZone = "Asia/Seoul"; + system = { primaryUser = username; stateVersion = 6; @@ -32,7 +38,6 @@ ''; defaults = { - loginwindow = { GuestEnabled = false; }; @@ -86,12 +91,12 @@ trackpad = { Clicking = true; - TrackpadRightClick = true; # two finger right click + TrackpadRightClick = true; # two finger right click TrackpadThreeFingerDrag = true; - TrackpadFourFingerHorizSwipeGesture = 2; # swipe between full-screen applications + TrackpadFourFingerHorizSwipeGesture = 2; # swipe between full-screen applications TrackpadFourFingerVertSwipeGesture = 2; # down for Mission Control, up for App Expose TrackpadPinch = true; - TrackpadThreeFingerHorizSwipGesture = 0; # disable for three finger drag + TrackpadThreeFingerHorizSwipGesture = 0; # disable for three finger drag TrackpadThreeFingerVertSwipeGesture = 0; # disable for three finger drag TrackpadTwoFingerDoubleTapGesture = true; # smart zoom TrackpadTwoFingerFromRightEdgeSwipeGesture = 0; @@ -142,6 +147,7 @@ NSTableViewDefaultSizeMode = 2; "com.apple.keyboard.fnState" = true; + "com.apple.sound.beep.feedback" = 0; }; # Customize settings that not supported by nix-darwin directly @@ -164,7 +170,7 @@ }; keyboard = { - enableKeyMapping = true; # enable key mapping so that we can use `option` as `control` + enableKeyMapping = true; # enable key mapping so that we can use `option` as `control` }; }; @@ -175,50 +181,60 @@ # this is required if you want to use darwin's default shell - zsh programs.zsh = { enable = true; - enableCompletion = true; - enableAutosuggestions = true; - enableFastSyntaxHighlighting = true; - enableFzfCompletion = true; - enableFzfGit = true; - enableFzfHistory = true; - promptInit = '' - source ${pkgs.zsh-powerlevel10k}/share/zsh-powerlevel10k/powerlevel10k.zsh-theme - source ${pkgs.zsh-fzf-tab}/share/fzf-tab/fzf-tab.plugin.zsh - ''; + # enableCompletion = true; + # enableAutosuggestions = true; + # enableFastSyntaxHighlighting = true; + # enableFzfCompletion = true; + # enableFzfGit = true; + # enableFzfHistory = true; + # promptInit = '' + # source ${pkgs.zsh-powerlevel10k}/share/zsh-powerlevel10k/powerlevel10k.zsh-theme + # source ${pkgs.zsh-fzf-tab}/share/fzf-tab/fzf-tab.plugin.zsh + # ''; }; environment = { shells = [ pkgs.zsh ]; - shellAliases = { - ls = "lsd --color=auto"; - l = "lsd -lhG"; - lt = "l --tree"; - ll = "lsd -alhG"; - lh = "lsd -dl .*"; - lsd = "lsd --group-directories-first"; - filecount="find . -type f | wc -l"; - cat = "bat --color=always"; - man = "tldr"; - nixrebuild = "sudo darwin-rebuild switch --flake ~/.config/nix-darwin"; - nixupgrade = "cd ~/.config/nix-darwin && nix flake update"; - nixconfig = "nvim ~/.config/nix-darwin"; - sshconfig = "nvim ~/.ssh/config"; - - # git - g = "git"; - gaa = "git add --all"; - gcm = "git commit -m"; - gca = "git commit --amend"; - gst = "git status"; - gco = "git checkout"; - gl = "git pull"; - gp = "git push"; - glg = "git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset' --date=short"; - }; + # shellAliases = { + # ls = "lsd --color=auto"; + # l = "lsd -lhG"; + # lt = "l --tree"; + # ll = "lsd -alhG"; + # lh = "lsd -dl .*"; + # lsd = "lsd --group-directories-first"; + # filecount = "find . -type f | wc -l"; + # cat = "bat --color=always"; + # man = "tldr"; + # nixrebuild = "sudo darwin-rebuild switch --flake ~/.config/nix-darwin"; + # nixupgrade = "cd ~/.config/nix-darwin && nix flake update"; + # nixconfig = "nvim ~/.config/nix-darwin"; + # sshconfig = "nvim ~/.ssh/config"; + # + # # git + # g = "git"; + # gaa = "git add --all"; + # gcm = "git commit -m"; + # gca = "git commit --amend"; + # gst = "git status"; + # gco = "git checkout"; + # gl = "git pull"; + # gp = "git push"; + # glg = "git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset' --date=short"; + # }; }; - # Set your time zone. - time.timeZone = "Asia/Seoul"; + fonts = { + packages = with pkgs; [ + material-design-icons + font-awesome + pretendard + nerd-fonts.symbols-only + nerd-fonts.jetbrains-mono + nerd-fonts.d2coding + nerd-fonts.iosevka + nerd-fonts.meslo-lg + ]; + }; }