diff --git a/flake.lock b/flake.lock index 274dfd1..24730d2 100644 --- a/flake.lock +++ b/flake.lock @@ -258,7 +258,7 @@ }, "locked": { "lastModified": 1682972682, - "narHash": "sha256-+XyTwr4jZuDlT5l/0LynDVtvdWj8WmAwDEP/2rZ+1hk=", + "narHash": "sha256-QuwwK2R4dAXTnM/MLwufUZOip8//H8G7i4ivS7YsP08=", "type": "git", "url": "file:///root/projects/microvm.nix" }, diff --git a/hosts/ward/microvms/test/default.nix b/hosts/ward/microvms/test/default.nix index a3bd2eb..ead4a9b 100644 --- a/hosts/ward/microvms/test/default.nix +++ b/hosts/ward/microvms/test/default.nix @@ -13,6 +13,8 @@ ../../../../users/root ]; + home-manager.users.root.home.minimal = true; + systemd.network.networks = { "10-wan" = { # TODO diff --git a/users/common/default.nix b/users/common/default.nix index 12d1aeb..908c9cf 100644 --- a/users/common/default.nix +++ b/users/common/default.nix @@ -1,70 +1,14 @@ {pkgs, ...}: { imports = [ ./modules/uid.nix + ./modules/minimal.nix - #./btop.nix - #./fish.nix ./git.nix ./htop.nix ./neovim - ./nushell.nix - #./ssh.nix - ./starship.nix - #./tmux.nix - #./xdg.nix - ./zsh + ./shell + ./utils.nix ]; - home = { - packages = with pkgs; [ - bandwhich - btop - fd - file - neofetch - rclone - ripgrep - rnr - rsync - sd - tree - rage - ]; - - shellAliases = { - l = "ls -lahF --group-directories-first --show-control-chars --quoting-style=escape --color=auto"; - t = "tree -F --dirsfirst -L 2"; - tt = "tree -F --dirsfirst -L 3 --filelimit 16"; - cpr = "rsync -axHAWXS --numeric-ids --info=progress2"; - - md = "mkdir"; - rmd = "rm --one-file-system -d"; - cp = "cp -vi"; - mv = "mv -vi"; - rm = "rm --one-file-system -I"; - chmod = "chmod -c --preserve-root"; - chown = "chown -c --preserve-root"; - - ip = "ip --color"; - tmux = "tmux -2"; - rg = "rg -S"; - - zf = "zathura --fork"; - }; - }; - - programs = { - atuin = { - enable = true; - settings.auto_sync = false; - }; - bat = { - enable = true; - config.theme = "base16"; - }; - fzf.enable = true; - gpg.enable = true; - }; - xdg.configFile."nixpkgs/config.nix".text = "{ allowUnfree = true; }"; } diff --git a/users/common/git.nix b/users/common/git.nix index af7f88e..42f3e21 100644 --- a/users/common/git.nix +++ b/users/common/git.nix @@ -1,4 +1,6 @@ {lib, ...}: { + # TODO use git-fuzzy. + # TODO integrate git-fuzzy and difft programs.gitui.enable = true; programs.git = { enable = true; diff --git a/users/common/modules/minimal.nix b/users/common/modules/minimal.nix new file mode 100644 index 0000000..cd19e84 --- /dev/null +++ b/users/common/modules/minimal.nix @@ -0,0 +1,5 @@ +{lib, ...}: { + options = { + home.minimal = lib.mkEnableOption "minimal setup only (e.g. for virtual machines)"; + }; +} diff --git a/users/common/neovim/default.nix b/users/common/neovim/default.nix index 1bb682a..ded4a1b 100644 --- a/users/common/neovim/default.nix +++ b/users/common/neovim/default.nix @@ -1,21 +1,22 @@ { + config, lib, pkgs, ... }: { - programs = { - neovim = { - enable = true; - viAlias = true; - vimAlias = true; - vimdiffAlias = true; - withPython3 = true; - extraPython3Packages = pyPkgs: with pyPkgs; [openai]; - withNodeJs = true; - defaultEditor = true; - }; + programs.neovim = { + enable = true; + viAlias = true; + vimAlias = true; + vimdiffAlias = true; + withPython3 = true; + extraPython3Packages = pyPkgs: with pyPkgs; [openai]; + withNodeJs = true; + defaultEditor = true; + }; + xdg.configFile = lib.mkIf (!config.home.minimal) { + "nvim/lua".source = ./lua; + "nvim/init.lua".source = ./init.lua; }; - xdg.configFile."nvim/lua".source = ./lua; - xdg.configFile."nvim/init.lua".source = ./init.lua; home.packages = with pkgs; [gcc shellcheck stylua]; } diff --git a/users/common/shell/default.nix b/users/common/shell/default.nix new file mode 100644 index 0000000..3fc52af --- /dev/null +++ b/users/common/shell/default.nix @@ -0,0 +1,31 @@ +{pkgs, ...}: { + imports = [ + ./nushell.nix + ./starship.nix + ./zsh + ]; + + home.shellAliases = { + l = "ls -lahF --group-directories-first --show-control-chars --quoting-style=escape --color=auto"; + t = "tree -F --dirsfirst -L 2"; + tt = "tree -F --dirsfirst -L 3 --filelimit 16"; + cpr = "rsync -axHAWXS --numeric-ids --info=progress2"; + + md = "mkdir"; + rmd = "rm --one-file-system -d"; + cp = "cp -vi"; + mv = "mv -vi"; + rm = "rm --one-file-system -I"; + chmod = "chmod -c --preserve-root"; + chown = "chown -c --preserve-root"; + + ip = "ip --color"; + tmux = "tmux -2"; + rg = "rg -S"; + }; + + programs.atuin = { + enable = true; + settings.auto_sync = false; + }; +} diff --git a/users/common/fish.nix b/users/common/shell/fish.nix similarity index 100% rename from users/common/fish.nix rename to users/common/shell/fish.nix diff --git a/users/common/nushell.nix b/users/common/shell/nushell.nix similarity index 100% rename from users/common/nushell.nix rename to users/common/shell/nushell.nix diff --git a/users/common/starship.nix b/users/common/shell/starship.nix similarity index 100% rename from users/common/starship.nix rename to users/common/shell/starship.nix diff --git a/users/common/zsh/default.nix b/users/common/shell/zsh/default.nix similarity index 100% rename from users/common/zsh/default.nix rename to users/common/shell/zsh/default.nix diff --git a/users/common/zsh/zshrc b/users/common/shell/zsh/zshrc similarity index 100% rename from users/common/zsh/zshrc rename to users/common/shell/zsh/zshrc diff --git a/users/common/utils.nix b/users/common/utils.nix new file mode 100644 index 0000000..340afa7 --- /dev/null +++ b/users/common/utils.nix @@ -0,0 +1,27 @@ +{pkgs, ...}: { + home = { + packages = with pkgs; [ + bandwhich + btop + fd + file + neofetch + rclone + ripgrep + rnr + rsync + sd + tree + rage + ]; + }; + + programs = { + bat = { + enable = true; + config.theme = "base16"; + }; + fzf.enable = true; + gpg.enable = true; + }; +} diff --git a/users/myuser/default.nix b/users/myuser/default.nix index 8c912e8..0804e8c 100644 --- a/users/myuser/default.nix +++ b/users/myuser/default.nix @@ -24,7 +24,7 @@ in { home-manager.users.${myuser} = { imports = [ #impermanence.home-manager.impermanence - ../common + ../common/core ./dev.nix ./gpg.nix ./ssh.nix @@ -36,6 +36,7 @@ in { username = config.users.users.${myuser}.name; shellAliases = { p = "cd ~/projects"; + zf = "zathura --fork"; }; }; }; diff --git a/users/common/graphical/default.nix b/users/myuser/graphical/default.nix similarity index 100% rename from users/common/graphical/default.nix rename to users/myuser/graphical/default.nix diff --git a/users/common/graphical/kitty.nix b/users/myuser/graphical/kitty.nix similarity index 100% rename from users/common/graphical/kitty.nix rename to users/myuser/graphical/kitty.nix