Skip to content

Commit

Permalink
ci(guide): add guide dependencies to pyproject.toml, build guide usin…
Browse files Browse the repository at this point in the history
…g nix
  • Loading branch information
vanutp committed Apr 20, 2024
1 parent 81ecc41 commit 0ebc140
Show file tree
Hide file tree
Showing 7 changed files with 705 additions and 39 deletions.
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
14 changes: 5 additions & 9 deletions .github/workflows/guide.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,15 @@ jobs:
working-directory: guide

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.10'
- name: Install dependencies
run: |
pip install -r requirements.txt
- uses: actions/checkout@v3
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main

- name: Build
run: mkdocs build
run: nix develop -c mkdocs build

- name: Deploy to Netlify
uses: nwtgck/actions-netlify@v1.2
uses: nwtgck/actions-netlify@v3.0
with:
publish-dir: './guide/site'
production-branch: master
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ config.yaml

guide/site
guide/.cache

.direnv/
54 changes: 32 additions & 22 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,42 +10,52 @@
};
};

outputs = { self, nixpkgs, flake-utils, poetry2nix }:
flake-utils.lib.eachDefaultSystem (system:
outputs =
{
self,
nixpkgs,
flake-utils,
poetry2nix,
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs {
inherit system;
};
buildTgpy = (pkgs:
let
inherit (poetry2nix.lib.mkPoetry2Nix { inherit pkgs; }) mkPoetryApplication;
in builtins.trace "Not all features are supported due to the nature of nix" mkPoetryApplication rec {
projectDir = ./.;
pkgs = import nixpkgs { inherit system; };
p2n = poetry2nix.lib.mkPoetry2Nix { inherit pkgs; };

buildTgpy =
pkgs:
dev:
builtins.trace "Not all features are supported due to the nature of nix" p2n.mkPoetryApplication {
projectDir = ./.;
preferWheels = true;
}
);
groups = if dev then [ "dev" "guide" ] else [];
};

buildTgpyImage = (pkgs: pkgs.dockerTools.buildLayeredImage {
name = "tgpy_image";
contents = [ (buildTgpy pkgs) ];
created = "now";
config = {
Cmd = [ "tgpy" ];
buildTgpyImage =
pkgs:
pkgs.dockerTools.buildLayeredImage {
name = "tgpy_image";
contents = [ (buildTgpy pkgs false) ];
created = "now";
config = {
Cmd = [ "tgpy" ];
};
};
});
in
{
packages = {
tgpy = buildTgpy pkgs;
tgpy = buildTgpy pkgs false;
tgpyImage = buildTgpyImage pkgs;
tgpyImage-aarch64Linux = buildTgpyImage pkgs.pkgsCross.aarch64-multiplatform;
tgpyImage-x86_64Linux = buildTgpyImage pkgs.pkgsCross.gnu64;
default = self.packages.${system}.tgpy;
};

devShells.default = pkgs.mkShell {
inputsFrom = [ self.packages.${system}.tgpy ];
inputsFrom = [ (buildTgpy pkgs true) ];
packages = [ pkgs.poetry ];
};
});
}
);
}
5 changes: 0 additions & 5 deletions guide/requirements.txt

This file was deleted.

Loading

0 comments on commit 0ebc140

Please sign in to comment.