Reshuffling stuff
This commit is contained in:
+30
-23
@@ -768,12 +768,13 @@ This is top file of this level which contains just an import statement for all r
|
|||||||
** =generated/modules/apps/packages.nix=
|
** =generated/modules/apps/packages.nix=
|
||||||
This will import all packages listed in ./assets/system/apps/packages.conf
|
This will import all packages listed in ./assets/system/apps/packages.conf
|
||||||
#+BEGIN_SRC nix :tangle generated/modules/apps/packages.nix :noweb tangle :mkdirp yes :eval never-html
|
#+BEGIN_SRC nix :tangle generated/modules/apps/packages.nix :noweb tangle :mkdirp yes :eval never-html
|
||||||
{ config, lib, pkgs, ... }:
|
{ lib, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
# Gebruik relatieve pad binnen module
|
# --- Path naar je packages.conf, relatief aan dit bestand ---
|
||||||
packagesConfPath = ../../../assets/system/apps/packages.conf;
|
packagesConfPath = ./assets/system/apps/packages.conf;
|
||||||
|
|
||||||
|
# --- Lees en split ---
|
||||||
raw = builtins.readFile packagesConfPath;
|
raw = builtins.readFile packagesConfPath;
|
||||||
rawLines = lib.splitString "\n" raw;
|
rawLines = lib.splitString "\n" raw;
|
||||||
|
|
||||||
@@ -789,29 +790,35 @@ let
|
|||||||
|
|
||||||
entries = builtins.filter (l: l != "") (map cleanLine rawLines);
|
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
|
in
|
||||||
{
|
{
|
||||||
options.mySystem.system.packages.enable = lib.mkEnableOption "Enable packages from packages.conf";
|
# --- Flake NixOS module export ---
|
||||||
|
flake.nixosModules.packages = { config, pkgs, lib, ... }:
|
||||||
|
|
||||||
config = lib.mkIf (config.mySystem.system.packages.enable or false) {
|
let
|
||||||
environment.systemPackages = packages;
|
# Resolve packages via pkgs
|
||||||
|
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}
|
||||||
|
''
|
||||||
|
else
|
||||||
|
found;
|
||||||
|
|
||||||
|
packages = builtins.seq _guard (map resolvePkg entries);
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.mySystem.system.packages.enable = lib.mkEnableOption "Enable packages from packages.conf";
|
||||||
|
|
||||||
|
config = lib.mkIf (config.mySystem.system.packages.enable or false) {
|
||||||
|
environment.systemPackages = packages;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
{ config, lib, pkgs, ... }:
|
{ lib, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
# Gebruik relatieve pad binnen module
|
# --- Path naar je packages.conf, relatief aan dit bestand ---
|
||||||
packagesConfPath = ../../../assets/system/apps/packages.conf;
|
packagesConfPath = ./assets/system/apps/packages.conf;
|
||||||
|
|
||||||
|
# --- Lees en split ---
|
||||||
raw = builtins.readFile packagesConfPath;
|
raw = builtins.readFile packagesConfPath;
|
||||||
rawLines = lib.splitString "\n" raw;
|
rawLines = lib.splitString "\n" raw;
|
||||||
|
|
||||||
@@ -19,28 +20,34 @@ let
|
|||||||
|
|
||||||
entries = builtins.filter (l: l != "") (map cleanLine rawLines);
|
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
|
in
|
||||||
{
|
{
|
||||||
options.mySystem.system.packages.enable = lib.mkEnableOption "Enable packages from packages.conf";
|
# --- Flake NixOS module export ---
|
||||||
|
flake.nixosModules.packages = { config, pkgs, lib, ... }:
|
||||||
|
|
||||||
config = lib.mkIf (config.mySystem.system.packages.enable or false) {
|
let
|
||||||
environment.systemPackages = packages;
|
# Resolve packages via pkgs
|
||||||
|
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}
|
||||||
|
''
|
||||||
|
else
|
||||||
|
found;
|
||||||
|
|
||||||
|
packages = builtins.seq _guard (map resolvePkg entries);
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.mySystem.system.packages.enable = lib.mkEnableOption "Enable packages from packages.conf";
|
||||||
|
|
||||||
|
config = lib.mkIf (config.mySystem.system.packages.enable or false) {
|
||||||
|
environment.systemPackages = packages;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user