Compare commits
3 commits
5f42498a39
...
8db9ceb372
Author | SHA1 | Date | |
---|---|---|---|
8db9ceb372 | |||
fbd8a20036 | |||
e9a6649f6a |
5 changed files with 126 additions and 26 deletions
50
flake.lock
generated
50
flake.lock
generated
|
@ -428,6 +428,31 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"python-flexseal": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-utils": [
|
||||||
|
"stable-diffusion-webui-nix",
|
||||||
|
"flake-utils"
|
||||||
|
],
|
||||||
|
"nixpkgs": [
|
||||||
|
"stable-diffusion-webui-nix",
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1751898758,
|
||||||
|
"narHash": "sha256-8EmTPdfOymvvHhmHYWiyO3cwZ4gtLo5uBFm3CU5vySo=",
|
||||||
|
"owner": "Janrupf",
|
||||||
|
"repo": "python-flexseal",
|
||||||
|
"rev": "af318e1fd047abbefcc68d0292a4d902179c95fe",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "Janrupf",
|
||||||
|
"repo": "python-flexseal",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"dedupe_flake-compat": "dedupe_flake-compat",
|
"dedupe_flake-compat": "dedupe_flake-compat",
|
||||||
|
@ -447,6 +472,7 @@
|
||||||
"nur": "nur",
|
"nur": "nur",
|
||||||
"nvf": "nvf",
|
"nvf": "nvf",
|
||||||
"sops-nix": "sops-nix",
|
"sops-nix": "sops-nix",
|
||||||
|
"stable-diffusion-webui-nix": "stable-diffusion-webui-nix",
|
||||||
"stylix": "stylix",
|
"stylix": "stylix",
|
||||||
"systems": "systems",
|
"systems": "systems",
|
||||||
"text": "text"
|
"text": "text"
|
||||||
|
@ -472,6 +498,30 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"stable-diffusion-webui-nix": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-utils": [
|
||||||
|
"dedupe_flake-utils"
|
||||||
|
],
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
],
|
||||||
|
"python-flexseal": "python-flexseal"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1751899247,
|
||||||
|
"narHash": "sha256-bh6xwc24Rv0YE4grKXvj+kmXmydns+OrlWn4WLnJSY4=",
|
||||||
|
"owner": "janrupf",
|
||||||
|
"repo": "stable-diffusion-webui-nix",
|
||||||
|
"rev": "d5ba5dccd190b0ded17f9c4a23dc7665c6dc2eae",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "janrupf",
|
||||||
|
"repo": "stable-diffusion-webui-nix",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"stylix": {
|
"stylix": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"base16": "base16",
|
"base16": "base16",
|
||||||
|
|
30
flake.nix
30
flake.nix
|
@ -15,6 +15,17 @@
|
||||||
systems.url = "github:nix-systems/default";
|
systems.url = "github:nix-systems/default";
|
||||||
# nixos-unstable provides a binary cache for all packages.
|
# nixos-unstable provides a binary cache for all packages.
|
||||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||||
|
# home-manager manages our user packages and dotfiles
|
||||||
|
home-manager = {
|
||||||
|
url = "github:nix-community/home-manager";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
# the nix user repository for mainly firefox extensions
|
||||||
|
nur = {
|
||||||
|
url = "github:nix-community/NUR";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
inputs.flake-parts.follows = "flake-parts";
|
||||||
|
};
|
||||||
# impermanence provides a nice abstraction over linking files from /persist
|
# impermanence provides a nice abstraction over linking files from /persist
|
||||||
impermanence.url = "github:nix-community/impermanence";
|
impermanence.url = "github:nix-community/impermanence";
|
||||||
# flake-parts lets us define flake modules.
|
# flake-parts lets us define flake modules.
|
||||||
|
@ -65,24 +76,13 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
### HOME-MANAGER ###
|
### FLAKES ###
|
||||||
|
|
||||||
# home-manager manages our user packages and dotfiles
|
|
||||||
home-manager = {
|
|
||||||
url = "github:nix-community/home-manager";
|
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
|
||||||
};
|
|
||||||
# nix-index-database indexes the nixpkgs binaries for use with comma
|
# nix-index-database indexes the nixpkgs binaries for use with comma
|
||||||
nix-index-database = {
|
nix-index-database = {
|
||||||
url = "github:nix-community/nix-index-database";
|
url = "github:nix-community/nix-index-database";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
# the nix user repository for mainly firefox extensions
|
|
||||||
nur = {
|
|
||||||
url = "github:nix-community/NUR";
|
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
|
||||||
inputs.flake-parts.follows = "flake-parts";
|
|
||||||
};
|
|
||||||
# nvf provides modules to wrap neovim
|
# nvf provides modules to wrap neovim
|
||||||
nvf = {
|
nvf = {
|
||||||
url = "github:notashelf/nvf";
|
url = "github:notashelf/nvf";
|
||||||
|
@ -94,6 +94,12 @@
|
||||||
mnw.follows = "dedupe_mnw";
|
mnw.follows = "dedupe_mnw";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
# provides comfy ui and sdwebui services
|
||||||
|
stable-diffusion-webui-nix = {
|
||||||
|
url = "github:janrupf/stable-diffusion-webui-nix";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
inputs.flake-utils.follows = "dedupe_flake-utils";
|
||||||
|
};
|
||||||
|
|
||||||
### DEDUPE ###
|
### DEDUPE ###
|
||||||
|
|
||||||
|
|
|
@ -18,14 +18,33 @@ in
|
||||||
mkHost = domain: if isRootDomain domain then domain else mkWildcardDomain (mkRootDomain domain);
|
mkHost = domain: if isRootDomain domain then domain else mkWildcardDomain (mkRootDomain domain);
|
||||||
mkWebApp =
|
mkWebApp =
|
||||||
{
|
{
|
||||||
|
config,
|
||||||
name,
|
name,
|
||||||
defaultPort,
|
defaultPort,
|
||||||
persistDirs ? [ ],
|
persistDirs ? [ ],
|
||||||
serviceConfig ? { },
|
|
||||||
extraOptions ? { },
|
extraOptions ? { },
|
||||||
|
extraConfig ? { },
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
cfg = config.server.web-apps.${name};
|
cfg = config.server.web-apps.${name};
|
||||||
|
networkingConfig =
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
cfg,
|
||||||
|
name,
|
||||||
|
}:
|
||||||
|
mkIf (cfg.domain != "") {
|
||||||
|
assertions = singleton {
|
||||||
|
assertion = config.server.web-servers.nginx.enable;
|
||||||
|
message = "You must enable a web server if you want to set server.web-apps.${name}.domain.";
|
||||||
|
};
|
||||||
|
server.ddns.domains = singleton (mkRootDomain cfg.domain);
|
||||||
|
server.web-servers.nginx.proxies = singleton {
|
||||||
|
source = cfg.domain;
|
||||||
|
target = "http://${config.hostname}:${toString cfg.port}";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.server.web-apps.${name} = {
|
options.server.web-apps.${name} = {
|
||||||
|
@ -41,20 +60,10 @@ in
|
||||||
inherit persistDirs;
|
inherit persistDirs;
|
||||||
networking.firewall = mkIf cfg.openFirewall { allowedTCPPorts = singleton cfg.port; };
|
networking.firewall = mkIf cfg.openFirewall { allowedTCPPorts = singleton cfg.port; };
|
||||||
}
|
}
|
||||||
(mkIf (cfg.domain != "") {
|
(networkingConfig { inherit config cfg name; })
|
||||||
assertions = singleton {
|
extraConfig
|
||||||
assertion = config.server.web-servers.nginx.enable;
|
|
||||||
message = "You must enable a web server if you want to set server.web-apps.${name}.domain.";
|
|
||||||
};
|
|
||||||
server.networking.ddns.domains = singleton (mkRootDomain cfg.domain);
|
|
||||||
server.web-servers.nginx.proxies = singleton {
|
|
||||||
source = cfg.domain;
|
|
||||||
target = "http://${config.hostname}:${toString cfg.port}";
|
|
||||||
};
|
|
||||||
})
|
|
||||||
serviceConfig
|
|
||||||
cfg.extraCfg
|
|
||||||
]);
|
]);
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
extraCfg.server.web-apps.comfy-ui.enable = true;
|
||||||
};
|
};
|
||||||
apollo = {
|
apollo = {
|
||||||
graphical = false;
|
graphical = false;
|
||||||
|
|
34
nix/modules/server/web-apps/comfy-ui.nix
Normal file
34
nix/modules/server/web-apps/comfy-ui.nix
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
inputs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
inherit (lib.lists) singleton;
|
||||||
|
inherit (config.flake.lib.services) mkWebApp;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
flake.modules.nixos.default =
|
||||||
|
{ config, ... }:
|
||||||
|
let
|
||||||
|
upstreamCfg = config.services.comfyUi;
|
||||||
|
in
|
||||||
|
mkWebApp {
|
||||||
|
inherit config;
|
||||||
|
name = "comfy-ui";
|
||||||
|
defaultPort = 8188;
|
||||||
|
persistDirs = singleton {
|
||||||
|
directory = upstreamCfg.dataDir;
|
||||||
|
inherit (upstreamCfg) user group;
|
||||||
|
mode = "777";
|
||||||
|
};
|
||||||
|
extraConfig.services.comfyUi = {
|
||||||
|
enable = true;
|
||||||
|
listenHost = "0.0.0.0";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
// {
|
||||||
|
imports = [ inputs.stable-diffusion-webui-nix.nixosModules.default ];
|
||||||
|
};
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue