split up the flake better

This commit is contained in:
Prunebutt 2025-09-27 18:54:24 +02:00
parent d6e6bd7768
commit c8ce4db2a2
2 changed files with 47 additions and 21 deletions

View file

@ -20,21 +20,9 @@
serverProject = inputs.pyproject-nix.lib.project.loadPyproject { serverProject = inputs.pyproject-nix.lib.project.loadPyproject {
projectRoot = ./.; projectRoot = ./.;
}; };
in {
# devShells.${system}.default = pkgs.mkShell { # Packages
# packages = with pkgs; [ script = pkgs.writeShellApplication {
# python313
# python313Packages.flask
# python313Packages.waitress
# ];
#
# shellHook = ''
# python --version
# exec zsh
# '';
# };
packages.${system} = let
scanbuddy = pkgs.writeShellApplication {
name = "scanbuddy"; name = "scanbuddy";
runtimeInputs = with pkgs; [sane-backends brscan5 ghostscript]; runtimeInputs = with pkgs; [sane-backends brscan5 ghostscript];
@ -48,13 +36,50 @@
// { // {
env.CUSTOM_ENVVAR = "foobar"; env.CUSTOM_ENVVAR = "foobar";
}); });
in {
default = pkgs.symlinkJoin { scanbuddy-pkg = pkgs.symlinkJoin {
name = "scanbuddy"; name = "scanbuddy";
paths = [scanbuddy server]; paths = [script server];
}; };
inherit scanbuddy; in {
# devShells.${system}.default = pkgs.mkShell {
# packages = with pkgs; [
# python313
# python313Packages.flask
# python313Packages.waitress
# ];
#
# shellHook = ''
# python --version
# exec zsh
# '';
# };
packages.${system} = {
default = scanbuddy-pkg;
inherit script;
inherit server; inherit server;
}; };
nixosModules.default = {
config,
pkgs,
lib,
...
}: {
options = {
service.scanbuddy = lib.mkEnableOption "Enable the scanbuddy server";
};
config = {
systemd.services.scanbuddy = lib.mkIf config.service.scanbuddy {
description = "The scanbuddy webservice";
wantedBy = ["multi-user.target"];
serviceConfig = {
ExecStart = "${scanbuddy-pkg}/bin/scanbuddy-server";
Path = ["${scanbuddy-pkg}/bin"];
WorkingDirectory = "/var/lib/scanbuddy";
};
};
};
};
}; };
} }

View file

@ -6,6 +6,7 @@ description = "A REST server for the scanbuddy shell-script"
# define any Python dependencies # define any Python dependencies
dependencies = [ dependencies = [
"flask>3", "flask>3",
"waitress"
] ]
# define the CLI executable # define the CLI executable