Recursive update

This commit is contained in:
Filippo Berto 2022-06-29 09:34:43 +02:00
parent 8592e99bf3
commit c741cd7201
4 changed files with 51 additions and 46 deletions

View file

@ -1,4 +1,5 @@
{ config, pkgs, ... }:
{ config, pkgs, lib, ... }:
with lib;
let
inherit (pkgs.rice) colorPalette opacity;
grep = "${pkgs.gnugrep}/bin/grep";
@ -110,7 +111,7 @@ in
screenchange-reload = false;
};
"bar/primary" = commonBar // {
"bar/primary" = recursiveUpdate commonBar {
modules-left = "bspwm";
# modules-center =
modules-right = "player pulseaudio temperature cpu memory battery date powermenu";
@ -121,7 +122,7 @@ in
};
};
"bar/secondary" = commonBar // {
"bar/secondary" = recursiveUpdate commonBar {
modules-left = "bspwm";
# modules-center =
modules-right = "player pulseaudio temperature cpu memory battery date powermenu";
@ -147,9 +148,9 @@ in
};
format = {
charging = colors.selected // { text = "<animation-charging> <label-charging>"; };
discharging = colors.active // { text = "<animation-discharging> <label-discharging>"; };
full = colors.normal // { text = " <label-full>"; };
charging = recursiveUpdate colors.selected { text = "<animation-charging> <label-charging>"; };
discharging = recursiveUpdate colors.active { text = "<animation-discharging> <label-discharging>"; };
full = recursiveUpdate colors.normal { text = " <label-full>"; };
};
label.text = "%percentage%%";
@ -173,18 +174,16 @@ in
};
in
{
focused = colors.selected // common;
occupied = colors.active // common;
urgent = colors.active // common // { background = colors.alert; };
empty = colors.normal // common // { text = "󰧟"; padding = 0; };
focused = recursiveUpdate colors.selected common;
occupied = recursiveUpdate colors.active common;
urgent = recursiveUpdate (recursiveUpdate colors.active common) { background = colors.alert; };
empty = recursiveUpdate (recursiveUpdate colors.normal common) { text = "󰧟"; padding = 0; };
};
};
"module/cpu" = {
type = "internal/cpu";
format = colors.normal // {
text = " <label>";
};
format = recursiveUpdate colors.normal { text = " <label>"; };
interval = 2;
label = "%percentage-sum%%";
ramp-load = ramp;
@ -207,9 +206,7 @@ in
"module/memory" = {
type = "internal/memory";
format = colors.normal // {
text = " <label>";
};
format = recursiveUpdate colors.normal { text = " <label>"; };
interval = 2;
label = "%percentage_used%%";
ramp-used = ramp;
@ -237,7 +234,7 @@ in
format = {
padding = 1;
muted = colors.active;
volume = colors.normal // { text = "<ramp-volume> <label-volume>"; };
volume = recursiveUpdate colors.normal { text = "<ramp-volume> <label-volume>"; };
};
label.muted.text = " muted";
label.volume.text = "%percentage%%";
@ -246,7 +243,7 @@ in
};
"module/temperature" = {
format = colors.normal // {
format = recursiveUpdate colors.normal {
text = "<ramp> <label>";
warn = {
text = "<ramp> <label-warn>";
@ -272,8 +269,8 @@ in
suffix = " ";
};
label = {
open = colors.normal // { text = " "; };
close = colors.normal // { text = "Cancel"; };
open = recursiveUpdate colors.normal { text = " "; };
close = recursiveUpdate colors.normal { text = "Cancel"; };
separator = { text = "|"; };
};
menu = [
@ -300,7 +297,7 @@ in
"module/player" = {
type = "custom/script";
format = colors.normal // { padding = 0; };
format = recursiveUpdate colors.normal { padding = 0; };
exec = playerStatus;
click.left = "${playerCtl} play-pause";
scroll = {

View file

@ -1,5 +1,5 @@
{ config, pkgs, lib, ... }:
with lib;
{
boot = {
binfmt.emulatedSystems = [ "armv7l-linux" "aarch64-linux" ];
@ -78,7 +78,7 @@
dbus.packages = with pkgs; [ dconf ];
fail2ban = { enable = true; bantime-increment.enable = true; };
gnome.gnome-keyring.enable = true;
gvfs = { enable = true; package = lib.mkForce pkgs.gnome3.gvfs; };
gvfs = { enable = true; package = mkForce pkgs.gnome3.gvfs; };
jackett = { enable = true; openFirewall = true; group = "users"; };
jellyfin = { enable = true; openFirewall = true; group = "users"; };
logind.lidSwitch = "ignore";
@ -109,19 +109,19 @@
"force group" = "users";
}; in
{
bertof = common // {
bertof = recursiveUpdate common {
path = "/mnt/raid0/bertof";
comment = "Bertof samba share";
"force user" = "bertof";
"valid users" = "bertof";
};
tiziano = common // {
tiziano = recursiveUpdate common {
path = "/mnt/raid0/tiziano";
comment = "Tiziano samba share";
"force user" = "tiziano";
"valid users" = "tiziano";
};
condiviso = common // {
condiviso = recursiveUpdate common {
path = "/mnt/raid0/condiviso";
comment = "Samba share condiviso";
"valid users" = "bertof tiziano";
@ -130,19 +130,19 @@
"force create mode" = "0660";
"force directory mode" = "2770";
};
bertof_safe = common // {
bertof_safe = recursiveUpdate common {
path = "/mnt/raid1/bertof";
comment = "Bertof samba share";
"force user" = "bertof";
"valid users" = "bertof";
};
tiziano_safe = common // {
tiziano_safe = recursiveUpdate common {
path = "/mnt/raid1/tiziano";
comment = "Tiziano samba share";
"force user" = "tiziano";
"valid users" = "tiziano";
};
condiviso_safe = common // {
condiviso_safe = recursiveUpdate common {
path = "/mnt/raid1/condiviso";
comment = "Samba share condiviso";
"valid users" = "bertof tiziano";
@ -239,13 +239,18 @@
systemd.packages = with pkgs; [ syncthing ];
systemd.services = let common = {
documentation = [ "man:syncthing(1)" ];
startLimitIntervalSec = 60;
startLimitBurst = 4;
after = [ "network.target" ];
environment = { STNORESTART = "yes"; STNOUPGRADE = "yes"; };
wantedBy = [ "default.target" ];
serviceConfig = {
Restart = "on-failure";
SuccessExitStatus = "2 3 4";
RestartSec = 1;
SuccessExitStatus = "3 4";
RestartForceExitStatus = "3 4";
Group = config.ids.gids.users;
MemoryDenyWriteExecute = true;
NoNewPrivileges = true;
@ -264,13 +269,13 @@
};
}; in
{
syncthing-bertof = common // {
syncthing-bertof = recursiveUpdate common {
description = "Syncthing service bertof";
serviceConfig = common.serviceConfig // { User = "bertof"; ExecStart = "${pkgs.syncthing}/bin/syncthing -no-browser -gui-address=0.0.0.0:8384 -home=/mnt/raid0/bertof/Syncthing/.config"; };
serviceConfig = { User = "bertof"; ExecStart = "${pkgs.syncthing}/bin/syncthing -no-browser -gui-address=0.0.0.0:8384 -home=/mnt/raid0/bertof/Syncthing/.config"; };
};
syncthing-tiziano = common // {
syncthing-tiziano = recursiveUpdate common {
description = "Syncthing service tiziano";
serviceConfig = common.serviceConfig // { User = "tiziano"; ExecStart = "${pkgs.syncthing}/bin/syncthing -no-browser -gui-address=0.0.0.0:8385 -home=/mnt/raid0/tiziano/Syncthing/.config"; };
serviceConfig = { User = "tiziano"; ExecStart = "${pkgs.syncthing}/bin/syncthing -no-browser -gui-address=0.0.0.0:8385 -home=/mnt/raid0/tiziano/Syncthing/.config"; };
};
};
@ -324,7 +329,7 @@
nixpkgs.config.allowUnfree = true;
nix = {
package = pkgs.nixFlakes;
extraOptions = lib.optionalString (config.nix.package == pkgs.nixFlakes)
extraOptions = optionalString (config.nix.package == pkgs.nixFlakes)
"experimental-features = nix-command flakes";
gc.automatic = true;
};

View file

@ -1,4 +1,6 @@
{ config, pkgs, lib, ... }: {
{ config, pkgs, lib, ... }:
with lib;
{
# Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true;
@ -150,15 +152,15 @@
common = { extraConfig = bertofExtraConfig; };
in
{
bertof_home = common // { subvolume = "/home/bertof"; };
bertof_music = common // { subvolume = "/home/bertof/Musica"; };
bertof_downloads = common // { subvolume = "/home/bertof/Scaricati"; };
bertof_images = common // { subvolume = "/home/bertof/Immagini"; };
bertof_videos = common // { subvolume = "/home/bertof/Video"; };
bertof_documents = common // { subvolume = "/home/bertof/Documenti"; };
bertof_games_ssd = common // { subvolume = "/home/bertof/Giochi/SSD"; };
# bertof_games_hdd = common // { subvolume = "/home/bertof/Giochi/HDD"; };
bertof_git = common // { subvolume = "/home/bertof/Documenti/Git"; };
bertof_home = recursiveUpdate common { subvolume = "/home/bertof"; };
bertof_music = recursiveUpdate common { subvolume = "/home/bertof/Musica"; };
bertof_downloads = recursiveUpdate common { subvolume = "/home/bertof/Scaricati"; };
bertof_images = recursiveUpdate common { subvolume = "/home/bertof/Immagini"; };
bertof_videos = recursiveUpdate common { subvolume = "/home/bertof/Video"; };
bertof_documents = recursiveUpdate common { subvolume = "/home/bertof/Documenti"; };
bertof_games_ssd = recursiveUpdate common { subvolume = "/home/bertof/Giochi/SSD"; };
# bertof_games_hdd = recursiveUpdate common { subvolume = "/home/bertof/Giochi/HDD"; };
bertof_git = recursiveUpdate common { subvolume = "/home/bertof/Documenti/Git"; };
};
};

View file

@ -1,4 +1,5 @@
{ config, pkgs, ... }:
with lib;
{
boot = {
binfmt.emulatedSystems = [ "armv7l-linux" "aarch64-linux" ];
@ -110,7 +111,7 @@
};
in
{
bertof_home = common // { subvolume = "/home/bertof"; };
bertof_home = recursiveUpdate common { subvolume = "/home/bertof"; };
};
};
thermald.enable = true;