Skip to content

Commit

Permalink
remove flake.nix
Browse files Browse the repository at this point in the history
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 <alejandrosanchzmedina@gmail.com>
  • Loading branch information
fricklerhandwerk and alejandrosame committed Nov 7, 2023
1 parent 51e43e3 commit 1e2299c
Show file tree
Hide file tree
Showing 6 changed files with 295 additions and 146 deletions.
73 changes: 70 additions & 3 deletions default.nix
Original file line number Diff line number Diff line change
@@ -1,3 +1,70 @@
(import (fetchTarball https://github.com/edolstra/flake-compat/archive/master.tar.gz) {
src = builtins.fetchGit ./.;
}).defaultNix
{ inputs ? import ./nix/sources.nix }:
let
pkgs = import inputs.nixpkgs {
config = { };
overlays = [ (import ./overlay.nix) ];
};

nix-dev = pkgs.stdenv.mkDerivation {
name = "nix-dev";
src = ./.;
nativeBuildInputs = with pkgs.python310.pkgs; [
linkify-it-py
myst-parser
sphinx
sphinx-book-theme
sphinx-copybutton
sphinx-design
sphinx-notfound-page
sphinx-sitemap
];
buildPhase = ''
make html
'';
installPhase = ''
mkdir -p $out
cp -R build/html/* $out/
'';
};

devmode =
let
pythonEnvironment = pkgs.python310.withPackages (ps: with ps; [
livereload
]);
script = ''
from livereload import Server, shell
server = Server()
build_docs = shell("make html")
print("Doing an initial build of the docs...")
build_docs()
server.watch("source/*", build_docs)
server.watch("source/**/*", build_docs)
server.watch("_templates/*.html", build_docs)
server.serve(root="build/html")
'';
in
pkgs.writeShellApplication {
name = "devmode";
runtimeInputs = [ pythonEnvironment ];
text = ''
python ${pkgs.writeText "live.py" script}
'';
};
in
{
# build with `nix-build -A build`
build = nix-dev;

shell = pkgs.mkShell {
inputsFrom = [ nix-dev ];
packages = with pkgs.python310.pkgs; [
black
devmode
];
};
}
61 changes: 0 additions & 61 deletions flake.lock

This file was deleted.

79 changes: 0 additions & 79 deletions flake.nix

This file was deleted.

26 changes: 26 additions & 0 deletions nix/sources.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"nixpkgs": {
"branch": "nixos-23.05",
"description": "Nix Packages collection & NixOS",
"homepage": "",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "898cb2064b6e98b8c5499f37e81adbdf2925f7c5",
"sha256": "0ha53gbglrcnpzfc4lwzgyvlsagvm1m2q9z5i5b4nfahplnqpsbj",
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/898cb2064b6e98b8c5499f37e81adbdf2925f7c5.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"poetry2nix": {
"branch": "master",
"description": "Convert poetry projects to nix automagically [maintainer=@adisbladis] ",
"homepage": "",
"owner": "nix-community",
"repo": "poetry2nix",
"rev": "fe0dcb4c9b44162a385f1170895fe6a392ed71b5",
"sha256": "0cxccm7hzcmizhbg79rdqimjndin98waibw824cmgzwwqkyzl9lv",
"type": "tarball",
"url": "https://github.com/nix-community/poetry2nix/archive/fe0dcb4c9b44162a385f1170895fe6a392ed71b5.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
}
}

0 comments on commit 1e2299c

Please sign in to comment.