diff --git a/flake.lock b/flake.lock index b4a6f7e2..777dc1e2 100644 --- a/flake.lock +++ b/flake.lock @@ -17,61 +17,6 @@ "type": "github" } }, - "artemiscli": { - "inputs": { - "artemiscore": [ - "artemiscore" - ], - "flake-utils": [ - "utils" - ], - "nixpkgs": [ - "nixpkgs" - ], - "poetry2nix": "poetry2nix", - "std": [ - "std" - ] - }, - "locked": { - "lastModified": 1693677435, - "narHash": "sha256-Vs3NQ3JnCEkg7QFXKcJZ/p8YImV3FNyYXw0K6kYJn2M=", - "ref": "refs/heads/main", - "rev": "301c1544b5d7eca590df277eefc3ffb14ad1427d", - "revCount": 175, - "type": "git", - "url": "ssh://git@github.com/Glamorous-ai/metaflow-cli-plugin.git" - }, - "original": { - "type": "git", - "url": "ssh://git@github.com/Glamorous-ai/metaflow-cli-plugin.git" - } - }, - "artemiscore": { - "inputs": { - "flake-utils": [ - "utils" - ], - "nixpkgs": [ - "nixpkgs" - ], - "poetry2nix": "poetry2nix_2" - }, - "locked": { - "lastModified": 1695031434, - "narHash": "sha256-mAcZz0n0cORv+WHnCbLfAhB2RrLNgSThuw70GBuyFHk=", - "ref": "develop", - "rev": "717b0a497bc8027d540a46e5ad0ac260c1b3660c", - "revCount": 113, - "type": "git", - "url": "ssh://git@github.com/Glamorous-ai/metaflow-core-plugin.git" - }, - "original": { - "ref": "develop", - "type": "git", - "url": "ssh://git@github.com/Glamorous-ai/metaflow-core-plugin.git" - } - }, "base16": { "inputs": { "flakelib": "flakelib", @@ -230,42 +175,6 @@ "type": "github" } }, - "flake-utils": { - "inputs": { - "systems": "systems" - }, - "locked": { - "lastModified": 1689068808, - "narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flake-utils_2": { - "inputs": { - "systems": "systems_2" - }, - "locked": { - "lastModified": 1689068808, - "narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, "flakelib": { "inputs": { "fl-config": "fl-config", @@ -400,50 +309,6 @@ "type": "github" } }, - "nix-github-actions": { - "inputs": { - "nixpkgs": [ - "artemiscli", - "poetry2nix", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1688870561, - "narHash": "sha256-4UYkifnPEw1nAzqqPOTL2MvWtm3sNGw1UTYTalkTcGY=", - "owner": "nix-community", - "repo": "nix-github-actions", - "rev": "165b1650b753316aa7f1787f3005a8d2da0f5301", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "nix-github-actions", - "type": "github" - } - }, - "nix-github-actions_2": { - "inputs": { - "nixpkgs": [ - "artemiscore", - "poetry2nix", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1688870561, - "narHash": "sha256-4UYkifnPEw1nAzqqPOTL2MvWtm3sNGw1UTYTalkTcGY=", - "owner": "nix-community", - "repo": "nix-github-actions", - "rev": "165b1650b753316aa7f1787f3005a8d2da0f5301", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "nix-github-actions", - "type": "github" - } - }, "nix-index-database": { "inputs": { "nixpkgs": [ @@ -564,52 +429,6 @@ "type": "github" } }, - "poetry2nix": { - "inputs": { - "flake-utils": "flake-utils", - "nix-github-actions": "nix-github-actions", - "nixpkgs": [ - "artemiscli", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1689512738, - "narHash": "sha256-p2hKM6WYl4dJ6C6qmf8kct2PYJRNii3eAoRUhWjkGdU=", - "owner": "nix-community", - "repo": "poetry2nix", - "rev": "e7a88dfc2c5aa0c660a3ec4661a695c1c2380a8a", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "poetry2nix", - "type": "github" - } - }, - "poetry2nix_2": { - "inputs": { - "flake-utils": "flake-utils_2", - "nix-github-actions": "nix-github-actions_2", - "nixpkgs": [ - "artemiscore", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1689512738, - "narHash": "sha256-p2hKM6WYl4dJ6C6qmf8kct2PYJRNii3eAoRUhWjkGdU=", - "owner": "nix-community", - "repo": "poetry2nix", - "rev": "e7a88dfc2c5aa0c660a3ec4661a695c1c2380a8a", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "poetry2nix", - "type": "github" - } - }, "pypi-deps-db": { "flake": false, "locked": { @@ -629,8 +448,6 @@ "root": { "inputs": { "arcexprs": "arcexprs", - "artemiscli": "artemiscli", - "artemiscore": "artemiscore", "base16": "base16", "base16-data": "base16-data", "darwin": "darwin", @@ -789,36 +606,6 @@ "type": "github" } }, - "systems_2": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, - "systems_3": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, "tree": { "inputs": { "nixpkgs": [ @@ -844,7 +631,7 @@ }, "utils": { "inputs": { - "systems": "systems_3" + "systems": "systems" }, "locked": { "lastModified": 1701680307, diff --git a/flake.nix b/flake.nix index 5346537b..c696b4df 100644 --- a/flake.nix +++ b/flake.nix @@ -139,23 +139,6 @@ home-manager.follows = "home-manager"; }; }; - # work - artemiscore = { - url = "git+ssh://git@github.com/Glamorous-ai/metaflow-core-plugin.git?ref=develop"; - inputs = { - flake-utils.follows = "utils"; - nixpkgs.follows = "nixpkgs"; - }; - }; - artemiscli = { - url = "git+ssh://git@github.com/Glamorous-ai/metaflow-cli-plugin.git"; - inputs = { - artemiscore.follows = "artemiscore"; - flake-utils.follows = "utils"; - nixpkgs.follows = "nixpkgs"; - std.follows = "std"; - }; - }; }; outputs = inputs: import ./outputs.nix {inherit inputs;}; } diff --git a/home/profiles/common/base16.nix b/home/profiles/common/base16.nix index c851c228..f78e9259 100644 --- a/home/profiles/common/base16.nix +++ b/home/profiles/common/base16.nix @@ -4,7 +4,6 @@ inputs, ... }: let - inherit (lib.modules) mkMerge; inherit (inputs.base16-data.lib.base16-data) schemeSources; in { base16 = { diff --git a/home/profiles/devops/packages.nix b/home/profiles/devops/packages.nix index aa2b661d..c8bebcee 100644 --- a/home/profiles/devops/packages.nix +++ b/home/profiles/devops/packages.nix @@ -9,6 +9,7 @@ kubectl # kubectl k9s # cute k8s client, canines~ kubernetes-helm # k8s package manager + kustomize # config management and patching, ... # AWS diff --git a/modules/nixos/machine.nix b/modules/nixos/machine.nix deleted file mode 100644 index 644e758b..00000000 --- a/modules/nixos/machine.nix +++ /dev/null @@ -1,15 +0,0 @@ -{lib, ...}: let - inherit (lib.options) mkOption; - inherit (lib.types) enum; -in { - options.machine = { - cpuVendor = mkOption { - type = enum [ - "intel" - "amd" - "apple" - ]; - description = "CPU vendor"; - }; - }; -} diff --git a/nixos/hardware/amd_cpu.nix b/nixos/hardware/amd_cpu.nix new file mode 100644 index 00000000..fd6738b1 --- /dev/null +++ b/nixos/hardware/amd_cpu.nix @@ -0,0 +1,10 @@ +{ + config, + lib, + ... +}: let + inherit (lib.modules) mkDefault; +in { + boot.kernelModules = ["kvm-amd"]; + hardware.cpu.amd.updateMicrocode = mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/nixos/hardware/amd_gpu.nix b/nixos/hardware/amd_gpu.nix new file mode 100644 index 00000000..f16a5f97 --- /dev/null +++ b/nixos/hardware/amd_gpu.nix @@ -0,0 +1,5 @@ +_: { + boot.kernelParams = [ + "amdgpu.gpu_recovery=1" + ]; +} diff --git a/nixos/hardware/b550m-itx-ac.nix b/nixos/hardware/b550m-itx-ac.nix new file mode 100644 index 00000000..f6f45698 --- /dev/null +++ b/nixos/hardware/b550m-itx-ac.nix @@ -0,0 +1,91 @@ +{pkgs, ...}: { + systemd.services.fanSetup = let + # https://github.com/arcnmx/home/blob/9eb1cd4dd43883e1a0c6a2a55c00d7c3bede1776/hw/x370gpc/default.nix#L80 <3 + nct = "/sys/devices/platform/nct6775.656/hwmon/hwmon*/"; + # https://www.kernel.org/doc/html/next/hwmon/nct6775.html + #nct = ".//.//.sys.devices.platform.nct6775/656.hwmon.hwmon0"; + + # take in celcius, turn it into millicelcius + tempIn = x: toString (x * 1000); + # take in a percentage, turn it into a number between 0 and 255 + pwmIn = x: toString (x * 255 / 100); + + pwmEnable = { + maximum = 0; + manual = 1; + thermalCruise = 2; + speedCruise = 3; + # smart_fan_3 = 4; + smart_fan = 5; + }; + + cpu_sensor = 2; + mobo_sensor = 3; + + cpu_temp = "temp${toString cpu_sensor}"; + mobo_temp = "temp${toString mobo_sensor}"; + exhaust = "pwm1"; + intake = "pwm3"; + + temps = { + cpu = { + max = 80; + max_hyst = 75; + }; + + mobo = { + max = 50; + max_hyst = 45; + }; + }; + + fanScript = pkgs.writeShellScriptBin "fan" '' + cd ${nct} + echo "${toString temps.cpu.max}" > ${cpu_temp}_max + echo "${toString temps.cpu.max_hyst}" > ${cpu_temp}_max_hyst + echo "${toString temps.mobo.max}" > ${mobo_temp}_max + echo "${toString temps.mobo.max_hyst}" > ${mobo_temp}_max_hyst + + # Rear and Top Exhaust + + echo "${toString pwmEnable.smart_fan}" > ${exhaust}_enable + echo "${toString mobo_sensor}" > ${exhaust}_temp_sel + echo "${tempIn 35}" > ${exhaust}_auto_point1_temp + echo "${pwmIn 10}" > ${exhaust}_auto_point1_pwm + echo "${tempIn 40}" > ${exhaust}_auto_point2_temp + echo "${pwmIn 20}" > ${exhaust}_auto_point2_pwm + echo "${tempIn 45}" > ${exhaust}_auto_point3_temp + echo "${pwmIn 50}" > ${exhaust}_auto_point3_pwm + echo "${tempIn 50}" > ${exhaust}_auto_point4_temp + echo "${pwmIn 75}" > ${exhaust}_auto_point4_pwm + echo "${tempIn 55}" > ${exhaust}_auto_point5_temp + echo "${pwmIn 100}" > ${exhaust}_auto_point5_pwm + + # Bottom Intake + + echo "${toString pwmEnable.smart_fan}" > ${intake}_enable + echo "${toString mobo_sensor}" > ${intake}_temp_sel + echo "${tempIn 35}" > ${intake}_auto_point1_temp + echo "${pwmIn 10}" > ${intake}_auto_point1_pwm + echo "${tempIn 40}" > ${intake}_auto_point2_temp + echo "${pwmIn 20}" > ${intake}_auto_point2_pwm + echo "${tempIn 45}" > ${intake}_auto_point3_temp + echo "${pwmIn 50}" > ${intake}_auto_point3_pwm + echo "${tempIn 50}" > ${intake}_auto_point4_temp + echo "${pwmIn 75}" > ${intake}_auto_point4_pwm + echo "${tempIn 55}" > ${intake}_auto_point5_temp + echo "${pwmIn 100}" > ${intake}_auto_point5_pwm + + # CLC + ${pkgs.liquidctl}/bin/liquidctl --match clc set fan speed 20 0 30 0 40 10 50 50 60 75 70 100 + ''; + in { + wantedBy = ["multi-user.target"]; + description = "Set up the fan speeds for the system"; + after = ["systemd-modules-load.service"]; + serviceConfig = { + Type = "oneshot"; + ExecStart = "${fanScript}/bin/fan"; + }; + }; +} diff --git a/nixos/hardware/intel.nix b/nixos/hardware/intel.nix deleted file mode 100644 index ccd4a462..00000000 --- a/nixos/hardware/intel.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ - config, - lib, - ... -}: let - inherit (lib.modules) mkIf; -in { - config = mkIf (config.machine.cpuVendor == "intel") { - boot.kernelModules = ["kvm-intel"]; - }; -} diff --git a/nixos/hardware/intel_cpu.nix b/nixos/hardware/intel_cpu.nix new file mode 100644 index 00000000..e412ab20 --- /dev/null +++ b/nixos/hardware/intel_cpu.nix @@ -0,0 +1,5 @@ +_: let +in { + boot.kernelModules = ["kvm-intel"]; + services.thermald.enable = true; +} diff --git a/nixos/hardware/uefi.nix b/nixos/hardware/uefi.nix new file mode 100644 index 00000000..a8a5265f --- /dev/null +++ b/nixos/hardware/uefi.nix @@ -0,0 +1,13 @@ +_: { + boot.loader = { + grub = { + devices = ["nodev"]; + efiSupport = true; + gfxmodeEfi = "1920x1080"; + }; + efi = { + canTouchEfiVariables = true; + efiSysMountPoint = "/boot"; + }; + }; +} diff --git a/nixos/profiles/bootable/grub.nix b/nixos/profiles/bootable/grub.nix index b421eb89..4b1c0a49 100644 --- a/nixos/profiles/bootable/grub.nix +++ b/nixos/profiles/bootable/grub.nix @@ -1,8 +1,9 @@ _: { boot.loader = { - timeout = -1; + timeout = null; grub = { - # theme = pkgs.nixos-grub2-theme; # so like, this turbo-breaks the fuck out of GRUB, i have no clue why? + enable = true; + useOSProber = true; splashImage = ./splash.jpg; extraConfig = '' set color_normal=black/black diff --git a/nixos/profiles/graphical/packages.nix b/nixos/profiles/graphical/packages.nix index df954d0c..19735192 100644 --- a/nixos/profiles/graphical/packages.nix +++ b/nixos/profiles/graphical/packages.nix @@ -8,6 +8,7 @@ dnsutils firefox usbutils + plexamp inputs.konawall-py.packages.${pkgs.system}.konawall-py ]; services.udev.packages = [ diff --git a/nixos/profiles/laptop/thermald.nix b/nixos/profiles/laptop/thermald.nix deleted file mode 100644 index 53228d61..00000000 --- a/nixos/profiles/laptop/thermald.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ - config, - lib, - ... -}: let - inherit (lib.modules) mkIf; -in { - config = mkIf (config.machine.cpuVendor == "intel") { - services.thermald.enable = true; - }; -} diff --git a/systems/goliath.nix b/systems/goliath.nix index e86a68fa..dfb9d305 100644 --- a/systems/goliath.nix +++ b/systems/goliath.nix @@ -6,10 +6,40 @@ _: let pkgs, ... }: let - inherit (lib.modules) mkDefault; + inherit (lib.lists) singleton; + drives = { + root = { + raw = "/dev/disk/by-uuid/af144e7f-e35b-49e7-be90-ef7001cc2abd"; + luks = "luks-af144e7f-e35b-49e7-be90-ef7001cc2abd"; + result = { + device = "/dev/disk/by-uuid/cf7fc410-4e27-4797-8464-a409766928c1"; + fsType = "ext4"; + }; + }; + boot = rec { + raw = "/dev/disk/by-uuid/D0D8-F8BF"; + result = { + device = raw; + fsType = "vfat"; + }; + }; + swap = { + raw = "/dev/disk/by-uuid/111c4857-5d73-4e75-89c7-43be9b044ade"; + luks = "luks-111c4857-5d73-4e75-89c7-43be9b044ade"; + result = { + device = "/dev/disk/by-uuid/bebdb14c-4707-4e05-848f-5867764b7c27"; + }; + }; + }; in { imports = - (with tree.nixos.profiles; [ + (with tree.nixos.hardware; [ + amd_cpu + amd_gpu + b550m-itx-ac + uefi + ]) + ++ (with tree.nixos.profiles; [ graphical wireless gaming @@ -27,72 +57,37 @@ _: let kde ]); - machine = { - cpuVendor = "amd"; - }; - - # to-do: add this and kvm-amd to automation - hardware.cpu.amd.updateMicrocode = mkDefault config.hardware.enableRedistributableFirmware; - - environment.systemPackages = with pkgs; [ - fd # fd, better fine! - ripgrep # rg, better grep! - deadnix # dead-code scanner - alejandra # code formatter - statix # anti-pattern finder - deploy-rs.deploy-rs # deployment system - rnix-lsp # vscode nix extensions - terraform # terraform - kubectl - k9s - ]; - boot = { loader = { grub = { - enable = true; - efiSupport = true; - devices = ["nodev"]; enableCryptodisk = true; - useOSProber = true; - gfxmodeBios = "1920x1080"; - gfxmodeEfi = "1920x1080"; - }; - efi = { - canTouchEfiVariables = true; - efiSysMountPoint = "/boot"; }; }; - # Enable swap on luks initrd = { luks.devices = { - "luks-111c4857-5d73-4e75-89c7-43be9b044ade".device = "/dev/disk/by-uuid/111c4857-5d73-4e75-89c7-43be9b044ade"; - "luks-111c4857-5d73-4e75-89c7-43be9b044ade".keyFile = "/crypto_keyfile.bin"; - "luks-af144e7f-e35b-49e7-be90-ef7001cc2abd".device = "/dev/disk/by-uuid/af144e7f-e35b-49e7-be90-ef7001cc2abd"; + ${drives.swap.luks} = { + device = drives.swap.raw; + keyFile = "/crypto_keyfile.bin"; + }; + ${drives.root.luks}.device = drives.root.raw; }; - availableKernelModules = ["nvme" "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod"]; + # secrets = { "/crypto_keyfile.bin" = null; }; + availableKernelModules = ["nvme" "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod"]; }; - kernelParams = [ - "amdgpu.gpu_recovery=1" - ]; - kernelModules = ["kvm-amd"]; + kernelModules = ["nct6775"]; supportedFilesystems = ["ntfs"]; }; fileSystems = { - "/" = { - device = "/dev/disk/by-uuid/cf7fc410-4e27-4797-8464-a409766928c1"; - fsType = "ext4"; - }; - "/boot" = { - device = "/dev/disk/by-uuid/D0D8-F8BF"; - fsType = "vfat"; - }; + "/" = drives.root.result; + "/boot" = drives.boot.result; }; + swapDevices = singleton drives.swap.result; + services.openssh = { hostKeys = [ { @@ -111,15 +106,6 @@ _: let ''; }; - swapDevices = [ - {device = "/dev/disk/by-uuid/bebdb14c-4707-4e05-848f-5867764b7c27";} - ]; - - networking = { - hostId = "dddbb888"; - useDHCP = false; - }; - system.stateVersion = "21.11"; }; in { diff --git a/systems/renko.nix b/systems/renko.nix index 84502953..b42cb4c7 100644 --- a/systems/renko.nix +++ b/systems/renko.nix @@ -25,7 +25,6 @@ _: let boot.kernelPackages = pkgs.linuxPackages_6_3; environment.systemPackages = with pkgs; [ - inputs.artemiscli.packages.aarch64-linux.artemiscli awscli2 kubectl ]; diff --git a/systems/sumireko.nix b/systems/sumireko.nix index 892aa128..d818169a 100644 --- a/systems/sumireko.nix +++ b/systems/sumireko.nix @@ -1,9 +1,5 @@ _: let - hostConfig = { - tree, - pkgs, - ... - }: { + hostConfig = {tree, ...}: { imports = with tree.darwin; [ orbstack packages diff --git a/tree.nix b/tree.nix index 33ac003e..c1cb51b5 100644 --- a/tree.nix +++ b/tree.nix @@ -64,6 +64,9 @@ "nixos/hardware" = { external = inputs.nixos-hardware.outputs.nixosModules; }; + "nixos/hardware/conditional" = { + functor.enable = true; + }; "modules/nixos" = { functor = { enable = true;