From 098805ae76ddb97a98cda81347c56e0f91e74004 Mon Sep 17 00:00:00 2001 From: Price Hiller Date: Thu, 30 Nov 2023 00:49:32 -0600 Subject: [PATCH] =?UTF-8?q?feat:=20migrate=20to=20nix=20home-manager=20?= =?UTF-8?q?=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitmodules | 3 + config/default.nix | 61 +++++ dots/.config/.gitignore | 26 -- dots/.config/emacs/.gitignore | 5 - dots/.config/home-manager | 1 + dots/.config/nix/nix.conf | 2 + .../zsh/config/completions/completions/_exa | 59 ----- dots/.config/zsh/config/plugins/init.zsh | 1 + dots/.config/zsh/config/plugins/powerlevel10k | 1 + flake.lock | 224 ++++++++++++++++++ flake.nix | 38 +++ 11 files changed, 331 insertions(+), 90 deletions(-) create mode 100644 config/default.nix delete mode 100644 dots/.config/.gitignore delete mode 100644 dots/.config/emacs/.gitignore create mode 120000 dots/.config/home-manager create mode 100644 dots/.config/nix/nix.conf delete mode 100644 dots/.config/zsh/config/completions/completions/_exa create mode 160000 dots/.config/zsh/config/plugins/powerlevel10k create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/.gitmodules b/.gitmodules index e65e8c30..2c63bc5e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -22,3 +22,6 @@ [submodule "dots/.config/zsh/config/plugins/zsh-nix-shell"] path = dots/.config/zsh/config/plugins/zsh-nix-shell url = https://github.com/chisui/zsh-nix-shell +[submodule "dots/.config/zsh/config/plugins/powerlevel10k"] + path = dots/.config/zsh/config/plugins/powerlevel10k + url = https://github.com/romkatv/powerlevel10k.git diff --git a/config/default.nix b/config/default.nix new file mode 100644 index 00000000..afb4576b --- /dev/null +++ b/config/default.nix @@ -0,0 +1,61 @@ +{ pkgs, ... }: { + programs.home-manager.enable = true; + + home = { + packages = with pkgs; [ + gcc + sqlite + luajit + imagemagick + dotnet-sdk_8 + cargo + rustc + shellcheck + openjdk + go + nodejs + poetry + python3 + ruby + yamllint + curl + llvm + openssh + openssl + pkg-config + wget + rsync + readline + gnumake + cmake + git + gh + ffmpeg + silicon + man + jq + tectonic + fzf + eza + luajit + ]; + file = { + ".config/" = { source = ../dots/.config; recursive = true; force = true; }; + ".local/" = { source = ../dots/.local; recursive = true; force = true; }; + ".omnisharp" = { source = ../dots/.omnisharp; force = true; }; + ".zshrc" = { source = ../dots/.zshrc; force = true; }; + ".latexmkrc" = { source = ../dots/.latexmkrc; force = true; }; + }; + }; + + programs.neovim = { + enable = true; + extraPackages = with pkgs; [ + sqlite + gh + ]; + # Magick is required for image.nvim + extraLuaPackages = lp: [ lp.magick ]; + }; + +} diff --git a/dots/.config/.gitignore b/dots/.config/.gitignore deleted file mode 100644 index f05d5cb2..00000000 --- a/dots/.config/.gitignore +++ /dev/null @@ -1,26 +0,0 @@ -/* -!nvim -!zathura -!chrome-flags.conf -!chromium-flags.conf -!bat -!zsh -!hypr -!mako -!mpv -!waybar -!silicon -!powershell -!wezterm -!wofi -!kitty -!alacritty -!git -!gtk-3.0 -!gtk-4.0 -!fontconfig -!stylua.toml -!Trolltech.conf -!systemd -!mimeapps.list -!emacs diff --git a/dots/.config/emacs/.gitignore b/dots/.config/emacs/.gitignore deleted file mode 100644 index 71f1d3d4..00000000 --- a/dots/.config/emacs/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -* -!.gitignore -!init.el -!lisp -!early-init.el diff --git a/dots/.config/home-manager b/dots/.config/home-manager new file mode 120000 index 00000000..d1ef4cfa --- /dev/null +++ b/dots/.config/home-manager @@ -0,0 +1 @@ +/home/sam/.dot_files \ No newline at end of file diff --git a/dots/.config/nix/nix.conf b/dots/.config/nix/nix.conf new file mode 100644 index 00000000..06582103 --- /dev/null +++ b/dots/.config/nix/nix.conf @@ -0,0 +1,2 @@ +extra-experimental-features = flakes nix-command +max-jobs = auto diff --git a/dots/.config/zsh/config/completions/completions/_exa b/dots/.config/zsh/config/completions/completions/_exa deleted file mode 100644 index f3392894..00000000 --- a/dots/.config/zsh/config/completions/completions/_exa +++ /dev/null @@ -1,59 +0,0 @@ -#compdef exa - -# Save this file as _exa in /usr/local/share/zsh/site-functions or in any -# other folder in $fpath. E. g. save it in a folder called ~/.zfunc and add a -# line containing `fpath=(~/.zfunc $fpath)` somewhere before `compinit` in your -# ~/.zshrc. - -__exa() { - # Give completions using the `_arguments` utility function with - # `-s` for option stacking like `exa -ab` for `exa -a -b` and - # `-S` for delimiting options with `--` like in `exa -- -a`. - _arguments -s -S \ - "(- *)"{-v,--version}"[Show version of exa]" \ - "(- *)"{-'\?',--help}"[Show list of command-line options]" \ - {-1,--oneline}"[Display one entry per line]" \ - {-l,--long}"[Display extended file metadata as a table]" \ - {-G,--grid}"[Display entries as a grid]" \ - {-x,--across}"[Sort the grid across, rather than downwards]" \ - {-R,--recurse}"[Recurse into directories]" \ - {-T,--tree}"[Recurse into directories as a tree]" \ - {-F,--classify}"[Display type indicator by file names]" \ - --colo{,u}r"[When to use terminal colours]" \ - --colo{,u}r-scale"[Highlight levels of file sizes distinctly]" \ - --icons"[Display icons]" \ - --no-icons"[Hide icons]" \ - --group-directories-first"[Sort directories before other files]" \ - --git-ignore"[Ignore files mentioned in '.gitignore']" \ - {-a,--all}"[Show hidden and 'dot' files]" \ - {-d,--list-dirs}"[List directories like regular files]" \ - {-D,--only-dirs}"[List only directories]" \ - {-L,--level}"+[Limit the depth of recursion]" \ - {-r,--reverse}"[Reverse the sort order]" \ - {-s,--sort}="[Which field to sort by]:(sort field):(accessed age changed created date extension Extension filename Filename inode modified oldest name Name newest none size time type)" \ - {-I,--ignore-glob}"[Ignore files that match these glob patterns]" \ - {-b,--binary}"[List file sizes with binary prefixes]" \ - {-B,--bytes}"[List file sizes in bytes, without any prefixes]" \ - --changed"[Use the changed timestamp field]" \ - {-g,--group}"[List each file's group]" \ - {-h,--header}"[Add a header row to each column]" \ - {-H,--links}"[List each file's number of hard links]" \ - {-i,--inode}"[List each file's inode number]" \ - {-m,--modified}"[Use the modified timestamp field]" \ - {-n,--numeric}"[List numeric user and group IDs.]" \ - {-S,--blocks}"[List each file's number of filesystem blocks]" \ - {-t,--time}="[Which time field to show]:(time field):(accessed changed created modified)" \ - --time-style="[How to format timestamps]:(time style):(default iso long-iso full-iso)" \ - --no-permissions"[Suppress the permissions field]" \ - --octal-permissions"[List each file's permission in octal format]" \ - --no-filesize"[Suppress the filesize field]" \ - --no-user"[Suppress the user field]" \ - --no-time"[Suppress the time field]" \ - {-u,--accessed}"[Use the accessed timestamp field]" \ - {-U,--created}"[Use the created timestamp field]" \ - --git"[List each file's Git status, if tracked]" \ - {-@,--extended}"[List each file's extended attributes and sizes]" \ - '*:filename:_files' -} - -__exa diff --git a/dots/.config/zsh/config/plugins/init.zsh b/dots/.config/zsh/config/plugins/init.zsh index 6714ceaf..3cf4ab03 100644 --- a/dots/.config/zsh/config/plugins/init.zsh +++ b/dots/.config/zsh/config/plugins/init.zsh @@ -8,6 +8,7 @@ configure() { init() { local wkdir="${BASE_ZSH_CONFIG_DIR}/config/plugins" + source "${wkdir}/powerlevel10k/powerlevel10k.zsh-theme" source "${wkdir}/fzf-tab/fzf-tab.plugin.zsh" source "${wkdir}/zsh-autosuggestions/zsh-autosuggestions.zsh" source "${wkdir}/zsh-completions/zsh-completions.plugin.zsh" diff --git a/dots/.config/zsh/config/plugins/powerlevel10k b/dots/.config/zsh/config/plugins/powerlevel10k new file mode 160000 index 00000000..174ce9bf --- /dev/null +++ b/dots/.config/zsh/config/plugins/powerlevel10k @@ -0,0 +1 @@ +Subproject commit 174ce9bf0166c657404a21f4dc9608da935f7325 diff --git a/flake.lock b/flake.lock new file mode 100644 index 00000000..42797553 --- /dev/null +++ b/flake.lock @@ -0,0 +1,224 @@ +{ + "nodes": { + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": [ + "neovim-nightly-overlay", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1698882062, + "narHash": "sha256-HkhafUayIqxXyHH1X8d9RDl1M2CkFgZLjKD3MzabiEo=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "8c9fa2545007b49a5db5f650ae91f227672c3877", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_2": { + "inputs": { + "nixpkgs-lib": [ + "neovim-nightly-overlay", + "hercules-ci-effects", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1696343447, + "narHash": "sha256-B2xAZKLkkeRFG5XcHHSXXcP7To9Xzr59KXeZiRf4vdQ=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "c9afaba3dfa4085dbd2ccb38dfade5141e33d9d4", + "type": "github" + }, + "original": { + "id": "flake-parts", + "type": "indirect" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1685518550, + "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "hercules-ci-effects": { + "inputs": { + "flake-parts": "flake-parts_2", + "nixpkgs": [ + "neovim-nightly-overlay", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1701009247, + "narHash": "sha256-GuX16rzRze2y7CsewJLTV6qXkXWyEwp6VCZXi8HLruU=", + "owner": "hercules-ci", + "repo": "hercules-ci-effects", + "rev": "31b6cd7569191bfcd0a548575b0e2ef953ed7d09", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "hercules-ci-effects", + "type": "github" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1701071203, + "narHash": "sha256-lQywA7QU/vzTdZ1apI0PfgCWNyQobXUYghVrR5zuIeM=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "db1878f013b52ba5e4034db7c1b63e8d04173a86", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "neovim-flake": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": [ + "neovim-nightly-overlay", + "nixpkgs" + ] + }, + "locked": { + "dir": "contrib", + "lastModified": 1701130526, + "narHash": "sha256-+TPrkfN6jG5ZlRBG4d+6vS8tRIVWMNsVFECb3gbjI9E=", + "owner": "neovim", + "repo": "neovim", + "rev": "3a3474371b6b87e630e7aa217e7860e9154cd563", + "type": "github" + }, + "original": { + "dir": "contrib", + "owner": "neovim", + "repo": "neovim", + "type": "github" + } + }, + "neovim-nightly-overlay": { + "inputs": { + "flake-compat": "flake-compat", + "flake-parts": "flake-parts", + "hercules-ci-effects": "hercules-ci-effects", + "neovim-flake": "neovim-flake", + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1701137963, + "narHash": "sha256-ihXnCLR42qO9Mc+fLT/vtp+EW8CZHJwgdKMhc/+y76I=", + "owner": "nix-community", + "repo": "neovim-nightly-overlay", + "rev": "e8b2276946b372057d6c425fe259c1351fdf2c67", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "neovim-nightly-overlay", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1701040486, + "narHash": "sha256-vawYwoHA5CwvjfqaT3A5CT9V36Eq43gxdwpux32Qkjw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "45827faa2132b8eade424f6bdd48d8828754341a", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1701040486, + "narHash": "sha256-vawYwoHA5CwvjfqaT3A5CT9V36Eq43gxdwpux32Qkjw=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "45827faa2132b8eade424f6bdd48d8828754341a", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "home-manager": "home-manager", + "neovim-nightly-overlay": "neovim-nightly-overlay", + "nixpkgs": "nixpkgs_2" + } + }, + "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 00000000..18b7bacb --- /dev/null +++ b/flake.nix @@ -0,0 +1,38 @@ +{ + description = "Price Hiller's home manager configuration"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + neovim-nightly-overlay.url = "github:nix-community/neovim-nightly-overlay"; + }; + + outputs = inputs @ { home-manager, nixpkgs, ... }: + let + system = "x86_64-linux"; + username = "sam"; + in + { + defaultPackage.x86_64-linux = home-manager.defaultPackage.x86_64-linux; + targets.genericLinux.enable = true; + homeConfigurations.${username} = home-manager.lib.homeManagerConfiguration { + pkgs = nixpkgs.legacyPackages.${system}; + modules = [ + ({ + nixpkgs.overlays = [ + inputs.neovim-nightly-overlay.overlay + ]; + home = { + username = "${username}"; + homeDirectory = "/home/${username}"; + stateVersion = "24.05"; + }; + }) + ./config + ]; + }; + }; +}