From a82e8ed459fbd8c1a2a54cb3ac2d87af9b6bf402 Mon Sep 17 00:00:00 2001 From: "info@data-pro.nu" Date: Wed, 18 Mar 2026 18:27:00 +0000 Subject: [PATCH] Reshuffling stuff --- Droidnix/README.org | 58 +++++++++----------- Droidnix/generated/modules/apps/packages.nix | 58 +++++++++----------- 2 files changed, 52 insertions(+), 64 deletions(-) diff --git a/Droidnix/README.org b/Droidnix/README.org index 09d6004af..0d0ad76a4 100644 --- a/Droidnix/README.org +++ b/Droidnix/README.org @@ -768,44 +768,38 @@ This is top file of this level which contains just an import statement for all r ** =generated/modules/apps/packages.nix= This will import all packages listed in ./assets/system/apps/packlages.conf #+BEGIN_SRC nix :tangle generated/modules/apps/packages.nix :noweb tangle :mkdirp yes :eval never-html -{ config, lib, pkgs, flakeRoot, inputs, ... }: +# ./modules/apps/packages.nix +{ lib, config, flakeRoot, ... }: + let packagesConfPath = "${flakeRoot}/assets/system/apps/packages.conf"; raw = builtins.readFile packagesConfPath; - # IMPORTANT: explicit "\n" so we never accidentally split into characters + + # split lines safely rawLines = lib.splitString "\n" raw; - # Guard: if we accidentally split into characters, rawLines length ~= stringLength raw + + # guard against accidental character splitting _guard = assert !( - builtins.stringLength raw > 1 && - builtins.length rawLines == builtins.stringLength raw + 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); -in -{ - environment.systemPackages = packages; + + # clean a line (remove CR, inline comments, whitespace) + cleanLine = line: + let + noCR = lib.replaceStrings [ "\r" ] [ "" ] line; + noInlineComment = lib.head (lib.splitString "#" noCR); + in + lib.strings.trim noInlineComment; + + entries = builtins.filter (l: l != "") (map cleanLine rawLines); + +in { + # --- symbolic config only --- + mySystem.apps.packages = { + enable = true; + packageNames = entries; # just the names, no pkgs references + }; } #+END_SRC diff --git a/Droidnix/generated/modules/apps/packages.nix b/Droidnix/generated/modules/apps/packages.nix index c6a31c6d9..90e24a663 100644 --- a/Droidnix/generated/modules/apps/packages.nix +++ b/Droidnix/generated/modules/apps/packages.nix @@ -1,39 +1,33 @@ -{ config, lib, pkgs, flakeRoot, inputs, ... }: +# ./modules/apps/packages.nix +{ lib, config, flakeRoot, ... }: + let packagesConfPath = "${flakeRoot}/assets/system/apps/packages.conf"; raw = builtins.readFile packagesConfPath; - # IMPORTANT: explicit "\n" so we never accidentally split into characters + + # split lines safely rawLines = lib.splitString "\n" raw; - # Guard: if we accidentally split into characters, rawLines length ~= stringLength raw + + # guard against accidental character splitting _guard = assert !( - builtins.stringLength raw > 1 && - builtins.length rawLines == builtins.stringLength raw + 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); -in -{ - environment.systemPackages = packages; + + # clean a line (remove CR, inline comments, whitespace) + cleanLine = line: + let + noCR = lib.replaceStrings [ "\r" ] [ "" ] line; + noInlineComment = lib.head (lib.splitString "#" noCR); + in + lib.strings.trim noInlineComment; + + entries = builtins.filter (l: l != "") (map cleanLine rawLines); + +in { + # --- symbolic config only --- + mySystem.apps.packages = { + enable = true; + packageNames = entries; # just the names, no pkgs references + }; }