diff --git a/flake.nix b/flake.nix index 4ce515a..6230256 100644 --- a/flake.nix +++ b/flake.nix @@ -12,42 +12,46 @@ }; }; - outputs = { self, nixpkgs, nixos-hardware, ... }@inputs: - let - system = "x86_64-linux"; - pkg = nixpkgs.legacyPackages.${system}; - in { - nixosConfigurations = { - laptop = nixpkgs.lib.nixosSystem { - specialArgs = { inherit inputs; }; - modules = [ - ./hosts/laptop/configuration.nix - inputs.home-manager.nixosModules.default - inputs.stylix.nixosModules.stylix - nixos-hardware.nixosModules.lenovo-thinkpad-x13-yoga - (import ./overlays/ollama.nix) - ]; - }; + outputs = { + self, + nixpkgs, + nixos-hardware, + ... + } @ inputs: let + system = "x86_64-linux"; + pkg = nixpkgs.legacyPackages.${system}; + in { + formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.alejandra; + nixosConfigurations = { + laptop = nixpkgs.lib.nixosSystem { + specialArgs = {inherit inputs;}; + modules = [ + ./hosts/laptop/configuration.nix + inputs.home-manager.nixosModules.default + inputs.stylix.nixosModules.stylix + nixos-hardware.nixosModules.lenovo-thinkpad-x13-yoga + (import ./overlays/ollama.nix) + ]; + }; - server = nixpkgs.lib.nixosSystem { - specialArgs = { inherit inputs; }; - modules = [ - ./hosts/server/configuration.nix - inputs.home-manager.nixosModules.default - nixos-hardware.nixosModules.system76 - (import ./overlays/ollama.nix) - ]; - }; - - tablet = nixpkgs.lib.nixosSystem { - specialArgs = { inherit inputs; }; - modules = [ - ./hosts/tablet/configuration.nix - inputs.home-manager.nixosModules.default - nixos-hardware.nixosModules.microsoft-surface-pro-intel - ]; - }; + server = nixpkgs.lib.nixosSystem { + specialArgs = {inherit inputs;}; + modules = [ + ./hosts/server/configuration.nix + inputs.home-manager.nixosModules.default + nixos-hardware.nixosModules.system76 + (import ./overlays/ollama.nix) + ]; + }; + tablet = nixpkgs.lib.nixosSystem { + specialArgs = {inherit inputs;}; + modules = [ + ./hosts/tablet/configuration.nix + inputs.home-manager.nixosModules.default + nixos-hardware.nixosModules.microsoft-surface-pro-intel + ]; }; }; + }; } diff --git a/hosts/home/gnome.nix b/hosts/home/gnome.nix index 1276373..e8a8f55 100644 --- a/hosts/home/gnome.nix +++ b/hosts/home/gnome.nix @@ -1,6 +1,9 @@ -{ config, pkgs, inputs, ... }: - { + config, + pkgs, + inputs, + ... +}: { # ... dconf.settings = { # ... @@ -22,4 +25,3 @@ gnomeExtensions.search-light ]; } - diff --git a/hosts/home/home_common.nix b/hosts/home/home_common.nix index 218315b..b51a07d 100644 --- a/hosts/home/home_common.nix +++ b/hosts/home/home_common.nix @@ -1,6 +1,9 @@ -{ config, pkgs, inputs, ... }: - { + config, + pkgs, + inputs, + ... +}: { home = { username = "k"; homeDirectory = "/home/k"; @@ -13,7 +16,7 @@ userName = "k"; userEmail = "markers711@gmail.com"; }; - tmux = { enable = true; }; + tmux = {enable = true;}; starship.enable = true; zsh = { enable = true; @@ -21,16 +24,18 @@ enableCompletion = true; syntaxHighlighting.enable = true; autocd = true; - plugins = [{ - name = "zsh-nix-shell"; - file = "nix-shell.plugin.zsh"; - src = pkgs.fetchFromGitHub { - owner = "chisui"; - repo = "zsh-nix-shell"; - rev = "v0.8.0"; - sha256 = "1lzrn0n4fxfcgg65v0qhnj7wnybybqzs4adz7xsrkgmcsr0ii8b7"; - }; - }]; + plugins = [ + { + name = "zsh-nix-shell"; + file = "nix-shell.plugin.zsh"; + src = pkgs.fetchFromGitHub { + owner = "chisui"; + repo = "zsh-nix-shell"; + rev = "v0.8.0"; + sha256 = "1lzrn0n4fxfcgg65v0qhnj7wnybybqzs4adz7xsrkgmcsr0ii8b7"; + }; + } + ]; }; }; } diff --git a/hosts/home/hyprland.nix b/hosts/home/hyprland.nix index 5829eb3..c61735c 100644 --- a/hosts/home/hyprland.nix +++ b/hosts/home/hyprland.nix @@ -1,15 +1,21 @@ -{ config, pkgs, inputs, ... }: - { - imports = [ ./waybar.nix ./tile.nix ]; + config, + pkgs, + inputs, + ... +}: { + imports = [./waybar.nix ./tile.nix]; wayland.windowManager.hyprland = { enable = true; - systemd.variables = [ "--all" ]; + systemd.variables = ["--all"]; xwayland.enable = true; - + settings = { - exec-once = [ "${pkgs.hyprpaper}/bin/hyprpaper" "${pkgs.iio-hyprland}/bin/iio-hyprland" ]; + exec-once = [ + "${pkgs.hyprpaper}/bin/hyprpaper" + "${pkgs.iio-hyprland}/bin/iio-hyprland" + ]; monitor = "eDP-1,preferred,auto,1"; general = { "$mainMod" = "SUPER"; @@ -28,7 +34,7 @@ size = 2; passes = 2; brightness = 1; - noise = .3; + noise = 0.3; new_optimizations = true; }; drop_shadow = true; @@ -48,12 +54,8 @@ vrr = 1; }; - input = { - touchpad = { - natural_scroll = true; - }; - }; - + input = {touchpad = {natural_scroll = true;};}; + bind = [ # keybindings "$mainMod, Return, exec, $terminal" @@ -68,7 +70,6 @@ "$mainMod, up, movefocus, u" "$mainMod, down, movefocus, d" - # switch workspace "$mainMod, 1, workspace, 1" "$mainMod, 2, workspace, 2" @@ -124,10 +125,9 @@ "$mainMod, mouse:273, resizewindow" ]; - windowrule = - [ "float,mpv" "center,mpv" "pin,wofi" "idleinhibit focus,mpv" ]; + windowrule = ["float,mpv" "center,mpv" "pin,wofi" "idleinhibit focus,mpv"]; - windowrulev2 = [ ]; + windowrulev2 = []; }; }; @@ -141,4 +141,3 @@ _JAVA_AWT_WM_NONREPARENTING = 1; }; } - diff --git a/hosts/home/sway.nix b/hosts/home/sway.nix index 993dd0f..fac381d 100644 --- a/hosts/home/sway.nix +++ b/hosts/home/sway.nix @@ -1,7 +1,10 @@ -{ config, pkgs, inputs, ... }: - { - imports = [ ./waybar.nix ./tile.nix ]; + config, + pkgs, + inputs, + ... +}: { + imports = [./waybar.nix ./tile.nix]; wayland.windowManager.sway = { enable = true; @@ -29,9 +32,5 @@ QT_WAYLAND_DISABLE_WINDOWDECORATION = "1"; _JAVA_AWT_WM_NONREPARENTING = 1; }; - services = { - swayidle = { enable = true; }; - }; - + services = {swayidle = {enable = true;};}; } - diff --git a/hosts/home/tile.nix b/hosts/home/tile.nix index 2de4e34..2984ac4 100644 --- a/hosts/home/tile.nix +++ b/hosts/home/tile.nix @@ -1,14 +1,15 @@ -{ config, pkgs, inputs, ... }: - { - services = { - mako = { enable = true; }; - }; + config, + pkgs, + inputs, + ... +}: { + services = {mako = {enable = true;};}; programs = { - alacritty = { enable = true; }; + alacritty = {enable = true;}; swaylock = {enable = true;}; - wofi = { enable = true; }; - zathura = { enable = true; }; - mpv = { enable = true; }; + wofi = {enable = true;}; + zathura = {enable = true;}; + mpv = {enable = true;}; }; } diff --git a/hosts/home/waybar.nix b/hosts/home/waybar.nix index 990c55f..269e0ce 100644 --- a/hosts/home/waybar.nix +++ b/hosts/home/waybar.nix @@ -1,4 +1,8 @@ -{ config, pkgs, ... }: { +{ + config, + pkgs, + ... +}: { programs.waybar = { enable = true; systemd.enable = true; @@ -6,14 +10,14 @@ mainBar = { layer = "bottom"; position = "bottom"; - output = [ "eDP-1" ]; + output = ["eDP-1"]; margin-left = 45; margin-right = 45; spacing = 15; - modules-left = [ "sway/workspaces" "sway/mode" ]; - modules-center = [ "clock" ]; - modules-right = [ "pulseaudio" "network" "battery" ]; + modules-left = ["sway/workspaces" "sway/mode"]; + modules-center = ["clock"]; + modules-right = ["pulseaudio" "network" "battery"]; cpu = { interval = 15; @@ -38,7 +42,7 @@ phone = " "; portable = " "; car = " "; - default = [ " " " " ]; + default = [" " " "]; }; scroll-step = 1; on-click = "pavucontrol"; @@ -66,7 +70,7 @@ battery = { format = "{capacity}% {icon}"; - "format-icons" = [ " " " " " " " " " " ]; + "format-icons" = [" " " " " " " " " "]; }; clock = { diff --git a/hosts/laptop/configuration.nix b/hosts/laptop/configuration.nix index 6a4be68..6c1acc7 100644 --- a/hosts/laptop/configuration.nix +++ b/hosts/laptop/configuration.nix @@ -1,7 +1,10 @@ -{ config, pkgs, inputs, ... }: - { - imports = [ ./hardware-configuration.nix ]; + config, + pkgs, + inputs, + ... +}: { + imports = [./hardware-configuration.nix]; nixpkgs.config.allowUnfree = true; system.autoUpgrade.enable = true; @@ -15,18 +18,12 @@ nix = { gc.automatic = true; settings = { - experimental-features = [ "nix-command" "flakes" ]; - substituters = [ - "http://nix.dhilton.xyz/" - "https://cache.nixos.org/" - ]; - trusted-public-keys = [ - "nix.dhilton.xyz:MOW060dF1A0/UXmPZBue9KMxCO13PHYFwx1X9hcdYZ4=" - ]; + experimental-features = ["nix-command" "flakes"]; + substituters = ["http://nix.dhilton.xyz/" "https://cache.nixos.org/"]; + trusted-public-keys = ["nix.dhilton.xyz:MOW060dF1A0/UXmPZBue9KMxCO13PHYFwx1X9hcdYZ4="]; }; }; - networking = { hostName = "laptop"; networkmanager.enable = true; @@ -115,7 +112,7 @@ programs = { nix-ld.enable = true; - nix-ld.libraries = with pkgs; [ glibc glib ]; + nix-ld.libraries = with pkgs; [glibc glib]; zsh.enable = true; steam.enable = true; steam.gamescopeSession.enable = true; @@ -126,19 +123,19 @@ users.users.k = { isNormalUser = true; description = "k"; - extraGroups = [ "networkmanager" "wheel" ]; - packages = with pkgs; [ zsh ]; + extraGroups = ["networkmanager" "wheel"]; + packages = with pkgs; [zsh]; shell = pkgs.zsh; }; home-manager = { backupFileExtension = "bk"; - users = { "k" = import ./home.nix; }; + users = {"k" = import ./home.nix;}; }; environment = { - sessionVariables = { MOZ_USE_XINPUT2 = "1"; }; - gnome.excludePackages = (with pkgs; [ + sessionVariables = {MOZ_USE_XINPUT2 = "1";}; + gnome.excludePackages = with pkgs; [ gnome-photos gnome-tour xterm @@ -153,7 +150,7 @@ iagno # go game hitori # sudoku game atomix # puzzle game - ]); + ]; systemPackages = with pkgs; [ intel-vaapi-driver intel-compute-runtime @@ -170,8 +167,7 @@ }; boot = { - - plymouth = { enable = true; }; + plymouth = {enable = true;}; consoleLogLevel = 0; initrd.verbose = false; @@ -194,5 +190,4 @@ # Before changing this value read the documentation for this option # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). system.stateVersion = "23.11"; # Did you read the comment? - } diff --git a/hosts/laptop/hardware-configuration.nix b/hosts/laptop/hardware-configuration.nix index 1f91c42..d1652a5 100644 --- a/hosts/laptop/hardware-configuration.nix +++ b/hosts/laptop/hardware-configuration.nix @@ -1,16 +1,19 @@ # Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. -{ config, lib, pkgs, modulesPath, ... }: - { - imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; + config, + lib, + pkgs, + modulesPath, + ... +}: { + imports = [(modulesPath + "/installer/scan/not-detected.nix")]; - boot.initrd.availableKernelModules = - [ "xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-intel" ]; - boot.extraModulePackages = [ ]; + boot.initrd.availableKernelModules = ["xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod"]; + boot.initrd.kernelModules = []; + boot.kernelModules = ["kvm-intel"]; + boot.extraModulePackages = []; fileSystems."/" = { device = "/dev/disk/by-uuid/a7301069-c11f-411e-9a23-446744c3ae76"; @@ -22,8 +25,7 @@ fsType = "vfat"; }; - swapDevices = - [{ device = "/dev/disk/by-uuid/d9df94a1-5088-468c-839d-f4cd10cb7e5f"; }]; + swapDevices = [{device = "/dev/disk/by-uuid/d9df94a1-5088-468c-839d-f4cd10cb7e5f";}]; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking # (the default) this is the recommended approach. When using systemd-networkd it's diff --git a/hosts/laptop/home.nix b/hosts/laptop/home.nix index fa50ec7..5ad6dff 100644 --- a/hosts/laptop/home.nix +++ b/hosts/laptop/home.nix @@ -1,7 +1,15 @@ -{ config, pkgs, inputs, ... }: - { - imports = [ ../home/home_common.nix ../home/gnome.nix ../home/sway.nix ../home/hyprland.nix]; + config, + pkgs, + inputs, + ... +}: { + imports = [ + ../home/home_common.nix + ../home/gnome.nix + ../home/sway.nix + ../home/hyprland.nix + ]; nixpkgs.config.allowUnfree = true; @@ -52,5 +60,4 @@ enable = true; autoEnable = true; }; - } diff --git a/hosts/server/configuration.nix b/hosts/server/configuration.nix index 0caea1d..2a532ee 100644 --- a/hosts/server/configuration.nix +++ b/hosts/server/configuration.nix @@ -1,44 +1,42 @@ -{ config, pkgs, inputs, ... }: - { - imports = [ ./hardware-configuration.nix ./service.nix ]; + config, + pkgs, + inputs, + ... +}: { + imports = [./hardware-configuration.nix ./service.nix]; powerManagement.enable = false; system.autoUpgrade.enable = true; networking.networkmanager.enable = true; - boot.kernelParams = [ "intel_pstate=active" ]; + boot.kernelParams = ["intel_pstate=active"]; nix = { gc.automatic = true; settings = { - experimental-features = [ "nix-command" "flakes" ]; - substituters = [ - "http://nix.dhilton.xyz/" - "https://cache.nixos.org/" - ]; - trusted-public-keys = [ - "nix.dhilton.xyz:MOW060dF1A0/UXmPZBue9KMxCO13PHYFwx1X9hcdYZ4=" - ]; + experimental-features = ["nix-command" "flakes"]; + substituters = ["http://nix.dhilton.xyz/" "https://cache.nixos.org/"]; + trusted-public-keys = ["nix.dhilton.xyz:MOW060dF1A0/UXmPZBue9KMxCO13PHYFwx1X9hcdYZ4="]; }; }; programs = { nix-ld.enable = true; - nix-ld.libraries = with pkgs; [ glibc glib ]; + nix-ld.libraries = with pkgs; [glibc glib]; zsh.enable = true; }; users.users.k = { isNormalUser = true; description = "k"; - extraGroups = [ "networkmanager" "wheel" ]; - packages = with pkgs; [ zsh ]; + extraGroups = ["networkmanager" "wheel"]; + packages = with pkgs; [zsh]; shell = pkgs.zsh; }; - home-manager = { users = { "k" = import ./home.nix; }; }; + home-manager = {users = {"k" = import ./home.nix;};}; + + environment.systemPackages = with pkgs; [microcodeIntel]; - environment.systemPackages = with pkgs; [ microcodeIntel ]; - hardware.bluetooth.enable = true; hardware.bluetooth.powerOnBoot = true; hardware.graphics = { @@ -54,7 +52,7 @@ ]; }; - services.xserver.videoDrivers = [ "intel" ]; + services.xserver.videoDrivers = ["intel"]; # This value determines the NixOS release from which the default # settings for stateful data, like file locations and database versions @@ -63,5 +61,4 @@ # Before changing this value read the documentation for this option # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). system.stateVersion = "23.11"; # Did you read the comment? - } diff --git a/hosts/server/hardware-configuration.nix b/hosts/server/hardware-configuration.nix index dc454e8..5c9f1f7 100644 --- a/hosts/server/hardware-configuration.nix +++ b/hosts/server/hardware-configuration.nix @@ -1,16 +1,19 @@ # Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. -{ config, lib, pkgs, modulesPath, ... }: - { - imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; + config, + lib, + pkgs, + modulesPath, + ... +}: { + imports = [(modulesPath + "/installer/scan/not-detected.nix")]; - boot.initrd.availableKernelModules = - [ "xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-intel" ]; - boot.extraModulePackages = [ ]; + boot.initrd.availableKernelModules = ["xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc"]; + boot.initrd.kernelModules = []; + boot.kernelModules = ["kvm-intel"]; + boot.extraModulePackages = []; boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; @@ -27,8 +30,7 @@ fsType = "vfat"; }; - swapDevices = - [{ device = "/dev/disk/by-uuid/ecde85bd-abea-4926-80d5-810b01d0e364"; }]; + swapDevices = [{device = "/dev/disk/by-uuid/ecde85bd-abea-4926-80d5-810b01d0e364";}]; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking # (the default) this is the recommended approach. When using systemd-networkd it's diff --git a/hosts/server/home.nix b/hosts/server/home.nix index 3bb68d6..22dc964 100644 --- a/hosts/server/home.nix +++ b/hosts/server/home.nix @@ -1,11 +1,9 @@ -{ config, pkgs, inputs, ... }: - { - imports = [ ../home/home_common.nix ]; - home = { - packages = with pkgs; [ - docker - docker-compose - ]; - }; + config, + pkgs, + inputs, + ... +}: { + imports = [../home/home_common.nix]; + home = {packages = with pkgs; [docker docker-compose];}; } diff --git a/hosts/server/service.nix b/hosts/server/service.nix index 486919a..df80dae 100644 --- a/hosts/server/service.nix +++ b/hosts/server/service.nix @@ -1,9 +1,12 @@ -{ pkgs, lib, ... }: { - +{ + pkgs, + lib, + ... +}: { networking.firewall = { enable = true; - allowedTCPPorts = [ 80 443 22 26615 ]; - allowedUDPPorts = [ 26615 ]; + allowedTCPPorts = [80 443 22 26615]; + allowedUDPPorts = [26615]; }; security.acme = { @@ -11,18 +14,18 @@ defaults.email = "markers711@gmail.com"; }; - virtualisation.docker = { enable = true; }; + virtualisation.docker = {enable = true;}; services = { - openssh = { enable = true; }; + openssh = {enable = true;}; - jellyfin = { enable = true; }; + jellyfin = {enable = true;}; - fail2ban = { enable = true; }; + fail2ban = {enable = true;}; - postgresql = { enable = true; }; + postgresql = {enable = true;}; - i2p = { enable = true; }; + i2p = {enable = true;}; nix-serve = { enable = true; @@ -32,7 +35,7 @@ ollama = { enable = true; package = pkgs.ollama-intel; - }; + }; gitea = { enable = true; @@ -64,13 +67,13 @@ home-assistant = { enable = true; - extraComponents = [ "wiz" "fail2ban" "ollama" "wyoming" ]; + extraComponents = ["wiz" "fail2ban" "ollama" "wyoming"]; config = { - default_config = { }; + default_config = {}; "automation ui" = "!include automations.yaml"; http = { use_x_forwarded_for = "true"; - trusted_proxies = [ "127.0.0.1" ]; + trusted_proxies = ["127.0.0.1"]; server_port = 8003; }; }; @@ -79,13 +82,13 @@ wyoming = { piper.servers."piperNix" = { enable = true; - uri = "tcp://0.0.0.0:10200"; - voice = "en-us-ryan-low"; + uri = "tcp://0.0.0.0:10200"; + voice = "en-us-ryan-low"; }; faster-whisper.servers."whisperNix" = { enable = true; - uri = "tcp://0.0.0.0:10300"; - language = "en"; + uri = "tcp://0.0.0.0:10300"; + language = "en"; }; }; @@ -94,7 +97,7 @@ settings = { server.port = 8005; server.secret_key = "secretlol"; - search.formats = ["html" "json"]; + search.formats = ["html" "json"]; }; }; @@ -109,7 +112,7 @@ email = "markers711@gmail.com"; registration_open = false; }; - "Pleroma.Web.Endpoint" = { url.host = "fed.dhilton.xyz"; }; + "Pleroma.Web.Endpoint" = {url.host = "fed.dhilton.xyz";}; }; }; nginx = { @@ -124,7 +127,6 @@ recommendedTlsSettings = true; virtualHosts = { - "dhilton.xyz" = { enableACME = true; forceSSL = true; @@ -167,9 +169,9 @@ }; }; - "nix.dhilton.xyz" = { - locations."/".proxyPass = "http://127.0.0.1:5000"; - }; + "nix.dhilton.xyz" = { + locations."/".proxyPass = "http://127.0.0.1:5000"; + }; }; }; }; diff --git a/hosts/tablet/configuration.nix b/hosts/tablet/configuration.nix index e040184..a904c85 100644 --- a/hosts/tablet/configuration.nix +++ b/hosts/tablet/configuration.nix @@ -1,14 +1,18 @@ # Edit this configuration file to define what should be installed on # your system. Help is available in the configuration.nix(5) man page # and in the NixOS manual (accessible by running ‘nixos-help’). - -{ config, pkgs, inputs, nixos-hardware, ... }: - { - imports = [ # Include the results of the hardware scan. + config, + pkgs, + inputs, + nixos-hardware, + ... +}: { + imports = [ + # Include the results of the hardware scan. ./hardware-configuration.nix ]; - nix.settings.experimental-features = [ "nix-command" "flakes" ]; + nix.settings.experimental-features = ["nix-command" "flakes"]; nixpkgs.config.allowUnfree = true; networking.networkmanager.enable = true; @@ -69,11 +73,11 @@ users.users.k = { isNormalUser = true; description = "k"; - extraGroups = [ "networkmanager" "wheel" ]; - packages = with pkgs; [ zsh ]; + extraGroups = ["networkmanager" "wheel"]; + packages = with pkgs; [zsh]; shell = pkgs.zsh; }; - home-manager = { users = { "k" = import ./home.nix; }; }; + home-manager = {users = {"k" = import ./home.nix;};}; system.autoUpgrade.enable = true; nix.gc.automatic = true; @@ -89,7 +93,7 @@ neovim ]; - boot.kernelModules = [ "soc_button_array" ]; + boot.kernelModules = ["soc_button_array"]; networking.firewall.enable = true; @@ -100,5 +104,4 @@ # Before changing this value read the documentation for this option # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). system.stateVersion = "23.11"; # Did you read the comment? - } diff --git a/hosts/tablet/hardware-configuration.nix b/hosts/tablet/hardware-configuration.nix index 7d33460..2f3fc38 100644 --- a/hosts/tablet/hardware-configuration.nix +++ b/hosts/tablet/hardware-configuration.nix @@ -1,16 +1,19 @@ # Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. -{ config, lib, pkgs, modulesPath, ... }: - { - imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; + config, + lib, + pkgs, + modulesPath, + ... +}: { + imports = [(modulesPath + "/installer/scan/not-detected.nix")]; - boot.initrd.availableKernelModules = - [ "xhci_pci" "nvme" "usb_storage" "sd_mod" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-intel" ]; - boot.extraModulePackages = [ ]; + boot.initrd.availableKernelModules = ["xhci_pci" "nvme" "usb_storage" "sd_mod"]; + boot.initrd.kernelModules = []; + boot.kernelModules = ["kvm-intel"]; + boot.extraModulePackages = []; hardware.opengl.driSupport32Bit = true; networking.hostName = "surface"; @@ -29,8 +32,7 @@ fsType = "vfat"; }; - swapDevices = - [{ device = "/dev/disk/by-uuid/19941c01-ac8c-4609-a834-20259f3ee32e"; }]; + swapDevices = [{device = "/dev/disk/by-uuid/19941c01-ac8c-4609-a834-20259f3ee32e";}]; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking # (the default) this is the recommended approach. When using systemd-networkd it's diff --git a/hosts/tablet/home.nix b/hosts/tablet/home.nix index a583aea..906fd5f 100644 --- a/hosts/tablet/home.nix +++ b/hosts/tablet/home.nix @@ -1,6 +1,9 @@ -{ config, pkgs, inputs, ... }: - { + config, + pkgs, + inputs, + ... +}: { home.enableNixpkgsReleaseCheck = false; nixpkgs.config.allowUnfree = true; @@ -25,15 +28,17 @@ enableCompletion = true; syntaxHighlighting.enable = true; autocd = true; - plugins = [{ - name = "zsh-nix-shell"; - file = "nix-shell.plugin.zsh"; - src = pkgs.fetchFromGitHub { - owner = "chisui"; - repo = "zsh-nix-shell"; - rev = "v0.8.0"; - sha256 = "1lzrn0n4fxfcgg65v0qhnj7wnybybqzs4adz7xsrkgmcsr0ii8b7"; - }; - }]; + plugins = [ + { + name = "zsh-nix-shell"; + file = "nix-shell.plugin.zsh"; + src = pkgs.fetchFromGitHub { + owner = "chisui"; + repo = "zsh-nix-shell"; + rev = "v0.8.0"; + sha256 = "1lzrn0n4fxfcgg65v0qhnj7wnybybqzs4adz7xsrkgmcsr0ii8b7"; + }; + } + ]; }; } diff --git a/overlays/ollama.nix b/overlays/ollama.nix index 793daaf..ddba088 100644 --- a/overlays/ollama.nix +++ b/overlays/ollama.nix @@ -1,16 +1,22 @@ -{ config, pkgs, lib, ... }: - { + config, + pkgs, + lib, + ... +}: { nixpkgs.overlays = [ (final: prev: { ollama-intel = prev.ollama.overrideAttrs (oldAttrs: { - buildInputs = oldAttrs.buildInputs or [ ] - ++ [ prev.intel-compute-runtime.drivers ]; - propagatedBuildInputs = oldAttrs.propagetedBuildInputs or [ ] - ++ [ prev.intel-compute-runtime.drivers ]; + buildInputs = + oldAttrs.buildInputs + or [] + ++ [prev.intel-compute-runtime.drivers]; + propagatedBuildInputs = + oldAttrs.propagetedBuildInputs + or [] + ++ [prev.intel-compute-runtime.drivers]; - NIX_CFLAGS_COMPILE = - "${oldAttrs.NIX_CFLAGS_COMPILE or ""} -mavx2 -mfma -O3"; + NIX_CFLAGS_COMPILE = "${oldAttrs.NIX_CFLAGS_COMPILE or ""} -mavx2 -mfma -O3"; cmakeFlags = [ "GGML_NATIVE=true" "BUILD_SHARED_LIBS=true" @@ -21,20 +27,21 @@ "CMAKE_CXX_COMPILER=icpx" ]; - postInstall = (oldAttrs.postInstall or "") + '' - mkdir -p "$out/bin" - cat << EOF > "$out/bin/ollama-wrapped" - #!/bin/sh - export LD_LIBRARY_PATH="${prev.intel-compute-runtime.drivers}/lib" - export OLLAMA_INTEL_GPU=-1 - exec "$out/bin/ollama-base" "\$@" - EOF - chmod +x "$out/bin/ollama-wrapped" - mv $out/bin/ollama $out/bin/ollama-base - ln -s "$out/bin/ollama-wrapped" "$out/bin/ollama" - ''; + postInstall = + (oldAttrs.postInstall or "") + + '' + mkdir -p "$out/bin" + cat << EOF > "$out/bin/ollama-wrapped" + #!/bin/sh + export LD_LIBRARY_PATH="${prev.intel-compute-runtime.drivers}/lib" + export OLLAMA_INTEL_GPU=-1 + exec "$out/bin/ollama-base" "\$@" + EOF + chmod +x "$out/bin/ollama-wrapped" + mv $out/bin/ollama $out/bin/ollama-base + ln -s "$out/bin/ollama-wrapped" "$out/bin/ollama" + ''; }); }) ]; } -