Skip to content

Commit

Permalink
style: formating
Browse files Browse the repository at this point in the history
  • Loading branch information
isabelroses committed May 14, 2024
1 parent 67be4e9 commit 10a159f
Show file tree
Hide file tree
Showing 305 changed files with 3,994 additions and 3,258 deletions.
124 changes: 76 additions & 48 deletions docs/default.nix
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
# modfied from https://github.com/nekowinston/nur/blob/49cfefd3c252f4c56725df01f817d1a8b93447d8/docs/default.nix
# modified from https://github.com/nekowinston/nur/blob/49cfefd3c252f4c56725df01f817d1a8b93447d8/docs/default.nix
{
lib,
pkgs,
self,
...
}: let
inherit (lib) mkForce filterAttrs scrubDerivations removePrefix;

mkEval = module:
}:
let
inherit (lib)
mkForce
filterAttrs
scrubDerivations
removePrefix
;

mkEval =
module:
lib.evalModules {
modules = [
module
Expand All @@ -18,40 +25,47 @@
};
}
];
specialArgs = {inherit pkgs;};
specialArgs = {
inherit pkgs;
};
};

gitHubDeclaration = user: repo: subpath: {
url = "https://github.com/${user}/${repo}/blob/main/${subpath}";
name = subpath;
};

mkDoc = name: options: let
doc = pkgs.nixosOptionsDoc {
options = filterAttrs (n: _: n != "_module") options;
documentType = "none";
transformOptions = opt:
opt
// {
declarations =
map
(decl:
if lib.hasPrefix (toString ../.) (toString decl)
then gitHubDeclaration "isabelroses" "dotfiles" (removePrefix "/" (removePrefix (toString ../.) (toString decl)))
else decl)
opt.declarations;
};
};
in
pkgs.runCommand "${name}-module-doc.md" {} ''
mkDoc =
name: options:
let
doc = pkgs.nixosOptionsDoc {
options = filterAttrs (n: _: n != "_module") options;
documentType = "none";
transformOptions =
opt:
opt
// {
declarations = map (
decl:
if lib.hasPrefix (toString ../.) (toString decl) then
gitHubDeclaration "isabelroses" "dotfiles" (
removePrefix "/" (removePrefix (toString ../.) (toString decl))
)
else
decl
) opt.declarations;
};
};
in
pkgs.runCommand "${name}-module-doc.md" { } ''
cat >$out <<EOF
# ${name} module options
EOF
cat ${doc.optionsCommonMark} >> $out
'';

pkgs-list = pkgs.runCommand "package-list.md" {} ''
pkgs-list = pkgs.runCommand "package-list.md" { } ''
cat >$out <<EOF
# package list
EOF
Expand All @@ -68,27 +82,35 @@
sed -E "s/(.*)/- [\1](https:\/\/github.com\/isabelroses\/dotfiles\/blob\/main\/docs)/g" >> $out
'';

convert = md:
pkgs.runCommand "isabelroses-dotfiles.html" {nativeBuildInputs = with pkgs; [pandoc texinfo];} ''
mkdir $out
pandoc \
--from markdown \
--to texinfo \
-o file.texi \
${builtins.concatStringsSep " " md}
sed -i "s/@top Top/@top isabelroses' modules/" file.texi
texi2any ./file.texi \
--html \
--split=chapter \
--css-include=${./pandoc.css} \
--document-language=en \
-o $out
substituteInPlace $out/index.html --replace-quiet "Top (isabelroses&rsquo; modules)" "isabelroses&rsquo; modules"
'';
convert =
md:
pkgs.runCommand "isabelroses-dotfiles.html"
{
nativeBuildInputs = with pkgs; [
pandoc
texinfo
];
}
''
mkdir $out
pandoc \
--from markdown \
--to texinfo \
-o file.texi \
${builtins.concatStringsSep " " md}
sed -i "s/@top Top/@top isabelroses' modules/" file.texi
texi2any ./file.texi \
--html \
--split=chapter \
--css-include=${./pandoc.css} \
--document-language=en \
-o $out
substituteInPlace $out/index.html --replace-quiet "Top (isabelroses&rsquo; modules)" "isabelroses&rsquo; modules"
'';

modulesPath = ../modules;
extraModulesPath = modulesPath + /extra;
Expand All @@ -102,8 +124,14 @@
nixos = mkDoc "nixos" nixosEval.options;
darwin = mkDoc "darwin" darwinEval.options;
hm = mkDoc "home-manager" hmEval.options;
in {
html = convert [pkgs-list nixos darwin hm];
in
{
html = convert [
pkgs-list
nixos
darwin
hm
];

md = pkgs.linkFarm "md" [
{
Expand Down
59 changes: 30 additions & 29 deletions flake.lock

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

2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
description = "Isabel's dotfiles";

outputs = inputs: inputs.flake-parts.lib.mkFlake {inherit inputs;} {imports = [./parts];};
outputs = inputs: inputs.flake-parts.lib.mkFlake { inherit inputs; } { imports = [ ./parts ]; };

inputs = {
# choose our nixpkgs version
Expand Down
16 changes: 13 additions & 3 deletions home/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,25 @@
inputs,
inputs',
...
}: let
}:
let
inherit (config.modules.programs) defaults;
in {
in
{
home-manager = {
verbose = true;
useUserPackages = true;
useGlobalPkgs = true;
backupFileExtension = "bak";
extraSpecialArgs = {inherit inputs self inputs' self' defaults;};
extraSpecialArgs = {
inherit
inputs
self
inputs'
self'
defaults
;
};
users = lib.genAttrs config.modules.system.users (name: ./${name});
};
}
8 changes: 5 additions & 3 deletions home/isabel/configs/cli/atuin.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
config,
osConfig,
...
}: let
}:
let
inherit (lib) mkIf isModernShell;
in {
in
{
programs.atuin = mkIf (isModernShell osConfig) {
enable = true;

Expand All @@ -14,7 +16,7 @@ in {
enableZshIntegration = config.programs.zsh.enable;
enableNushellIntegration = config.programs.nushell.enable;

flags = ["--disable-up-arrow"];
flags = [ "--disable-up-arrow" ];
settings = {
dialect = "uk";
show_preview = true;
Expand Down
5 changes: 1 addition & 4 deletions home/isabel/configs/cli/bat.nix
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
{ lib, osConfig, ... }:
{
lib,
osConfig,
...
}: {
programs.bat = lib.mkIf (lib.isModernShell osConfig) {
# We activate it like this so that catppuccin is applied
enable = true;
Expand Down
8 changes: 5 additions & 3 deletions home/isabel/configs/cli/bellado.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
inputs,
osConfig,
...
}: let
}:
let
inherit (lib) mkIf isModernShell;
in {
imports = [inputs.bellado.homeManagerModules.default];
in
{
imports = [ inputs.bellado.homeManagerModules.default ];

config = mkIf (isModernShell osConfig) {
programs.bellado = {
Expand Down
Loading

0 comments on commit 10a159f

Please sign in to comment.