Files
archmgr/notes.md
T

3.8 KiB

Concept for tracking changes

  • Create new commit (if possible)
  • If force is unset: Diff system's files against current state by copying them into the current state branch
  • Then, diff the package state against the state branch by dumping it
  • Else, or if no diff, continue
  • Render and copy config files into correct directories
  • Create config files from presets
  • Retrieve explicitly installed packages and remove those that are not present in goal and install those that are not present in current state

Concept for updating config automatically

  1. Track which files contain the setting
  2. If there are multiple and is no array, then simply overwrite the last
  3. If there are multiple and is array, then remove from the file where it is present and add to last file in requires list -> To enable this, update the loader to keep more metadata (list of all requires, list of files for each setting)

Ideas

  • function to collect new configs -> Not smart because templates
  • Templates foreach (array of arrays or something like it)
  • Improved base GTK theme
  • config options for users and groups -> Omitted for now
  • Wallpaper settings for other WM than hyprland
  • presets for things like desktops (like Hyprland)
  • config options for the template rendering
  • config options for themes
  • grub config
  • Dynamic selection of more configs (i.e. require syntax)
  • Conditional require
  • Own config syntax? -> just use yaml
  • Autocompletion
  • Basic arch install how? -> Probably manual (or semi-automatic)
  • Mounts?

REGEX

TODO: Improve the below (especially file can be shortened with positive lookahead)

  • File: ^(^(~|\\.|\\.\\.)?\\/)?([\\w\\/.-]+(?!.*[^\\w\\/.-]+))
  • Folder: ^(^(~|\\.|\\.\\.)?\\/)?([\\w\\/.-]+(?!.*[^\\w\\/.-]+))\\/$
  • URL (just domain): ^(https?):\\/\\/(([a-z0-9-]+)((?=\\.))\\.)+[a-z]+(?=[a-z]$)
  • Full URL: ^(https?):\\/\\/(([a-z0-9-]+)((?=\\.))\\.)+[a-z]+(?=\\/)\\/([\\w\\-?.=]+(?=\\/[\\w\\-?.=])\\/)*([\\w\\-?&.=\\/]+(?=[\\w\\-.=\\/]$))
  • UNIX username and groups: ^[a-zA-Z0-9\\-._]{2,19}(?=[a-zA-Z0-9]$)
  • Git SSH: ([a-zA-Z0-9\\-._]+(?=[a-zA-Z0-9])[a-zA-Z0-9])@(([a-z0-9\\-]+(?=\\.))\\.)+[a-z]+(?=:):([a-zA-Z0-9\\-._]+(?=\\/)\\/)+([a-zA-Z0-9\\-._]+(?=[a-zA-Z0-9]$))

User config schema

This may or may not ever be a thing

        "users": {
            "type": "array",
            "description": "Users to add, including groups. Users will be diffed and removed if they are removed from here. No files are deleted",
            "items": {
                "type": "object",
                "properties": {
                    "username": {
                        "type": "string",
                        "pattern": "^[a-zA-Z0-9\\-._]{2,19}(?=[a-zA-Z0-9]$)"
                    },
                    "groups": {
                        "type": "array",
                        "description": "The groups to add the user to. Groups are created if they don't exist. User's own group doesn't have to be listed explicitly",
                        "items": {
                            "type": "string",
                            "pattern": "^[a-zA-Z0-9\\-._]{2,19}(?=[a-zA-Z0-9]$)"
                        }
                    },
                    "sudo_user": {
                        "type": "boolean",
                        "default": false,
                        "description": "Whether a user can use sudo or not. Same as appending them to the `wheel` group"
                    },
                    "home_dir": {
                        "type": "boolean",
                        "description": "Whether to create a home directory for the user or not",
                        "default": false
                    }
                },
                "required": [
                    "username"
                ],
                "additionalProperties": false
            }
        },