flake updates

This commit is contained in:
Adrian Gunnar Lauterer 2024-05-29 18:43:06 +02:00
parent 6aee571407
commit 27e33a2892
Signed by: adriangl
GPG Key ID: D33368A59745C2F0
5 changed files with 80 additions and 123 deletions

View File

@ -1,2 +0,0 @@
{ pkgs ? import <nixpkgs> {} }:
pkgs.callPackage ./src/derivation.nix {}

View File

@ -2,16 +2,16 @@
"nodes": { "nodes": {
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1711200738, "lastModified": 1716769173,
"narHash": "sha256-dkJmk/ET/tRV4007O6kU101UEg1svUwiyk/zEEX9Tdg=", "narHash": "sha256-7EXDb5WBw+d004Agt+JHC/Oyh/KTUglOaQ4MNjBbo5w=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "20bc93ca7b2158ebc99b8cef987a2173a81cde35", "rev": "9ca3f649614213b2aaf5f1e16ec06952fe4c2632",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "NixOS", "owner": "NixOS",
"ref": "nixpkgs-unstable", "ref": "nixos-unstable",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }

100
flake.nix
View File

@ -1,39 +1,44 @@
{ {
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};
outputs = { self, nixpkgs}: outputs = { self, nixpkgs, ... }@inputs:
let let
supportedSystems = [ "x86_64-linux"]; pkgs = import nixpkgs {
forAllSystems = nixpkgs.lib.genAttrs supportedSystems; system = "x86_64-linux";
pkgs = forAllSystems (system: nixpkgs.legacyPackages.${system}); };
lib = forAllSystems (system: nixpkgs.legacyPackages.${system}).lib; lib = pkgs.lib;
types = forAllSystems (system: nixpkgs.legacyPackages.${system}).lib.types; types = lib.types;
in
{
packages = forAllSystems (system:
let
python = pkgs.${system}.python3.withPackages (ps: [ps.flask ps.flask-socketio]);
ozai-webui = import ./default.nix { inherit (pkgs.${system}) pkgs; };
in { in {
default = ozai-webui; devShell = {
}); x86_64-linux = pkgs.mkShell {
packages = [
devShells = forAllSystems (system: pkgs.python3
let pkgs.python3Packages.flask
python = pkgs.${system}.python3.withPackages (ps: [ps.flask ps.flask-socketio]); pkgs.python3Packages.flask-socketio
in {
default = pkgs.${system}.mkShellNoCC {
packages = with pkgs.${system}; [
python
]; ];
}; };
}); };
nixosModules = forAllSystems (system: let packages = {
ozai-webui = import ./default.nix { inherit (pkgs.${system}) pkgs; }; x86_64-linux.default = pkgs.python3Packages.buildPythonApplication rec {
lib = pkgs.${system}.lib; pname = "ozai-webui";
types = pkgs.${system}.lib.types; version = "0.1.1";
in { propagatedBuildInputs = [ pkgs.python3Packages.flask pkgs.python3Packages.flask-socketio ];
src = ./.;
doCheck = false;
postInstall = ''
mkdir -p $out/share/ozai-webui
cp -r static $out/share/ozai-webui/static
cp -r templates $out/share/ozai-webui/templates
mv $out/bin/main.py $out/bin/ozai-webui
'';
};
};
nixosModules = {
ozai-webui = { config, pkgs, ... }: { ozai-webui = { config, pkgs, ... }: {
options.services.ozai-webui = { options.services.ozai-webui = {
enable = lib.mkEnableOption "Ozai WebUI"; enable = lib.mkEnableOption "Ozai WebUI";
@ -58,49 +63,20 @@
description = "The secret key for the Flask app"; description = "The secret key for the Flask app";
}; };
}; };
config = lib.mkIf config.services.ozai-webui.enable { config = lib.mkIf config.services.ozai-webui.enable {
systemd.services.ozai-webui = { systemd.services.ozai-webui = {
description = "Ozai WebUI"; description = "Ozai WebUI server";
after = [ "network.target" ]; after = [ "network.target" ];
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
serviceConfig = { serviceConfig = {
ExecStart = "${ozai-webui}/bin/ozai-webui --port ${toString config.services.ozai-webui.port} --host '${config.services.ozai-webui.host}' --ozai_url '${config.services.ozai-webui.ozaiUrl}' --secret_key '${config.services.ozai-webui.secretKey}' --static_folder '/share/ozai-webui/static' --template_folder '/share/ozai-webui/templates'"; ExecStart = "${pkgs.ozai-webui}/bin/ozai-webui --port ${toString config.services.ozai-webui.port} --host '${config.services.ozai-webui.host}' --ozai_url '${config.services.ozai-webui.ozaiUrl}' --secret_key '${config.services.ozai-webui.secretKey}' --static_folder '/share/ozai-webui/static' --template_folder '/share/ozai-webui/templates'";
Restart = "always"; Restart = "always";
}; };
}; };
}; };
}; };
});
nixosConfigurations = {
ozai-webui = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
self.nixosModules.x86_64-linux.ozai-webui
{
system.stateVersion = "23.11";
boot.isContainer = true;
services.ozai-webui.enable = true;
}
];
}; };
}; };
# nixosConfigurations = forAllSystems (system: {
# ozai-webui = { config, pkgs, ... }: {
# modules = [
# self.systems.${system}.nixosModules.ozai-webui
# {
# system.stateVersion = "23.11";
# boot.isContainer = true;
# services.ozai-webui.enable = true;
# }
# ];
# };
# });
};
} }

View File

@ -1,17 +0,0 @@
{ lib, python3Packages }:
with python3Packages;
buildPythonApplication rec {
pname = "ozai-webui";
version = "0.1.1";
propagatedBuildInputs = [ flask flask-socketio ];
src = ./.;
doCheck = false;
#copy the static files to the output
postInstall = ''
mkdir -p $out/share/ozai-webui
cp -r static $out/share/ozai-webui/static
cp -r templates $out/share/ozai-webui/templates
mv $out/bin/main.py $out/bin/ozai-webui
'';
}

View File

@ -8,7 +8,7 @@
* { * {
--border-color: #616C71; --border-color: #616C71;
--bg-transparency: 0.5; --bg-transparency: 0.5;
--tile-size: 2em; --tile-size: 3em;
--blue: 49, 157, 245; --blue: 49, 157, 245;
--yellow: 210, 160, 0; --yellow: 210, 160, 0;
--red: 200, 50, 50; --red: 200, 50, 50;