Added stuf for installing packages and such
This commit is contained in:
@@ -0,0 +1,22 @@
|
|||||||
|
##############################################
|
||||||
|
# These files are just for reference.
|
||||||
|
# If you want to change anything, edit the source files in:
|
||||||
|
# ~/henrovnix/assets/conf
|
||||||
|
#
|
||||||
|
# After that, run:
|
||||||
|
# cd ~/henrovnix && emacs README.org --batch -f org-babel-tangle && git add . && git commit -m "Adjusted conf files" && sudo nixos-rebuild switch --flake .#<yourhost>
|
||||||
|
#
|
||||||
|
# If everything still works, you can use the same command but:
|
||||||
|
# - keep "switch"
|
||||||
|
# - and add a reboot:
|
||||||
|
#
|
||||||
|
# cd ~/henrovnix && sudo nixos-rebuild switch --flake .#<yourhost> && systemctl reboot
|
||||||
|
#
|
||||||
|
# NOTE:
|
||||||
|
# Make sure the lines starting with: cd ~/henrovnix
|
||||||
|
# are written as ONE single line.
|
||||||
|
##############################################
|
||||||
|
#app.zen_browser.zen
|
||||||
|
com.github.tchx84.Flatseal
|
||||||
|
eu.betterbird.Betterbird
|
||||||
|
com.todoist.Todoist
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
##############################################
|
||||||
|
# These files are just for reference.
|
||||||
|
# If you want to change anything, edit the source files in:
|
||||||
|
# ~/henrovnix/assets/conf
|
||||||
|
#
|
||||||
|
# After that, run:
|
||||||
|
# cd ~/henrovnix && emacs README.org --batch -f org-babel-tangle && git add . && git commit -m "Adjusted conf files" && sudo nixos-rebuild switch --flake .#<yourhost>
|
||||||
|
#
|
||||||
|
# If everything still works, you can use the same command but:
|
||||||
|
# - keep "switch"
|
||||||
|
# - and add a reboot:
|
||||||
|
#
|
||||||
|
# cd ~/henrovnix && sudo nixos-rebuild switch --flake .#<yourhost> && systemctl reboot
|
||||||
|
#
|
||||||
|
# Make sure the lines starting with: cd ~/henrovnix
|
||||||
|
# are written as ONE single line.
|
||||||
|
#
|
||||||
|
#IMPORTANT:
|
||||||
|
# Only packages/attributes that exist in Nixpkgs can be installed.
|
||||||
|
# Check names on https://search.nixos.org/packages
|
||||||
|
# A wrong package name (or attribute path) will cause the Nix build to fail.
|
||||||
|
###############################################
|
||||||
|
|
||||||
|
|
||||||
|
# system
|
||||||
|
nixVersions.latest
|
||||||
|
wofi
|
||||||
|
xdg-utils
|
||||||
|
desktop-file-utils
|
||||||
|
playerctl
|
||||||
|
mpv
|
||||||
|
networkmanagerapplet
|
||||||
|
|
||||||
|
#productivity
|
||||||
|
todoist
|
||||||
|
|
||||||
|
# browsers
|
||||||
|
brave
|
||||||
|
vivaldi
|
||||||
|
chromium
|
||||||
|
|
||||||
|
# hyprland
|
||||||
|
hyprpaper
|
||||||
|
|
||||||
|
# utils
|
||||||
|
wget
|
||||||
|
kdePackages.kdeconnect-kde
|
||||||
|
_1password-gui
|
||||||
|
tree
|
||||||
|
gparted
|
||||||
|
file
|
||||||
|
htop
|
||||||
|
wev
|
||||||
|
solaar
|
||||||
|
baobab
|
||||||
|
duf
|
||||||
|
zed-editor
|
||||||
|
|
||||||
|
# office
|
||||||
|
obsidian
|
||||||
|
onlyoffice-desktopeditors
|
||||||
|
|
||||||
|
# development
|
||||||
|
postman
|
||||||
|
tea
|
||||||
|
|
||||||
|
#jetbrains.pycharm
|
||||||
|
python3
|
||||||
|
|
||||||
|
# communication
|
||||||
|
nextcloud-talk-desktop
|
||||||
|
signal-desktop
|
||||||
|
openssl
|
||||||
|
|
||||||
|
# multimedia
|
||||||
|
audacity
|
||||||
|
handbrake
|
||||||
|
spotify
|
||||||
|
vlc
|
||||||
@@ -1,101 +1,111 @@
|
|||||||
{ config, pkgs, lib, flakeRoot, ... }:
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
flakeRoot,
|
||||||
|
...
|
||||||
|
}:
|
||||||
let
|
let
|
||||||
moduleName = "install-flatpaks";
|
moduleName = "install-flatpaks";
|
||||||
flatpakConfPath = flakeRoot.outPath + "/assets/conf/apps/flatpaks.conf";
|
flatpakConfPath = flakeRoot.outPath + "/assets/common/apps/flatpaks.conf";
|
||||||
raw = builtins.readFile flatpakConfPath;
|
raw = builtins.readFile flatpakConfPath;
|
||||||
# Explicit "\n" so we never accidentally split into characters
|
# Explicit "\n" so we never accidentally split into characters
|
||||||
rawLines = lib.splitString "\n" raw;
|
rawLines = lib.splitString "\n" raw;
|
||||||
|
|
||||||
# Guard: if we accidentally split into characters, rawLines length ~= stringLength raw
|
# Guard: if we accidentally split into characters, rawLines length ~= stringLength raw
|
||||||
_guard = assert !(
|
_guard =
|
||||||
builtins.stringLength raw > 1 &&
|
assert !(builtins.stringLength raw > 1 && builtins.length rawLines == builtins.stringLength raw);
|
||||||
builtins.length rawLines == builtins.stringLength raw
|
true;
|
||||||
); true;
|
|
||||||
|
|
||||||
cleanLine = l:
|
cleanLine =
|
||||||
let
|
l:
|
||||||
noCR = lib.replaceStrings [ "\r" ] [ "" ] l;
|
let
|
||||||
noInlineComment = lib.head (lib.splitString "#" noCR);
|
noCR = lib.replaceStrings [ "\r" ] [ "" ] l;
|
||||||
in
|
noInlineComment = lib.head (lib.splitString "#" noCR);
|
||||||
lib.strings.trim noInlineComment;
|
in
|
||||||
|
lib.strings.trim noInlineComment;
|
||||||
|
|
||||||
entries =
|
entries = builtins.filter (l: l != "") (map cleanLine rawLines);
|
||||||
builtins.filter (l: l != "")
|
|
||||||
(map cleanLine rawLines);
|
|
||||||
|
|
||||||
# Flatpak app IDs are reverse-DNS style like org.example.App (at least 2 dots).
|
# 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.
|
# We'll validate and fail early with a clear message.
|
||||||
dotCount = s: builtins.length (lib.splitString "." s) - 1;
|
dotCount = s: builtins.length (lib.splitString "." s) - 1;
|
||||||
|
|
||||||
isValidId = s:
|
isValidId = s: (dotCount s) >= 2; # matches the error you're seeing: "at least 2 periods"
|
||||||
(dotCount s) >= 2; # matches the error you're seeing: "at least 2 periods"
|
|
||||||
|
|
||||||
_validate =
|
_validate = builtins.seq _guard (
|
||||||
builtins.seq _guard (
|
builtins.map (
|
||||||
builtins.map (id:
|
id:
|
||||||
if isValidId id then true else
|
if isValidId id then
|
||||||
throw ''
|
true
|
||||||
${moduleName}: invalid Flatpak ID in flatpaks.conf (needs reverse-DNS with at least 2 dots)
|
else
|
||||||
|
throw ''
|
||||||
|
${moduleName}: invalid Flatpak ID in flatpaks.conf (needs reverse-DNS with at least 2 dots)
|
||||||
|
|
||||||
Token : ${builtins.toJSON id}
|
Token : ${builtins.toJSON id}
|
||||||
flatpaks.conf : ${toString flatpakConfPath}
|
flatpaks.conf : ${toString flatpakConfPath}
|
||||||
|
|
||||||
Fix: remove stray tokens/headers, or comment them out with '#'.
|
Fix: remove stray tokens/headers, or comment them out with '#'.
|
||||||
''
|
''
|
||||||
) entries
|
) entries
|
||||||
);
|
);
|
||||||
|
|
||||||
# Use validated entries
|
# Use validated entries
|
||||||
flatpakApps = builtins.seq _validate entries;
|
flatpakApps = builtins.seq _validate entries;
|
||||||
|
|
||||||
syncFlatpaks = pkgs.writeShellScript "sync-flatpaks" ''
|
syncFlatpaks = pkgs.writeShellScript "sync-flatpaks" ''
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
# Use the deployed config path (matches environment.etc below)
|
# Use the deployed config path (matches environment.etc below)
|
||||||
CONF="/etc/flatpak/flatpaks.conf"
|
CONF="/etc/flatpak/flatpaks.conf"
|
||||||
if [[ -f "$CONF" ]]; then
|
if [[ -f "$CONF" ]]; then
|
||||||
echo "flatpak-sync: using $CONF"
|
echo "flatpak-sync: using $CONF"
|
||||||
else
|
else
|
||||||
echo "flatpak-sync: WARNING: $CONF not found, using embedded list"
|
echo "flatpak-sync: WARNING: $CONF not found, using embedded list"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! flatpak remotes --system --columns=name | grep -qx flathub; then
|
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
|
flatpak remote-add --system --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
|
||||||
fi
|
fi
|
||||||
|
|
||||||
desired_apps=(
|
desired_apps=(
|
||||||
${lib.concatStringsSep "\n" (map (a: ''"${a}"'') flatpakApps)}
|
${lib.concatStringsSep "\n" (map (a: ''"${a}"'') flatpakApps)}
|
||||||
)
|
)
|
||||||
|
|
||||||
for app in "''${desired_apps[@]}"; do
|
for app in "''${desired_apps[@]}"; do
|
||||||
if ! flatpak info --system "$app" >/dev/null 2>&1; then
|
if ! flatpak info --system "$app" >/dev/null 2>&1; then
|
||||||
flatpak install --system -y --noninteractive flathub "$app"
|
flatpak install --system -y --noninteractive flathub "$app"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
'';
|
'';
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
services.flatpak.enable = true;
|
services.flatpak.enable = true;
|
||||||
|
|
||||||
xdg.portal = {
|
xdg.portal = {
|
||||||
enable = true;
|
enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
# Deploy the config file for runtime visibility/debugging
|
# Deploy the config file for runtime visibility/debugging
|
||||||
environment.etc."flatpak/flatpaks.conf".source = lib.mkForce flatpakConfPath;
|
environment.etc."flatpak/flatpaks.conf".source = lib.mkForce flatpakConfPath;
|
||||||
|
|
||||||
systemd.services.flatpak-sync = {
|
systemd.services.flatpak-sync = {
|
||||||
description = "Install Flatpak apps listed in flatpaks.conf";
|
description = "Install Flatpak apps listed in flatpaks.conf";
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
wants = [ "network-online.target" ];
|
wants = [ "network-online.target" ];
|
||||||
after = [ "network-online.target" ];
|
after = [ "network-online.target" ];
|
||||||
|
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "oneshot";
|
Type = "oneshot";
|
||||||
ExecStart = syncFlatpaks;
|
ExecStart = syncFlatpaks;
|
||||||
};
|
};
|
||||||
|
|
||||||
restartTriggers = [ flatpakConfPath ];
|
restartTriggers = [ flatpakConfPath ];
|
||||||
path = [ pkgs.flatpak pkgs.coreutils pkgs.gnugrep pkgs.gnused ];
|
path = [
|
||||||
|
pkgs.flatpak
|
||||||
|
pkgs.coreutils
|
||||||
|
pkgs.gnugrep
|
||||||
|
pkgs.gnused
|
||||||
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,43 +1,46 @@
|
|||||||
{ config, lib, pkgs, flakeRoot, inputs, ... }:
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
flakeRoot,
|
||||||
|
inputs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
let
|
let
|
||||||
packagesConfPath = flakeRoot.outPath + "/assets/conf/apps/packages.conf";
|
packagesConfPath = flakeRoot.outPath + "/assets/common/apps/packages.conf";
|
||||||
raw = builtins.readFile packagesConfPath;
|
raw = builtins.readFile packagesConfPath;
|
||||||
# IMPORTANT: explicit "\n" so we never accidentally split into characters
|
# IMPORTANT: explicit "\n" so we never accidentally split into characters
|
||||||
rawLines = lib.splitString "\n" raw;
|
rawLines = lib.splitString "\n" raw;
|
||||||
# Guard: if we accidentally split into characters, rawLines length ~= stringLength raw
|
# Guard: if we accidentally split into characters, rawLines length ~= stringLength raw
|
||||||
_guard = assert !(
|
_guard =
|
||||||
builtins.stringLength raw > 1 &&
|
assert !(builtins.stringLength raw > 1 && builtins.length rawLines == builtins.stringLength raw);
|
||||||
builtins.length rawLines == builtins.stringLength raw
|
true;
|
||||||
); true;
|
cleanLine =
|
||||||
cleanLine = l:
|
l:
|
||||||
let
|
let
|
||||||
noCR = lib.replaceStrings [ "\r" ] [ "" ] l;
|
noCR = lib.replaceStrings [ "\r" ] [ "" ] l;
|
||||||
noInlineComment = lib.head (lib.splitString "#" noCR);
|
noInlineComment = lib.head (lib.splitString "#" noCR);
|
||||||
in
|
in
|
||||||
lib.strings.trim noInlineComment;
|
lib.strings.trim noInlineComment;
|
||||||
entries =
|
entries = builtins.filter (l: l != "") (map cleanLine rawLines);
|
||||||
builtins.filter (l: l != "")
|
resolvePkg =
|
||||||
(map cleanLine rawLines);
|
name:
|
||||||
resolvePkg = name:
|
let
|
||||||
let
|
parts = lib.splitString "." name;
|
||||||
parts = lib.splitString "." name;
|
found = lib.attrByPath parts null pkgs;
|
||||||
found = lib.attrByPath parts null pkgs;
|
in
|
||||||
in
|
if found == null then
|
||||||
if found == null then
|
throw ''
|
||||||
throw ''
|
packages.nix: package not found in pkgs
|
||||||
packages.nix: package not found in pkgs
|
Token : ${builtins.toJSON name}
|
||||||
Token : ${builtins.toJSON name}
|
packages.conf : ${toString packagesConfPath}
|
||||||
packages.conf : ${toString packagesConfPath}
|
Hint : check the attribute name on search.nixos.org/packages
|
||||||
Hint : check the attribute name on search.nixos.org/packages
|
''
|
||||||
''
|
else
|
||||||
else
|
found;
|
||||||
found;
|
|
||||||
packages = builtins.seq _guard (map resolvePkg entries);
|
packages = builtins.seq _guard (map resolvePkg entries);
|
||||||
zenBrowser =
|
zenBrowser = inputs.zen-browser.packages.${pkgs.stdenv.hostPlatform.system}.default;
|
||||||
inputs.zen-browser.packages.${pkgs.stdenv.hostPlatform.system}.default;
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
environment.systemPackages =
|
environment.systemPackages = packages ++ [ zenBrowser ];
|
||||||
packages
|
|
||||||
++ [ zenBrowser ];
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user