Skip to content

Commit 1e2299c

Browse files
remove flake.nix
use niv for dependency management. this follows our own tutorials on writing packages and development shells, and we generally find it is easier to read and work with. Co-authored-by: Alejandro Sanchez Medina <[email protected]>
1 parent 51e43e3 commit 1e2299c

File tree

6 files changed

+295
-146
lines changed

6 files changed

+295
-146
lines changed

default.nix

Lines changed: 70 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,70 @@
1-
(import (fetchTarball https://github.com/edolstra/flake-compat/archive/master.tar.gz) {
2-
src = builtins.fetchGit ./.;
3-
}).defaultNix
1+
{ inputs ? import ./nix/sources.nix }:
2+
let
3+
pkgs = import inputs.nixpkgs {
4+
config = { };
5+
overlays = [ (import ./overlay.nix) ];
6+
};
7+
8+
nix-dev = pkgs.stdenv.mkDerivation {
9+
name = "nix-dev";
10+
src = ./.;
11+
nativeBuildInputs = with pkgs.python310.pkgs; [
12+
linkify-it-py
13+
myst-parser
14+
sphinx
15+
sphinx-book-theme
16+
sphinx-copybutton
17+
sphinx-design
18+
sphinx-notfound-page
19+
sphinx-sitemap
20+
];
21+
buildPhase = ''
22+
make html
23+
'';
24+
installPhase = ''
25+
mkdir -p $out
26+
cp -R build/html/* $out/
27+
'';
28+
};
29+
30+
devmode =
31+
let
32+
pythonEnvironment = pkgs.python310.withPackages (ps: with ps; [
33+
livereload
34+
]);
35+
script = ''
36+
from livereload import Server, shell
37+
38+
server = Server()
39+
40+
build_docs = shell("make html")
41+
42+
print("Doing an initial build of the docs...")
43+
build_docs()
44+
45+
server.watch("source/*", build_docs)
46+
server.watch("source/**/*", build_docs)
47+
server.watch("_templates/*.html", build_docs)
48+
server.serve(root="build/html")
49+
'';
50+
in
51+
pkgs.writeShellApplication {
52+
name = "devmode";
53+
runtimeInputs = [ pythonEnvironment ];
54+
text = ''
55+
python ${pkgs.writeText "live.py" script}
56+
'';
57+
};
58+
in
59+
{
60+
# build with `nix-build -A build`
61+
build = nix-dev;
62+
63+
shell = pkgs.mkShell {
64+
inputsFrom = [ nix-dev ];
65+
packages = with pkgs.python310.pkgs; [
66+
black
67+
devmode
68+
];
69+
};
70+
}

flake.lock

Lines changed: 0 additions & 61 deletions
This file was deleted.

flake.nix

Lines changed: 0 additions & 79 deletions
This file was deleted.

nix/sources.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"nixpkgs": {
3+
"branch": "nixos-23.05",
4+
"description": "Nix Packages collection & NixOS",
5+
"homepage": "",
6+
"owner": "NixOS",
7+
"repo": "nixpkgs",
8+
"rev": "898cb2064b6e98b8c5499f37e81adbdf2925f7c5",
9+
"sha256": "0ha53gbglrcnpzfc4lwzgyvlsagvm1m2q9z5i5b4nfahplnqpsbj",
10+
"type": "tarball",
11+
"url": "https://github.com/NixOS/nixpkgs/archive/898cb2064b6e98b8c5499f37e81adbdf2925f7c5.tar.gz",
12+
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
13+
},
14+
"poetry2nix": {
15+
"branch": "master",
16+
"description": "Convert poetry projects to nix automagically [maintainer=@adisbladis] ",
17+
"homepage": "",
18+
"owner": "nix-community",
19+
"repo": "poetry2nix",
20+
"rev": "fe0dcb4c9b44162a385f1170895fe6a392ed71b5",
21+
"sha256": "0cxccm7hzcmizhbg79rdqimjndin98waibw824cmgzwwqkyzl9lv",
22+
"type": "tarball",
23+
"url": "https://github.com/nix-community/poetry2nix/archive/fe0dcb4c9b44162a385f1170895fe6a392ed71b5.tar.gz",
24+
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
25+
}
26+
}

0 commit comments

Comments
 (0)