From b86646816bcb91910c1bb15f1278e256b12824c9 Mon Sep 17 00:00:00 2001 From: lsoriano-mcm Date: Thu, 7 Aug 2025 12:01:20 -0500 Subject: [PATCH] darwin rebuilding --- config.nix | 17 ++++++ flake.nix | 40 ++++++-------- home/darwin/home.nix | 6 +++ home/kenji/home.nix | 4 ++ hosts/darwin/macbook-air/configuration.nix | 37 +++++++++++++ modules/home/terminal.nix | 15 ++++++ pkgs/fish/home.nix | 14 +++++ pkgs/fonts/home.nix | 8 +++ pkgs/kitty/home.nix | 28 ++++++++++ pkgs/neovim/home.nix | 9 ++++ pkgs/starship/home.nix | 61 ++++++++++++++++++++++ pkgs/zsh/home.nix | 33 ++++++++++++ 12 files changed, 247 insertions(+), 25 deletions(-) create mode 100644 config.nix create mode 100644 home/darwin/home.nix create mode 100644 hosts/darwin/macbook-air/configuration.nix create mode 100644 modules/home/terminal.nix create mode 100644 pkgs/fish/home.nix create mode 100644 pkgs/fonts/home.nix create mode 100644 pkgs/kitty/home.nix create mode 100644 pkgs/neovim/home.nix create mode 100644 pkgs/starship/home.nix create mode 100644 pkgs/zsh/home.nix diff --git a/config.nix b/config.nix new file mode 100644 index 0000000..73defb1 --- /dev/null +++ b/config.nix @@ -0,0 +1,17 @@ +{ + myConfig = { + General = { + terminal = { + size = 18; + font = "JetBrainsMono Nerd Font"; + shell = "fish"; # or zsh + aliases = {}; + }; + }; + NixOS = { + }; + Darwin = { + username = "lsoriano"; + }; + }; +} diff --git a/flake.nix b/flake.nix index 120fb64..6090c06 100644 --- a/flake.nix +++ b/flake.nix @@ -3,6 +3,7 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; home-manager = { url = "github:nix-community/home-manager"; @@ -14,7 +15,10 @@ inputs.nixpkgs.follows = "nixpkgs"; }; - flake-utils.url = "github:numtide/flake-utils"; + nixovim = { + url = "git+https://git.sakamoto.dev/kenji/nixovim.git"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; outputs = { @@ -31,28 +35,26 @@ config.allowUnfree = true; }; - homeManagerModule = { - home.stateVersion = "24.05"; - }; + args = {inherit system pkgs;}; + + config = ./config.nix; in { nixosConfigurations = { "hakase" = nixpkgs.lib.nixosSystem { inherit system; modules = [ + config ./hosts/nixos/my-nixos-desktop/configuration.nix home-manager.nixosModules.home-manager { home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; - home-manager.users.youruser = homeManagerModule; - # home-manager.users.youruser = import ./home/youruser/home.nix; + home-manager.users.youruser = import ./home/youruser/home.nix; } ]; - specialArgs = { - inherit self pkgs; - }; + specialArgs = args; }; }; @@ -60,11 +62,9 @@ "kenji" = home-manager.lib.homeManagerConfiguration { inherit pkgs; modules = [ - homeManagerModule + config ./home/kenji/home.nix ]; - - # specialArgs = { inherit self; }; }; }; @@ -72,20 +72,10 @@ "my-macbook-pro" = nix-darwin.lib.darwinSystem { inherit system; modules = [ - ./hosts/darwin/my-macbook-pro/configuration.nix - - home-manager.darwinModules.home-manager - { - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - home-manager.users.youruser = homeManagerModule; - # home-manager.users.youruser = import ./home/youruser/home.nix; - } + config + ./hosts/darwin/macbook-air/configuration.nix ]; - - specialArgs = { - inherit self pkgs; - }; + specialArgs = args; }; }; }); diff --git a/home/darwin/home.nix b/home/darwin/home.nix new file mode 100644 index 0000000..e76358b --- /dev/null +++ b/home/darwin/home.nix @@ -0,0 +1,6 @@ +{}: { + imports = [ + ../../modules/home/terminal.nix + ]; + home.stateVersion = "25.11"; +} diff --git a/home/kenji/home.nix b/home/kenji/home.nix index e69de29..4a4dede 100644 --- a/home/kenji/home.nix +++ b/home/kenji/home.nix @@ -0,0 +1,4 @@ +{inputs, ...}: { + imports = [ + ]; +} diff --git a/hosts/darwin/macbook-air/configuration.nix b/hosts/darwin/macbook-air/configuration.nix new file mode 100644 index 0000000..9db6ce7 --- /dev/null +++ b/hosts/darwin/macbook-air/configuration.nix @@ -0,0 +1,37 @@ +{ + inputs, + myConfig, + pkgs, + system, + ... +}: { + imports = [ + inputs.home-manager.darwinModules.home-manager + ]; + + nix.settings.experimental-features = "nix-command flakes"; + + programs = { + zsh.enable = true; + fish.enable = true; + home-manager.enable = true; + }; + + nixpkgs.hostPlatform = "aarch64-darwin"; + security.pam.services.sudo_local.touchIdAuth = true; + + users.users.${myConfig.Darwin.username} = { + name = "${myConfig.Darwin.username}"; + home = "/Users/${myConfig.Darwin.username}"; + # shell = pkgs.${myConfig.general.terminal.Shell}; # no support for nix-darwin, but can be changed via chsh. + }; + + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + extraSpecialArgs = {inherit pkgs system;}; + users.${myConfig.Darwin.username} = import ../../../home/darwin/home.nix; + }; + + system.stateVersion = 5; +} diff --git a/modules/home/terminal.nix b/modules/home/terminal.nix new file mode 100644 index 0000000..7401f3c --- /dev/null +++ b/modules/home/terminal.nix @@ -0,0 +1,15 @@ +{}: { + programs = { + kitty.enable = true; + zsh.enable = true; + starship.enable = true; + }; + + imports = [ + ../../pkgs/fish/home.nix + ../../pkgs/kitty/home.nix + ../../pkgs/fonts/home.nix + ../../pkgs/neovim/home.nix + ../../pkgs/starship/home.nix + ]; +} diff --git a/pkgs/fish/home.nix b/pkgs/fish/home.nix new file mode 100644 index 0000000..3c1c754 --- /dev/null +++ b/pkgs/fish/home.nix @@ -0,0 +1,14 @@ +{ + pkgs, + myConfig, + ... +}: { + programs.fish = { + interactiveShellInit = '' + set fish_greeting + fish_vi_key_bindings + zoxide init fish | source + + ''; + }; +} diff --git a/pkgs/fonts/home.nix b/pkgs/fonts/home.nix new file mode 100644 index 0000000..fda586b --- /dev/null +++ b/pkgs/fonts/home.nix @@ -0,0 +1,8 @@ +{pkgs, ...}: { + fonts = { + fontconfig.enable = true; + }; + home.packages = with pkgs; [ + nerd-fonts.jetbrains-mono + ]; +} diff --git a/pkgs/kitty/home.nix b/pkgs/kitty/home.nix new file mode 100644 index 0000000..43f4a65 --- /dev/null +++ b/pkgs/kitty/home.nix @@ -0,0 +1,28 @@ +{ + myConfig, + pkgs, + ... +}: { + programs.kitty = { + themeFile = "kanagawa"; + settings = { + confirm_os_window_close = 0; + window_padding_width = 10; + + font_size = myConfig.General.terminal.size; + font_family = myConfig.General.terminal.font; + bold_font = "auto"; + italic_font = "auto"; + bold_italic_font = "auto"; + shell = "${pkgs.${myConfig.General.terminal.shell}}/bin/${myConfig.General.terminal.shell}"; + + # optimization + input_delay = 0; + repaint_delay = 2; + sync_to_monitor = false; + wayland_enable_ime = false; + allow_remote_control = true; + }; + # extraConfig = "include colors.conf"; + }; +} diff --git a/pkgs/neovim/home.nix b/pkgs/neovim/home.nix new file mode 100644 index 0000000..c953b01 --- /dev/null +++ b/pkgs/neovim/home.nix @@ -0,0 +1,9 @@ +{ + inputs, + system, + ... +}: { + imports = [ + inputs.nixovim.packages.${system}.fullNvim + ]; +} diff --git a/pkgs/starship/home.nix b/pkgs/starship/home.nix new file mode 100644 index 0000000..e05a48b --- /dev/null +++ b/pkgs/starship/home.nix @@ -0,0 +1,61 @@ +{lib, ...}: { + programs.starship = { + settings = { + format = lib.concatStrings [ + "$username" + "$hostname" + "$directory" + "$git_branch" + "$git_state" + "$git_status" + "$cmd_duration" + "$line_break" + "$python" + "$character" + ]; + + directory = { + style = "blue"; + }; + + character = { + success_symbol = "[→](purple)"; + error_symbol = "[→](red)"; + vimcmd_symbol = "[←](green)"; + }; + + git_branch = { + format = "[$branch]($style)"; + style = "bright-black"; + }; + git_status = { + format = "[(*$conflicted$untracked$modified$staged$renamed$deleted) $ahead_behind$stashed]($style)"; + style = "cyan"; + conflicted = "​"; + untracked = "​"; + modified = "​"; + staged = "​"; + renamed = "​"; + deleted = "​"; + stashed = "≡"; + }; + git_state = { + format = "([$state( $progress_current/$progress_total)]($style)) "; + style = "bright-black"; + }; + + cmd_duration = { + format = "[$duration]($style) "; + style = "yellow"; + }; + + python = { + format = "[$virtualenv]($style) "; + style = "bright-black"; + }; + }; + }; + # home.file.".config/starship.toml" = { + # source = builtins.toPath ./pure.toml; + # }; +} diff --git a/pkgs/zsh/home.nix b/pkgs/zsh/home.nix new file mode 100644 index 0000000..5c05742 --- /dev/null +++ b/pkgs/zsh/home.nix @@ -0,0 +1,33 @@ +{ + pkgs, + myConfig, + ... +}: { + programs.zsh = { + enableCompletion = false; + syntaxHighlighting.enable = false; + # shellAliases = myConfig.general.Terminal.aliases; + history.size = 10000; + antidote = { + enable = true; + plugins = [ + "MichaelAquilina/zsh-autoswitch-virtualenv" + "jeffreytse/zsh-vi-mode" + "zdharma-continuum/fast-syntax-highlighting kind:defer" + "zsh-users/zsh-autosuggestions kind:defer" + "zsh-users/zsh-history-substring-search kind:defer" + ]; + }; + initContent = '' + # zsh-autocomplete + # bindkey -M menuselect '^M' .accept-line # run code when selected completion + + autoload -Uz compinit + if [ "$(date +'%j')" != "$(stat -f '%Sm' -t '%j' ~/.zcompdump 2>/dev/null)" ]; then + compinit + else + compinit -C + fi + ''; + }; +}