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 <[email protected]>
  • Loading branch information
fricklerhandwerk and alejandrosame committed Oct 16, 2023
1 parent 8c657ff commit 97a1a23
Show file tree
Hide file tree
Showing 9 changed files with 295 additions and 139 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Official documentation for getting things done with Nix.

## Contributing

Run `./live` and open a browser at <http://localhost:5500>.
Run `nix-shell --run devmode` and open a browser at <http://localhost:5500>.

As you make changes your browser should auto-reload within a few seconds.

Expand Down
72 changes: 69 additions & 3 deletions default.nix
Original file line number Diff line number Diff line change
@@ -1,3 +1,69 @@
(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
{
packages.default = nix-dev;

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

This file was deleted.

57 changes: 0 additions & 57 deletions flake.nix

This file was deleted.

1 change: 0 additions & 1 deletion live

This file was deleted.

13 changes: 0 additions & 13 deletions live.py

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"
}
}
Loading

0 comments on commit 97a1a23

Please sign in to comment.