refactor: rename modules directory to nix
This commit is contained in:
parent
5501c39e31
commit
e884735f25
13 changed files with 1 additions and 1 deletions
28
nix/flake-parts/files.nix
Normal file
28
nix/flake-parts/files.nix
Normal file
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
inputs,
|
||||
withSystem,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (builtins) map head;
|
||||
inherit (lib) concatStringsSep;
|
||||
mkListEntry = x: "- [" + x.path_ + "](" + x.path_ + ")";
|
||||
listOfGeneratedFiles = withSystem (head config.systems) (psArgs: psArgs.config.files.files);
|
||||
in
|
||||
{
|
||||
imports = [ inputs.files.flakeModules.default ];
|
||||
perSystem = psArgs: {
|
||||
make-shells.default.packages = [ psArgs.config.files.writer.drv ];
|
||||
};
|
||||
text.readme.parts."Generated Files" = concatStringsSep "\n" (
|
||||
[
|
||||
"This flake uses the [files flake-parts module](https://flake.parts/options/files.html) to generate documentation."
|
||||
|
||||
"The list of generated files are:"
|
||||
|
||||
]
|
||||
++ (map mkListEntry listOfGeneratedFiles)
|
||||
);
|
||||
}
|
17
nix/flake-parts/files/cheatsheet.nix
Normal file
17
nix/flake-parts/files/cheatsheet.nix
Normal file
|
@ -0,0 +1,17 @@
|
|||
{ lib, config, ... }:
|
||||
let
|
||||
inherit (lib) concatStringsSep singleton;
|
||||
in
|
||||
{
|
||||
text.cheatsheet = concatStringsSep "\n" [
|
||||
"`__curPos.file` will give the full evaluated path of the nix file it is called in. See [this issue](https://github.com/NixOS/nix/issues/5897#issuecomment-1012165198) for more information."
|
||||
];
|
||||
perSystem =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
files.files = singleton {
|
||||
path_ = "docs/cheatsheet.md";
|
||||
drv = pkgs.writeText "cheatsheet.md" config.text.cheatsheet;
|
||||
};
|
||||
};
|
||||
}
|
21
nix/flake-parts/files/readme.nix
Normal file
21
nix/flake-parts/files/readme.nix
Normal file
|
@ -0,0 +1,21 @@
|
|||
{ config, lib, ... }:
|
||||
let
|
||||
inherit (lib) singleton;
|
||||
in
|
||||
{
|
||||
text.readme = {
|
||||
heading = "Pantheon";
|
||||
description = ''
|
||||
This flake serves as a monorepo for my systems (using IaC), dotfiles, and scripts.
|
||||
'';
|
||||
};
|
||||
|
||||
perSystem =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
files.files = singleton {
|
||||
path_ = "README.md";
|
||||
drv = pkgs.writeText "README.md" config.text.readme;
|
||||
};
|
||||
};
|
||||
}
|
23
nix/flake-parts/git-hooks.nix
Normal file
23
nix/flake-parts/git-hooks.nix
Normal file
|
@ -0,0 +1,23 @@
|
|||
{ inputs, ... }:
|
||||
{
|
||||
imports = [ inputs.git-hooks.flakeModule ];
|
||||
perSystem = psArgs: {
|
||||
pre-commit.settings.hooks = {
|
||||
# Nix Linters
|
||||
deadnix.enable = true;
|
||||
statix.enable = true;
|
||||
nil.enable = true;
|
||||
nixfmt-rfc-style.enable = true;
|
||||
# Flake Health Checks
|
||||
flake-checker.enable = true;
|
||||
# Misc
|
||||
mixed-line-endings.enable = true;
|
||||
trim-trailing-whitespace.enable = true;
|
||||
#TODO: figure out vale
|
||||
#TODO: make nix develop work
|
||||
#TODO: add nix flake check
|
||||
#TODO: add write-files
|
||||
};
|
||||
make-shells.default.shellHook = psArgs.config.pre-commit.installationScript;
|
||||
};
|
||||
}
|
5
nix/flake-parts/make-shell.nix
Normal file
5
nix/flake-parts/make-shell.nix
Normal file
|
@ -0,0 +1,5 @@
|
|||
{ inputs, ... }:
|
||||
{
|
||||
#TODO: add to readme
|
||||
imports = [ inputs.make-shell.flakeModules.default ];
|
||||
}
|
4
nix/flake-parts/modules.nix
Normal file
4
nix/flake-parts/modules.nix
Normal file
|
@ -0,0 +1,4 @@
|
|||
{ inputs, ... }:
|
||||
{
|
||||
imports = [ inputs.flake-parts.flakeModules.modules ];
|
||||
}
|
4
nix/flake-parts/text.nix
Normal file
4
nix/flake-parts/text.nix
Normal file
|
@ -0,0 +1,4 @@
|
|||
{ inputs, ... }:
|
||||
{
|
||||
imports = [ inputs.text.flakeModules.default ];
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue