[WIP] Several changes

- `foot` fonts and background color
- `helix` editor
- `pass` related aliases in shell
- `nix-index` automatic update
- `sway`/`waybar` changes
-  new `beebox` host
- `kodi` module
- `coredns` for `hs`
This commit is contained in:
Andrea Ciceri 2022-10-18 10:55:48 +02:00
parent 859896c9b2
commit 759b200b45
No known key found for this signature in database
GPG key ID: A1FC89532D1C5654
14 changed files with 313 additions and 41 deletions

View file

@ -9,17 +9,18 @@
settings = { settings = {
main = { main = {
term = "xterm-256color"; term = "xterm-256color";
login-shell = "yes";
font = "Fira Code:size=11"; font = "Fira Code,Symbols Nerd Font,JoyPixels";
dpi-aware = "yes"; dpi-aware = "yes";
}; };
mouse = { mouse = {
hide-when-typing = "yes"; hide-when-typing = "yes";
}; };
};
};
# without `--login-shell` PATH isn't well configured (it's inherited from the "systemd shell") colors = {
systemd.user.services.foot.Service.ExecStart = lib.mkForce "${config.programs.foot.package}/bin/foot --server --login-shell"; background = "282C34";
};
};
};
} }

View file

@ -0,0 +1,21 @@
{
config,
lib,
pkgs,
...
}: {
programs.helix = {
enable = true;
settings = {
theme = "onedark";
editor = {
indent-guides.render = true;
cursor-shape = {
insert = "bar";
normal = "block";
select = "underline";
};
};
};
};
}

View file

@ -62,6 +62,8 @@
"cat" = "bat"; "cat" = "bat";
"emw" = "emacsclient -c"; "emw" = "emacsclient -c";
"emnw" = "emacsclient -c -nw"; "emnw" = "emacsclient -c -nw";
"pass-clone" = "[ -d .password-store ] && echo 'Password store archive already exists' || git clone git@git.sr.ht:~zrsk/pass ~/.password-store";
"getpass" = "pass show $(find .password-store/ -name \"*.gpg\" | sed \"s/\\.password-store\\/\\(.*\\)\\.gpg$/\\1/g\" | fzf) | wl-copy; ((sleep 60 && wl-copy --clear) &)";
}; };
localVariables = { localVariables = {
PASSWORD_STORE_DIR = "/home/ccr/.password-store"; PASSWORD_STORE_DIR = "/home/ccr/.password-store";
@ -83,5 +85,27 @@
enableZshIntegration = true; enableZshIntegration = true;
}; };
systemd.user.services.nix-index-update = {
Unit = {Description = "Update nix-index";};
Service = {
CPUSchedulingPolicy = "idle";
IOSchedulingClass = "idle";
ExecStart = "${pkgs.nix-index}/bin/nix-index --path ${config.programs.password-store.settings.PASSWORD_STORE_DIR}";
};
};
systemd.user.timers.nix-index-update = {
Unit = {Description = "Update nix-index";};
Timer = {
Unit = "nix-index-update.service";
OnCalendar = "OnCalendar=monday *-*-* 10:00:00";
Persistent = true;
};
Install = {WantedBy = ["timers.target"];};
};
home.packages = with pkgs; [thefuck]; home.packages = with pkgs; [thefuck];
} }

View file

@ -22,7 +22,7 @@
gtk = { gtk = {
enable = true; enable = true;
font.name = "DejaVu Sans"; font.name = "Fira Code,Symbols Nerd Font";
iconTheme = { iconTheme = {
name = "Adwaita"; name = "Adwaita";
package = pkgs.gnome.adwaita-icon-theme; package = pkgs.gnome.adwaita-icon-theme;

View file

@ -1,6 +1,6 @@
* { * {
border: none; border: none;
font-family: "Fira Code"; font-family: "Fira Code, Symbols Nerd Font";
font-weight: bold; font-weight: bold;
font-size: 9pt; font-size: 9pt;
min-height: 0; min-height: 0;

View file

@ -15,13 +15,13 @@
modules-center = ["sway/window"]; modules-center = ["sway/window"];
modules-right = [ modules-right = [
"tray" "tray"
"pulseaudio"
"network" "network"
"cpu" "cpu"
"memory" "memory"
"pulseaudio" "temperature"
"clock"
"backlight"
"battery" "battery"
"clock"
]; ];
"sway/workspaces" = { "sway/workspaces" = {
@ -32,36 +32,61 @@
"sway/mode" = {tooltip = false;}; "sway/mode" = {tooltip = false;};
"sway/window" = {max_length = 50;}; "sway/window" = {max_length = 50;};
tray = {
pulseaudio = { spacing = "1px";
format = "vol {volume}%";
on-click-middle = "${pkgs.sway}/bin/swaymsg exec \"${pkgs.pavucontrol}/bin/pavucontrol\"";
}; };
network = {
format-wifi = "{essid} {signalStrength}% {bandwidthUpBits} {bandwidthDownBits}";
format-ethernet = "{ifname} eth {bandwidthUpBits} {bandwidthDownBits}";
};
cpu = {
interval = 2;
format = "{icon} {usage}";
};
memory.format = "mem {}%";
backlight = {
format = "nit {percent}%";
on-scroll-up = "${pkgs.brightnessctl}/bin/brightnessctl s +5%";
on-scroll-down = "${pkgs.brightnessctl}/bin/brightnessctl s 5%-";
};
tray.spacing = 10;
clock.format = "{:%a %b %d %H:%M}";
battery = { battery = {
format = "bat {}"; format = "{capacity}% {icon}";
format-alt = "{time} {icon}";
format-charging = "{capacity}% ";
format-icons = ["" "" "" "" ""];
format-plugged = "{capacity}% ";
states = {
critical = 15;
warning = 30;
};
};
clock = {
format-alt = "{:%Y-%m-%d}";
tooltip-format = "{:%Y-%m-%d | %H:%M}";
};
cpu = {
format = "{usage}% ";
tooltip = false;
};
memory = {format = "{}% ";};
network = {
interval = 1;
format-alt = "{ifname}: {ipaddr}/{cidr}";
format-disconnected = "Disconnected ";
format-ethernet = "{ifname}: {ipaddr}/{cidr} up: {bandwidthUpBits} down: {bandwidthDownBits}";
format-linked = "{ifname} (No IP) ";
format-wifi = "{essid} ({signalStrength}%) ";
};
pulseaudio = {
format = "{volume}% {icon} {format_source}";
format-bluetooth = "{volume}% {icon} {format_source}";
format-bluetooth-muted = " {icon} {format_source}";
format-icons = {
car = "";
default = ["" "" ""];
handsfree = "";
headphones = "";
headset = "";
phone = "";
portable = "";
};
format-muted = " {format_source}";
format-source = "{volume}% ";
format-source-muted = "";
on-click = "${pkgs.pavucontrol}/bin/pavucontrol";
};
"sway/mode" = {format = ''<span style="italic">{}</span>'';};
temperature = {
critical-threshold = 80;
format = "{temperatureC}°C {icon}";
format-icons = ["" "" ""];
hwmon-path = "/sys/class/thermal/thermal_zone4/temp";
}; };
}; };
}; };

23
hosts/beebox/default.nix Normal file
View file

@ -0,0 +1,23 @@
{
fleetModules,
pkgs,
lib,
...
}: {
imports =
[
./hardware-configuration.nix
]
++ fleetModules [
"common"
"ssh"
"ccr"
"audio"
"dbus"
"bluetooth"
"kodi"
"udisks2"
];
ccr.enable = true;
}

View file

@ -0,0 +1,60 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{
config,
lib,
pkgs,
modulesPath,
...
}: {
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = ["ahci" "xhci_pci" "usb_storage" "usbhid" "sd_mod"];
boot.initrd.kernelModules = [];
boot.kernelModules = ["kvm-intel"];
boot.extraModulePackages = [];
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
fileSystems."/" = {
device = "/dev/disk/by-label/nixos";
fsType = "f2fs";
};
fileSystems."/boot" = {
device = "/dev/disk/by-label/boot";
fsType = "vfat";
};
swapDevices = [
{device = "/dev/disk/by-label/swap";}
];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking = {
useDHCP = false;
interfaces.wlp1s0.useDHCP = true;
networkmanager.enable = true;
};
# networking.interfaces.enp2s0.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp1s0.useDHCP = lib.mkDefault true;
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
hardware.opengl = {
enable = true;
extraPackages = with pkgs; [
intel-media-driver # LIBVA_DRIVER_NAME=iHD
vaapiIntel # LIBVA_DRIVER_NAME=i965 (older but works better for Firefox/Chromium)
vaapiVdpau
libvdpau-va-gl
];
};
}

View file

@ -2,6 +2,7 @@
fleetModules, fleetModules,
pkgs, pkgs,
lib, lib,
config,
... ...
}: { }: {
imports = imports =
@ -128,7 +129,7 @@
transmission = { transmission = {
enable = true; enable = true;
# the following json is merged to this attrset, it must have `rpc-username` and `rpc-password` # following json is merged to this attrset, it must have `rpc-username` and `rpc-password`
credentialsFile = "/mnt/archivio/transmission/credentials.json"; credentialsFile = "/mnt/archivio/transmission/credentials.json";
settings = { settings = {
download-dir = "/mnt/archivio/transmission/"; download-dir = "/mnt/archivio/transmission/";
@ -295,11 +296,13 @@
4712 # amule 4712 # amule
4711 # amule web gui 4711 # amule web gui
8384 # syncthing 8384 # syncthing
53 # dns
]; ];
allowedUDPPorts = [ allowedUDPPorts = [
137 # samba 137 # samba
138 # samba 138 # samba
51820 # wireguard 51820 # wireguard
53 # dns
]; ];
}; };
@ -360,4 +363,35 @@
}; };
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
# TODO move away
networking.nameservers = [
# https://libreops.cc/radicaldns.html
"88.198.92.222"
"192.71.166.92"
];
#environment.etc."coredns/blocklist.hosts".source = ../blocklist.hosts;
services.coredns = {
enable = true;
config = ''
. {
# RadicalDNS Forwarding
forward . 88.198.92.222 192.71.166.92
cache
}
ccr.ydns.eu {
template IN A {
answer "{{ .Name }} 0 IN A 192.168.1.33"
}
}
*.ccr.ydns.eu {
template IN A {
answer "{{ .Name }} 0 IN A 192.168.1.33"
}
}
'';
};
} }

View file

@ -50,6 +50,7 @@
"discord" "discord"
"cura" "cura"
"xdg" "xdg"
"helix"
]; ];
packages = with pkgs; [ packages = with pkgs; [
comma comma

View file

@ -1,9 +1,10 @@
{pkgs, ...}: { {pkgs, ...}: {
fonts = { fonts = {
fonts = with pkgs; [powerline-fonts dejavu_fonts fira-code fira-code-symbols emacs-all-the-icons-fonts]; fonts = with pkgs; [powerline-fonts dejavu_fonts fira-code fira-code-symbols emacs-all-the-icons-fonts nerdfonts joypixels];
fontconfig.defaultFonts = { fontconfig.defaultFonts = {
monospace = ["DejaVu Sans Mono for Powerline"]; monospace = ["DejaVu Sans Mono for Powerline"];
sansSerif = ["DejaVu Sans"]; sansSerif = ["DejaVu Sans"];
}; };
}; };
nixpkgs.config.joypixels.acceptLicense = true;
} }

78
modules/kodi/default.nix Normal file
View file

@ -0,0 +1,78 @@
{
config,
lib,
pkgs,
...
}: {
services.xserver = {
enable = true;
desktopManager.kodi = {
enable = true;
package = pkgs.kodi.withPackages (ps:
with ps; [
joystick
youtube
libretro
libretro-mgba
]);
};
displayManager.autoLogin = {
enable = true;
user = "kodi";
};
};
users.extraUsers.kodi = {
isNormalUser = true;
uid = 1002;
};
networking.firewall = {
allowedTCPPorts = [8080];
allowedUDPPorts = [8080];
};
environment.systemPackages = with pkgs; [xboxdrv cifs-utils];
fileSystems."/mnt/film" = {
device = "//ccr.ydns.eu/film";
fsType = "cifs";
options = let
credentials = pkgs.writeText "credentials" ''
username=guest
password=
'';
in ["credentials=${credentials},x-systemd.automount,noauto,x-systemd.idle-timeout=60,x-systemd.device-timeout=5s,x-systemd.mount-timeout=5s"];
};
fileSystems."/mnt/archivio" = {
device = "//ccr.ydns.eu/archivio";
fsType = "cifs";
options = let
credentials = pkgs.writeText "credentials" ''
username=guest
password=
'';
in ["credentials=${credentials},x-systemd.automount,noauto,x-systemd.idle-timeout=60,x-systemd.device-timeout=5s,x-systemd.mount-timeout=5s"];
};
systemd.services.xboxdrv = {
wantedBy = ["multi-user.target"];
after = ["network.target"];
serviceConfig = {
Type = "forking";
User = "root";
ExecStart = ''${pkgs.xboxdrv}/bin/xboxdrv --daemon --detach --pid-file /var/run/xboxdrv.pid --dbus disabled --silent --deadzone 4000 --deadzone-trigger 10% --mimic-xpad-wireless'';
};
};
services.xserver.config = ''
Section "InputClass"
Identifier "joystick catchall"
MatchIsJoystick "on"
MatchDevicePath "/dev/input/event*"
Driver "evdev"
Option "StartKeysEnabled" "False"
Option "StartMouseEnabled" "False"
EndSection
'';
boot.blacklistedKernelModules = ["xpad"];
}

View file

@ -41,7 +41,7 @@
system.activationScripts = { system.activationScripts = {
populate-netrc.text = '' populate-netrc.text = ''
cat <<EOF> /etc/nix/netrc cat <<EOF> /etc/nix/netrc
machine mlabs.cachix.org login "" password "$(cat ${config.age.secrets.mlabs-cachix.path})" machine mlabs.cachix.org login x password "$(cat ${config.age.secrets.mlabs-cachix.path})"
EOF EOF
''; '';
}; };

View file

@ -64,6 +64,10 @@
system = supportedSystems.aarch64-linux; system = supportedSystems.aarch64-linux;
modules = ["${nixosHardware}/pine64/pinebook-pro"]; modules = ["${nixosHardware}/pine64/pinebook-pro"];
}; };
beebox = mkConfiguration {
name = "beebox";
system = supportedSystems.x86_64-linux;
};
}; };
mkVmApp = system: configuration: let mkVmApp = system: configuration: let