working on zsh
This commit is contained in:
+36
-39
@@ -648,58 +648,55 @@ This is top file of this level which contains just an import statement for all r
|
||||
** =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,
|
||||
...
|
||||
}:
|
||||
{ config, lib, pkgs, flakeRoot, inputs, ... }:
|
||||
let
|
||||
packagesConfPath = "${builtins.toString flakeRoot.outPath}/assets/common/apps/packages.conf";
|
||||
packagesConfPath = flakeRoot.outPath + "/assets/conf/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;
|
||||
_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;
|
||||
zenBrowser =
|
||||
inputs.zen-browser.packages.${pkgs.stdenv.hostPlatform.system}.default;
|
||||
in
|
||||
{
|
||||
environment.systemPackages = packages ++ [ zenBrowser ];
|
||||
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
|
||||
#+BEGIN_SRC nix :tangle generated/system/applications/flatpaks.nix :noweb tangle :mkdirp yes :eval never-html
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
|
||||
Reference in New Issue
Block a user