diff --git a/default.nix b/default.nix deleted file mode 100644 index dff0e92..0000000 --- a/default.nix +++ /dev/null @@ -1,2 +0,0 @@ -{ pkgs ? import {} }: -pkgs.callPackage ./src/derivation.nix {} diff --git a/flake.lock b/flake.lock index e2a0510..96b4586 100644 --- a/flake.lock +++ b/flake.lock @@ -2,16 +2,16 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1711200738, - "narHash": "sha256-dkJmk/ET/tRV4007O6kU101UEg1svUwiyk/zEEX9Tdg=", + "lastModified": 1716769173, + "narHash": "sha256-7EXDb5WBw+d004Agt+JHC/Oyh/KTUglOaQ4MNjBbo5w=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "20bc93ca7b2158ebc99b8cef987a2173a81cde35", + "rev": "9ca3f649614213b2aaf5f1e16ec06952fe4c2632", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixpkgs-unstable", + "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" } diff --git a/flake.nix b/flake.nix index e9932c4..f32b86b 100644 --- a/flake.nix +++ b/flake.nix @@ -1,106 +1,69 @@ { - inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + description = "Ozai WebUI"; - outputs = { self, nixpkgs}: - let - supportedSystems = [ "x86_64-linux"]; - forAllSystems = nixpkgs.lib.genAttrs supportedSystems; - pkgs = forAllSystems (system: nixpkgs.legacyPackages.${system}); - lib = forAllSystems (system: nixpkgs.legacyPackages.${system}).lib; - types = forAllSystems (system: nixpkgs.legacyPackages.${system}).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 { - default = ozai-webui; - }); + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + }; - devShells = forAllSystems (system: - let - python = pkgs.${system}.python3.withPackages (ps: [ps.flask ps.flask-socketio]); - in { - default = pkgs.${system}.mkShellNoCC { - packages = with pkgs.${system}; [ - python - ]; + outputs = { self, nixpkgs, ... }@inputs: + let + pkgs = import nixpkgs { system = "x86_64-linux"; }; + lib = pkgs.lib; + types = lib.types; + in + { + packages.x86_64-linux.default = pkgs.python3Packages.buildPythonApplication rec { + pname = "ozai-webui"; + version = "0.1.1"; + propagatedBuildInputs = [ pkgs.python3Packages.flask pkgs.python3Packages.flask-socketio ]; + src = ./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, ... }: { + options.services.ozai-webui = { + enable = lib.mkEnableOption "Ozai WebUI"; + host = lib.mkOption { + type = types.str; + default = "127.0.0.1"; + description = "The host to run the server on"; }; - }); + port = lib.mkOption { + type = types.int; + default = 8080; + description = "The port to run the server on"; + }; + ozaiUrl = lib.mkOption { + type = types.str; + default = "http://localhost:8000/api/"; + description = "The URL of the Ozai server"; + }; + secretKey = lib.mkOption { + type = types.str; + default = "secret_key"; + description = "The secret key for the Flask app"; + }; + }; - nixosModules = forAllSystems (system: let - ozai-webui = import ./default.nix { inherit (pkgs.${system}) pkgs; }; - lib = pkgs.${system}.lib; - types = pkgs.${system}.lib.types; - in { - ozai-webui = { config, pkgs, ... }: { - options.services.ozai-webui = { - enable = lib.mkEnableOption "Ozai WebUI"; - host = lib.mkOption { - type = types.str; - default = "127.0.0.1"; - description = "The host to run the server on"; - }; - port = lib.mkOption { - type = types.int; - default = 8080; - description = "The port to run the server on"; - }; - ozaiUrl = lib.mkOption { - type = types.str; - default = "http://localhost:8000/api/"; - description = "The URL of the Ozai server"; - }; - secretKey = lib.mkOption { - type = types.str; - default = "secret_key"; - description = "The secret key for the Flask app"; - }; - }; - config = lib.mkIf config.services.ozai-webui.enable { - systemd.services.ozai-webui = { - description = "Ozai WebUI"; - after = [ "network.target" ]; - wantedBy = [ "multi-user.target" ]; - 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'"; - 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; - } - ]; + config = lib.mkIf config.services.ozai-webui.enable { + systemd.services.ozai-webui = { + description = "Ozai WebUI server"; + after = [ "network.target" ]; + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + 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"; }; }; - - # 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; - # } - # ]; - # }; - # }); - - - + }; }; -} \ No newline at end of file + }; +} + diff --git a/result b/result new file mode 120000 index 0000000..14a2936 --- /dev/null +++ b/result @@ -0,0 +1 @@ +/nix/store/j2lil82hrmdp8gqxpql5iy4rd3jb3xla-ozai-webui-0.1.1 \ No newline at end of file diff --git a/src/derivation.nix b/src/derivation.nix deleted file mode 100644 index 8466288..0000000 --- a/src/derivation.nix +++ /dev/null @@ -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 - ''; -} \ No newline at end of file diff --git a/src/templates/game.html b/src/templates/game.html index f9d13ab..05589f9 100644 --- a/src/templates/game.html +++ b/src/templates/game.html @@ -8,7 +8,7 @@ * { --border-color: #616C71; --bg-transparency: 0.5; - --tile-size: 2em; + --tile-size: 3em; --blue: 49, 157, 245; --yellow: 210, 160, 0; --red: 200, 50, 50; @@ -529,4 +529,4 @@ - \ No newline at end of file +