# {{{autogen}}} { lib, config, pkgs, flakeRoot, ... }: let ################################# # FILE ################################# confPath = "${flakeRoot}/generated/assets/2_b_installed.conf"; raw = builtins.readFile confPath; lines = lib.splitString "\n" raw; ################################# # CLEAN LINE ################################# cleanLine = line: let noCR = lib.replaceStrings [ "\r" ] [ "" ] line; noInlineComment = lib.head (lib.splitString "#" noCR); in lib.strings.trim noInlineComment; ################################# # PARSE SECTION ################################# parseSection = section: let result = builtins.foldl' (acc: line: let l = lib.strings.trim line; in if l == section then acc // { active = true; } else if lib.hasPrefix "#" l then acc // { active = false; } else if acc.active then acc // { entries = acc.entries ++ [ l ]; } else acc ) { active = false; entries = []; } lines; in builtins.filter (l: l != "") (map cleanLine result.entries); ################################# # NIX PACKAGES ################################# packageEntries = parseSection "#packages"; resolvePkg = name: let parts = lib.splitString "." name; found = lib.attrByPath parts null pkgs; in if found == null then throw '' packages.nix: package not found Token: ${name} File : ${confPath} '' else found; packages = map resolvePkg packageEntries; ################################# # FLATPAKS ################################# flatpakEntries = parseSection "#flatpaks"; in { ################################# # Allow unfree ################################# nixpkgs.config.allowUnfree = true; ################################# # System packages (Nix) ################################# environment.systemPackages = packages; ################################# # Flatpak setup ################################# services.flatpak.enable = true; services.flatpak.remotes = [ { name = "flathub"; location = "https://flathub.org/repo/flathub.flatpakrepo"; } ]; ################################# # Flatpak apps ################################# services.flatpak.packages = flatpakEntries; }