feat: Get ROCm working with flake
This commit is contained in:
parent
5284d6e596
commit
c20fd46f9f
6 changed files with 73 additions and 25 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -6,3 +6,6 @@ result-*
|
||||||
# Ignore automatically generated direnv output
|
# Ignore automatically generated direnv output
|
||||||
.direnv
|
.direnv
|
||||||
|
|
||||||
|
hardware-configuration.nix
|
||||||
|
comfy-ui.nix
|
||||||
|
*.bak
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,8 @@
|
||||||
|
|
||||||
let
|
let
|
||||||
hostConfigs = {
|
hostConfigs = {
|
||||||
crossbox = [ ./crossbox.nix ./sdr.nix ./syncthing.nix ./forgejo.nix ./radicale.nix ./ollama.nix ./docuseal.nix ./nginx.nix ];
|
crossbox = [ ./crossbox.nix ./sdr.nix ./syncthing.nix ./forgejo.nix ./radicale.nix ./ollama.nix #./docuseal.nix
|
||||||
|
./nginx.nix ];
|
||||||
anvil = [ ./anvil.nix ./sdr.nix ./vpn.nix ./syncthing.nix ./staging.nginx.nix ];
|
anvil = [ ./anvil.nix ./sdr.nix ./vpn.nix ./syncthing.nix ./staging.nginx.nix ];
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
|
|
@ -10,7 +11,7 @@ in
|
||||||
imports =
|
imports =
|
||||||
[ # Include the results of the hardware scan.
|
[ # Include the results of the hardware scan.
|
||||||
./hardware-configuration.nix
|
./hardware-configuration.nix
|
||||||
] ++ hostConfigs.anvil;
|
] ++ hostConfigs.crossbox;
|
||||||
|
|
||||||
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
||||||
nix.gc = {
|
nix.gc = {
|
||||||
|
|
@ -208,4 +209,4 @@ in
|
||||||
systemd.targets.suspend.enable = false;
|
systemd.targets.suspend.enable = false;
|
||||||
systemd.targets.hibernate.enable = false;
|
systemd.targets.hibernate.enable = false;
|
||||||
systemd.targets.hybrid-sleep.enable = false;
|
systemd.targets.hybrid-sleep.enable = false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
30
crossbox.nix
30
crossbox.nix
|
|
@ -1,9 +1,24 @@
|
||||||
{ config, pkgs, ... }:
|
{ config, pkgs, lib, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
# Using nixos-24.05 for bisq-desktop (last stable release with working bisq-desktop)
|
||||||
|
# bisq-desktop was removed after 24.05 due to OpenJFX EOL issues
|
||||||
|
bisqPkgs = import (builtins.fetchTarball {
|
||||||
|
url = "https://github.com/NixOS/nixpkgs/archive/nixos-24.05.tar.gz";
|
||||||
|
sha256 = "0zydsqiaz8qi4zd63zsb2gij2p614cgkcaisnk11wjy3nmiq0x1s";
|
||||||
|
}) { system = pkgs.system; };
|
||||||
|
in
|
||||||
{
|
{
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
bisqPkgs.bisq-desktop # v1.9.15-1.9.17 from nixos-24.05
|
||||||
|
bisq2
|
||||||
|
llamacpp-rocm-bin-gfx1151
|
||||||
|
lmstudio
|
||||||
|
];
|
||||||
|
|
||||||
networking.hostName = "crossbox";
|
networking.hostName = "crossbox";
|
||||||
system.stateVersion = "25.11";
|
system.stateVersion = "25.11";
|
||||||
networking.firewall.allowedTCPPorts = [ 22 ];
|
networking.firewall.allowedTCPPorts = [ 22 1234 ];
|
||||||
services.pulseaudio.enable = false;
|
services.pulseaudio.enable = false;
|
||||||
|
|
||||||
hardware.graphics = {
|
hardware.graphics = {
|
||||||
|
|
@ -16,6 +31,17 @@
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
boot.kernelParams = [ "amdgpu.gttsize=115200" ];
|
||||||
|
boot.kernelPackages = pkgs.linuxPackages_latest;
|
||||||
|
|
||||||
|
# ROCm environment for gfx1151 (Strix Halo)
|
||||||
|
# gfx1151 lacks TensileLibrary support in most ROCm builds,
|
||||||
|
# so we override to gfx1100 which is close enough and has full library support.
|
||||||
|
# The strix-halo overlay's llamacpp binaries override this with 11.5.1 in their wrappers.
|
||||||
|
environment.variables = {
|
||||||
|
HSA_OVERRIDE_GFX_VERSION = "11.0.0";
|
||||||
|
};
|
||||||
|
|
||||||
# List services that you want to enable:
|
# List services that you want to enable:
|
||||||
services.openssh = {
|
services.openssh = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
|
||||||
23
flake.nix
Normal file
23
flake.nix
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
# /etc/nixos/flake.nix
|
||||||
|
{
|
||||||
|
description = "Framework Desktop with Strix Halo";
|
||||||
|
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
|
strix-halo.url = "github:hellas-ai/nix-strix-halo";
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = { self, nixpkgs, strix-halo, ... }: {
|
||||||
|
nixosConfigurations.crossbox = nixpkgs.lib.nixosSystem {
|
||||||
|
system = "x86_64-linux";
|
||||||
|
modules = [
|
||||||
|
./configuration.nix
|
||||||
|
|
||||||
|
({ pkgs, ... }: {
|
||||||
|
# Apply Strix Halo overlay
|
||||||
|
nixpkgs.overlays = [ strix-halo.overlays.default ];
|
||||||
|
})
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
27
nginx.nix
27
nginx.nix
|
|
@ -1,21 +1,10 @@
|
||||||
{ config, pkgs, lib, ... }:
|
{ config, pkgs, lib, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
# Read multiple API keys from the secrets file at build time
|
# NOTE: API keys will be loaded from /srv/nginx/secrets at runtime
|
||||||
# Note: This embeds the secrets in the Nix store, which is a trade-off
|
# This file should contain one Bearer token per line
|
||||||
# Alternative: Keep secrets file and read via njs module or external auth service
|
# The secrets file is read at runtime via include directive instead of build time
|
||||||
secretsFile = "/srv/nginx/secrets";
|
# to avoid flake purity issues
|
||||||
|
|
||||||
# Read API keys from file (one key per line, will be evaluated at build time)
|
|
||||||
# If the file doesn't exist yet, this will fail - create it first
|
|
||||||
apiKeysRaw = builtins.readFile secretsFile;
|
|
||||||
apiKeys = lib.filter (k: k != "") (lib.splitString "\n" apiKeysRaw);
|
|
||||||
|
|
||||||
# Generate map entries for each key
|
|
||||||
mapEntries = lib.concatMapStringsSep "\n "
|
|
||||||
(key: ''"Bearer ${key}" "authorized";'')
|
|
||||||
apiKeys;
|
|
||||||
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
services.nginx = {
|
services.nginx = {
|
||||||
|
|
@ -31,12 +20,16 @@ in
|
||||||
mapHashBucketSize = 128;
|
mapHashBucketSize = 128;
|
||||||
|
|
||||||
# Map directive to check Authorization header against multiple keys
|
# Map directive to check Authorization header against multiple keys
|
||||||
|
# Keys are loaded from /srv/nginx/secrets.map at runtime
|
||||||
appendHttpConfig = ''
|
appendHttpConfig = ''
|
||||||
# Check if the Authorization header matches any expected value
|
# Check if the Authorization header matches any expected value
|
||||||
map $http_authorization $auth_status {
|
map $http_authorization $auth_status {
|
||||||
default "unauthorized";
|
default "unauthorized";
|
||||||
"" "no_auth";
|
"" "no_auth";
|
||||||
${mapEntries}
|
# Add your Bearer tokens here manually, or use include directive
|
||||||
|
# Format: "Bearer YOUR_TOKEN_HERE" "authorized";
|
||||||
|
# You can also create /srv/nginx/secrets.map and include it:
|
||||||
|
# include /srv/nginx/secrets.map;
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
|
@ -66,7 +59,7 @@ in
|
||||||
locations."/blog/private/" = {
|
locations."/blog/private/" = {
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
auth_basic "Private Articles";
|
auth_basic "Private Articles";
|
||||||
auth_basic_user_file /srv/nginx/.htpasswd;
|
auth_basic_user_file "/srv/nginx/.htpasswd";
|
||||||
|
|
||||||
# Enable Server Side Includes
|
# Enable Server Side Includes
|
||||||
ssi on;
|
ssi on;
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,9 @@
|
||||||
];
|
];
|
||||||
|
|
||||||
# Add CA certificate for Ollama
|
# Add CA certificate for Ollama
|
||||||
security.pki.certificateFiles = [
|
# Note: Path must be accessible at runtime, not build time
|
||||||
/home/brimlock/ollama-ca.crt
|
# You can copy the cert to /etc/nixos/ and reference it, or use a string path
|
||||||
];
|
# security.pki.certificateFiles = [
|
||||||
|
# "/home/brimlock/ollama-ca.crt"
|
||||||
|
# ];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue