1
Fork 0

Add module documentation

This commit is contained in:
Matei Adriel 2023-11-13 04:31:54 +01:00
parent 7c495bceb8
commit 2cd801aa2b
No known key found for this signature in database
12 changed files with 66 additions and 19 deletions

View file

@ -2,7 +2,7 @@
In case you are not familiar with nix/nixos, this is a collection of configuration files which build all my systems in a declarative manner. The tool used to configure the global system is called [nixos](https://nixos.org/), and the one used to configure the individual users is called [home-manager](https://github.com/nix-community/home-manager).
> A [visual history](./history.md) of my setup is in the works!
> A [visual history](./docs/history.md) of my setup is in the works!
## Features this repository includes:
@ -25,17 +25,19 @@ This repo's structure is based on the concept of hosts - individual machines con
| Location | Description |
| ---------------------------- | ------------------------------------------------------------------ |
| [common](./common) | Configuration loaded on both nixos and home-manager |
| [dotfiles](./dotfiles) | Contains some of the bigger dotfile dirs. Will eventually be moved |
| [hosts/nixos](./hosts/nixos) | Nixos configurations |
| [home](./home) | Home manager configurations |
| [pkgs](./pkgs) | Nix packages |
| [overlays](./overlays) | Nix overlays |
| [devshells](./devshells) | Nix shells |
| [stylua.toml](./stylua.toml) | Lua formatter config for the repo |
| [docs](./docs) | Additional documentation regarding my setup |
| [dotfiles](./dotfiles) | Contains some of the bigger dotfile dirs. Will eventually be moved |
| [home](./home) | Home manager configurations |
| [hosts/nixos](./hosts/nixos) | Nixos configurations |
| [modules](./modules) | Custom generic/nixos/home-manager modules |
| [overlays](./overlays) | Nix overlays |
| [pkgs](./pkgs) | Nix packages |
| [flake.nix](./flake.nix) | Nix flake entrypoint! |
| [shell.nix](./shell.nix) | Bootstrapping nix shell |
| [nixpkgs.nix](./nixpkgs.nix) | Pinned nixpkgs for bootstrapping |
| [secrets.nix](./secrets.nix) | Agenix entrypoint |
| [shell.nix](./shell.nix) | Bootstrapping nix shell |
| [stylua.toml](./stylua.toml) | Lua formatter config for the repo |
## Points of interest

View file

Before

Width:  |  Height:  |  Size: 2.1 MiB

After

Width:  |  Height:  |  Size: 2.1 MiB

View file

Before

Width:  |  Height:  |  Size: 1.9 MiB

After

Width:  |  Height:  |  Size: 1.9 MiB

View file

Before

Width:  |  Height:  |  Size: 1.7 MiB

After

Width:  |  Height:  |  Size: 1.7 MiB

View file

@ -1,7 +1,7 @@
{ pkgs, lib, config, inputs, ... }:
let
enabledMonitors = lib.filter (m: m.enabled) config.monitors;
enabledMonitors = lib.filter (m: m.enabled) config.satellite.monitors;
hyprland-monitors = lib.concatStringsSep "\n" (lib.forEach enabledMonitors (m: ''
monitor=${m.name},${toString m.width}x${toString m.height}@${toString m.refreshRate},${toString m.x}x${toString m.y},1
${lib.optionalString (m.workspace != null) "workspace=${m.name},${m.workspace}"}

View file

@ -59,11 +59,11 @@
# App state which I should be able to delete at any point
at.cache.path = "/persist/local/cache";
};
};
monitors = [{
name = "eDP-1";
width = 1920;
height = 1080;
}];
};
}

34
modules/README.md Normal file
View file

@ -0,0 +1,34 @@
# Modules
This directory contains custom module definitions used throughout my config.
## File structure
| Directory | Description |
| ------------------------------ | -------------------------------------------------------------- |
| [common](./common) | Modules usable in both HM and nixos (and perhaps other places) |
| [nixos](./nixos) | Nixos specific functinality |
| [home-manager](./home-manager) | Home manager specific functionality |
## Common modules
| Name | Attribute | Description | Dependencies |
| ----------------------------------------------- | --------------------------- | ---------------------------------------- | ----------------------------------------- |
| [lua-colorscheme](./common/lua-colorscheme.nix) | `satellite.colorscheme.lua` | Base16 theme to lua module generation | [stylix](https://github.com/danth/stylix) |
| [theming](./common/theming.nix) | `satellite.theming` | Base16 theming helpers and configuration | [stylix](https://github.com/danth/stylix) |
| [toggles](./common/toggles.nix) | `satellite.toggles` | Generic interface for feature flags | |
## Nixos modules
There are no nixos modules at the moment!
## Home-manager modules
| Name | Attribute | Description | Dependencies |
| ------------------------------------------------- | ----------------------- | ------------------------------------------------------------------ | ------------------------------------------------------------- |
| [discord](./home-manager/discord.nix) | `programs.discord` | Additional discord options | |
| [eww-hyprland](./home-manager/eww-hyprland.nix) | `programs.eww-hyprland` | `eww` service for `hyprland` | |
| [hyprpaper](./home-manager/hyprpaper.nix) | `services.hyprpaper` | Wallpaper service for `hyprland` | |
| [monitors](./home-manager/monitors.nix) | `satellite.monitors` | WM generic monitor configuration | |
| [persistence](./home-manager/persistence.nix) | `satellite.persistence` | Syntactic wrapper around impermanence | [impermanence](https://github.com/nix-community/impermanence) |
| [satellite-dev](./home-manager/satellite-dev.nix) | `satellite.dev` | Helpers for managing dotfiles which are actively under development | |

View file

@ -5,7 +5,7 @@
description = "Lua file containing the current colorscheme";
};
config.satellite.colorscheme.lua = ''
config.satellite.colorscheme.lua = /* lua */ ''
return {
name = "${config.lib.stylix.scheme.scheme}",
base00 = "${config.lib.stylix.scheme.base00}",

View file

@ -1,3 +1,12 @@
# Generic interface for working with feature flags!
#
# For instance, my neovim config sets `programs.neovim.enable` to `false`,
# so other modules cannot detect whether it is on or off without doing weird
# tricks like checking if certain attributes have been set.
#
# Instead, the neovim config sets `satellite.toggles.neovim.enable` to `true`,
# which can then be read from places like the firefox config to trigger things
# like installing the `firenvim` extension.
{ lib, ... }:
{
options.satellite.toggles = lib.mkOption {

View file

@ -1,10 +1,12 @@
# A big chunk of this was taken from fuxefan's config:
# https://github.com/fufexan/dotfiles/blob/main/home/programs/eww/default.nix
{ config
, pkgs
, lib
, ...
}:
let
reload_script = pkgs.writeShellScript "reload_eww" ''
reloadScript = pkgs.writeShellScript "reload_eww" ''
systemctl --user restart eww.service
'';
@ -51,7 +53,7 @@ in
onChange =
if cfg.autoReload
then reload_script.outPath
then reloadScript.outPath
else "";
};

View file

@ -2,7 +2,7 @@
# This is meant to provide a wm-independent way of specifying the monitor configuration of each machine.
{ lib, ... }:
{
options.monitors = lib.mkOption {
options.satellite.monitors = lib.mkOption {
type = lib.types.listOf (lib.types.submodule {
options = {
name = lib.mkOption {