Files
home-manager/docs/flake.nix
Austin Horstman 01ea51d706 treewide: use inherit for attribute assignments
This change converts redundant attribute assignments of the form `a =
a;` or `a = someSet.a;` into cleaner `inherit` statements. This reduces
verbosity and follows common Nix style for bringing attributes into
scope.

Statix Codes: W03 (manual_inherit), W04 (manual_inherit_from)

Also include statix and the rule in our configuration.
2026-04-08 14:47:48 -05:00

89 lines
2.0 KiB
Nix

{
description = "Support developing Home Manager documentation";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
scss-reset = {
url = "github:andreymatin/scss-reset/1.4.2";
flake = false;
};
};
outputs =
{
nixpkgs,
scss-reset,
...
}:
let
supportedSystems = [
"aarch64-darwin"
"aarch64-linux"
"i686-linux"
"x86_64-darwin"
"x86_64-linux"
];
# Note, this should be "the standard library" + HM extensions.
lib = import ../modules/lib/stdlib-extended.nix nixpkgs.lib;
forAllSystems = lib.genAttrs supportedSystems;
flakePkgs = pkgs: {
p-build = pkgs.writeShellScriptBin "p-build" ''
set -euo pipefail
export PATH=${
lib.makeBinPath [
pkgs.coreutils
pkgs.rsass
]
}
tmpfile=$(mktemp -d)
trap "rm -r $tmpfile" EXIT
ln -s "${scss-reset}/build" "$tmpfile/scss-reset"
rsass --load-path="$tmpfile" --style compressed \
./static/style.scss > ./static/style.css
echo "Generated ./static/style.css"
'';
};
releaseInfo = lib.importJSON ../release.json;
in
{
devShells = forAllSystems (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
fpkgs = flakePkgs pkgs;
in
{
default = pkgs.mkShell {
name = "hm-docs";
packages = [ fpkgs.p-build ];
};
}
);
# Expose the docs outputs
packages = forAllSystems (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
docs = import ./default.nix {
inherit pkgs lib;
inherit (releaseInfo) isReleaseBranch release;
};
in
{
inherit (docs) manPages jsonModuleMaintainers;
inherit (docs.manual) html htmlOpenTool;
inherit (docs.options) json;
}
);
};
}