From e74b033549c462054cfaa55190deaf5da5804dda Mon Sep 17 00:00:00 2001 From: Geir Okkenhaug Jerstad Date: Sun, 15 Dec 2024 14:14:45 +0100 Subject: [PATCH] local ollama with codestral --- workstation/#configuration.nix# | 231 ++++++++++++++++++++++++++++++++ workstation/.#configuration.nix | 1 + workstation/aliases.nix | 4 +- workstation/ollama.nix | 10 +- workstation/ollama.nix~ | 4 + 5 files changed, 246 insertions(+), 4 deletions(-) create mode 100644 workstation/#configuration.nix# create mode 120000 workstation/.#configuration.nix create mode 100644 workstation/ollama.nix~ diff --git a/workstation/#configuration.nix# b/workstation/#configuration.nix# new file mode 100644 index 0000000..a9e7dba --- /dev/null +++ b/workstation/#configuration.nix# @@ -0,0 +1,231 @@ + + +{ config, lib, pkgs, ... }: + +{ + imports = + [ + ./hardware-configuration.nix + ./k8s.nix + ./podman.nix + ./tty.nix + ./aliases.nix + ./zsh.nix + ./incus.nix + ./libvirt.nix + ./plymouth.nix + ./ollama.nix + ]; + + boot.loader.grub = { + enable = true; + zfsSupport = true; + efiSupport = true; + efiInstallAsRemovable = true; + mirroredBoots = [ + { devices = [ "nodev"]; path = "/boot"; } + ]; + }; + zramSwap = { + enable = true; + algorithm = "zstd"; + }; + + # firmaware + services.fwupd.enable = true; + hardware.enableRedistributableFirmware = true; + hardware.amdgpu.initrd.enable = true; + + # Bluetooth + hardware.bluetooth.enable = true; + hardware.bluetooth.powerOnBoot = true; + + # enable unfree + nixpkgs.config.allowUnfree = true; + + # Network + networking.nftables.enable = true; + networking.hostName = "work"; + services.tailscale.enable = true; + networking.networkmanager.enable = true; + networking.hostId = "8425e349"; + # Set your time zone. + time.timeZone = "Europe/Oslo"; + + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + console = { + font = "Lat2-Terminus16"; + keyMap = "no"; + }; + + # TuiGreet + services.greetd = { + enable = true; + settings = { + default_session = { + command = "${pkgs.greetd.tuigreet}/bin/tuigreet --time --cmd sway"; + user = "geir"; + }; + }; + }; + + # Gnome + services.xserver.desktopManager.gnome.enable = true; + + services.flatpak.enable = true; + + # Emacs + services.emacs.enable = true; + + # Enable flakes and other experimental features + nix = { + extraOptions = "experimental-features = nix-command flakes"; + #package = pkgs.nixFlakes; + }; + + # Sway + programs.sway = { + enable = true; + wrapperFeatures.gtk = true; + }; + services.dbus.enable = true; + xdg.portal = { + enable = true; + wlr.enable = true; + # gtk portal needed to make gtk apps happy + extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; + }; + + # Configure keymap in X11 + services.xserver.xkb.layout = "no"; + # services.xserver.xkb.options = "eurosign:e,caps:escape"; + fonts.packages = with pkgs; [ + noto-fonts + noto-fonts-cjk-sans + noto-fonts-emoji + liberation_ttf + dina-font + proggyfonts + # Fonts + nerd-fonts.meslo-lg + nerd-fonts.jetbrains-mono + nerd-fonts.fira-code + nerd-fonts.droid-sans-mono + nerd-fonts.zed-mono + nerd-fonts.iosevka + nerd-fonts.iosevka-term + + ]; + + services.pipewire = { + enable = true; + alsa.enable = true; + pulse.enable = true; + }; + hardware.pulseaudio.enable = false; + + programs.steam.enable = true; + programs.zsh.enable = true; + services.teamviewer.enable = true; + + users.users.geir = { + isNormalUser = true; + extraGroups = [ "networkmanager" "wheel" "libvirt" ]; + shell = pkgs.zsh; + packages = with pkgs; [ + firefox ncpamixer starship fastfetch hyfetch nerdfetch + emacsPackages.vterm virt-manager + chromium pavucontrol gnome-tweaks beauty-line-icon-theme + neo-cowsay fortune lolcat + zellij zsh godot_4 gimp-with-plugins obs-studio + vesktop + ]; + }; + # Allow insecure dotnet 7 + # nixpkgs.config.permittedInsecurePackages = [ + # "dotnet-sdk-7.0.120" + # "dotnet-core-combined" + # "dotnet-runtime-6.0.36" + # "dotnet-sdk-wrapped-7.0.120" + # "dotnet-core-combined" + # "dotnet-wrapped-combined" + # "dotnet-combined" + # ]; + + + # ld + programs.nix-ld.enable = true; + programs.nix-ld.libraries = with pkgs; [ + # Add any missing dynamic libraries for unpackaged programs + # here, NOT in environment.systemPackages + ]; + + # List packages installed in system profile. To search, run: + environment.systemPackages = with pkgs; [ + kitty terminator + dbus + greetd.tuigreet + wayland + xdg-utils + nix-direnv + du-dust fd bat + # Sway + swaylock swayidle swaybg waybar fuzzel gammastep mako + neovim emacs + glances inxi htop bottom + wget curl + git + mc eza du-dust ripgrep + nix-direnv + + # Languages + zig + python3 python3Packages.pip + guile + go gotools golint + rustup + nodejs + dotnet-sdk + dotnet-runtime + #avalonia + nodejs deno + typescript + + # language servers + csharp-ls + zls + python3Packages.python-lsp-server + gopls + luajitPackages.lua-lsp + nodePackages.bash-language-server + vimPlugins.cmp-nvim-lsp + ccls + gdb + marksman + + # Editor + vscode + + ]; + + # Enable the OpenSSH daemon. + services.openssh.enable = true; + + # zfs options + services.zfs.autoScrub.enable = true; + services.zfs.trim.enable = true; + + # Open ports in the firewall. + + networking.firewall.allowedTCPPorts = [ 22 ]; + networking.firewall.allowedUDPPorts = [ 22 ]; + networking.firewall.enable = true; + + system.copySystemConfiguration = true; + + system.stateVersion = "23.11"; + +} + diff --git a/workstation/.#configuration.nix b/workstation/.#configuration.nix new file mode 120000 index 0000000..014993f --- /dev/null +++ b/workstation/.#configuration.nix @@ -0,0 +1 @@ +geir@work.214172:1734192282 \ No newline at end of file diff --git a/workstation/aliases.nix b/workstation/aliases.nix index 723b30d..c18f2fd 100644 --- a/workstation/aliases.nix +++ b/workstation/aliases.nix @@ -15,7 +15,7 @@ cat = "bat"; grep = "rg"; top = "btm --color gruvbox"; - # some tools - + # Testing run0 + #sudo = "run0"; }; } diff --git a/workstation/ollama.nix b/workstation/ollama.nix index 4f9f0e5..1377420 100644 --- a/workstation/ollama.nix +++ b/workstation/ollama.nix @@ -1,4 +1,10 @@ -{ pkgs, ... }: +{ configs, pkgs, ... }: { - + services.ollama = { + enable = true; + home = "/home/geir/virtual/ollama"; + package = pkgs.ollama-rocm; + acceleration = "rocm"; + loadModela = [ "codestral" ]; + }; } diff --git a/workstation/ollama.nix~ b/workstation/ollama.nix~ new file mode 100644 index 0000000..4f9f0e5 --- /dev/null +++ b/workstation/ollama.nix~ @@ -0,0 +1,4 @@ +{ pkgs, ... }: +{ + +}