diff --git a/home-manager/cli-tools.nix b/home-manager/cli-tools.nix new file mode 100644 index 0000000..e1baefe --- /dev/null +++ b/home-manager/cli-tools.nix @@ -0,0 +1,190 @@ +{ config, pkgs, lib, ... }: + +{ + home.packages = with pkgs; [ + #cli tools + bat + btop + curl + docker + dust + ghostty + git + neovim + nettools + nix-prefetch-github + nmap + openssh + tailscale + thefuck + tldr + unzip + vim + wget + ]; + + programs = { + fastfetch.enable = true; + fzf.enable = true; + bat.enable = true; + btop.enable = true; + kitty.enable = true; + yazi.enable = true; + starship.enable = true; + lazygit.enable = true; + #thefuck.enable = true; + #thefuck.enableZshIntegration = true; + + git = { + enable = true; + userName = "USER"; + }; + + eza = { + enable = true; + icons = "auto"; + enableZshIntegration = true; + extraOptions = [ + "--group-directories-first" + ]; + }; + + ssh = { + enable = true; + matchBlocks = { + global = { + host = "*"; + setEnv = { + TERM = "xterm-256color"; + }; + }; + }; + # Add IdentityAgent configuration here + extraConfig = '' + IdentityAgent ~/.1password/agent.sock + ''; + }; + + + + zoxide = { + enable = true; + enableZshIntegration = true; + }; + + zsh = { + enable = true; + enableCompletion = true; + autosuggestion.enable = true; + syntaxHighlighting.enable = true; + historySubstringSearch.enable = true; + + shellAliases = { + ls = "eza --color=auto"; + grep = "grep --color=auto"; + ll = "eza -la"; + lg = "lazygit"; + fu = "fuck"; + lt = "eza --tree"; + cd = "z"; + cat = "bat"; + catp = "bat -p"; + btop = "btop --utf-force"; + open = "xdg-open"; + }; + + initExtra = '' + . ~/.nix-profile/etc/profile.d/nix.sh + fastfetch + ''; + + history = { + size = 10000; + path = "${config.xdg.dataHome}/zsh/history"; + }; + + oh-my-zsh = { + enable = true; + #plugins = ["thefuck"]; + }; + }; + + starship = { + settings = { + add_newline = true; + format = lib.concatStrings [ + "$time" + "$directory" + "$git_branch" + "$git_status" + "$hostname" + "$golang" + "direnv" + "$status" + ]; + + right_format = lib.concatStrings [ + "$cmd_duration" + ]; + + cmd_duration = { + disabled = false; + show_notifications = false; + min_time = 2000; + format = "[$duration](bold yellow)"; + }; + + directory = { + style = "cyan"; + format = ''\[[$path]($style)\] ''; + }; + + direnv = { + disabled = false; + }; + + git_branch = { + style = "bold cyan"; + format = ''\[[$symbol$branch(:$remote_branch)]($style)\] ''; + }; + + git_status = { + format = "[($all_status$ahead_behind )]($style)"; + conflicted = "🏳"; + ahead = "⇡\${count}"; + diverged = "⇕⇡\${ahead_count}⇣\${behind_count}"; + behind = "⇣\${count}"; + up_to_date = "✓"; + untracked = "🤷"; + stashed = "📦"; + modified = "📝"; + staged = ''[++\($count\)](green)''; + renamed = "👅"; + deleted = "🗑"; + }; + + golang = { + format = ''\[[$symbol($version)]($style)\]''; + }; + + hostname = { + format = "[$ssh_symbol$hostname]($style) "; + }; + + status = { + disabled = false; + success_symbol = "[❱](bold red)[❱](bold yellow)[❱](bold green) "; + symbol = "[❱❱❱](bold red) "; + format = "$symbol"; + }; + + time = { + disabled = false; + style = "cyan"; + format = ''\[[$time]($style)\] ''; + }; + + }; + }; + }; +} diff --git a/home-manager/direnv.nix b/home-manager/direnv.nix new file mode 100644 index 0000000..dd517b5 --- /dev/null +++ b/home-manager/direnv.nix @@ -0,0 +1,26 @@ +{ + programs = { + direnv = { + enable = true; + enableZshIntegration = true; + # export_function needed for per directory function/alias with direnv: https://github.com/direnv/direnv/issues/73 + stdlib = '' + export_function() { + local name=$1 + local alias_dir=$PWD/.direnv/aliases + mkdir -p "$alias_dir" + PATH_add "$alias_dir" + local target="$alias_dir/$name" + if declare -f "$name" >/dev/null; then + echo "#!$SHELL" > "$target" + declare -f "$name" >> "$target" 2>/dev/null + # notice that we add shell variables to the function trigger. + echo "$name \$*" >> "$target" + chmod +x "$target" + fi + } + ''; + nix-direnv.enable = true; + }; + }; +} diff --git a/home-manager/fastfetch/assets/evangelion-mecha-neon-genesis-desktop-wallpaper-cover.jpg b/home-manager/fastfetch/assets/evangelion-mecha-neon-genesis-desktop-wallpaper-cover.jpg new file mode 100644 index 0000000..a4c778c Binary files /dev/null and b/home-manager/fastfetch/assets/evangelion-mecha-neon-genesis-desktop-wallpaper-cover.jpg differ diff --git a/home-manager/fastfetch/assets/image.png b/home-manager/fastfetch/assets/image.png new file mode 100644 index 0000000..e69de29 diff --git a/home-manager/fastfetch/fastfetch.nix b/home-manager/fastfetch/fastfetch.nix new file mode 100644 index 0000000..708cdb1 --- /dev/null +++ b/home-manager/fastfetch/fastfetch.nix @@ -0,0 +1,126 @@ +{ + programs = { + fastfetch = { + enable = true; + settings = { + logo = { + source = "/etc/nixos/home-manager/fastfetch/assets/evangelion-mecha-neon-genesis-desktop-wallpaper-cover.jpg"; + type = "kitty"; + height = 20; + width = 60; + padding = { + top = 2; #2; + left = 2; # 3; + }; + }; + display = { + separator = " ➜ "; + }; + modules = [ + "break" + "break" + { + type = "os"; + key = " OS "; + keyColor = "31"; + } + { + type = "kernel"; + key = " ├  kernel"; + keyColor = "31"; + } + { + type = "packages"; + key = " ├ 󰏖 packages"; + keyColor = "31"; + } + { + type = "shell"; + key = " └  shell"; + keyColor = "31"; + } + "break" + { + type = "wm"; + key = " WM "; + keyColor = "32"; + } + { + type = "wmtheme"; + key = " ├ 󰉼 theme"; + keyColor = "32"; + } + { + type = "icons"; + key = " ├ 󰀻 icons"; + keyColor = "32"; + } + { + type = "cursor"; + key = " ├  cursor"; + keyColor = "32"; + } + { + type = "terminal"; + key = " ├  terminal"; + keyColor = "32"; + } + { + type = "processes"; + key = " └  processes"; + keyColor = "32"; + } + "break" + { + type = "host"; + format = "{5} {1} Type {2}"; + key = " PC "; + keyColor = "33"; + } + { + type = "cpu"; + format = "{1} ({3}) @ {7} GHz"; + key = " ├  cpu"; + keyColor = "33"; + } + { + type = "gpu"; + format = "{1} {2} @ {12} GHz"; + key = " ├ 󰢮 gpu"; + keyColor = "33"; + } + { + type = "memory"; + key = " ├  memory"; + keyColor = "33"; + } + { + type = "swap"; + key = " ├ 󰓡 swap"; + keyColor = "33"; + } + { + type = "disk"; + key = " ├ 󰋊 disk"; + keyColor = "33"; + } + { + type = "monitor"; + key = " ├  monitor"; + keyColor = "33"; + } + { + type = "battery"; + key = " ├ 󰂀 battery"; + keyColor = "33"; + } + { + type = "localip"; + key = " └ 󰩟 local ip"; + keyColor = "33"; + } + ]; + }; + }; + }; +} diff --git a/home-manager/home.nix b/home-manager/home.nix new file mode 100644 index 0000000..ab67ad0 --- /dev/null +++ b/home-manager/home.nix @@ -0,0 +1,71 @@ +{ config, pkgs, inputs, ... }: + +{ + imports = [ + ./cli-tools.nix + ./fastfetch/fastfetch.nix + ./direnv.nix + ]; + + # Home Manager needs a bit of information about you and the paths it should + # manage. + home.username = "USER"; + home.homeDirectory = "/home/USER"; + + # This value determines the Home Manager release that your configuration is + # compatible with. This helps avoid breakage when a new Home Manager release + # introduces backwards incompatible changes. + # + # You should not change this value, even if you update Home Manager. If you do + # want to update the value, then make sure to first check the Home Manager + # release notes. + home.stateVersion = "24.11"; # Please read the comment before changing. + + nixpkgs.config.allowUnfree = true; + + fonts.fontconfig.enable = true; + + # The home.packages option allows you to install Nix packages into your + # environment. + home.packages = with pkgs; [ + #(pkgs.nerdfonts.override { fonts = [ "FiraCode" "DroidSansMono" ]; }) + ]; + + # 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'. These will be explicitly sourced when using a + # shell provided by Home Manager. 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/sapphiregaze/etc/profile.d/hm-session-vars.sh + # + home.sessionVariables = { + EDITOR = "nvim"; + }; + + # Let Home Manager install and manage itself. + programs.home-manager.enable = true; +} diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..d96aef1 --- /dev/null +++ b/install.sh @@ -0,0 +1,31 @@ +!#/bin/bash +echo "Intalling nix and home-manager" + +sh <(curl -L https://nixos.org/nix/install) --no-daemon + +mkdir -p ~/.config/nix +echo "experimental-features = nix-command flakes" >>~/.config/nix/nix.conf + +. ~/.nix-profile/etc/profile.d/nix.sh + +nix-channel --add https://nixos.org/channels/nixos-24.11 nixpkgs +nix-channel --add https://github.com/nix-community/home-manager/archive/release-24.11.tar.gz home-manager +nix-channel --update + +nix-shell '' -A install + +cp -r home-manager/ ~/.config/ + +home-manager switch + +sudo echo "/home/$USER/.nix-profile/bin/zsh" | sudo tee -a /etc/shells + +. ~/.nix-profile/etc/profile.d/nix.sh + +chsh -s /home/$USER/.nix-profile/bin/zsh $USER + +source ~/.zshrc + +#sudo echo ". ~/.nix-profile/etc/profile.d/nix.sh" | sudo tee -a ~/.bashrc + +#sudo echo "zsh" | sudo tee -a ~/.bashrc