working on zsh
This commit is contained in:
+515
-334
File diff suppressed because it is too large
Load Diff
+181
-2
@@ -367,6 +367,7 @@ The Nix flake definition for Droidnix.
|
||||
|
||||
outputs =
|
||||
inputs@{
|
||||
self,
|
||||
nixpkgs,
|
||||
home-manager,
|
||||
emacs-overlay,
|
||||
@@ -410,10 +411,11 @@ The Nix flake definition for Droidnix.
|
||||
);
|
||||
|
||||
devShells.${system}.default = import ./assets/flake/terminal_shell/devshell.nix {
|
||||
inherit (nixpkgs) mkShell;
|
||||
inherit (nixpkgs.legacyPackages.${system}) mkShell;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
#+END_SRC
|
||||
|
||||
* First the nix-files that flake really needs and that do not fit wel in the hierarchical structure
|
||||
@@ -432,7 +434,7 @@ This is the default user, just search and replace henrov another name if you wan
|
||||
** =assets/flake/terminal_shell/devshell.nix=
|
||||
This code defines a Nix shell environment (also called a "devShell") that you can enter using the nix develop command. When you enter this shell, Nix will provide the tools and dependencies listed in buildInputs.
|
||||
#+BEGIN_SRC nix :tangle assets/flake/terminal_shell/devshell.nix :noweb tangle :mkdirp yes :eval never-html
|
||||
{ mkShell }:
|
||||
{ mkShell, ... }:
|
||||
mkShell {
|
||||
buildInputs = with import <nixpkgs> {}; [
|
||||
nil
|
||||
@@ -630,6 +632,8 @@ This is top file of this level which contains just an import statement for all r
|
||||
{ config, pkgs, lib, user, inputs, flakeRoot,... }:
|
||||
{
|
||||
imports = [
|
||||
./packages.nix
|
||||
./flatpaks.nix
|
||||
./accessibility/top.nix
|
||||
./file_management/top.nix
|
||||
./gaming/top.nix
|
||||
@@ -641,6 +645,178 @@ This is top file of this level which contains just an import statement for all r
|
||||
}
|
||||
#+END_SRC
|
||||
|
||||
** =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,
|
||||
...
|
||||
}:
|
||||
let
|
||||
packagesConfPath = "${builtins.toString flakeRoot.outPath}/assets/common/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;
|
||||
packages = builtins.seq _guard (map resolvePkg entries);
|
||||
zenBrowser = inputs.zen-browser.packages.${pkgs.stdenv.hostPlatform.system}.default;
|
||||
in
|
||||
{
|
||||
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
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
flakeRoot,
|
||||
...
|
||||
}:
|
||||
let
|
||||
moduleName = "install-flatpaks";
|
||||
flatpakConfPath = flakeRoot.outPath + "/assets/common/apps/flatpaks.conf";
|
||||
raw = builtins.readFile flatpakConfPath;
|
||||
# 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);
|
||||
|
||||
# Flatpak app IDs are reverse-DNS style like org.example.App (at least 2 dots).
|
||||
# We'll validate and fail early with a clear message.
|
||||
dotCount = s: builtins.length (lib.splitString "." s) - 1;
|
||||
|
||||
isValidId = s: (dotCount s) >= 2; # matches the error you're seeing: "at least 2 periods"
|
||||
|
||||
_validate = builtins.seq _guard (
|
||||
builtins.map (
|
||||
id:
|
||||
if isValidId id then
|
||||
true
|
||||
else
|
||||
throw ''
|
||||
${moduleName}: invalid Flatpak ID in flatpaks.conf (needs reverse-DNS with at least 2 dots)
|
||||
|
||||
Token : ${builtins.toJSON id}
|
||||
flatpaks.conf : ${toString flatpakConfPath}
|
||||
|
||||
Fix: remove stray tokens/headers, or comment them out with '#'.
|
||||
''
|
||||
) entries
|
||||
);
|
||||
|
||||
# Use validated entries
|
||||
flatpakApps = builtins.seq _validate entries;
|
||||
|
||||
syncFlatpaks = pkgs.writeShellScript "sync-flatpaks" ''
|
||||
set -euo pipefail
|
||||
|
||||
# Use the deployed config path (matches environment.etc below)
|
||||
CONF="/etc/flatpak/flatpaks.conf"
|
||||
if [[ -f "$CONF" ]]; then
|
||||
echo "flatpak-sync: using $CONF"
|
||||
else
|
||||
echo "flatpak-sync: WARNING: $CONF not found, using embedded list"
|
||||
fi
|
||||
|
||||
if ! flatpak remotes --system --columns=name | grep -qx flathub; then
|
||||
flatpak remote-add --system --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
|
||||
fi
|
||||
|
||||
desired_apps=(
|
||||
${lib.concatStringsSep "\n" (map (a: ''"${a}"'') flatpakApps)}
|
||||
)
|
||||
|
||||
for app in "''${desired_apps[@]}"; do
|
||||
if ! flatpak info --system "$app" >/dev/null 2>&1; then
|
||||
flatpak install --system -y --noninteractive flathub "$app"
|
||||
fi
|
||||
done
|
||||
'';
|
||||
in
|
||||
{
|
||||
services.flatpak.enable = true;
|
||||
|
||||
xdg.portal = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
# Deploy the config file for runtime visibility/debugging
|
||||
environment.etc."flatpak/flatpaks.conf".source = lib.mkForce flatpakConfPath;
|
||||
|
||||
systemd.services.flatpak-sync = {
|
||||
description = "Install Flatpak apps listed in flatpaks.conf";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
wants = [ "network-online.target" ];
|
||||
after = [ "network-online.target" ];
|
||||
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
ExecStart = syncFlatpaks;
|
||||
};
|
||||
|
||||
restartTriggers = [ flatpakConfPath ];
|
||||
path = [
|
||||
pkgs.flatpak
|
||||
pkgs.coreutils
|
||||
pkgs.gnugrep
|
||||
pkgs.gnused
|
||||
];
|
||||
};
|
||||
}
|
||||
|
||||
#+END_SRC
|
||||
|
||||
|
||||
|
||||
|
||||
** =generated/system/core/top.nix=
|
||||
This is top file of this level which contains just an import statement for all relevant files and/or the subfolder in this folder
|
||||
#+BEGIN_SRC nix :tangle generated/system/core/top.nix :noweb tangle :mkdirp yes :eval never-html
|
||||
@@ -1027,6 +1203,7 @@ This is top file of this level which contains just an import statement for all r
|
||||
}
|
||||
#+END_SRC
|
||||
|
||||
|
||||
** =generated/system/applications/accessibility/top.nix=
|
||||
This is top file of this level which contains just an import statement for all relevant files and/or the subfolder in this folder
|
||||
#+BEGIN_SRC nix :tangle generated/system/applications/accessibility/top.nix :noweb tangle :mkdirp yes :eval never-html
|
||||
@@ -1184,6 +1361,8 @@ in
|
||||
}
|
||||
#+END_SRC
|
||||
|
||||
|
||||
|
||||
** =generated/system/development/databases/top.nix=
|
||||
This is top file of this level which contains just an import statement for all relevant files and/or the subfolder in this folder
|
||||
#+BEGIN_SRC nix :tangle generated/system/development/databases/top.nix :noweb tangle :mkdirp yes :eval never-html
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{ mkShell }:
|
||||
{ mkShell, ... }:
|
||||
mkShell {
|
||||
buildInputs = with import <nixpkgs> {}; [
|
||||
nil
|
||||
|
||||
+2
-1
@@ -24,6 +24,7 @@
|
||||
|
||||
outputs =
|
||||
inputs@{
|
||||
self,
|
||||
nixpkgs,
|
||||
home-manager,
|
||||
emacs-overlay,
|
||||
@@ -67,7 +68,7 @@
|
||||
);
|
||||
|
||||
devShells.${system}.default = import ./assets/flake/terminal_shell/devshell.nix {
|
||||
inherit (nixpkgs) mkShell;
|
||||
inherit (nixpkgs.legacyPackages.${system}) mkShell;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
{ config, pkgs, lib, user, inputs, flakeRoot,... }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
@@ -44,3 +45,115 @@ in
|
||||
{
|
||||
environment.systemPackages = packages ++ [ zenBrowser ];
|
||||
}
|
||||
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
flakeRoot,
|
||||
...
|
||||
}:
|
||||
let
|
||||
moduleName = "install-flatpaks";
|
||||
flatpakConfPath = flakeRoot.outPath + "/assets/common/apps/flatpaks.conf";
|
||||
raw = builtins.readFile flatpakConfPath;
|
||||
# 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);
|
||||
|
||||
# Flatpak app IDs are reverse-DNS style like org.example.App (at least 2 dots).
|
||||
# We'll validate and fail early with a clear message.
|
||||
dotCount = s: builtins.length (lib.splitString "." s) - 1;
|
||||
|
||||
isValidId = s: (dotCount s) >= 2; # matches the error you're seeing: "at least 2 periods"
|
||||
|
||||
_validate = builtins.seq _guard (
|
||||
builtins.map (
|
||||
id:
|
||||
if isValidId id then
|
||||
true
|
||||
else
|
||||
throw ''
|
||||
${moduleName}: invalid Flatpak ID in flatpaks.conf (needs reverse-DNS with at least 2 dots)
|
||||
|
||||
Token : ${builtins.toJSON id}
|
||||
flatpaks.conf : ${toString flatpakConfPath}
|
||||
|
||||
Fix: remove stray tokens/headers, or comment them out with '#'.
|
||||
''
|
||||
) entries
|
||||
);
|
||||
|
||||
# Use validated entries
|
||||
flatpakApps = builtins.seq _validate entries;
|
||||
|
||||
syncFlatpaks = pkgs.writeShellScript "sync-flatpaks" ''
|
||||
set -euo pipefail
|
||||
|
||||
# Use the deployed config path (matches environment.etc below)
|
||||
CONF="/etc/flatpak/flatpaks.conf"
|
||||
if [[ -f "$CONF" ]]; then
|
||||
echo "flatpak-sync: using $CONF"
|
||||
else
|
||||
echo "flatpak-sync: WARNING: $CONF not found, using embedded list"
|
||||
fi
|
||||
|
||||
if ! flatpak remotes --system --columns=name | grep -qx flathub; then
|
||||
flatpak remote-add --system --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
|
||||
fi
|
||||
|
||||
desired_apps=(
|
||||
${lib.concatStringsSep "\n" (map (a: ''"${a}"'') flatpakApps)}
|
||||
)
|
||||
|
||||
for app in "''${desired_apps[@]}"; do
|
||||
if ! flatpak info --system "$app" >/dev/null 2>&1; then
|
||||
flatpak install --system -y --noninteractive flathub "$app"
|
||||
fi
|
||||
done
|
||||
'';
|
||||
in
|
||||
{
|
||||
services.flatpak.enable = true;
|
||||
|
||||
xdg.portal = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
# Deploy the config file for runtime visibility/debugging
|
||||
environment.etc."flatpak/flatpaks.conf".source = lib.mkForce flatpakConfPath;
|
||||
|
||||
systemd.services.flatpak-sync = {
|
||||
description = "Install Flatpak apps listed in flatpaks.conf";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
wants = [ "network-online.target" ];
|
||||
after = [ "network-online.target" ];
|
||||
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
ExecStart = syncFlatpaks;
|
||||
};
|
||||
|
||||
restartTriggers = [ flatpakConfPath ];
|
||||
path = [
|
||||
pkgs.flatpak
|
||||
pkgs.coreutils
|
||||
pkgs.gnugrep
|
||||
pkgs.gnused
|
||||
];
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,11 +1,4 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
user,
|
||||
flakeRoot,
|
||||
...
|
||||
}:
|
||||
{ config, pkgs, lib, user, flakeRoot, ... }:
|
||||
let
|
||||
zshConfigDir = "${config.home-manager.users.${user.username}.xdg.configHome}/zsh";
|
||||
assetsDir = "${flakeRoot}/assets/common/conf/zsh";
|
||||
@@ -42,5 +35,4 @@ in
|
||||
|
||||
# Use the .zshrc file from assets
|
||||
xdg.configFile."zsh/.zshrc".source = "${assetsDir}/.zshrc";
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,16 +1,8 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
user,
|
||||
inputs,
|
||||
flakeRoot,
|
||||
...
|
||||
}:
|
||||
{ config, pkgs, lib, user, inputs, flakeRoot,... }:
|
||||
{
|
||||
imports = [
|
||||
./flatpaks.nix
|
||||
./packages.nix
|
||||
./flatpaks.nix
|
||||
./accessibility/top.nix
|
||||
./file_management/top.nix
|
||||
./gaming/top.nix
|
||||
|
||||
Reference in New Issue
Block a user