-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
clean up lib.mdDoc, update flake.lock, introduce treefmt-nix/nixfmt, …
…cleanup patches, use specialArgs where sensible. (#12) * feat: use specialArgs where sensible * flake.lock: Update Flake lock file updates: • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/666fc80e7b2afb570462423cb0e1cf1a3a34fedd' (2023-12-09) → 'github:NixOS/nixpkgs/5672bc9dbf9d88246ddab5ac454e82318d094bb8' (2024-04-16) * feat: introduce treefmt-nix ++ nixfmt-rfc-style * purge: lib.mdDoc * cleanup: nixdoc patch landed in nixpkgs
- Loading branch information
1 parent
0205c8c
commit 1cf30ea
Showing
29 changed files
with
1,455 additions
and
859 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
(import | ||
( | ||
let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in | ||
fetchTarball { | ||
url = lock.nodes.flake-compat.locked.url or "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz"; | ||
sha256 = lock.nodes.flake-compat.locked.narHash; | ||
} | ||
) | ||
{ src = ./.; } | ||
).defaultNix | ||
(import ( | ||
let | ||
lock = builtins.fromJSON (builtins.readFile ./flake.lock); | ||
in | ||
fetchTarball { | ||
url = | ||
lock.nodes.flake-compat.locked.url | ||
or "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz"; | ||
sha256 = lock.nodes.flake-compat.locked.narHash; | ||
} | ||
) { src = ./.; }).defaultNix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,45 @@ | ||
{ utils }: { lib, runCommand, nixosOptionsDoc, ... }: | ||
{ utils }: | ||
{ | ||
lib, | ||
runCommand, | ||
nixosOptionsDoc, | ||
... | ||
}: | ||
let | ||
mkModuleDocs = module: (nixosOptionsDoc { | ||
inherit (lib.evalModules { | ||
modules = [ | ||
# ignores the configs part in modules | ||
# which is good since we only want the options | ||
{ | ||
config._module.check = false; | ||
options._module.args = lib.mkOption { visible = false; }; | ||
} | ||
mkModuleDocs = | ||
module: | ||
(nixosOptionsDoc { | ||
inherit | ||
(lib.evalModules { | ||
modules = [ | ||
# ignores the configs part in modules | ||
# which is good since we only want the options | ||
{ | ||
config._module.check = false; | ||
options._module.args = lib.mkOption { visible = false; }; | ||
} | ||
|
||
module | ||
]; | ||
}) options; | ||
}).optionsCommonMark; | ||
module | ||
]; | ||
specialArgs = { | ||
inherit utils; | ||
}; | ||
}) | ||
options | ||
; | ||
}).optionsCommonMark; | ||
modules = { | ||
dnsConfig = import ../modules/dnsConfig.nix { inherit utils; }; | ||
dnsConfig = import ../modules/dnsConfig.nix; | ||
extraConfig = import ../modules/extraConfig.nix; | ||
|
||
# darwin = import ../modules/darwin.nix { inherit utils; }; | ||
nixos = import ../modules/nixos.nix { inherit utils; }; | ||
extraConfig = import ../modules/extraConfig.nix { inherit utils; }; | ||
|
||
# darwin = import ../modules/darwin.nix { inherit utils; }; | ||
}; | ||
in | ||
runCommand "modules" { } '' | ||
mkdir -p $out | ||
cp ${./modules.md} $out/index.md | ||
${ | ||
lib.concatLines ( | ||
lib.mapAttrsToList (name: module: | ||
"cat ${mkModuleDocs module} > $out/${name}.md" | ||
) modules | ||
) | ||
} | ||
${lib.concatLines ( | ||
lib.mapAttrsToList (name: module: "cat ${mkModuleDocs module} > $out/${name}.md") modules | ||
)} | ||
'' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,27 @@ | ||
{ utils }: { lib | ||
, fetchpatch | ||
, nixdoc | ||
, nixosOptionsDoc | ||
, runCommand | ||
, ... | ||
}: | ||
{ utils }: | ||
{ | ||
lib, | ||
fetchpatch, | ||
nixdoc, | ||
nixosOptionsDoc, | ||
runCommand, | ||
... | ||
}: | ||
let | ||
utilNames = lib.mapAttrsToList (name: value: name) (builtins.removeAttrs utils [ "__unfix__" "extend" ]); | ||
patchedNixdoc = nixdoc.overrideAttrs (o: { | ||
patches = (o.patches or [ ]) ++ [ | ||
(fetchpatch { | ||
url = "https://github.com/nix-community/nixdoc/commit/b4480a2143464d8238402514dd35c78b6f9b9928.patch"; | ||
hash = "sha256-WZ/tA2q+u4h7G1gUn2nkAutsjYHNxqXwjqAKpxYTf7k="; | ||
}) | ||
]; | ||
}); | ||
utilNames = lib.mapAttrsToList (name: value: name) ( | ||
builtins.removeAttrs utils [ | ||
"__unfix__" | ||
"extend" | ||
] | ||
); | ||
in | ||
runCommand "utils" { } '' | ||
mkdir -p $out | ||
cp ${./utils.md} $out/index.md | ||
${ | ||
lib.concatLines (builtins.map (name: "${lib.getExe' patchedNixdoc "nixdoc"} --file ${../utils/${name}.nix} --prefix 'utils' --category '${name}' --description '${name}' > $out/${name}.md") utilNames) | ||
} | ||
${lib.concatLines ( | ||
builtins.map ( | ||
name: | ||
"${lib.getExe' nixdoc "nixdoc"} --file ${../utils/${name}.nix} --prefix 'utils' --category '${name}' --description '${name}' > $out/${name}.md" | ||
) utilNames | ||
)} | ||
'' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.