Update Cfg and add proxy/wsl

This commit is contained in:
soraefir
2026-05-30 17:48:18 +02:00
parent d9e7775afc
commit 4217227070
18 changed files with 136 additions and 20 deletions

View File

@@ -22,6 +22,9 @@
inputs.nixpkgs.follows = "nixpkgs";
};
nix-colors.url = "github:misterio77/nix-colors";
nixos-wsl.url = "github:nix-community/nixos-wsl";
vscode-server.url = "github:nix-community/nixos-vscode-server";
};
outputs = inputs:

View File

@@ -5,7 +5,7 @@
nameValuePair = name: value: { inherit name value; };
in ({
"nixos" = inputs.nixpkgs.lib.nixosSystem {
system = syscfg.syscfg.system;
system = "x86_64-linux";
specialArgs = { inherit inputs; };
modules = [
./modules/shared/syscfg
@@ -15,6 +15,10 @@
./systems/${host}
inputs.sops-nix.nixosModules.sops
inputs.home-manager.nixosModules.home-manager
(if (syscfg.syscfg.extra.wsl) then inputs.nixos-wsl.nixosModules.wsl else "")
(if (syscfg.syscfg.extra.wsl) then inputs.vscode-server.nixosModules.default else "")
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
@@ -28,7 +32,6 @@
syscfg
{ usercfg = userConfig; }
inputs.nix-colors.homeManagerModule
# inputs.hyprland.homeManagerModules.default
inputs.sops-nix.homeManagerModules.sops
];
}) syscfg.syscfg.users);
@@ -37,7 +40,7 @@
};
"macos" = inputs.darwin.lib.darwinSystem {
system = syscfg.system;
system = "x86_64-darwin";
modules = [
./modules/shared/syscfg
./modules/shared/sops

View File

@@ -1 +1 @@
{ ... }: { imports = [ ./base ./boot ./fs ./graphics ./power ./udev ./virt ]; }
{ ... }: { imports = [ ./base ./boot ./fs ./graphics ./power ./udev ./virt ./wsl ]; }

View File

@@ -0,0 +1,13 @@
{ lib, config, pkgs, ... }: {
config = lib.mkIf (config.syscfg.extra.wsl) {
wsl.enable = true;
wsl.defaultUser = config.syscfg.defaultUser;
wsl.extraBin = with pkgs; [
{ src = "${coreutils}/bin/uname"; }
{ src = "${coreutils}/bin/dirname"; }
{ src = "${coreutils}/bin/readlink"; }
];
wsl.wslConf.network.generateHosts = false;
};
}

View File

@@ -1,9 +1,19 @@
{ config, ... }: {
{ lib, config, ... }: {
networking = {
hostName = config.syscfg.hostname;
useDHCP = true;
nameservers = [ "1.1.1.1" "9.9.9.9" ];
extraHosts = ''
${lib.concatStringsSep "\n" config.syscfg.extra.hosts}
'';
proxy = lib.mkIf (config.syscfg.extra.proxy.domain != "") {
default = "http://${config.syscfg.extra.proxy.domain}:${config.syscfg.extra.proxy.port or "8080"}";
noProxy = "${config.syscfg.extra.proxy.noProxy}";
};
firewall = {
enable = true;
allowedUDPPorts =

View File

@@ -37,5 +37,40 @@
];
};
};
programs.nix-ld = {
enable = true;
libraries = with pkgs; [
# Correctly namespaced X11 dependencies
xorg.libX11 xorg.libxcb xorg.libXi xorg.libXext xorg.libxkbfile xorg.xcbutilcursor
libpng libdrm libpulseaudio nss nspr expat libbsd
# Core system requirements
# stdenv.cc.cc
# zlib
# fuse3
# alsa-lib
# openssl
#
# xorg.libXdamage
# xorg.libXfixes
# xorg.libXcomposite
# xorg.libXcursor
# xorg.libXrandr
#
# xorg.libXtst
# # Graphics and system audio/menus
# libGL
# dbus
# fontconfig
# freetype
# glib
#
#
#
];
};
system.stateVersion = "24.11";
}

View File

@@ -9,6 +9,13 @@ in {
imports = [ ./ollama ];
config = lib.mkIf (config.syscfg.make.develop) {
services.vscode-server = lib.mkIf (config.syscfg.extra.wsl) {
enable = true;
enableFHS = true;
};
environment.systemPackages = with pkgs;
[
# android-tools

View File

@@ -1,5 +1,6 @@
{ config, containerCfg, pkgs, lib, builder, name,... }:
let
version = "latest";
serverCfg = config.syscfg.server;
image = pkgs.dockerTools.streamLayeredImage {
name = "EXAMPLE";
@@ -10,6 +11,7 @@ let
ExposedPorts = { };
};
};
settings = pkgs.writeText "settings.yaml" ...;
templateData = builder.mkData { name = "template"; dir = "template"; vars = {
_ARGUMENT = "template";
};
@@ -25,7 +27,8 @@ in {
containers = {
server = builder.mkContainer {
subdomain = containerCfg.subdomain;
imageStream = image;
# imageStream = image;
image = "....:${version}";
port = 8080;
secret = name;
extraEnv = { };

View File

@@ -0,0 +1,40 @@
{ config, containerCfg, pkgs, lib, builder, name,... }:
let
version = "latest";
serverCfg = config.syscfg.server;
settings = pkgs.writers.writeYAML "settings.yaml" {
title = "My Self-Hosted Dashboard";
base = "";
theme = "dark";
# Nested structures transfer natively to YAML blocks
# layout = {
# Infrastructure = {
# style = "grid";
# columns = 3;
# };
# };
};
in {
sops = false;
db = false;
containers = {
server = builder.mkContainer {
subdomain = containerCfg.subdomain;
image = "ghcr.io/gethomepage/homepage:${version}";
port = 3000;
# extraEnv = { };
extraLabels = {
"traefik.http.routers.${containerCfg.subdomain}.service" = "${containerCfg.subdomain}";
};
overrides = {
volumes = [
"${settings}:/app/config/settings.yaml:ro"
];
};
};
};
}

View File

@@ -14,10 +14,6 @@ in with lib; {
type = types.enum [ "nixos" "macos" "home" ];
default = "nixos";
};
system = mkOption {
type = types.enum [ "x86_64-linux" "x86_64-darwin" "-" ];
default = "x86_64-linux";
};
defaultUser = mkOption { type = types.str; };
make = import ./make.nix {inherit lib;};
net = import ./net.nix {inherit lib;};
@@ -32,5 +28,6 @@ in with lib; {
type = types.oneOf [ types.bool (types.submodule { options = import ./server.nix {inherit lib;}; }) ];
default = false;
};
extra = import ./extra.nix {inherit lib;};
};
}

View File

@@ -0,0 +1,11 @@
{ lib,... }:
with lib; {
wsl = mkOption { type = types.bool; default = false; };
hosts = mkOption { type = types.listOf (types.str); default = []; };
proxy = {
domain = mkOption { type = types.str; default = ""; };
port = mkOption { type = types.str; default = ""; };
noProxy = mkOption { type = types.str; default = ""; };
cert = mkOption { type = types.path; default = null; };
};
}

View File

@@ -3,6 +3,5 @@
hostname = "asgard";
defaultUser = "sora";
type = "macos";
system = "x86_64-darwin";
};
}

View File

@@ -1,7 +1,6 @@
{
syscfg = {
hostname = "avalon";
system = "x86_64-linux";
type = "nixos";
defaultUser = "sora";
users = [

View File

@@ -2,7 +2,6 @@
syscfg = {
hostname = "ci";
type = "nixos";
system = "x86_64-linux";
defaultUser = "ci";
users = [{
username = "ci";

View File

@@ -2,7 +2,6 @@
syscfg = {
hostname = "gateway";
type = "nixos";
system = "x86_64-linux";
defaultUser = "sora";
users = [{
username = "sora";

View File

@@ -2,7 +2,6 @@
syscfg = {
hostname = "iriy";
type = "nixos";
system = "x86_64-linux";
defaultUser = "sora";
users = [{
username = "sora";

View File

@@ -2,7 +2,6 @@
syscfg = {
hostname = "sandbox";
type = "nixos";
system = "x86_64-linux";
defaultUser = "sora";
users = [{
username = "sora";
@@ -38,6 +37,7 @@
umami.subdomain = "umami";
authentik.subdomain = "sso";
searxng.subdomain = "searx";
homepage.subdomain = "home";
# ===== CLOUD =====
# nextcloud.subdomain = "cloud";
# collabora.subdomain = "office";
@@ -53,7 +53,7 @@
# ===== DEV =====
gitea.subdomain = "git";
# ===== HOME =====
openhab.subdomain = "hab";
# openhab.subdomain = "hab";
# trmnl = { subdomain = "hass"; subpath = "trmnl"; };
influx.subdomain = "metrum";
};

View File

@@ -2,7 +2,6 @@
syscfg = {
hostname = "valinor";
type = "nixos";
system = "x86_64-linux";
defaultUser = "sora";
users = [{
username = "sora";