Skip to content

Commit

Permalink
Switch from poetry to nixpkgs
Browse files Browse the repository at this point in the history
  • Loading branch information
zmitchell committed Apr 7, 2023
1 parent 89d5f8a commit 7115adc
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 77 deletions.
35 changes: 5 additions & 30 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

69 changes: 22 additions & 47 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,61 +1,36 @@
{
description = "nix.dev static website";

inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.05";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.11";
inputs.flake-utils.url = "github:numtide/flake-utils/master";
inputs.poetry2nix = {
inputs.flake-utils.follows = "flake-utils";
inputs.nixpkgs.follows = "nixpkgs";
url = "github:nix-community/poetry2nix/master";
};

outputs = { self, nixpkgs, flake-utils, poetry2nix }:
outputs = { self, nixpkgs, flake-utils}:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ poetry2nix.overlay ];
};
poetryOverrides = self: super: {

# Refs https://github.com/nix-community/poetry2nix/issues/218#issuecomment-981615612
typing-extensions = super.typing-extensions.overridePythonAttrs (
old: {
buildInputs = (old.buildInputs or [ ]) ++ [ self.flit-core ];
}
);

sphinx-design = super.sphinx-design.overridePythonAttrs (
old: {
buildInputs = (old.buildInputs or [ ]) ++ [ self.flit-core ];
}
);
in {
defaultPackage = pkgs.stdenv.mkDerivation {
name = "nix-dev";
src = self;
buildInputs = with pkgs.python310Packages; [
livereload
myst-parser
sphinx
sphinx-book-theme
sphinx-copybutton
sphinx-design
black
];
buildPhase = ''
make html
'';
installPhase = ''
mkdir -p $out
cp -R build/html/* $out/
'';
};
in rec {
packages = flake-utils.lib.flattenTree {
nix-dev-pyenv = pkgs.poetry2nix.mkPoetryEnv {
projectDir = self;
python = pkgs.python39;
overrides = [
pkgs.poetry2nix.defaultPoetryOverrides
poetryOverrides
];
};
nix-dev-html = pkgs.stdenv.mkDerivation {
name = "nix-dev";
src = self;
buildInputs = [ packages.nix-dev-pyenv ];
buildPhase = ''
make html
'';
installPhase = ''
mkdir -p $out
cp -R build/html/* $out/
'';
};
};
defaultPackage = packages.nix-dev-html;
}
);

}

0 comments on commit 7115adc

Please sign in to comment.