Skip to content

Commit

Permalink
add code for building docs
Browse files Browse the repository at this point in the history
  • Loading branch information
marenz2569 committed Nov 20, 2023
1 parent e5c5899 commit 98b0a67
Showing 1 changed file with 40 additions and 52 deletions.
92 changes: 40 additions & 52 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-22.11";

utils = {
url = "github:numtide/flake-utils";
};
utils = { url = "github:numtide/flake-utils"; };

tlms-rust = {
url = "github:tlm-solutions/tlms.rs";
Expand All @@ -18,56 +16,46 @@
};

outputs = { self, nixpkgs, utils, tlms-rust, json-structs, ... }:
(utils.lib.eachDefaultSystem
(system:
let
pkgs = nixpkgs.legacyPackages.${system};
(utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};

package = pkgs.callPackage ./derivation.nix {
tlms-rust = tlms-rust;
json-structs-src = json-structs;
};
in
rec {
checks = packages;
packages = {
funnel = package;
default = package;
};
devShells.default = pkgs.mkShell {
nativeBuildInputs = (with packages.funnel; buildInputs ++ nativeBuildInputs);
};
}
) // {
overlays.default = final: prev: {
inherit (self.packages.${prev.system})
funnel;
};
package = pkgs.callPackage ./derivation.nix {
tlms-rust = tlms-rust;
json-structs-src = json-structs;
};
in rec {
checks = packages;
packages = {
funnel = package;
default = package;
docs = (pkgs.nixosOptionsDoc {
options = (nixpkgs.lib.nixosSystem {
inherit system;
modules = [ self.nixosModules.default ];
}).options.TLMS;
}).optionsCommonMark;
};
devShells.default = pkgs.mkShell {
nativeBuildInputs =
(with packages.funnel; buildInputs ++ nativeBuildInputs);
};
}) // {
overlays.default = final: prev: {
inherit (self.packages.${prev.system}) funnel;
};

nixosModules = rec {
default = funnel;
funnel = import ./nixos-module;
};
nixosModules = rec {
default = funnel;
funnel = import ./nixos-module;
};

hydraJobs =
let
hydraSystems = [
"x86_64-linux"
"aarch64-linux"
];
in
builtins.foldl'
(hydraJobs: system:
builtins.foldl'
(hydraJobs: pkgName:
nixpkgs.lib.recursiveUpdate hydraJobs {
${pkgName}.${system} = self.packages.${system}.${pkgName};
}
)
hydraJobs
(builtins.attrNames self.packages.${system})
)
{ }
hydraSystems;
});
hydraJobs = let hydraSystems = [ "x86_64-linux" "aarch64-linux" ];
in builtins.foldl' (hydraJobs: system:
builtins.foldl' (hydraJobs: pkgName:
nixpkgs.lib.recursiveUpdate hydraJobs {
${pkgName}.${system} = self.packages.${system}.${pkgName};
}) hydraJobs (builtins.attrNames self.packages.${system})) { }
hydraSystems;
});
}

0 comments on commit 98b0a67

Please sign in to comment.