about summary refs log tree commit diff
path: root/flake.nix
blob: 51ffc0f81df5a2d894fbf49dda90af8e40677fd3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
{
  description = "A basic flake using pyproject.toml project metadata";

  inputs = {
    pyproject-nix = {
      url = "github:nix-community/pyproject.nix";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs = { nixpkgs, pyproject-nix, ... }:
    let
      inherit (nixpkgs) lib;

      project = pyproject-nix.lib.project.loadPyproject {
        # Read & unmarshal pyproject.toml relative to this project root.
        # projectRoot is also used to set `src` for renderers such as buildPythonPackage.
        projectRoot = ./.;
      };

      # This example is only using x86_64-linux
      pkgs = nixpkgs.legacyPackages.x86_64-linux;

      python = pkgs.python3;

      # Returns an attribute set that can be passed to `buildPythonPackage`.
      attrs = project.renderers.buildPythonPackage { inherit python; };

      pkg = python.pkgs.buildPythonPackage (attrs // {
          meta = {
            description = "Blog backend for blog.node5.net";
            homepage = "https://blog.node5.net/Blog%20meta/";
            changelog = "https://git.node5.net/blog/blog.node5.net_flask/log/";
            mainProgram = "blog-node5";
          };
        });
    in
    {
      # Build our package using `buildPythonPackage
      packages.x86_64-linux.default =
        # Pass attributes to buildPythonPackage.
        # Here is a good spot to add on any missing or custom attributes.
        pkg;
    } //  {
    pythonPath = "${python.pkgs.makePythonPath attrs.dependencies}:${pkg}/${python.sitePackages}";
  };
}