diff --git a/flake.lock b/flake.lock index 33ff08e..09ad853 100644 --- a/flake.lock +++ b/flake.lock @@ -49,6 +49,27 @@ "type": "github" } }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": [ + "hermes-agent", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1772408722, + "narHash": "sha256-rHuJtdcOjK7rAHpHphUb1iCvgkU3GpfvicLMwwnfMT0=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "f20dc5d9b8027381c474144ecabc9034d6a839a3", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, "gitignore": { "inputs": { "nixpkgs": [ @@ -71,6 +92,29 @@ "type": "github" } }, + "hermes-agent": { + "inputs": { + "flake-parts": "flake-parts", + "nixpkgs": "nixpkgs", + "npm-lockfile-fix": "npm-lockfile-fix", + "pyproject-build-systems": "pyproject-build-systems", + "pyproject-nix": "pyproject-nix_2", + "uv2nix": "uv2nix_2" + }, + "locked": { + "lastModified": 1780086628, + "narHash": "sha256-+O+2ecAWOSiIkCBPgXh8c5Uq5RUZIycnXqiYnRWyxJA=", + "owner": "NousResearch", + "repo": "hermes-agent", + "rev": "689ef5e233980f5d5a32080e959f44c8991dd03a", + "type": "github" + }, + "original": { + "owner": "NousResearch", + "repo": "hermes-agent", + "type": "github" + } + }, "hjem": { "inputs": { "nix-darwin": "nix-darwin", @@ -208,7 +252,7 @@ "hyprutils": "hyprutils", "hyprwayland-scanner": "hyprwayland-scanner", "hyprwire": "hyprwire", - "nixpkgs": "nixpkgs_2", + "nixpkgs": "nixpkgs_3", "pre-commit-hooks": "pre-commit-hooks", "systems": "systems_2", "xdph": "xdph" @@ -460,7 +504,7 @@ }, "ndg": { "inputs": { - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs_2" }, "locked": { "lastModified": 1766342086, @@ -499,6 +543,22 @@ } }, "nixpkgs": { + "locked": { + "lastModified": 1775036866, + "narHash": "sha256-ZojAnPuCdy657PbTq5V0Y+AHKhZAIwSIT2cb8UgAz/U=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "6201e203d09599479a3b3450ed24fa81537ebc4e", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { "locked": { "lastModified": 1766070988, "narHash": "sha256-G/WVghka6c4bAzMhTwT2vjLccg/awmHkdKSd2JrycLc=", @@ -514,7 +574,7 @@ "type": "github" } }, - "nixpkgs_2": { + "nixpkgs_3": { "locked": { "lastModified": 1767379071, "narHash": "sha256-EgE0pxsrW9jp9YFMkHL9JMXxcqi/OoumPJYwf+Okucw=", @@ -530,7 +590,7 @@ "type": "github" } }, - "nixpkgs_3": { + "nixpkgs_4": { "locked": { "lastModified": 1769170682, "narHash": "sha256-oMmN1lVQU0F0W2k6OI3bgdzp2YOHWYUAw79qzDSjenU=", @@ -546,7 +606,7 @@ "type": "github" } }, - "nixpkgs_4": { + "nixpkgs_5": { "locked": { "lastModified": 1768127708, "narHash": "sha256-1Sm77VfZh3mU0F5OqKABNLWxOuDeHIlcFjsXeeiPazs=", @@ -562,6 +622,27 @@ "type": "github" } }, + "npm-lockfile-fix": { + "inputs": { + "nixpkgs": [ + "hermes-agent", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1775903712, + "narHash": "sha256-2GV79U6iVH4gKAPWYrxUReB0S41ty/Y3dBLquU8AlaA=", + "owner": "jeslie0", + "repo": "npm-lockfile-fix", + "rev": "c6093acb0c0548e0f9b8b3d82918823721930fe8", + "type": "github" + }, + "original": { + "owner": "jeslie0", + "repo": "npm-lockfile-fix", + "type": "github" + } + }, "pre-commit-hooks": { "inputs": { "flake-compat": "flake-compat", @@ -585,12 +666,101 @@ "type": "github" } }, + "pyproject-build-systems": { + "inputs": { + "nixpkgs": [ + "hermes-agent", + "nixpkgs" + ], + "pyproject-nix": "pyproject-nix", + "uv2nix": "uv2nix" + }, + "locked": { + "lastModified": 1772555609, + "narHash": "sha256-3BA3HnUvJSbHJAlJj6XSy0Jmu7RyP2gyB/0fL7XuEDo=", + "owner": "pyproject-nix", + "repo": "build-system-pkgs", + "rev": "c37f66a953535c394244888598947679af231863", + "type": "github" + }, + "original": { + "owner": "pyproject-nix", + "repo": "build-system-pkgs", + "type": "github" + } + }, + "pyproject-nix": { + "inputs": { + "nixpkgs": [ + "hermes-agent", + "pyproject-build-systems", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1769936401, + "narHash": "sha256-kwCOegKLZJM9v/e/7cqwg1p/YjjTAukKPqmxKnAZRgA=", + "owner": "nix-community", + "repo": "pyproject.nix", + "rev": "b0d513eeeebed6d45b4f2e874f9afba2021f7812", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "pyproject.nix", + "type": "github" + } + }, + "pyproject-nix_2": { + "inputs": { + "nixpkgs": [ + "hermes-agent", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1772865871, + "narHash": "sha256-/ZTSg97aouL0SlPHaokA4r3iuH9QzHVuWPACD2CUCFY=", + "owner": "pyproject-nix", + "repo": "pyproject.nix", + "rev": "e537db02e72d553cea470976b9733581bcf5b3ed", + "type": "github" + }, + "original": { + "owner": "pyproject-nix", + "repo": "pyproject.nix", + "type": "github" + } + }, + "pyproject-nix_3": { + "inputs": { + "nixpkgs": [ + "hermes-agent", + "uv2nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1771518446, + "narHash": "sha256-nFJSfD89vWTu92KyuJWDoTQJuoDuddkJV3TlOl1cOic=", + "owner": "pyproject-nix", + "repo": "pyproject.nix", + "rev": "eb204c6b3335698dec6c7fc1da0ebc3c6df05937", + "type": "github" + }, + "original": { + "owner": "pyproject-nix", + "repo": "pyproject.nix", + "type": "github" + } + }, "root": { "inputs": { + "hermes-agent": "hermes-agent", "hjem": "hjem", "hjem-rum": "hjem-rum", "hyprland": "hyprland", - "nixpkgs": "nixpkgs_3", + "nixpkgs": "nixpkgs_4", "zen-browser": "zen-browser" } }, @@ -690,6 +860,55 @@ "type": "github" } }, + "uv2nix": { + "inputs": { + "nixpkgs": [ + "hermes-agent", + "pyproject-build-systems", + "nixpkgs" + ], + "pyproject-nix": [ + "hermes-agent", + "pyproject-build-systems", + "pyproject-nix" + ] + }, + "locked": { + "lastModified": 1770770348, + "narHash": "sha256-A2GzkmzdYvdgmMEu5yxW+xhossP+txrYb7RuzRaqhlg=", + "owner": "pyproject-nix", + "repo": "uv2nix", + "rev": "5d1b2cb4fe3158043fbafbbe2e46238abbc954b0", + "type": "github" + }, + "original": { + "owner": "pyproject-nix", + "repo": "uv2nix", + "type": "github" + } + }, + "uv2nix_2": { + "inputs": { + "nixpkgs": [ + "hermes-agent", + "nixpkgs" + ], + "pyproject-nix": "pyproject-nix_3" + }, + "locked": { + "lastModified": 1773039484, + "narHash": "sha256-+boo33KYkJDw9KItpeEXXv8+65f7hHv/earxpcyzQ0I=", + "owner": "pyproject-nix", + "repo": "uv2nix", + "rev": "b68be7cfeacbed9a3fa38a2b5adc0cfb81d9bb1f", + "type": "github" + }, + "original": { + "owner": "pyproject-nix", + "repo": "uv2nix", + "type": "github" + } + }, "xdph": { "inputs": { "hyprland-protocols": [ @@ -734,7 +953,7 @@ "zen-browser": { "inputs": { "home-manager": "home-manager", - "nixpkgs": "nixpkgs_4" + "nixpkgs": "nixpkgs_5" }, "locked": { "lastModified": 1769491693, diff --git a/flake.nix b/flake.nix index 746073c..35cca8b 100644 --- a/flake.nix +++ b/flake.nix @@ -1,7 +1,9 @@ { inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + hyprland.url = "github:hyprwm/Hyprland"; + hermes-agent.url = "github:NousResearch/hermes-agent"; hjem = { url = "github:feel-co/hjem"; @@ -17,10 +19,16 @@ zen-browser = { url = "github:0xc000022070/zen-browser-flake"; }; + }; outputs = - { self, nixpkgs, ... }@inputs: + { + self, + nixpkgs, + hermes-agent, + ... + }@inputs: let system = "x86_64-linux"; username = "poslop"; @@ -43,6 +51,10 @@ nixos-vm2 = mkHost "nixos-vm2" [ ./hosts/nixos-vm2/configuration.nix ]; qemu-vm = mkHost "qemu-vm" [ ./hosts/qemu-vm/configuration.nix ]; goyplex-vm = mkHost "goyplex-vm" [ ./hosts/goyplex-vm/configuration.nix ]; + hermes-vm = mkHost "hermes-vm" [ + hermes-agent.nixosModules.default + ./hosts/hermes-vm/configuration.nix + ]; }; }; } diff --git a/hosts/goyplex-vm/hardware-configuration.nix b/hosts/goyplex-vm/hardware-configuration.nix index 897045e..a97c9d6 100644 --- a/hosts/goyplex-vm/hardware-configuration.nix +++ b/hosts/goyplex-vm/hardware-configuration.nix @@ -1,28 +1,45 @@ # 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, ... }: +{ + config, + lib, + pkgs, + modulesPath, + ... +}: { - imports = - [ (modulesPath + "/profiles/qemu-guest.nix") - ]; + imports = [ + (modulesPath + "/profiles/qemu-guest.nix") + ]; - boot.initrd.availableKernelModules = [ "uhci_hcd" "ehci_pci" "ahci" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod" ]; + boot.initrd.availableKernelModules = [ + "uhci_hcd" + "ehci_pci" + "ahci" + "virtio_pci" + "virtio_scsi" + "sd_mod" + "sr_mod" + ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ ]; boot.extraModulePackages = [ ]; - fileSystems."/" = - { device = "/dev/disk/by-uuid/4a546e61-4a4d-4e09-8b00-3f56acc14ccb"; - fsType = "ext4"; - }; + fileSystems."/" = { + device = "/dev/disk/by-uuid/4a546e61-4a4d-4e09-8b00-3f56acc14ccb"; + fsType = "ext4"; + }; - fileSystems."/boot" = - { device = "/dev/disk/by-uuid/C838-5FC2"; - fsType = "vfat"; - options = [ "fmask=0077" "dmask=0077" ]; - }; + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/C838-5FC2"; + fsType = "vfat"; + options = [ + "fmask=0077" + "dmask=0077" + ]; + }; swapDevices = [ ]; diff --git a/hosts/hermes-vm/configuration.nix b/hosts/hermes-vm/configuration.nix new file mode 100644 index 0000000..9203c1e --- /dev/null +++ b/hosts/hermes-vm/configuration.nix @@ -0,0 +1,19 @@ +{ pkgs, ... }: + +{ + imports = [ + ./hardware-configuration.nix + ../../modules + ../../modules/hermes + ]; + + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + boot.kernelPackages = pkgs.linuxPackages_latest; + + services.spice-vdagentd.enable = true; + services.qemuGuest.enable = true; + + system.stateVersion = "25.11"; +} diff --git a/hosts/hermes-vm/hardware-configuration.nix b/hosts/hermes-vm/hardware-configuration.nix new file mode 100644 index 0000000..a97c9d6 --- /dev/null +++ b/hosts/hermes-vm/hardware-configuration.nix @@ -0,0 +1,47 @@ +# 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 + "/profiles/qemu-guest.nix") + ]; + + boot.initrd.availableKernelModules = [ + "uhci_hcd" + "ehci_pci" + "ahci" + "virtio_pci" + "virtio_scsi" + "sd_mod" + "sr_mod" + ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = { + device = "/dev/disk/by-uuid/4a546e61-4a4d-4e09-8b00-3f56acc14ccb"; + fsType = "ext4"; + }; + + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/C838-5FC2"; + fsType = "vfat"; + options = [ + "fmask=0077" + "dmask=0077" + ]; + }; + + swapDevices = [ ]; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; +} diff --git a/modules/core/zsh/.zshrc b/modules/core/zsh/.zshrc index 854b395..bf24491 100644 --- a/modules/core/zsh/.zshrc +++ b/modules/core/zsh/.zshrc @@ -25,6 +25,16 @@ ga() { rerice() { local flake_dir="/etc/rice-flakes" - host="${1:-$(hostname -s)}" + local host="$(hostname -s)" + local OPTIND=1 + + while getopts ":h:" opt; do + case $opt in + h) host="$OPTARG" ;; + :) echo "Option -$OPTARG requires an argument." >&2; return 1 ;; + \?) echo "Unknown option: -$OPTARG" >&2; return 1 ;; + esac + done + sudo nixos-rebuild switch --flake "${flake_dir}#${host}" } diff --git a/modules/hermes/default.nix b/modules/hermes/default.nix new file mode 100644 index 0000000..f9dc820 --- /dev/null +++ b/modules/hermes/default.nix @@ -0,0 +1,6 @@ +{ + imports = [ + ./sudo.nix + ./hermes.nix + ]; +} diff --git a/modules/hermes/hermes.nix b/modules/hermes/hermes.nix new file mode 100644 index 0000000..0517db2 --- /dev/null +++ b/modules/hermes/hermes.nix @@ -0,0 +1,12 @@ +{ + services.hermes-agent = { + enable = true; + addToSystemPackages = true; + container = { + enable = true; + hostUsers = [ "poslop" ]; + }; + + settings.model.base_url = "http://10.0.1.139:5000/v1"; + }; +} diff --git a/modules/hermes/sudo.nix b/modules/hermes/sudo.nix new file mode 100644 index 0000000..cb8b5c6 --- /dev/null +++ b/modules/hermes/sudo.nix @@ -0,0 +1,13 @@ +{ + security.sudo.extraRules = [ + { + users = [ "poslop" ]; + commands = [ + { + command = "/run/current-system/sw/bin/docker"; + options = [ "NOPASSWD" ]; + } + ]; + } + ]; +}