Reshuffling stuff
This commit is contained in:
@@ -1,22 +1,15 @@
|
||||
{ config, lib, pkgs, flakeRoot, inputs, ... }:
|
||||
{ config, pkgs, lib, inputs, ... }:
|
||||
|
||||
let
|
||||
# --- Path to your packages.conf ---
|
||||
packagesConfPath = "${flakeRoot}/assets/conf/apps/packages.conf";
|
||||
# Gebruik een relatief pad, geen flakeRoot
|
||||
packagesConfPath = ./assets/system/apps/packages.conf;
|
||||
|
||||
# --- Read raw content ---
|
||||
raw = builtins.readFile packagesConfPath;
|
||||
|
||||
# --- Split into lines explicitly on "\n" to avoid accidental char splitting ---
|
||||
rawLines = lib.splitString "\n" raw;
|
||||
|
||||
# --- Guard against accidental character splitting ---
|
||||
_guard = assert !(
|
||||
builtins.stringLength raw > 1 &&
|
||||
builtins.length rawLines == builtins.stringLength raw
|
||||
); true;
|
||||
_guard = assert !(builtins.stringLength raw > 1 &&
|
||||
builtins.length rawLines == builtins.stringLength raw); true;
|
||||
|
||||
# --- Clean each line: remove CR, inline comments, trim ---
|
||||
cleanLine = line:
|
||||
let
|
||||
noCR = lib.replaceStrings [ "\r" ] [ "" ] line;
|
||||
@@ -24,10 +17,8 @@ let
|
||||
in
|
||||
lib.strings.trim noComment;
|
||||
|
||||
# --- Filter empty lines ---
|
||||
entries = builtins.filter (l: l != "") (map cleanLine rawLines);
|
||||
|
||||
# --- Resolve a package name from pkgs ---
|
||||
resolvePkg = name:
|
||||
let
|
||||
parts = lib.splitString "." name;
|
||||
@@ -43,15 +34,9 @@ let
|
||||
else
|
||||
found;
|
||||
|
||||
# --- Map entries to actual pkgs ---
|
||||
packages = builtins.seq _guard (map resolvePkg entries);
|
||||
|
||||
# --- Zen Browser package from inputs ---
|
||||
zenBrowser =
|
||||
inputs.zen-browser.packages.${pkgs.stdenv.hostPlatform.system}.default;
|
||||
|
||||
in
|
||||
{
|
||||
# --- Add the packages to systemPackages ---
|
||||
environment.systemPackages = packages ++ [ zenBrowser ];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user