refactor: rename vars.user to vars.mainUser
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-01-09 13:13:04 -05:00
parent b0542f4f2d
commit 77643378cc
27 changed files with 127 additions and 88 deletions

View file

@ -57,7 +57,7 @@
}; };
home-manager.users = let home-manager.users = let
mainUser = config.vars.user; inherit (config.vars) mainUser;
mainUserConf = config.home-manager.users.${mainUser}; mainUserConf = config.home-manager.users.${mainUser};
default = { default = {

View file

@ -7,13 +7,13 @@
... ...
}: }:
with lib; let with lib; let
nvimIde = config.vars.neovimIde; inherit (config.vars) neovimIde;
javaSdk = pkgs.temurin-bin-17; javaSdk = pkgs.temurin-bin-17;
nvim-treesitter-hyprlang = tree-sitter-hyprlang-flake.packages.${pkgs.system}.default; nvim-treesitter-hyprlang = tree-sitter-hyprlang-flake.packages.${pkgs.system}.default;
coc-stylelintplus = coc-stylelintplus-flake.packages.${pkgs.system}.default; coc-stylelintplus = coc-stylelintplus-flake.packages.${pkgs.system}.default;
in { in {
home = optionalAttrs nvimIde { home = optionalAttrs neovimIde {
packages = with pkgs; [ packages = with pkgs; [
gradle gradle
gradle-completion # FIXME: not working gradle-completion # FIXME: not working
@ -21,14 +21,14 @@ in {
]; ];
}; };
xdg.dataFile = optionalAttrs nvimIde { xdg.dataFile = optionalAttrs neovimIde {
".gradle/gradle.properties".text = '' ".gradle/gradle.properties".text = ''
org.gradle.java.home = ${javaSdk} org.gradle.java.home = ${javaSdk}
''; '';
}; };
programs = { programs = {
java = optionalAttrs nvimIde { java = optionalAttrs neovimIde {
enable = true; enable = true;
package = javaSdk; package = javaSdk;
}; };
@ -54,7 +54,7 @@ in {
bat bat
gcc gcc
] ]
++ optionals nvimIde [ ++ optionals neovimIde [
nodejs_latest nodejs_latest
nodePackages.npm nodePackages.npm
nodePackages.neovim nodePackages.neovim
@ -63,11 +63,11 @@ in {
]); ]);
extraPython3Packages = ps: extraPython3Packages = ps:
optionals nvimIde [ optionals neovimIde [
ps.pylint ps.pylint
]; ];
coc = optionalAttrs nvimIde { coc = optionalAttrs neovimIde {
enable = true; enable = true;
settings = { settings = {
# General # General
@ -186,7 +186,7 @@ in {
config = fileContents ./plugins/mini.lua; config = fileContents ./plugins/mini.lua;
} }
] ]
++ optionals nvimIde [ ++ optionals neovimIde [
# Coc configured # Coc configured
coc-css coc-css
coc-eslint coc-eslint

View file

@ -4,6 +4,7 @@
lib, lib,
... ...
}: let }: let
inherit (config.vars) mainUser;
cfg = config.services.locate; cfg = config.services.locate;
locateGroup = lib.getName cfg.package.name; locateGroup = lib.getName cfg.package.name;
@ -21,7 +22,7 @@
--prunepaths "${prunePaths}" --prunenames "${pruneNames}" --prunepaths "${prunePaths}" --prunenames "${pruneNames}"
''; '';
in { in {
users.users.${config.vars.user}.extraGroups = [ users.users.${mainUser}.extraGroups = [
locateGroup locateGroup
]; ];
@ -29,7 +30,7 @@ in {
systemd.services.locate = { systemd.services.locate = {
wantedBy = ["default.target"]; wantedBy = ["default.target"];
serviceConfig = { serviceConfig = {
User = config.vars.user; User = mainUser;
Group = locateGroup; Group = locateGroup;
StateDirectory = "locate"; StateDirectory = "locate";
StateDirectoryMode = "0770"; StateDirectoryMode = "0770";
@ -37,7 +38,7 @@ in {
}; };
}; };
home-manager.users.${config.vars.user}.programs.bash.shellAliases = { home-manager.users.${mainUser}.programs.bash.shellAliases = {
locate = "${pkgs.writeShellScriptBin "lct" '' locate = "${pkgs.writeShellScriptBin "lct" ''
exec ${locate} -d ${database} "$@" 2> >(grep -v "/var/cache/locatedb") exec ${locate} -d ${database} "$@" 2> >(grep -v "/var/cache/locatedb")
''}/bin/lct"; ''}/bin/lct";

View file

@ -3,8 +3,10 @@
lib, lib,
... ...
}: { }: {
options.vars = with lib; { options.vars = with lib; let
user = mkOption { inherit (config.vars) mainUser hostName;
in {
mainUser = mkOption {
type = types.str; type = types.str;
description = '' description = ''
Username that was defined at the initial setup process Username that was defined at the initial setup process
@ -20,7 +22,7 @@
configDir = mkOption { configDir = mkOption {
type = types.str; type = types.str;
default = "/home/${config.vars.user}/.nix/devices/${config.vars.hostName}/config"; default = "/home/${mainUser}/.nix/devices/${hostName}/config";
description = '' description = ''
The path to where most of the devices' configs are in the .nix folder The path to where most of the devices' configs are in the .nix folder
''; '';

View file

@ -1,6 +1,6 @@
{pkgs, ...}: { {pkgs, ...}: {
vars = { vars = {
user = "nix-on-droid"; mainUser = "nix-on-droid";
hostName = "localhost"; hostName = "localhost";
neovimIde = false; neovimIde = false;
}; };

View file

@ -1,4 +1,6 @@
{config, ...}: { {config, ...}: let
inherit (config.vars) mainUser hostName;
in {
imports = [ imports = [
./hardware-configuration.nix ./hardware-configuration.nix
@ -17,14 +19,14 @@
]; ];
vars = { vars = {
user = "matt"; mainUser = "matt";
hostName = "binto"; hostName = "binto";
mainMonitor = "desc:GIGA-BYTE TECHNOLOGY CO. LTD. G27QC 0x00000B1D"; mainMonitor = "desc:GIGA-BYTE TECHNOLOGY CO. LTD. G27QC 0x00000B1D";
greetdDupe = false; greetdDupe = false;
fontSize = 12.5; fontSize = 12.5;
}; };
users.users.${config.vars.user} = { users.users.${mainUser} = {
isNormalUser = true; isNormalUser = true;
extraGroups = [ extraGroups = [
"wheel" "wheel"
@ -40,7 +42,7 @@
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJGbLu+Gb7PiyNgNXMHemaQLnKixebx1/4cdJGna9OQp matt@wim" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJGbLu+Gb7PiyNgNXMHemaQLnKixebx1/4cdJGna9OQp matt@wim"
]; ];
}; };
home-manager.users.${config.vars.user} = { home-manager.users.${mainUser} = {
imports = [ imports = [
../../home/firefox ../../home/firefox
@ -52,7 +54,7 @@
}; };
networking = { networking = {
inherit (config.vars) hostName; inherit hostName;
networkmanager.enable = true; networkmanager.enable = true;
firewall.enable = false; firewall.enable = false;
}; };

View file

@ -5,6 +5,8 @@
gpu-screen-recorder-src, gpu-screen-recorder-src,
... ...
}: let }: let
inherit (config.vars) mainUser;
gsr = pkgs.stdenv.mkDerivation { gsr = pkgs.stdenv.mkDerivation {
name = "gpu-screen-recorder"; name = "gpu-screen-recorder";
version = gpu-screen-recorder-src.rev; version = gpu-screen-recorder-src.rev;
@ -74,7 +76,7 @@ in {
}; };
}; };
home-manager.users.${config.vars.user} = { home-manager.users.${mainUser} = {
# TODO: add mic sound # TODO: add mic sound
xdg.configFile."gsr.sh" = { xdg.configFile."gsr.sh" = {
executable = true; executable = true;

View file

@ -1,4 +1,6 @@
{config, ...}: { {config, ...}: let
inherit (config.vars) mainUser hostName;
in {
imports = [ imports = [
./hardware-configuration.nix ./hardware-configuration.nix
@ -13,12 +15,12 @@
]; ];
vars = { vars = {
user = "matt"; mainUser = "matt";
hostName = "oksys"; hostName = "oksys";
neovimIde = false; neovimIde = false;
}; };
users.users.${config.vars.user} = { users.users.${mainUser} = {
isNormalUser = true; isNormalUser = true;
extraGroups = [ extraGroups = [
"wheel" "wheel"
@ -31,7 +33,7 @@
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJGbLu+Gb7PiyNgNXMHemaQLnKixebx1/4cdJGna9OQp matt@wim" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJGbLu+Gb7PiyNgNXMHemaQLnKixebx1/4cdJGna9OQp matt@wim"
]; ];
}; };
home-manager.users.${config.vars.user} = { home-manager.users.${mainUser} = {
imports = []; imports = [];
# No touchy # No touchy
@ -39,7 +41,7 @@
}; };
networking = { networking = {
inherit (config.vars) hostName; inherit hostName;
resolvconf = { resolvconf = {
enable = true; enable = true;
extraConfig = '' extraConfig = ''

View file

@ -4,12 +4,14 @@
config, config,
... ...
}: let }: let
inherit (config.vars) mainUser;
inherit (config.sops) secrets;
caddy = caddy-plugins.packages.${pkgs.system}.default; caddy = caddy-plugins.packages.${pkgs.system}.default;
secrets = config.sops.secrets;
in { in {
imports = [caddy-plugins.nixosModules.default]; imports = [caddy-plugins.nixosModules.default];
environment.systemPackages = [caddy]; environment.systemPackages = [caddy];
users.users.${config.vars.user}.extraGroups = ["caddy"]; users.users.${mainUser}.extraGroups = ["caddy"];
systemd.services.caddy.serviceConfig = { systemd.services.caddy.serviceConfig = {
EnvironmentFile = secrets.caddy-cloudflare.path; EnvironmentFile = secrets.caddy-cloudflare.path;

View file

@ -4,10 +4,11 @@
config, config,
... ...
}: let }: let
inherit (config.vars) mainUser;
headscale-flake = headscale.packages.${pkgs.system}.headscale; headscale-flake = headscale.packages.${pkgs.system}.headscale;
in { in {
environment.systemPackages = [headscale-flake]; environment.systemPackages = [headscale-flake];
users.users.${config.vars.user}.extraGroups = ["headscale"]; users.users.${mainUser}.extraGroups = ["headscale"];
services.headscale = { services.headscale = {
enable = true; enable = true;

View file

@ -1,8 +1,10 @@
{config, ...}: { {config, ...}: let
inherit (config.vars) mainUser;
in {
# https://github.com/MatthewVance/unbound-docker-rpi/issues/4#issuecomment-1001879602 # https://github.com/MatthewVance/unbound-docker-rpi/issues/4#issuecomment-1001879602
boot.kernel.sysctl."net.core.rmem_max" = 1048576; boot.kernel.sysctl."net.core.rmem_max" = 1048576;
users.users.${config.vars.user}.extraGroups = ["unbound"]; users.users.${mainUser}.extraGroups = ["unbound"];
services.unbound = { services.unbound = {
enable = true; enable = true;

View file

@ -1,4 +1,6 @@
{config, ...}: { {config, ...}: let
inherit (config.vars) mainUser hostName;
in {
imports = [ imports = [
./hardware-configuration.nix ./hardware-configuration.nix
@ -13,12 +15,12 @@
]; ];
vars = { vars = {
user = "matt"; mainUser = "matt";
hostName = "servivi"; hostName = "servivi";
}; };
users.users = { users.users = {
${config.vars.user} = { ${mainUser} = {
isNormalUser = true; isNormalUser = true;
extraGroups = [ extraGroups = [
"wheel" "wheel"
@ -45,7 +47,7 @@
}; };
}; };
home-manager.users.${config.vars.user} = { home-manager.users.${mainUser} = {
imports = []; imports = [];
# No touchy # No touchy
@ -53,7 +55,7 @@
}; };
networking = { networking = {
inherit (config.vars) hostName; inherit hostName;
resolvconf.enable = true; resolvconf.enable = true;
firewall.enable = false; firewall.enable = false;
}; };

View file

@ -7,12 +7,13 @@
} @ inputs: } @ inputs:
with lib; with lib;
with builtins; let with builtins; let
user = config.vars.user; inherit (config.vars) mainUser;
configPath = "/var/lib/arion"; configPath = "/var/lib/arion";
in { in {
imports = [arion.nixosModules.arion]; imports = [arion.nixosModules.arion];
users.extraUsers.${user}.extraGroups = ["docker"]; users.extraUsers.${mainUser}.extraGroups = ["docker"];
services.borgbackup.configs.arion = { services.borgbackup.configs.arion = {
paths = [configPath]; paths = [configPath];

View file

@ -3,8 +3,8 @@
pkgs, pkgs,
... ...
}: let }: let
secrets = config.sops.secrets; inherit (config.vars) mainUser;
vars = config.vars; inherit (config.sops) secrets;
in { in {
services.nix-serve = { services.nix-serve = {
enable = true; enable = true;
@ -16,8 +16,8 @@ in {
services.buildAll = { services.buildAll = {
serviceConfig = { serviceConfig = {
Type = "oneshot"; Type = "oneshot";
User = vars.user; User = mainUser;
Group = config.users.users.${vars.user}.group; Group = config.users.users.${mainUser}.group;
}; };
path = with pkgs; [ path = with pkgs; [

View file

@ -3,7 +3,9 @@
nms, nms,
pkgs, pkgs,
... ...
}: { }: let
inherit (config.vars) mainUser;
in {
imports = [nms.nixosModules.default]; imports = [nms.nixosModules.default];
services = { services = {
@ -13,7 +15,7 @@
modded-minecraft-servers = { modded-minecraft-servers = {
eula = true; eula = true;
user = config.vars.user; user = mainUser;
instances = let instances = let
jre8 = pkgs.temurin-bin-8; jre8 = pkgs.temurin-bin-8;

View file

@ -1,4 +1,6 @@
{config, ...}: { {config, ...}: let
inherit (config.vars) mainUser hostName;
in {
imports = [ imports = [
./hardware-configuration.nix ./hardware-configuration.nix
@ -15,13 +17,13 @@
]; ];
vars = { vars = {
user = "matt"; mainUser = "matt";
hostName = "wim"; hostName = "wim";
fontSize = 12.5; fontSize = 12.5;
mainMonitor = "eDP-1"; mainMonitor = "eDP-1";
}; };
users.users.${config.vars.user} = { users.users.${mainUser} = {
isNormalUser = true; isNormalUser = true;
extraGroups = [ extraGroups = [
"wheel" "wheel"
@ -32,7 +34,7 @@
"libvirtd" "libvirtd"
]; ];
}; };
home-manager.users .${config.vars.user} = { home-manager.users.${mainUser} = {
imports = [ imports = [
../../home/firefox ../../home/firefox
@ -45,7 +47,7 @@
}; };
networking = { networking = {
inherit (config.vars) hostName; inherit hostName;
networkmanager = { networkmanager = {
enable = true; enable = true;
wifi.backend = "wpa_supplicant"; wifi.backend = "wpa_supplicant";

View file

@ -1,5 +1,5 @@
{config, ...}: let {config, ...}: let
configDir = config.vars.configDir; inherit (config.vars) configDir;
symlink = config.lib.file.mkOutOfStoreSymlink; symlink = config.lib.file.mkOutOfStoreSymlink;
in { in {
xdg.configFile = { xdg.configFile = {

Binary file not shown.

BIN
flake.nix

Binary file not shown.

View file

@ -1,4 +1,6 @@
{config, ...}: { {config, ...}: let
inherit (config.vars) fontSize;
in {
programs.alacritty = { programs.alacritty = {
enable = true; enable = true;
settings = { settings = {
@ -37,7 +39,7 @@
family = "JetBrainsMono Nerd Font"; family = "JetBrainsMono Nerd Font";
style = "Italic"; style = "Italic";
}; };
size = config.vars.fontSize; size = fontSize;
}; };
# https://github.com/dracula/alacritty/blob/05faff15c0158712be87d200081633d9f4850a7d/dracula.yml # https://github.com/dracula/alacritty/blob/05faff15c0158712be87d200081633d9f4850a7d/dracula.yml

View file

@ -3,7 +3,9 @@
lib, lib,
config, config,
... ...
}: { }: let
inherit (config.vars) fontSize;
in {
home.pointerCursor = { home.pointerCursor = {
name = "Dracula-cursors"; name = "Dracula-cursors";
package = pkgs.dracula-theme; package = pkgs.dracula-theme;
@ -31,7 +33,7 @@
font = { font = {
name = "Sans Serif"; name = "Sans Serif";
size = config.vars.fontSize; size = fontSize;
}; };
}; };
@ -49,15 +51,15 @@
"${pkgs.dracula-theme}/xres"; "${pkgs.dracula-theme}/xres";
xdg.configFile = let xdg.configFile = let
fontSize = lib.strings.floatToString config.vars.fontSize; floatFont = lib.strings.floatToString fontSize;
qtconf = qtconf =
/* /*
ini ini
*/ */
'' ''
[Fonts] [Fonts]
fixed="Sans Serif,${fontSize},-1,5,50,0,0,0,0,0" fixed="Sans Serif,${floatFont},-1,5,50,0,0,0,0,0"
general="Sans Serif,${fontSize},-1,5,50,0,0,0,0,0" general="Sans Serif,${floatFont},-1,5,50,0,0,0,0,0"
[Appearance] [Appearance]
icon_theme=Flat-Remix-Violet-Dark icon_theme=Flat-Remix-Violet-Dark

View file

@ -4,11 +4,12 @@
pkgs, pkgs,
... ...
}: let }: let
inherit (config.vars) configDir mainUser;
isTouchscreen = config.hardware.sensor.iio.enable; isTouchscreen = config.hardware.sensor.iio.enable;
in { in {
services.upower.enable = true; services.upower.enable = true;
home-manager.users.${config.vars.user}.imports = [ home-manager.users.${mainUser}.imports = [
ags.homeManagerModules.default ags.homeManagerModules.default
({ ({
@ -21,7 +22,7 @@ in {
in { in {
programs.ags = { programs.ags = {
enable = true; enable = true;
configDir = symlink "${config.vars.configDir}/ags"; configDir = symlink "${configDir}/ags";
package = ags.packages.${pkgs.system}.default; package = ags.packages.${pkgs.system}.default;
extraPackages = with pkgs; [ extraPackages = with pkgs; [
libgudev libgudev

View file

@ -2,12 +2,14 @@
config, config,
pkgs, pkgs,
... ...
}: { }: let
inherit (config.vars) mainUser;
in {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
plasma5Packages.kio-admin plasma5Packages.kio-admin
]; ];
home-manager.users.${config.vars.user}.home.packages = with pkgs; home-manager.users.${mainUser}.home.packages = with pkgs;
[] []
++ (with pkgs.plasma5Packages; [ ++ (with pkgs.plasma5Packages; [
ark ark

View file

@ -5,6 +5,8 @@
... ...
}: }:
with lib; let with lib; let
inherit (config.vars) mainUser greetdDupe mainMonitor;
# Nix stuff # Nix stuff
isNvidia = config.hardware.nvidia.modesetting.enable; isNvidia = config.hardware.nvidia.modesetting.enable;
isTouchscreen = config.hardware.sensor.iio.enable; isTouchscreen = config.hardware.sensor.iio.enable;
@ -13,7 +15,7 @@ with lib; let
config config
.home-manager .home-manager
.users .users
.${config.vars.user} .${mainUser}
.wayland .wayland
.windowManager .windowManager
.hyprland .hyprland
@ -24,7 +26,7 @@ with lib; let
# Show Regreet on all monitors # Show Regreet on all monitors
dupeMonitors = pkgs.writeShellScriptBin "dupeMonitors" '' dupeMonitors = pkgs.writeShellScriptBin "dupeMonitors" ''
main="${config.vars.mainMonitor}" main="${mainMonitor}"
names=($(${hyprBin}/hyprctl -j monitors | ${pkgs.jq}/bin/jq -r '.[] .description')) names=($(${hyprBin}/hyprctl -j monitors | ${pkgs.jq}/bin/jq -r '.[] .description'))
if [[ "$main" == "null" ]]; then if [[ "$main" == "null" ]]; then
@ -44,8 +46,8 @@ with lib; let
# Check if user wants Regreet only on main monitor # Check if user wants Regreet only on main monitor
setupMonitors = setupMonitors =
if (config.vars.mainMonitor != "null" && !config.vars.greetdDupe) if (mainMonitor != "null" && !greetdDupe)
then "${hyprBin}/hyprctl dispatch focusmonitor ${config.vars.mainMonitor}" then "${hyprBin}/hyprctl dispatch focusmonitor ${mainMonitor}"
else "${dupeMonitors}/bin/dupeMonitors"; else "${dupeMonitors}/bin/dupeMonitors";
# Get css for regreet # Get css for regreet
@ -117,7 +119,7 @@ in {
initial_session = { initial_session = {
command = "${hyprBin}/Hyprland"; command = "${hyprBin}/Hyprland";
user = config.vars.user; user = mainUser;
}; };
}; };
}; };

View file

@ -8,6 +8,7 @@
}: }:
with lib; let with lib; let
# Config stuff # Config stuff
inherit (config.vars) configDir mainUser mainMonitor;
isNvidia = config.hardware.nvidia.modesetting.enable; isNvidia = config.hardware.nvidia.modesetting.enable;
isTouchscreen = config.hardware.sensor.iio.enable; isTouchscreen = config.hardware.sensor.iio.enable;
in { in {
@ -39,7 +40,7 @@ in {
}; };
# HOME-MANAGER CONFIG # HOME-MANAGER CONFIG
home-manager.users.${config.vars.user} = { home-manager.users.${mainUser} = {
imports = [ imports = [
../../home/alacritty.nix ../../home/alacritty.nix
../../home/dconf.nix ../../home/dconf.nix
@ -105,7 +106,7 @@ in {
]; ];
input = let input = let
xserver = config.services.xserver; inherit (config.services) xserver;
in { in {
kb_layout = xserver.layout; kb_layout = xserver.layout;
kb_variant = xserver.xkbVariant; kb_variant = xserver.xkbVariant;
@ -124,8 +125,8 @@ in {
"kdeconnect-indicator" "kdeconnect-indicator"
"gnome-keyring-daemon --start --components=secrets" "gnome-keyring-daemon --start --components=secrets"
] ]
++ optionals (! isNull config.vars.mainMonitor) ++ optionals (! isNull mainMonitor)
["hyprctl dispatch focusmonitor ${config.vars.mainMonitor}"]; ["hyprctl dispatch focusmonitor ${mainMonitor}"];
windowrule = [ windowrule = [
"noborder,^(wofi)$" "noborder,^(wofi)$"
@ -209,7 +210,7 @@ in {
special_scale_factor = 0.8; special_scale_factor = 0.8;
}; };
source = ["${config.vars.configDir}/hypr/main.conf"]; source = ["${configDir}/hypr/main.conf"];
}; };
}; };

View file

@ -1,4 +1,6 @@
{config, ...}: { {config, ...}: let
inherit (config.vars) hostName mainUser;
in {
services = { services = {
tailscale = { tailscale = {
enable = true; enable = true;
@ -10,9 +12,7 @@
}; };
}; };
home-manager.users.${config.vars.user} = let home-manager.users.${mainUser} = {
hostName = config.vars.hostName;
in {
programs.bash.shellAliases = { programs.bash.shellAliases = {
tup = "tailscale up --login-server https://headscale.nelim.org"; tup = "tailscale up --login-server https://headscale.nelim.org";

View file

@ -1,5 +1,11 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Deps:
# - nurl
# - jq
# - mozilla-addons-to-nix
# - alejandra
parseNurl() { parseNurl() {
REV=$(nurl -j "$1" | jq '.["args"].["rev"]') REV=$(nurl -j "$1" | jq '.["args"].["rev"]')
HASH=$(nurl -j "$1" | jq '.["args"].["hash"]') HASH=$(nurl -j "$1" | jq '.["args"].["hash"]')
@ -22,7 +28,7 @@ parseFetchurl() {
} }
updateFFZ() { updateFFZ() {
FILE="/home/matt/.nix/home/firefox/addons/default.nix" FILE="$FLAKE/home/firefox/addons/default.nix"
URL="https://cdn.frankerfacez.com/script/frankerfacez-4.0-an+fx.xpi" URL="https://cdn.frankerfacez.com/script/frankerfacez-4.0-an+fx.xpi"
parseFetchurl "$URL" "$FILE" parseFetchurl "$URL" "$FILE"
@ -31,20 +37,22 @@ updateFFZ() {
updateFirefoxAddons() { updateFirefoxAddons() {
echo "Updating firefox addons using mozilla-addons-to-nix" echo "Updating firefox addons using mozilla-addons-to-nix"
(cd /home/matt/.nix/home/firefox/addons || return; (
cd "$FLAKE/home/firefox/addons" || return;
file=generated-firefox-addons.nix file=generated-firefox-addons.nix
if [[ -f $file ]]; then if [[ -f $file ]]; then
printf "\nOld versions: \n" printf "\nOld versions: \n"
grep -A 1 --no-group-separator 'pname' "$file" | grep -A 1 --no-group-separator 'pname' "$file" |
awk '{ gsub(/"/, ""); gsub(/;/, ""); print $3 }' | awk '{ gsub(/"/, ""); gsub(/;/, ""); print $3 }' |
awk 'NR%2{printf $0" version ";next;}1' | paste -sd'\n' - awk 'NR%2{printf $0" version ";next;}1' | paste -sd'\n' -
printf "\nNew versions: \n" printf "\nNew versions: \n"
fi fi
mozilla-addons-to-nix addons.json generated-firefox-addons.nix) mozilla-addons-to-nix addons.json generated-firefox-addons.nix
)
} }
@ -58,4 +66,4 @@ doAll() {
[[ "$1" == "-f" || "$1" == "--firefox" ]] && updateFirefoxAddons [[ "$1" == "-f" || "$1" == "--firefox" ]] && updateFirefoxAddons
[[ "$1" == "-ffz" || "$1" == "--frankerfacez" ]] && updateFFZ [[ "$1" == "-ffz" || "$1" == "--frankerfacez" ]] && updateFFZ
alejandra /home/matt/.nix alejandra "$FLAKE"