scanbuddy/flake.nix

61 lines
1.4 KiB
Nix
Raw Normal View History

2025-09-25 17:42:36 +02:00
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
2025-09-27 15:51:47 +02:00
pyproject-nix = {
url = "github:nix-community/pyproject.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
2025-09-25 17:42:36 +02:00
};
outputs = {
self,
nixpkgs,
2025-09-27 15:51:47 +02:00
...
2025-09-25 17:42:36 +02:00
} @ inputs: let
system = "x86_64-linux";
2025-09-26 00:26:43 +02:00
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
};
2025-09-27 15:51:47 +02:00
python = pkgs.python3;
serverProject = inputs.pyproject-nix.lib.project.loadPyproject {
projectRoot = ./.;
2025-09-26 00:26:43 +02:00
};
2025-09-27 15:51:47 +02:00
in {
# devShells.${system}.default = pkgs.mkShell {
# packages = with pkgs; [
# python313
# python313Packages.flask
# python313Packages.waitress
# ];
#
# shellHook = ''
# python --version
# exec zsh
# '';
# };
2025-09-26 00:26:43 +02:00
packages.${system} = let
scanbuddy = pkgs.writeShellApplication {
2025-09-27 15:51:47 +02:00
name = "scanbuddy";
2025-09-26 00:26:43 +02:00
runtimeInputs = with pkgs; [sane-backends brscan5 ghostscript];
text = builtins.readFile ./scanbuddy.bash;
};
2025-09-25 17:42:36 +02:00
2025-09-27 15:51:47 +02:00
# Returns an attribute set that can be passed to `buildPythonPackage`.
attrs = serverProject.renderers.buildPythonPackage {inherit python;};
server = python.pkgs.buildPythonPackage (attrs
// {
env.CUSTOM_ENVVAR = "foobar";
});
in {
default = pkgs.symlinkJoin {
2025-09-26 00:26:43 +02:00
name = "scanbuddy";
2025-09-27 15:51:47 +02:00
paths = [scanbuddy server];
2025-09-26 00:26:43 +02:00
};
inherit scanbuddy;
2025-09-27 15:51:47 +02:00
inherit server;
2025-09-25 17:42:36 +02:00
};
};
}