From 861d4911104651672a5aca733d20f74e8db4c656 Mon Sep 17 00:00:00 2001 From: "Thomas A. Christensen II" <25492070+MillironX@users.noreply.github.com> Date: Sun, 8 Dec 2024 17:18:53 -0600 Subject: [PATCH] initial commit --- flake.lock | 131 ++++++++++++++++++++++++ flake.nix | 34 +++++++ home.nix | 284 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 449 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 home.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..a95ef8f --- /dev/null +++ b/flake.lock @@ -0,0 +1,131 @@ +{ + "nodes": { + "agenix": { + "inputs": { + "darwin": "darwin", + "home-manager": "home-manager", + "nixpkgs": [ + "nixpkgs" + ], + "systems": "systems" + }, + "locked": { + "lastModified": 1723293904, + "narHash": "sha256-b+uqzj+Wa6xgMS9aNbX4I+sXeb5biPDi39VgvSFqFvU=", + "owner": "ryantm", + "repo": "agenix", + "rev": "f6291c5935fdc4e0bef208cfc0dcab7e3f7a1c41", + "type": "github" + }, + "original": { + "owner": "ryantm", + "repo": "agenix", + "type": "github" + } + }, + "darwin": { + "inputs": { + "nixpkgs": [ + "agenix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1700795494, + "narHash": "sha256-gzGLZSiOhf155FW7262kdHo2YDeugp3VuIFb4/GGng0=", + "owner": "lnl7", + "repo": "nix-darwin", + "rev": "4b9b83d5a92e8c1fbfd8eb27eda375908c11ec4d", + "type": "github" + }, + "original": { + "owner": "lnl7", + "ref": "master", + "repo": "nix-darwin", + "type": "github" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "agenix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1703113217, + "narHash": "sha256-7ulcXOk63TIT2lVDSExj7XzFx09LpdSAPtvgtM7yQPE=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "3bfaacf46133c037bb356193bd2f1765d9dc82c1", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "home-manager_2": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1733572789, + "narHash": "sha256-zjO6m5BqxXIyjrnUziAzk4+T4VleqjstNudSqWcpsHI=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "c7ffc9727d115e433fd884a62dc164b587ff651d", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "release-24.11", + "repo": "home-manager", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1733412085, + "narHash": "sha256-FillH0qdWDt/nlO6ED7h4cmN+G9uXwGjwmCnHs0QVYM=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "4dc2fc4e62dbf62b84132fe526356fbac7b03541", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-24.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "agenix": "agenix", + "home-manager": "home-manager_2", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..f4c8e80 --- /dev/null +++ b/flake.nix @@ -0,0 +1,34 @@ +{ + description = "Home Manager configuration of millironx"; + + inputs = { + # Specify the source of Home Manager and Nixpkgs. + nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11"; + home-manager = { + url = "github:nix-community/home-manager/release-24.11"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + agenix = { + url = "github:ryantm/agenix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = { nixpkgs, home-manager, agenix, ... }: + let + system = "aarch64-darwin"; + pkgs = nixpkgs.legacyPackages.${system}; + in { + homeConfigurations."millironx" = + home-manager.lib.homeManagerConfiguration { + inherit pkgs; + + # Specify your home configuration modules here, for example, + # the path to your home.nix. + modules = [ ./home.nix agenix.homeManagerModules.default ]; + + # Optionally use extraSpecialArgs + # to pass through arguments to home.nix + }; + }; +} diff --git a/home.nix b/home.nix new file mode 100644 index 0000000..b81e9f2 --- /dev/null +++ b/home.nix @@ -0,0 +1,284 @@ +{ config, pkgs, ... }: + +{ + # Home Manager needs a bit of information about you and the paths it should + # manage. + home.username = "millironx"; + home.homeDirectory = "/Users/millironx"; + + # 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 = "23.11"; # Please read the comment before changing. + + # The home.packages option allows you to install Nix packages into your + # environment. + home.packages = with pkgs; [ + act + asitop + bat + cowsay + direnv + ffmpeg + figlet + fortune + gh + gitflow + git-absorb + gnugrep + gnupg + gnused + htop + inkscape-with-extensions + jq + lapce + lsd + lynx + most + neovide + nil + nixd + nixfmt + pandoc + pinentry_mac + pipx + python3 + quarto + shellcheck + sketchybar-app-font + sqlitebrowser + texlive.combined.scheme-full + woodpecker-cli + yt-dlp + zulu17 + + # # It is sometimes useful to fine-tune packages, for example, by applying + # # overrides. You can do that directly here, just don't forget the + # # parentheses. Maybe you want to install Nerd Fonts with a limited number of + # # fonts? + (pkgs.nerdfonts.override { + fonts = [ "FiraCode" "Hack" "Meslo" "NerdFontsSymbolsOnly" ]; + }) + + # # You can also create simple shell scripts directly inside your + # # configuration. For example, this adds a command 'my-hello' to your + # # environment: + # (pkgs.writeShellScriptBin "my-hello" '' + # echo "Hello, ${config.home.username}!" + # '') + (pkgs.writeShellScriptBin "nd" '' + mkdir "$1" + cd "$1" + '') + (pkgs.writeShellScriptBin "uq" '' + xattr -rdv com.apple.quarantine "/Applications/$1.app" + '') + ]; + + # 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'. 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 + # + # /etc/profiles/per-user/millironx/etc/profile.d/hm-session-vars.sh + # + home.sessionVariables = { + EDITOR = "nvim"; + PAGER = "most"; + NXF_HOME = "$HOME/.nextflow"; + NXF_CACHE = "$HOME/.cache/nextflow"; + NXF_CONDA_CACHEDIR = "$NXF_CACHE/conda"; + NXF_SINGULARITY_CACHEDIR = "$NXF_CACHE/singularity"; + JULIA_NUM_THREADS = "$(sysctl -n hw.logicalcpu)"; + JULIA_PKG_USE_CLI_GIT = "true"; + GPG_TTY = "$(tty)"; + SSH_AUTH_SOCK = "$(gpgconf --list-dirs agent-ssh-socket)"; + }; + + home.shellAliases = { + cat = "bat"; + ls = "lsd"; + code = "codium"; + nproc = "sysctl -n hw.logicalcpu"; + please = "sudo $(fc -ln -1)"; + nrun = '' + __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia __VK_LAYER_NV_optimus="NVIDIA_only"''; + grim = "git rebase -i --autosquash $(git_main_branch)"; + grid = "git rebase -i --autosquash $(git_develop_branch)"; + gpub = "git push --set-upstream origin $(git rev-parse --abbrev-ref HEAD)"; + }; + + home.sessionPath = [ + "$HOME/.julia/bin" + "$HOME/.juliaup/bin" + "$HOME/.cargo/bin" + "$HOME/.local/bin" + ]; + + # Let Home Manager install and manage itself. + programs.home-manager.enable = true; + + programs.bash = { + enable = true; + initExtra = '' + # >>> conda initialize >>> + # !! Contents within this block are managed by 'conda init' !! + __conda_setup="$($HOME/miniconda3/bin/conda shell.bash 'hook' 2> /dev/null)" + if [ $? -eq 0 ]; then + eval "$__conda_setup" + else + if [ -f "$HOME/miniconda3/etc/profile.d/conda.sh" ]; then + . "$HOME/miniconda3/etc/profile.d/conda.sh" + else + export PATH="$HOME/miniconda3/bin:$PATH" + fi + fi + unset __conda_setup + + if [ -f "$HOME/miniconda3/etc/profile.d/mamba.sh" ]; then + . "$HOME/miniconda3/etc/profile.d/mamba.sh" + fi + # <<< conda initialize <<< + export PS1="[\[\e[32m\]\u\[\e[m\]@\[\e[33m\]\h\[\e[m\] \[\e[34m\]\W\[\e[m\]] \\$ " + ''; + profileExtra = '' + if [ "$(arch)" = "i386" ]; then + eval "$(/usr/local/bin/brew shellenv bash)" + else + eval "$(/opt/homebrew/bin/brew shellenv bash)" + fi + gpgconf --launch gpg-agent + ''; + }; + programs.bat = { + enable = true; + config = { pager = "less -SRF"; }; + }; + programs.direnv = { + enable = true; + enableBashIntegration = true; + enableZshIntegration = true; + }; + programs.git = { + enable = true; + userName = "Thomas A. Christensen II"; + userEmail = "25492070+MillironX@users.noreply.github.com"; + signing = { + key = "0x073201D703B7C376"; + signByDefault = true; + }; + extraConfig = { + core = { editor = "nvim"; }; + credential = { helper = "store"; }; + color = { ui = "auto"; }; + init = { defaultBranch = "master"; }; + }; + }; + programs.gpg.enable = true; + programs.neovim = { + enable = true; + package = pkgs.neovim-unwrapped; + coc.enable = true; + plugins = with pkgs.vimPlugins; [ + mason-nvim + mason-lspconfig-nvim + nvim-lspconfig + nvim-dap + nvim-dap-ui + null-ls-nvim + nvim-lint + formatter-nvim + lspsaga-nvim + vim-slime + ]; + extraLuaConfig = '' + require("mason").setup() + ''; + }; + programs.zsh = { + enable = true; + autosuggestion.enable = true; + enableCompletion = true; + completionInit = + "autoload -U compinit && compinit; autoload -U bashcompinit && bashcompinit"; + antidote = { + enable = true; + plugins = [ + "ohmyzsh/ohmyzsh path:lib" + "ohmyzsh/ohmyzsh path:plugins/git" + "ohmyzsh/ohmyzsh path:plugins/extract" + "zsh-users/zsh-syntax-highlighting" + "zsh-users/zsh-autosuggestions" + "zsh-users/zsh-completions" + "romkatv/powerlevel10k" + ]; + }; + initExtraFirst = '' + if [[ -r "''${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-''${(%):-%n}.zsh" ]]; then + source "''${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-''${(%):-%n}.zsh" + fi + ''; + initExtra = '' + source ~/.p10k.zsh + # >>> conda initialize >>> + # !! Contents within this block are managed by 'conda init' !! + __conda_setup="$($HOME/miniconda3/bin/conda shell.zsh 'hook' 2> /dev/null)" + if [ $? -eq 0 ]; then + eval "$__conda_setup" + else + if [ -f "$HOME/miniconda3/etc/profile.d/conda.sh" ]; then + . "$HOME/miniconda3/etc/profile.d/conda.sh" + else + export PATH="$HOME/miniconda3/bin:$PATH" + fi + fi + unset __conda_setup + + if [ -f "$HOME/miniconda3/etc/profile.d/mamba.sh" ]; then + . "$HOME/miniconda3/etc/profile.d/mamba.sh" + fi + # <<< conda initialize <<< + gpgconf --launch gpg-agent + source "$HOME/.cargo/env" + ''; + profileExtra = '' + if [ "$(arch)" = "i386" ]; then + eval "$(/usr/local/bin/brew shellenv zsh)" + else + eval "$(/opt/homebrew/bin/brew shellenv zsh)" + fi + ''; + }; + services.gpg-agent = { + enable = pkgs.hostPlatform.isLinux; + enableBashIntegration = true; + enableSshSupport = true; + enableZshIntegration = true; + defaultCacheTtl = 60; + maxCacheTtl = 120; + #pinentryPackage = pkgs.pinentry-qt; + }; +}