Skip to content

Commit 2f88a8b

Browse files
authored
Add nix flake (#8)
The project can now be run with: ``` nix run . ``` :)
1 parent 3b5c444 commit 2f88a8b

File tree

3 files changed

+186
-0
lines changed

3 files changed

+186
-0
lines changed

README.md

+6
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ I would recommend installing it via [pipx](https://pipx.pypa.io/stable/):
1414
$ pipx install alga
1515
```
1616

17+
Or, via [Nix flakes](https://nixos.org/):
18+
19+
```shell
20+
nix run github:Tenzer/alga
21+
```
22+
1723

1824
Setup
1925
-----

flake.lock

+126
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
inputs = {
3+
pyproject-nix.url = "github:nix-community/pyproject.nix";
4+
pyproject-nix.inputs.nixpkgs.follows = "nixpkgs";
5+
6+
flake-utils.url = "github:numtide/flake-utils";
7+
};
8+
9+
outputs = { nixpkgs, pyproject-nix, flake-utils, ... }:
10+
flake-utils.lib.eachDefaultSystem (system:
11+
let
12+
inherit (nixpkgs) lib;
13+
project = pyproject-nix.lib.project.loadPoetryPyproject {
14+
projectRoot = ./.;
15+
};
16+
17+
overlay = _: prev: {
18+
python3 = prev.python3.override {
19+
packageOverrides = _: p: {
20+
cfgs = p.buildPythonPackage rec {
21+
version = "0.13.0";
22+
pname = "cfgs";
23+
format = "pyproject";
24+
nativeBuildInputs = with p.pythonPackages; [
25+
poetry-core
26+
];
27+
src = p.fetchPypi {
28+
inherit version pname;
29+
hash = "sha256-zvR+Z/BRJ4Pug+JMwvOeWyO11MoMMrvXIb1k9IY2Zn4=";
30+
};
31+
};
32+
};
33+
};
34+
};
35+
36+
pkgs = import nixpkgs { inherit system; overlays = [ overlay ]; };
37+
python = pkgs.python3;
38+
in
39+
{
40+
devShells.default =
41+
let
42+
arg = project.renderers.withPackages { inherit python; };
43+
pythonEnv = python.withPackages arg;
44+
in pkgs.mkShell {
45+
packages = [ pythonEnv ];
46+
};
47+
48+
packages.default =
49+
let
50+
attrs = project.renderers.buildPythonPackage { inherit python; };
51+
in python.pkgs.buildPythonPackage attrs;
52+
}
53+
);
54+
}

0 commit comments

Comments
 (0)