Skip to content

Commit

Permalink
use ndg for docs
Browse files Browse the repository at this point in the history
  • Loading branch information
viperML committed Apr 27, 2024
1 parent 3a4c510 commit de01640
Show file tree
Hide file tree
Showing 2 changed files with 103 additions and 66 deletions.
58 changes: 58 additions & 0 deletions flake.lock

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

111 changes: 45 additions & 66 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,86 +1,65 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
ndg = {
url = "github:feel-co/ndg";
inputs = {
nixpkgs.follows = "nixpkgs";
};
};
};

outputs = {
self,
nixpkgs,
ndg,
}: let
forAllSystems = function:
nixpkgs.lib.genAttrs [
nixpkgs.lib.genAttrs
[
"x86_64-linux"
"aarch64-linux"
] (system:
function
# Import nixpkgs to try google-chrome wrapper
# this pkgs is not used by the consumer, only .lib
(import nixpkgs {
inherit system;
config.allowUnfree = true;
}));

doc = forAllSystems (pkgs:
import ./doc {
inherit pkgs;
optionsCommonMark = self.legacyPackages.${pkgs.system}.optionsCommonMark;
});
]
(
system:
function
# Import nixpkgs to try google-chrome wrapper
# this pkgs is not used by the consumer, only .lib
(
import nixpkgs {
inherit system;
config.allowUnfree = true;
}
)
);
in
(
import ./default.nix {
inherit (nixpkgs) lib;
}
)
(import ./default.nix {inherit (nixpkgs) lib;})
// {
formatter = forAllSystems (pkgs: pkgs.alejandra);

checks = forAllSystems (pkgs:
(self.lib {
inherit pkgs;
modules = [./tests/test-module.nix];
specialArgs = {
some-special-arg = "foo";
};
})
.config
.build
.packages);

packages = forAllSystems (pkgs: doc.${pkgs.system}.packages);

devShells = forAllSystems (pkgs: doc.${pkgs.system}.devShells);

legacyPackages = forAllSystems (
checks = forAllSystems (
pkgs:
pkgs.nixosOptionsDoc {
options =
(self.lib {
inherit pkgs;
modules = [
{
options._module.args = pkgs.lib.mkOption {internal = true;};
}
];
})
.options;
transformOptions = opt:
opt
// {
declarations = with pkgs.lib;
map
(decl:
if hasPrefix (toString ./.) (toString decl)
then let
rev = self.rev or "master";
subpath = removePrefix "/" (removePrefix (toString ./.) (toString decl));
in {
url = "https://github.com/viperML/wrapper-manager/blob/${rev}/${subpath}";
name = subpath;
}
else decl)
opt.declarations;
};
}
(self.lib {
inherit pkgs;
modules = [./tests/test-module.nix];
specialArgs = {
some-special-arg = "foo";
};
})
.config
.build
.packages
);

packages = forAllSystems (
pkgs: {
doc = ndg.packages.${pkgs.system}.ndg-builder.override {
evaluatedModules = self.lib {
inherit pkgs;
modules = [];
};
};
}
);
};
}

0 comments on commit de01640

Please sign in to comment.