diff --git a/Droidnix/README.html b/Droidnix/README.html index 772d05fc6..0c59d9983 100644 --- a/Droidnix/README.html +++ b/Droidnix/README.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + Droidnix: A Dendritic NixOS + Home Manager Configuration NixOS Configuration Structure @@ -204,119 +204,121 @@

Table of Contents

-
-

Shortcuts

-
+
+

Shortcuts

+

Introduction The Assets Folder @@ -332,26 +334,26 @@

Introduction   intro

-
-

What is Droidnix

-
+
+

What is Droidnix

+

Droidnix is a modular, declarative NixOS + Home Manager configuration system. It allows users to choose between Hyprland and Mangowc as their window manager, with shared and WM-specific configurations managed via Emacs Org and Nix Flakes. The project is designed for reproducibility, maintainability, and cross-machine compatibility.

-
-

Installed components:

-
+
+

Installed components:

+
    -
  • Core
  • -
  • Hyprland
  • -
  • Mangowc
  • +
  • Core
  • +
  • Hyprland
  • +
  • Mangowc
-
-

Goals, project Structure, import hierarchy

-
+
+

Goals, project Structure, import hierarchy

+

This project uses a modular NixOS configuration with Hyprland and MangoWC support, designed for literate programming and cross-device reusability. The Droidnix repository is organized into two main parts: @@ -364,9 +366,9 @@ The Droidnix repository is organized into two main parts:

-
-

Root Level

-
+
+

Root Level

+
  • flake.nix is the entry point and imports:
      @@ -378,23 +380,23 @@ The Droidnix repository is organized into two main parts:
-
-

Generated Structure

-
+
+

Generated Structure

+

The generated/ directory contains all generated configurations, divided into three main groups: system, hyprland, and mangowc.

-
-

System (generated/system/)

-
+
+

System (generated/system/)

+

This directory contains system-wide configurations that are independent of the window manager.

-
-

Applications (applications/)

-
+
+

Applications (applications/)

+
  • file_management/: Configurations for file managers and storage solutions.
  • gaming/: Settings for gaming-related software.
  • @@ -404,9 +406,9 @@ This directory contains system-wide configurations that are independent of the w
-
-

Development (development/)

-
+
+

Development (development/)

+
  • databases/: Settings for local databases.
  • devops_ci_cd/: Configurations for DevOps tools.
  • @@ -416,9 +418,9 @@ This directory contains system-wide configurations that are independent of the w
-
-

System Management (system_management/)

-
+
+

System Management (system_management/)

+
  • backups/: Settings for backup software.
  • bluetooth/: Configurations for Bluetooth devices and services.
  • @@ -437,9 +439,9 @@ This directory contains system-wide configurations that are independent of the w
-
-

Hyprland (generated/hyprland/)

-
+
+

Hyprland (generated/hyprland/)

+

This directory contains configurations specific to Hyprland.

@@ -456,9 +458,9 @@ This directory contains configurations specific to Hyprland.
-
-

MangoWC (generated/mangowc/)

-
+
+

MangoWC (generated/mangowc/)

+

This directory contains configurations specific to MangoWC.

@@ -492,7 +494,7 @@ This directory contains configurations specific to MangoWC.
  • Scalability: Easy to add new machines or configurations.
  • -
    +
     .
     ├── assets
     │   ├── common
    @@ -674,9 +676,9 @@ This directory contains configurations specific to MangoWC.
     
    -
    -

    First Setup

    -
    +
    +

    First Setup

    +
    1. Clone this repository.
    2. Run the setup script: ./setup_droidnix.sh.
    3. @@ -698,9 +700,9 @@ This directory contains configurations specific to MangoWC. The .assets/ folder contains all static files, such as configs, scripts, and themes. These files are not generated and can be edited directly.

    -
    -

    .assets/common/

    -
    +
    +

    .assets/common/

    +

    This folder contains files shared across both window managers, such as wallpapers, shell configs, and common scripts.

    @@ -711,9 +713,9 @@ This folder contains files shared across both window managers, such as wallpaper
    -
    -

    .assets/hyprland/

    -
    +
    +

    .assets/hyprland/

    +

    Hyprland-specific assets, including configs, themes, and scripts.

    @@ -725,9 +727,9 @@ Hyprland-specific assets, including configs, themes, and scripts.
    -
    -

    .assets/mangowc/

    -
    +
    +

    .assets/mangowc/

    +

    Mangowc-specific assets, including configs, themes, and scripts.

    @@ -739,9 +741,9 @@ Mangowc-specific assets, including configs, themes, and scripts.
    -
    -

    .assets/machines/

    -
    +
    +

    .assets/machines/

    +

    Machine-specific NixOS configurations (e.g., configuration.nix for maindroid and traveldroid).

    @@ -759,9 +761,9 @@ Machine-specific NixOS configurations (e.g., configuration.nix for This section contains the Org blocks for tangling Nix code into the generated folders.

    -
    -

    flake.nix

    -
    +
    +

    flake.nix

    +

    The Nix flake definition for Droidnix.

    @@ -792,6 +794,7 @@ The Nix flake definition for Droidnix. outputs = inputs@{ + self, nixpkgs, home-manager, emacs-overlay, @@ -835,22 +838,23 @@ The Nix flake definition for Droidnix. ); devShells.${system}.default = import ./assets/flake/terminal_shell/devshell.nix { - inherit (nixpkgs) mkShell; + inherit (nixpkgs.legacyPackages.${system}) mkShell; }; }; } +
    -
    -

    First the nix-files that flake really needs and that do not fit wel in the hierarchical structure

    -
    +
    +

    First the nix-files that flake really needs and that do not fit wel in the hierarchical structure

    +
    -
    -

    assets/flake/users/henrov.nix

    -
    +
    +

    assets/flake/users/henrov.nix

    +

    This is the default user, just search and replace henrov another name if you want to change

    @@ -866,14 +870,14 @@ This is the default user, just search and replace henrov another name if you wan
    -
    -

    assets/flake/terminal_shell/devshell.nix

    -
    +
    +

    assets/flake/terminal_shell/devshell.nix

    +

    This code defines a Nix shell environment (also called a "devShell") that you can enter using the nix develop command. When you enter this shell, Nix will provide the tools and dependencies listed in buildInputs.

    -
    { mkShell }:
    +
    { mkShell, ... }:
     mkShell {
       buildInputs = with import <nixpkgs> {}; [
         nil
    @@ -884,9 +888,9 @@ mkShell {
     
    -
    -

    assets/flake/machines/traveldroid/top.nix

    -
    +
    +

    assets/flake/machines/traveldroid/top.nix

    +

    This code defines the machine to build. Just search and replace traveldroid to provision another machine.

    @@ -928,9 +932,9 @@ This code defines the machine to build. Just search and replace traveldroid to p
    -
    -

    assets/flake/machines/traveldroid/boot.nix

    -
    +
    +

    assets/flake/machines/traveldroid/boot.nix

    +

    This file has most of the settings the control how the computer boots up.

    @@ -965,13 +969,13 @@ This file has most of the settings the control how the computer boots up.
    -
    -

    Now we reach the top of the hierarchy which will call all other imports

    -
    +
    +

    Now we reach the top of the hierarchy which will call all other imports

    +
    -
    -

    generated/top.nix

    -
    +
    +

    generated/top.nix

    +

    The ./generated/top.nix file acts as an anchor or entry point for the entire chain of imports in the pyramid structure.

    @@ -988,9 +992,9 @@ The ./generated/top.nix file acts as an anchor or entry point for the entire cha
    -
    -

    generated/hyprland/top.nix

    -
    +
    +

    generated/hyprland/top.nix

    +

    This is top file of this level which contains just an import statement for all relevant files and/or the subfolder in this folder

    @@ -1013,9 +1017,9 @@ This is top file of this level which contains just an import statement for all r
    -
    -

    generated/hyprland/hyprland.nix

    -
    +
    +

    generated/hyprland/hyprland.nix

    +

    The ./generated/top.nix file acts as an anchor or entry point for the entire chain of imports in the pyramid structure.

    @@ -1066,9 +1070,9 @@ in
    -
    -

    generated/mangowc/top.nix

    -
    +
    +

    generated/mangowc/top.nix

    +

    This is top file of this level which contains just an import statement for all relevant files and/or the subfolder in this folder

    @@ -1091,9 +1095,9 @@ This is top file of this level which contains just an import statement for all r
    -
    -

    generated/system/top.nix

    -
    +
    +

    generated/system/top.nix

    +

    This is top file of this level which contains just an import statement for all relevant files and/or the subfolder in this folder

    @@ -1112,9 +1116,9 @@ This is top file of this level which contains just an import statement for all r
    -
    -

    generated/system/applications/top.nix

    -
    +
    +

    generated/system/applications/top.nix

    +

    This is top file of this level which contains just an import statement for all relevant files and/or the subfolder in this folder

    @@ -1122,6 +1126,8 @@ This is top file of this level which contains just an import statement for all r
    { config, pkgs, lib, user, inputs, flakeRoot,... }:
     {
       imports = [
    +    ./packages.nix
    +    ./flatpaks.nix
         ./accessibility/top.nix
         ./file_management/top.nix
         ./gaming/top.nix
    @@ -1135,9 +1141,190 @@ This is top file of this level which contains just an import statement for all r
     
    -
    -

    generated/system/core/top.nix

    -
    +
    +

    generated/system/applications/packages.nix

    +
    +

    +This will import all packages listed in ./assets/common/apps/packlages.conf +

    +
    +
    { config, pkgs, lib, user, inputs, flakeRoot,... }:
    +{
    +  config,
    +  lib,
    +  pkgs,
    +  flakeRoot,
    +  inputs,
    +  ...
    +}:
    +let
    +  packagesConfPath = "${builtins.toString flakeRoot.outPath}/assets/common/apps/packages.conf";
    +  raw = builtins.readFile packagesConfPath;
    +  # IMPORTANT: explicit "\n" so we never accidentally split into characters
    +  rawLines = lib.splitString "\n" raw;
    +  # Guard: if we accidentally split into characters, rawLines length ~= stringLength raw
    +  _guard =
    +    assert !(builtins.stringLength raw > 1 && builtins.length rawLines == builtins.stringLength raw);
    +    true;
    +  cleanLine =
    +    l:
    +    let
    +      noCR = lib.replaceStrings [ "\r" ] [ "" ] l;
    +      noInlineComment = lib.head (lib.splitString "#" noCR);
    +    in
    +    lib.strings.trim noInlineComment;
    +  entries = builtins.filter (l: l != "") (map cleanLine rawLines);
    +  resolvePkg =
    +    name:
    +    let
    +      parts = lib.splitString "." name;
    +      found = lib.attrByPath parts null pkgs;
    +    in
    +    if found == null then
    +      throw ''
    +        packages.nix: package not found in pkgs
    +        Token    : ${builtins.toJSON name}
    +        packages.conf   : ${toString packagesConfPath}
    +        Hint     : check the attribute name on search.nixos.org/packages
    +      ''
    +    else
    +      found;
    +  packages = builtins.seq _guard (map resolvePkg entries);
    +  zenBrowser = inputs.zen-browser.packages.${pkgs.stdenv.hostPlatform.system}.default;
    +in
    +{
    +  environment.systemPackages = packages ++ [ zenBrowser ];
    +}
    +
    +
    +
    +
    +
    +

    generated/system/applications/flatpaks.nix

    +
    +

    +This will import all packages listed in ./assets/common/apps/flatpaks.conf +

    +
    +
    {
    +  config,
    +  pkgs,
    +  lib,
    +  flakeRoot,
    +  ...
    +}:
    +let
    +  moduleName = "install-flatpaks";
    +  flatpakConfPath = flakeRoot.outPath + "/assets/common/apps/flatpaks.conf";
    +  raw = builtins.readFile flatpakConfPath;
    +  # Explicit "\n" so we never accidentally split into characters
    +  rawLines = lib.splitString "\n" raw;
    +
    +  # Guard: if we accidentally split into characters, rawLines length ~= stringLength raw
    +  _guard =
    +    assert !(builtins.stringLength raw > 1 && builtins.length rawLines == builtins.stringLength raw);
    +    true;
    +
    +  cleanLine =
    +    l:
    +    let
    +      noCR = lib.replaceStrings [ "\r" ] [ "" ] l;
    +      noInlineComment = lib.head (lib.splitString "#" noCR);
    +    in
    +    lib.strings.trim noInlineComment;
    +
    +  entries = builtins.filter (l: l != "") (map cleanLine rawLines);
    +
    +  # Flatpak app IDs are reverse-DNS style like org.example.App (at least 2 dots).
    +  # We'll validate and fail early with a clear message.
    +  dotCount = s: builtins.length (lib.splitString "." s) - 1;
    +
    +  isValidId = s: (dotCount s) >= 2; # matches the error you're seeing: "at least 2 periods"
    +
    +  _validate = builtins.seq _guard (
    +    builtins.map (
    +      id:
    +      if isValidId id then
    +        true
    +      else
    +        throw ''
    +          ${moduleName}: invalid Flatpak ID in flatpaks.conf (needs reverse-DNS with at least 2 dots)
    +
    +          Token    : ${builtins.toJSON id}
    +          flatpaks.conf : ${toString flatpakConfPath}
    +
    +          Fix: remove stray tokens/headers, or comment them out with '#'.
    +        ''
    +    ) entries
    +  );
    +
    +  # Use validated entries
    +  flatpakApps = builtins.seq _validate entries;
    +
    +  syncFlatpaks = pkgs.writeShellScript "sync-flatpaks" ''
    +    set -euo pipefail
    +
    +    # Use the deployed config path (matches environment.etc below)
    +    CONF="/etc/flatpak/flatpaks.conf"
    +    if [[ -f "$CONF" ]]; then
    +    echo "flatpak-sync: using $CONF"
    +    else
    +    echo "flatpak-sync: WARNING: $CONF not found, using embedded list"
    +    fi
    +
    +    if ! flatpak remotes --system --columns=name | grep -qx flathub; then
    +    flatpak remote-add --system --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
    +    fi
    +
    +    desired_apps=(
    +    ${lib.concatStringsSep "\n" (map (a: ''"${a}"'') flatpakApps)}
    +    )
    +
    +    for app in "''${desired_apps[@]}"; do
    +    if ! flatpak info --system "$app" >/dev/null 2>&1; then
    +      flatpak install --system -y --noninteractive flathub "$app"
    +    fi
    +    done
    +  '';
    +in
    +{
    +  services.flatpak.enable = true;
    +
    +  xdg.portal = {
    +    enable = true;
    +  };
    +
    +  # Deploy the config file for runtime visibility/debugging
    +  environment.etc."flatpak/flatpaks.conf".source = lib.mkForce flatpakConfPath;
    +
    +  systemd.services.flatpak-sync = {
    +    description = "Install Flatpak apps listed in flatpaks.conf";
    +    wantedBy = [ "multi-user.target" ];
    +    wants = [ "network-online.target" ];
    +    after = [ "network-online.target" ];
    +
    +    serviceConfig = {
    +      Type = "oneshot";
    +      ExecStart = syncFlatpaks;
    +    };
    +
    +    restartTriggers = [ flatpakConfPath ];
    +    path = [
    +      pkgs.flatpak
    +      pkgs.coreutils
    +      pkgs.gnugrep
    +      pkgs.gnused
    +    ];
    +  };
    +}
    +
    +
    +
    +
    +
    +
    +

    generated/system/core/top.nix

    +

    This is top file of this level which contains just an import statement for all relevant files and/or the subfolder in this folder

    @@ -1155,9 +1342,9 @@ This is top file of this level which contains just an import statement for all r
    -
    -

    generated/system/core/login-tuigreeter.nix

    -
    +
    +

    generated/system/core/login-tuigreeter.nix

    +

    This is top file of this level which contains just an import statement for all relevant files and/or the subfolder in this folder

    @@ -1180,9 +1367,9 @@ settings = {
    -
    -

    generated/system/core/wayland.nix

    -
    +
    +

    generated/system/core/wayland.nix

    +

    This is top file of this level which contains just an import statement for all relevant files and/or the subfolder in this folder

    @@ -1226,9 +1413,9 @@ This is top file of this level which contains just an import statement for all r
    -
    -

    generated/system/development/top.nix

    -
    +
    +

    generated/system/development/top.nix

    +

    This is top file of this level which contains just an import statement for all relevant files and/or the subfolder in this folder

    @@ -1248,9 +1435,9 @@ This is top file of this level which contains just an import statement for all r
    -
    -

    generated/system/system_management/top.nix

    -
    +
    +

    generated/system/system_management/top.nix

    +

    This is top file of this level which contains just an import statement for all relevant files and/or the subfolder in this folder

    @@ -1278,9 +1465,9 @@ This is top file of this level which contains just an import statement for all r
    -
    -

    generated/hyprland/animations_effects/top.nix

    -
    +
    +

    generated/hyprland/animations_effects/top.nix

    +

    This is top file of this level which contains just an import statement for all relevant files and/or the subfolder in this folder

    @@ -1296,9 +1483,9 @@ This is top file of this level which contains just an import statement for all r
    -
    -

    generated/hyprland/decorations/top.nix

    -
    +
    +

    generated/hyprland/decorations/top.nix

    +

    This is top file of this level which contains just an import statement for all relevant files and/or the subfolder in this folder

    @@ -1314,9 +1501,9 @@ This is top file of this level which contains just an import statement for all r
    -
    -

    generated/hyprland/keyboard_binds/top.nix

    -
    +
    +

    generated/hyprland/keyboard_binds/top.nix

    +

    This is top file of this level which contains just an import statement for all relevant files and/or the subfolder in this folder

    @@ -1345,9 +1532,9 @@ in
    -
    -

    generated/hyprland/notifications/top.nix

    -
    +
    +

    generated/hyprland/notifications/top.nix

    +

    This is top file of this level which contains just an import statement for all relevant files and/or the subfolder in this folder

    @@ -1363,9 +1550,9 @@ This is top file of this level which contains just an import statement for all r
    -
    -

    generated/hyprland/statusbar_tray/top.nix

    -
    +
    +

    generated/hyprland/statusbar_tray/top.nix

    +

    This is top file of this level which contains just an import statement for all relevant files and/or the subfolder in this folder

    @@ -1381,9 +1568,9 @@ This is top file of this level which contains just an import statement for all r
    -
    -

    generated/hyprland/task_launcher/top.nix

    -
    +
    +

    generated/hyprland/task_launcher/top.nix

    +

    This is top file of this level which contains just an import statement for all relevant files and/or the subfolder in this folder

    @@ -1399,9 +1586,9 @@ This is top file of this level which contains just an import statement for all r
    -
    -

    generated/hyprland/task_launcher/wofi.nix

    -
    +
    +

    generated/hyprland/task_launcher/wofi.nix

    +

    This is top file of this level which contains just an import statement for all relevant files and/or the subfolder in this folder

    @@ -1446,9 +1633,9 @@ in
    -
    -

    generated/hyprland/task_window_workspace_switcher/top.nix

    -
    +
    +

    generated/hyprland/task_window_workspace_switcher/top.nix

    +

    This is top file of this level which contains just an import statement for all relevant files and/or the subfolder in this folder

    @@ -1464,9 +1651,9 @@ This is top file of this level which contains just an import statement for all r
    -
    -

    generated/hyprland/window_rules/top.nix

    -
    +
    +

    generated/hyprland/window_rules/top.nix

    +

    This is top file of this level which contains just an import statement for all relevant files and/or the subfolder in this folder

    @@ -1482,9 +1669,9 @@ This is top file of this level which contains just an import statement for all r
    -
    -

    generated/mangowc/animations_effects/top.nix

    -
    +
    +

    generated/mangowc/animations_effects/top.nix

    +

    This is top file of this level which contains just an import statement for all relevant files and/or the subfolder in this folder

    @@ -1500,9 +1687,9 @@ This is top file of this level which contains just an import statement for all r
    -
    -

    generated/mangowc/decorations/top.nix

    -
    +
    +

    generated/mangowc/decorations/top.nix

    +

    This is top file of this level which contains just an import statement for all relevant files and/or the subfolder in this folder

    @@ -1518,9 +1705,9 @@ This is top file of this level which contains just an import statement for all r
    -
    -

    generated/mangowc/keyboard_binds/top.nix

    -
    +
    +

    generated/mangowc/keyboard_binds/top.nix

    +

    This is top file of this level which contains just an import statement for all relevant files and/or the subfolder in this folder

    @@ -1553,9 +1740,9 @@ in
    -
    -

    generated/mangowc/notifications/top.nix

    -
    +
    +

    generated/mangowc/notifications/top.nix

    +

    This is top file of this level which contains just an import statement for all relevant files and/or the subfolder in this folder

    @@ -1571,9 +1758,9 @@ This is top file of this level which contains just an import statement for all r
    -
    -

    generated/mangowc/statusbar_tray/top.nix

    -
    +
    +

    generated/mangowc/statusbar_tray/top.nix

    +

    This is top file of this level which contains just an import statement for all relevant files and/or the subfolder in this folder

    @@ -1589,9 +1776,9 @@ This is top file of this level which contains just an import statement for all r
    -
    -

    generated/mangowc/task_launcher/top.nix

    -
    +
    +

    generated/mangowc/task_launcher/top.nix

    +

    This is top file of this level which contains just an import statement for all relevant files and/or the subfolder in this folder

    @@ -1607,9 +1794,9 @@ This is top file of this level which contains just an import statement for all r
    -
    -

    generated/mangowc/task_launcher/wofi.nix

    -
    +
    +

    generated/mangowc/task_launcher/wofi.nix

    +

    This is top file of this level which contains just an import statement for all relevant files and/or the subfolder in this folder

    @@ -1622,9 +1809,9 @@ This is top file of this level which contains just an import statement for all r
    -
    -

    generated/mangowc/task_window_workspace_switcher/top.nix

    -
    +
    +

    generated/mangowc/task_window_workspace_switcher/top.nix

    +

    This is top file of this level which contains just an import statement for all relevant files and/or the subfolder in this folder

    @@ -1640,9 +1827,9 @@ This is top file of this level which contains just an import statement for all r
    -
    -

    generated/mangowc/window_rules/top.nix

    -
    +
    +

    generated/mangowc/window_rules/top.nix

    +

    This is top file of this level which contains just an import statement for all relevant files and/or the subfolder in this folder

    @@ -1658,9 +1845,9 @@ This is top file of this level which contains just an import statement for all r
    -
    -

    generated/system/applications/accessibility/top.nix

    -
    +
    +

    generated/system/applications/accessibility/top.nix

    +

    This is top file of this level which contains just an import statement for all relevant files and/or the subfolder in this folder

    @@ -1676,9 +1863,9 @@ This is top file of this level which contains just an import statement for all r
    -
    -

    generated/system/applications/file_management/top.nix

    -
    +
    +

    generated/system/applications/file_management/top.nix

    +

    This is top file of this level which contains just an import statement for all relevant files and/or the subfolder in this folder

    @@ -1694,9 +1881,9 @@ This is top file of this level which contains just an import statement for all r
    -
    -

    generated/system/applications/gaming/top.nix

    -
    +
    +

    generated/system/applications/gaming/top.nix

    +

    This is top file of this level which contains just an import statement for all relevant files and/or the subfolder in this folder

    @@ -1712,9 +1899,9 @@ This is top file of this level which contains just an import statement for all r
    -
    -

    generated/system/applications/media_playback_editing/top.nix

    -
    +
    +

    generated/system/applications/media_playback_editing/top.nix

    +

    This is top file of this level which contains just an import statement for all relevant files and/or the subfolder in this folder

    @@ -1730,9 +1917,9 @@ This is top file of this level which contains just an import statement for all r
    -
    -

    generated/system/applications/office_productivity/top.nix

    -
    +
    +

    generated/system/applications/office_productivity/top.nix

    +

    This is top file of this level which contains just an import statement for all relevant files and/or the subfolder in this folder

    @@ -1748,9 +1935,9 @@ This is top file of this level which contains just an import statement for all r
    -
    -

    generated/system/applications/terminal_shell/top.nix

    -
    +
    +

    generated/system/applications/terminal_shell/top.nix

    +

    This is top file of this level which contains just an import statement for all relevant files and/or the subfolder in this folder

    @@ -1768,9 +1955,9 @@ This is top file of this level which contains just an import statement for all r
    -
    -

    generated/system/applications/terminal_shell/kitty.nix

    -
    +
    +

    generated/system/applications/terminal_shell/kitty.nix

    +

    This file sets up Kitty terminal

    @@ -1798,9 +1985,9 @@ in
    -
    -

    generated/system/applications/terminal_shell/starship.nix

    -
    +
    +

    generated/system/applications/terminal_shell/starship.nix

    +

    This file sets up starship prompt

    @@ -1820,9 +2007,9 @@ This file sets up starship prompt
    -
    -

    generated/system/applications/terminal_shell/zsh.nix

    -
    +
    +

    generated/system/applications/terminal_shell/zsh.nix

    +

    This is top file of this level which contains just an import statement for all relevant files and/or the subfolder in this folder

    @@ -1864,20 +2051,14 @@ in # Use the .zshrc file from assets xdg.configFile."zsh/.zshrc".source = "${assetsDir}/.zshrc"; - - # Create symlinks or copy files from assets to XDG config - xdg.configFile."zsh/custom.zsh".source = "${assetsDir}/custom.zsh"; - xdg.configFile."zsh/aliases.zsh".source = "${assetsDir}/aliases.zsh"; - xdg.configFile."zsh/history.zsh".source = "${assetsDir}/history.zsh"; - }; }
    -
    -

    generated/system/development/databases/top.nix

    -
    +
    +

    generated/system/development/databases/top.nix

    +

    This is top file of this level which contains just an import statement for all relevant files and/or the subfolder in this folder

    @@ -1893,9 +2074,9 @@ This is top file of this level which contains just an import statement for all r
    -
    -

    generated/system/development/devops_ci_cd/top.nix

    -
    +
    +

    generated/system/development/devops_ci_cd/top.nix

    +

    This is top file of this level which contains just an import statement for all relevant files and/or the subfolder in this folder

    @@ -1911,9 +2092,9 @@ This is top file of this level which contains just an import statement for all r
    -
    -

    generated/system/development/programming_languages/top.nix

    -
    +
    +

    generated/system/development/programming_languages/top.nix

    +

    This is top file of this level which contains just an import statement for all relevant files and/or the subfolder in this folder

    @@ -1929,9 +2110,9 @@ This is top file of this level which contains just an import statement for all r
    -
    -

    generated/system/development/virtualization/top.nix

    -
    +
    +

    generated/system/development/virtualization/top.nix

    +

    This is top file of this level which contains just an import statement for all relevant files and/or the subfolder in this folder

    @@ -1947,9 +2128,9 @@ This is top file of this level which contains just an import statement for all r
    -
    -

    generated/system/development/web_development/top.nix

    -
    +
    +

    generated/system/development/web_development/top.nix

    +

    This is top file of this level which contains just an import statement for all relevant files and/or the subfolder in this folder

    @@ -1965,9 +2146,9 @@ This is top file of this level which contains just an import statement for all r
    -
    -

    generated/system/system_management/audio/top.nix

    -
    +
    +

    generated/system/system_management/audio/top.nix

    +

    This is top file of this level which contains just an import statement for all relevant files and/or the subfolder in this folder

    @@ -1983,9 +2164,9 @@ This is top file of this level which contains just an import statement for all r
    -
    -

    generated/system/system_management/backups/top.nix

    -
    +
    +

    generated/system/system_management/backups/top.nix

    +

    This is top file of this level which contains just an import statement for all relevant files and/or the subfolder in this folder

    @@ -2001,9 +2182,9 @@ This is top file of this level which contains just an import statement for all r
    -
    -

    generated/system/system_management/bluetooth/top.nix

    -
    +
    +

    generated/system/system_management/bluetooth/top.nix

    +

    This is top file of this level which contains just an import statement for all relevant files and/or the subfolder in this folder

    @@ -2019,9 +2200,9 @@ This is top file of this level which contains just an import statement for all r
    -
    -

    generated/system/system_management/disk_management/top.nix

    -
    +
    +

    generated/system/system_management/disk_management/top.nix

    +

    This is top file of this level which contains just an import statement for all relevant files and/or the subfolder in this folder

    @@ -2037,9 +2218,9 @@ This is top file of this level which contains just an import statement for all r
    -
    -

    generated/system/system_management/hardware_sensors/top.nix

    -
    +
    +

    generated/system/system_management/hardware_sensors/top.nix

    +

    This is top file of this level which contains just an import statement for all relevant files and/or the subfolder in this folder

    @@ -2055,9 +2236,9 @@ This is top file of this level which contains just an import statement for all r
    -
    -

    generated/system/system_management/logging_monitoring/top.nix

    -
    +
    +

    generated/system/system_management/logging_monitoring/top.nix

    +

    This is top file of this level which contains just an import statement for all relevant files and/or the subfolder in this folder

    @@ -2073,9 +2254,9 @@ This is top file of this level which contains just an import statement for all r
    -
    -

    generated/system/system_management/login_manager/top.nix

    -
    +
    +

    generated/system/system_management/login_manager/top.nix

    +

    This is top file of this level which contains just an import statement for all relevant files and/or the subfolder in this folder

    @@ -2091,9 +2272,9 @@ This is top file of this level which contains just an import statement for all r
    -
    -

    generated/system/system_management/monitor_setup/top.nix

    -
    +
    +

    generated/system/system_management/monitor_setup/top.nix

    +

    This is top file of this level which contains just an import statement for all relevant files and/or the subfolder in this folder

    @@ -2109,9 +2290,9 @@ This is top file of this level which contains just an import statement for all r
    -
    -

    generated/system/system_management/networking/top.nix

    -
    +
    +

    generated/system/system_management/networking/top.nix

    +

    This is top file of this level which contains just an import statement for all relevant files and/or the subfolder in this folder

    @@ -2127,9 +2308,9 @@ This is top file of this level which contains just an import statement for all r
    -
    -

    generated/system/system_management/power_management/top.nix

    -
    +
    +

    generated/system/system_management/power_management/top.nix

    +

    This is top file of this level which contains just an import statement for all relevant files and/or the subfolder in this folder

    @@ -2145,9 +2326,9 @@ This is top file of this level which contains just an import statement for all r
    -
    -

    generated/system/system_management/printers_scanners/top.nix

    -
    +
    +

    generated/system/system_management/printers_scanners/top.nix

    +

    This is top file of this level which contains just an import statement for all relevant files and/or the subfolder in this folder

    @@ -2163,9 +2344,9 @@ This is top file of this level which contains just an import statement for all r
    -
    -

    generated/system/system_management/security/top.nix

    -
    +
    +

    generated/system/system_management/security/top.nix

    +

    This is top file of this level which contains just an import statement for all relevant files and/or the subfolder in this folder

    @@ -2181,9 +2362,9 @@ This is top file of this level which contains just an import statement for all r
    -
    -

    generated/system/system_management/system_updates/top.nix

    -
    +
    +

    generated/system/system_management/system_updates/top.nix

    +

    This is top file of this level which contains just an import statement for all relevant files and/or the subfolder in this folder

    @@ -2203,7 +2384,7 @@ This is top file of this level which contains just an import statement for all r

    Author: Henro Veijer

    -

    Created: 2026-03-08 zo 13:31

    +

    Created: 2026-03-09 ma 19:37

    Validate

    diff --git a/Droidnix/README.org b/Droidnix/README.org index 921e3123b..5aa20bfff 100644 --- a/Droidnix/README.org +++ b/Droidnix/README.org @@ -367,6 +367,7 @@ The Nix flake definition for Droidnix. outputs = inputs@{ + self, nixpkgs, home-manager, emacs-overlay, @@ -410,10 +411,11 @@ The Nix flake definition for Droidnix. ); devShells.${system}.default = import ./assets/flake/terminal_shell/devshell.nix { - inherit (nixpkgs) mkShell; + inherit (nixpkgs.legacyPackages.${system}) mkShell; }; }; } + #+END_SRC * First the nix-files that flake really needs and that do not fit wel in the hierarchical structure @@ -432,7 +434,7 @@ This is the default user, just search and replace henrov another name if you wan ** =assets/flake/terminal_shell/devshell.nix= This code defines a Nix shell environment (also called a "devShell") that you can enter using the nix develop command. When you enter this shell, Nix will provide the tools and dependencies listed in buildInputs. #+BEGIN_SRC nix :tangle assets/flake/terminal_shell/devshell.nix :noweb tangle :mkdirp yes :eval never-html -{ mkShell }: +{ mkShell, ... }: mkShell { buildInputs = with import {}; [ nil @@ -630,6 +632,8 @@ This is top file of this level which contains just an import statement for all r { config, pkgs, lib, user, inputs, flakeRoot,... }: { imports = [ + ./packages.nix + ./flatpaks.nix ./accessibility/top.nix ./file_management/top.nix ./gaming/top.nix @@ -641,6 +645,178 @@ This is top file of this level which contains just an import statement for all r } #+END_SRC +** =generated/system/applications/packages.nix= +This will import all packages listed in ./assets/common/apps/packlages.conf +#+BEGIN_SRC nix :tangle generated/system/applications/packages.nix :noweb tangle :mkdirp yes :eval never-html +{ config, pkgs, lib, user, inputs, flakeRoot,... }: +{ + config, + lib, + pkgs, + flakeRoot, + inputs, + ... +}: +let + packagesConfPath = "${builtins.toString flakeRoot.outPath}/assets/common/apps/packages.conf"; + raw = builtins.readFile packagesConfPath; + # IMPORTANT: explicit "\n" so we never accidentally split into characters + rawLines = lib.splitString "\n" raw; + # Guard: if we accidentally split into characters, rawLines length ~= stringLength raw + _guard = + assert !(builtins.stringLength raw > 1 && builtins.length rawLines == builtins.stringLength raw); + true; + cleanLine = + l: + let + noCR = lib.replaceStrings [ "\r" ] [ "" ] l; + noInlineComment = lib.head (lib.splitString "#" noCR); + in + lib.strings.trim noInlineComment; + entries = builtins.filter (l: l != "") (map cleanLine rawLines); + resolvePkg = + name: + let + parts = lib.splitString "." name; + found = lib.attrByPath parts null pkgs; + in + if found == null then + throw '' + packages.nix: package not found in pkgs + Token : ${builtins.toJSON name} + packages.conf : ${toString packagesConfPath} + Hint : check the attribute name on search.nixos.org/packages + '' + else + found; + packages = builtins.seq _guard (map resolvePkg entries); + zenBrowser = inputs.zen-browser.packages.${pkgs.stdenv.hostPlatform.system}.default; +in +{ + environment.systemPackages = packages ++ [ zenBrowser ]; +} +#+END_SRC + +** =generated/system/applications/flatpaks.nix= +This will import all packages listed in ./assets/common/apps/flatpaks.conf +#+BEGIN_SRC nix :tangle generated/system/applications/packages.nix :noweb tangle :mkdirp yes :eval never-html +{ + config, + pkgs, + lib, + flakeRoot, + ... +}: +let + moduleName = "install-flatpaks"; + flatpakConfPath = flakeRoot.outPath + "/assets/common/apps/flatpaks.conf"; + raw = builtins.readFile flatpakConfPath; + # Explicit "\n" so we never accidentally split into characters + rawLines = lib.splitString "\n" raw; + + # Guard: if we accidentally split into characters, rawLines length ~= stringLength raw + _guard = + assert !(builtins.stringLength raw > 1 && builtins.length rawLines == builtins.stringLength raw); + true; + + cleanLine = + l: + let + noCR = lib.replaceStrings [ "\r" ] [ "" ] l; + noInlineComment = lib.head (lib.splitString "#" noCR); + in + lib.strings.trim noInlineComment; + + entries = builtins.filter (l: l != "") (map cleanLine rawLines); + + # Flatpak app IDs are reverse-DNS style like org.example.App (at least 2 dots). + # We'll validate and fail early with a clear message. + dotCount = s: builtins.length (lib.splitString "." s) - 1; + + isValidId = s: (dotCount s) >= 2; # matches the error you're seeing: "at least 2 periods" + + _validate = builtins.seq _guard ( + builtins.map ( + id: + if isValidId id then + true + else + throw '' + ${moduleName}: invalid Flatpak ID in flatpaks.conf (needs reverse-DNS with at least 2 dots) + + Token : ${builtins.toJSON id} + flatpaks.conf : ${toString flatpakConfPath} + + Fix: remove stray tokens/headers, or comment them out with '#'. + '' + ) entries + ); + + # Use validated entries + flatpakApps = builtins.seq _validate entries; + + syncFlatpaks = pkgs.writeShellScript "sync-flatpaks" '' + set -euo pipefail + + # Use the deployed config path (matches environment.etc below) + CONF="/etc/flatpak/flatpaks.conf" + if [[ -f "$CONF" ]]; then + echo "flatpak-sync: using $CONF" + else + echo "flatpak-sync: WARNING: $CONF not found, using embedded list" + fi + + if ! flatpak remotes --system --columns=name | grep -qx flathub; then + flatpak remote-add --system --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo + fi + + desired_apps=( + ${lib.concatStringsSep "\n" (map (a: ''"${a}"'') flatpakApps)} + ) + + for app in "''${desired_apps[@]}"; do + if ! flatpak info --system "$app" >/dev/null 2>&1; then + flatpak install --system -y --noninteractive flathub "$app" + fi + done + ''; +in +{ + services.flatpak.enable = true; + + xdg.portal = { + enable = true; + }; + + # Deploy the config file for runtime visibility/debugging + environment.etc."flatpak/flatpaks.conf".source = lib.mkForce flatpakConfPath; + + systemd.services.flatpak-sync = { + description = "Install Flatpak apps listed in flatpaks.conf"; + wantedBy = [ "multi-user.target" ]; + wants = [ "network-online.target" ]; + after = [ "network-online.target" ]; + + serviceConfig = { + Type = "oneshot"; + ExecStart = syncFlatpaks; + }; + + restartTriggers = [ flatpakConfPath ]; + path = [ + pkgs.flatpak + pkgs.coreutils + pkgs.gnugrep + pkgs.gnused + ]; + }; +} + +#+END_SRC + + + + ** =generated/system/core/top.nix= This is top file of this level which contains just an import statement for all relevant files and/or the subfolder in this folder #+BEGIN_SRC nix :tangle generated/system/core/top.nix :noweb tangle :mkdirp yes :eval never-html @@ -1027,6 +1203,7 @@ This is top file of this level which contains just an import statement for all r } #+END_SRC + ** =generated/system/applications/accessibility/top.nix= This is top file of this level which contains just an import statement for all relevant files and/or the subfolder in this folder #+BEGIN_SRC nix :tangle generated/system/applications/accessibility/top.nix :noweb tangle :mkdirp yes :eval never-html @@ -1184,6 +1361,8 @@ in } #+END_SRC + + ** =generated/system/development/databases/top.nix= This is top file of this level which contains just an import statement for all relevant files and/or the subfolder in this folder #+BEGIN_SRC nix :tangle generated/system/development/databases/top.nix :noweb tangle :mkdirp yes :eval never-html diff --git a/Droidnix/assets/flake/terminal_shell/devshell.nix b/Droidnix/assets/flake/terminal_shell/devshell.nix index abf39e0e7..c5d5b7e72 100644 --- a/Droidnix/assets/flake/terminal_shell/devshell.nix +++ b/Droidnix/assets/flake/terminal_shell/devshell.nix @@ -1,4 +1,4 @@ -{ mkShell }: +{ mkShell, ... }: mkShell { buildInputs = with import {}; [ nil diff --git a/Droidnix/flake.nix b/Droidnix/flake.nix index 2cac61c33..1c52543fd 100644 --- a/Droidnix/flake.nix +++ b/Droidnix/flake.nix @@ -24,6 +24,7 @@ outputs = inputs@{ + self, nixpkgs, home-manager, emacs-overlay, @@ -67,7 +68,7 @@ ); devShells.${system}.default = import ./assets/flake/terminal_shell/devshell.nix { - inherit (nixpkgs) mkShell; + inherit (nixpkgs.legacyPackages.${system}) mkShell; }; }; } diff --git a/Droidnix/generated/system/applications/packages.nix b/Droidnix/generated/system/applications/packages.nix index 1bab95c64..536906df9 100644 --- a/Droidnix/generated/system/applications/packages.nix +++ b/Droidnix/generated/system/applications/packages.nix @@ -1,3 +1,4 @@ +{ config, pkgs, lib, user, inputs, flakeRoot,... }: { config, lib, @@ -44,3 +45,115 @@ in { environment.systemPackages = packages ++ [ zenBrowser ]; } + +{ + config, + pkgs, + lib, + flakeRoot, + ... +}: +let + moduleName = "install-flatpaks"; + flatpakConfPath = flakeRoot.outPath + "/assets/common/apps/flatpaks.conf"; + raw = builtins.readFile flatpakConfPath; + # Explicit "\n" so we never accidentally split into characters + rawLines = lib.splitString "\n" raw; + + # Guard: if we accidentally split into characters, rawLines length ~= stringLength raw + _guard = + assert !(builtins.stringLength raw > 1 && builtins.length rawLines == builtins.stringLength raw); + true; + + cleanLine = + l: + let + noCR = lib.replaceStrings [ "\r" ] [ "" ] l; + noInlineComment = lib.head (lib.splitString "#" noCR); + in + lib.strings.trim noInlineComment; + + entries = builtins.filter (l: l != "") (map cleanLine rawLines); + + # Flatpak app IDs are reverse-DNS style like org.example.App (at least 2 dots). + # We'll validate and fail early with a clear message. + dotCount = s: builtins.length (lib.splitString "." s) - 1; + + isValidId = s: (dotCount s) >= 2; # matches the error you're seeing: "at least 2 periods" + + _validate = builtins.seq _guard ( + builtins.map ( + id: + if isValidId id then + true + else + throw '' + ${moduleName}: invalid Flatpak ID in flatpaks.conf (needs reverse-DNS with at least 2 dots) + + Token : ${builtins.toJSON id} + flatpaks.conf : ${toString flatpakConfPath} + + Fix: remove stray tokens/headers, or comment them out with '#'. + '' + ) entries + ); + + # Use validated entries + flatpakApps = builtins.seq _validate entries; + + syncFlatpaks = pkgs.writeShellScript "sync-flatpaks" '' + set -euo pipefail + + # Use the deployed config path (matches environment.etc below) + CONF="/etc/flatpak/flatpaks.conf" + if [[ -f "$CONF" ]]; then + echo "flatpak-sync: using $CONF" + else + echo "flatpak-sync: WARNING: $CONF not found, using embedded list" + fi + + if ! flatpak remotes --system --columns=name | grep -qx flathub; then + flatpak remote-add --system --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo + fi + + desired_apps=( + ${lib.concatStringsSep "\n" (map (a: ''"${a}"'') flatpakApps)} + ) + + for app in "''${desired_apps[@]}"; do + if ! flatpak info --system "$app" >/dev/null 2>&1; then + flatpak install --system -y --noninteractive flathub "$app" + fi + done + ''; +in +{ + services.flatpak.enable = true; + + xdg.portal = { + enable = true; + }; + + # Deploy the config file for runtime visibility/debugging + environment.etc."flatpak/flatpaks.conf".source = lib.mkForce flatpakConfPath; + + systemd.services.flatpak-sync = { + description = "Install Flatpak apps listed in flatpaks.conf"; + wantedBy = [ "multi-user.target" ]; + wants = [ "network-online.target" ]; + after = [ "network-online.target" ]; + + serviceConfig = { + Type = "oneshot"; + ExecStart = syncFlatpaks; + }; + + restartTriggers = [ flatpakConfPath ]; + path = [ + pkgs.flatpak + pkgs.coreutils + pkgs.gnugrep + pkgs.gnused + ]; + }; +} diff --git a/Droidnix/generated/system/applications/terminal_shell/zsh.nix b/Droidnix/generated/system/applications/terminal_shell/zsh.nix index b26e560fc..f690db10b 100644 --- a/Droidnix/generated/system/applications/terminal_shell/zsh.nix +++ b/Droidnix/generated/system/applications/terminal_shell/zsh.nix @@ -1,11 +1,4 @@ -{ - config, - pkgs, - lib, - user, - flakeRoot, - ... -}: +{ config, pkgs, lib, user, flakeRoot, ... }: let zshConfigDir = "${config.home-manager.users.${user.username}.xdg.configHome}/zsh"; assetsDir = "${flakeRoot}/assets/common/conf/zsh"; @@ -42,5 +35,4 @@ in # Use the .zshrc file from assets xdg.configFile."zsh/.zshrc".source = "${assetsDir}/.zshrc"; - }; } diff --git a/Droidnix/generated/system/applications/top.nix b/Droidnix/generated/system/applications/top.nix index 34b4b3294..e0088c8dc 100644 --- a/Droidnix/generated/system/applications/top.nix +++ b/Droidnix/generated/system/applications/top.nix @@ -1,16 +1,8 @@ -{ - config, - pkgs, - lib, - user, - inputs, - flakeRoot, - ... -}: +{ config, pkgs, lib, user, inputs, flakeRoot,... }: { imports = [ - ./flatpaks.nix ./packages.nix + ./flatpaks.nix ./accessibility/top.nix ./file_management/top.nix ./gaming/top.nix