From 9a880cdaa3844ff596d6b7d2745ecdf65f61c520 Mon Sep 17 00:00:00 2001 From: Christoph Herb <52382992+chrishrb@users.noreply.github.com> Date: Thu, 3 Oct 2024 11:28:01 +0200 Subject: [PATCH] make some work related changes --- apps/default.nix | 3 ++ apps/ollama.nix | 15 ++++++++ flake.nix | 12 +++--- hosts/{mw => mb-pro-cc}/default.nix | 19 ++++++---- modules/common/applications/chrisNvim.nix | 18 +++++++-- modules/common/applications/default.nix | 1 + modules/common/applications/zoom.nix | 19 ++++++++++ modules/common/default.nix | 6 +++ modules/common/nvim/default.nix | 38 ------------------- .../common/nvim/lua/chrishrb/plugins/init.lua | 1 + modules/common/programming/web.nix | 2 +- modules/darwin/homebrew.nix | 8 ++-- 12 files changed, 82 insertions(+), 60 deletions(-) create mode 100644 apps/ollama.nix rename hosts/{mw => mb-pro-cc}/default.nix (73%) create mode 100644 modules/common/applications/zoom.nix diff --git a/apps/default.nix b/apps/default.nix index 500807b..074cf20 100644 --- a/apps/default.nix +++ b/apps/default.nix @@ -6,6 +6,9 @@ # install NixOS on a machine installer = import ./installer.nix { inherit pkgs; }; + # script to pull ollama models + ollama = import ./ollama.nix { inherit pkgs; }; + # neovim nvim = import ./nvim.nix { inherit system inputs; }; } diff --git a/apps/ollama.nix b/apps/ollama.nix new file mode 100644 index 0000000..8ad08c6 --- /dev/null +++ b/apps/ollama.nix @@ -0,0 +1,15 @@ +{ pkgs, ... }: +{ + + type = "app"; + + program = builtins.toString ( + pkgs.writeShellScript "ollama" '' + # code assistant model: deepseek-coder-v2, qwen2.5-coder, .. + ${pkgs.ollama}/bin/ollama pull deepseek-coder-v2 + + # general purpose model: mistral, qwen:7b, qwen:14b, .. + ${pkgs.ollama}/bin/ollama pull mistral + '' + ); +} diff --git a/flake.nix b/flake.nix index c515f87..658d286 100644 --- a/flake.nix +++ b/flake.nix @@ -87,7 +87,7 @@ fullName = "Christoph Herb"; gitName = fullName; gitEmail = "52382992+chrishrb@users.noreply.github.com"; - gitWorkEmail = "christoph.herb@maibornwolff.de"; + gitWorkEmail = "c.herb@chargecloud.de"; dotfilesRepo = "git@github.com:chrishrb/nix-dots.git"; }; @@ -113,18 +113,18 @@ }; # Contains my full Mac system builds, including home-manager - # darwin-rebuild switch --flake .#mw + # darwin-rebuild switch --flake .#cc darwinConfigurations = { - mw = import ./hosts/mw { inherit inputs globals overlays; }; + mb-pro-cc = import ./hosts/mb-pro-cc { inherit inputs globals overlays; }; macbook-christoph = import ./hosts/macbook-christoph { inherit inputs globals overlays; }; }; # For quickly applying home-manager settings with: - # home-manager switch --flake .#mw + # home-manager switch --flake .#cc homeConfigurations = { ambush = nixosConfigurations.ambush.config.home-manager.users."christoph".home; - mw = darwinConfigurations.mw.config.home-manager.users."christoph.herb".home; - macbook-christoph = darwinConfigurations.mw.config.home-manager.users."christophherb".home; + mb-pro-cc = darwinConfigurations.mb-pro-cc.config.home-manager.users."christophherb".home; + macbook-christoph = darwinConfigurations.cc.config.home-manager.users."christophherb".home; }; # Programs that can be run by calling this flake diff --git a/hosts/mw/default.nix b/hosts/mb-pro-cc/default.nix similarity index 73% rename from hosts/mw/default.nix rename to hosts/mb-pro-cc/default.nix index 1a3dbf0..a5ef49a 100644 --- a/hosts/mw/default.nix +++ b/hosts/mb-pro-cc/default.nix @@ -10,7 +10,7 @@ inputs.darwin.lib.darwinSystem { ../../modules/common ../../modules/darwin (globals // { - user = "christoph.herb"; + user = "christophherb"; }) inputs.home-manager.darwinModules.home-manager inputs.nix-homebrew.darwinModules.nix-homebrew @@ -19,28 +19,31 @@ inputs.darwin.lib.darwinSystem { nixpkgs.overlays = overlays; # Darwin specific - networking.hostName = "MB-GDWLXJMCPF"; + networking.hostName = "mb-pro-cc"; # Turn on all features related to desktop and graphical apps gui.enable = true; + work.enable = true; # Programs and services colima.enable = true; alacritty.enable = true; chrisNvim.enable = true; - dotfiles.enable = true; - drawio.enable = true; + dotfiles.enable = false; + drawio.enable = false; + chrome.enable = true; + zoom.enable = true; # languaages python.enable = true; lua.enable = true; devops.enable = true; - go.enable = true; - java.enable = true; + go.enable = false; + java.enable = false; web.enable = true; ai.enable = true; - discord.enable = true; - latex.enable = true; + discord.enable = false; + latex.enable = false; nixlang.enable = true; } ]; diff --git a/modules/common/applications/chrisNvim.nix b/modules/common/applications/chrisNvim.nix index 1df8cb7..fa73284 100644 --- a/modules/common/applications/chrisNvim.nix +++ b/modules/common/applications/chrisNvim.nix @@ -22,10 +22,20 @@ in home-manager.users.${config.user} = { imports = [ chrisNvim.homeModule ]; - chrisNvim = { - enable = config.chrisNvim.enable; - packageNames = [ "chrisNvim" "chrisNvimLocalAI" ]; + chrisNvim = (let + inherit (chrisNvim) utils packageDefinitions; + in { + enable = config.chrisNvim.enable; + packageNames = [ "chrisNvim" ]; + + packages = { + chrisNvim = utils.mergeCatDefs packageDefinitions.chrisNvim ({ pkgs, ... }: { + categories = { + aiAdapter = if (config.work.enable) then "ollama" else "copilot"; + }; + }); + }; + }); }; - }; }; } diff --git a/modules/common/applications/default.nix b/modules/common/applications/default.nix index 7badf56..4ca3fff 100644 --- a/modules/common/applications/default.nix +++ b/modules/common/applications/default.nix @@ -6,5 +6,6 @@ ./chrome.nix ./discord.nix ./drawio.nix + ./zoom.nix ]; } diff --git a/modules/common/applications/zoom.nix b/modules/common/applications/zoom.nix new file mode 100644 index 0000000..0bec481 --- /dev/null +++ b/modules/common/applications/zoom.nix @@ -0,0 +1,19 @@ +{ config, pkgs, lib, ... }: { + + options = { + zoom = { + enable = lib.mkEnableOption { + description = "Enable Zoom."; + default = false; + }; + }; + }; + + config = lib.mkIf (config.gui.enable && config.zoom.enable) { + unfreePackages = [ "zoom" ]; + home-manager.users.${config.user} = { + home.packages = with pkgs; [ zoom-us ]; + }; + }; + +} diff --git a/modules/common/default.nix b/modules/common/default.nix index 01db2e3..7e590ef 100644 --- a/modules/common/default.nix +++ b/modules/common/default.nix @@ -32,6 +32,12 @@ default = false; }; }; + work = { + enable = lib.mkEnableOption { + description = "Enable work specific brews/casks etc."; + default = false; + }; + }; homePath = lib.mkOption { type = lib.types.path; description = "Path of user's home directory."; diff --git a/modules/common/nvim/default.nix b/modules/common/nvim/default.nix index 033816c..0524eb6 100644 --- a/modules/common/nvim/default.nix +++ b/modules/common/nvim/default.nix @@ -265,44 +265,6 @@ let php = false; aiAdapter = "copilot"; - # this does not have an associated category of plugins, - # but lua can still check for it - lspDebugMode = false; - }; - }; - chrisNvimLocalAI = - { pkgs, ... }: - { - # see :help nixCats.flake.outputs.settings - settings = { - # will check for config in the store rather than .config - wrapRc = true; - configDirName = "chrishrb-nvim-local-ai"; - aliases = [ - "viml" - "vl" - ]; - # caution: this option must be the same for all packages. - # nvimSRC = inputs.neovim; - }; - # see :help nixCats.flake.outputs.packageDefinitions - categories = { - lazy = true; - generalBuildInputs = true; - general = true; - debug = true; - - # languages - go = true; - python = true; - web = true; - java = true; - javaExtras = extraJavaItems pkgs; - devops = true; - latex = false; - php = false; - aiAdapter = "ollama"; - # this does not have an associated category of plugins, # but lua can still check for it lspDebugMode = false; diff --git a/modules/common/nvim/lua/chrishrb/plugins/init.lua b/modules/common/nvim/lua/chrishrb/plugins/init.lua index e707ff9..7654730 100644 --- a/modules/common/nvim/lua/chrishrb/plugins/init.lua +++ b/modules/common/nvim/lua/chrishrb/plugins/init.lua @@ -238,6 +238,7 @@ local plugins = { { "zbirenbaum/copilot.lua", cmd = "Copilot", + enabled = nixCats("aiAdapter") == "copilot", config = function () require("copilot").setup({}) end diff --git a/modules/common/programming/web.nix b/modules/common/programming/web.nix index 7ea0275..1a06a0f 100644 --- a/modules/common/programming/web.nix +++ b/modules/common/programming/web.nix @@ -4,7 +4,7 @@ config = lib.mkIf config.web.enable { home-manager.users.${config.user}.home.packages = with pkgs; [ - nodejs_22 + nodejs_18 nodePackages.pnpm yarn ]; diff --git a/modules/darwin/homebrew.nix b/modules/darwin/homebrew.nix index 33aae98..01f0b04 100644 --- a/modules/darwin/homebrew.nix +++ b/modules/darwin/homebrew.nix @@ -35,15 +35,17 @@ "tiles" "skim" # open pdfs - # Browsers - #"google-chrome" - # other "bitwarden" "spotify" "logi-options+" "keepassxc" "notunes" # disable autolaunch of music app + + ] ++ lib.optionals config.work.enable [ + + "tunnelblick" + "microsoft-teams" ]; };