feat: fighter config

This commit is contained in:
Guz
2024-09-02 09:43:55 -03:00
parent 478a582bbf
commit b3d3e9a968
13 changed files with 484 additions and 36 deletions

View File

@@ -59,6 +59,10 @@
echo $rain
fi
'';
eww-battery = pkgs.writeShellScriptBin "eww-battery" ''
BAT="$(ls /sys/class/power_supply | grep BAT | head -n 1)"
cat "/sys/class/power_supply/$BAT/capacity"
'';
in {
imports = [];
options = {};
@@ -89,6 +93,9 @@ in {
"${eww-weather}/bin/eww-weather --precipitation")
(defpoll rain :interval "15m" :initial "00.0"
"${eww-weather}/bin/eww-weather --rain")
(defpoll battery :interval "1s"
"${eww-battery}/bin/eww-battery")
'';
home.file."${ewwDir}/vars.scss".text = ''

View File

@@ -69,3 +69,7 @@ tooltip {
}
}
}
.bar-full-volume-align {
margin-left: 10px;
}

View File

@@ -16,7 +16,6 @@
:initial "00/00"
`date +%d/%m`)
(defwidget empty [] "")
(defwidget day []
@@ -33,12 +32,12 @@
:tooltip "${value-text != "" ? value-text : value}"
:space-evenly false
:class "metric"
(box :orientation "h"
(box :orientation "h"
:class "label"
(eventbox :active {onclick != ""}
:width 15
(eventbox :active {onclick != ""}
:width 15
:cursor "pointer"
:onclick onclick
:onclick onclick
label))
(scale :min 0
:max 101
@@ -95,8 +94,8 @@
:halign "end"
:class "leftstuff"
:space-evenly false
(metric :label volume-label
:value volume
(metric :label volume-label
:value volume
:value-text "${volume-label} Volume ${volume}%"
:onclick volume-toggle
:onchange volume-set)))))
@@ -121,13 +120,13 @@
:halign "start"
:class "rightstuff"
(metric :label ""
:value "${EWW_RAM.used_mem_perc}"
:value "${EWW_RAM.used_mem_perc}"
:value-text " Ram ${round(EWW_RAM.used_mem_perc, 2)}%")
(metric :label ""
:value "${EWW_CPU.avg}"
:value "${EWW_CPU.avg}"
:value-text " CPU ${round(EWW_CPU.avg, 2)}%")
(metric :label "󰨣"
:value "${EWW_DISK["/"].used_perc}"
:value "${EWW_DISK["/"].used_perc}"
:value-text "󰨣 Disk ${round(EWW_DISK["/"].used_perc, 2)}%")
(empty)
(empty))
@@ -136,10 +135,10 @@
:class "middlestuff"
:space-evenly false
(box :class "season"
(season))
(season))
(label :tooltip "󱣖 ${temperature}°C -  ${wind}km/h"
:class "temperature"
:text "${round(temperature, 0)}󰔄")
:text "${round(temperature, 0)}󰔄")
(label :tooltip "󰖗 ${rain}mm - 󰖌 ${precipitation}mm"
:class "rain"
:text "${round(precipitation, 2)}mm"))
@@ -149,3 +148,52 @@
(empty)
(workspaces :workspace "${active-workspace - 5}")))))
(defwindow bar-full
:monitor 0
:geometry (geometry :x "0%"
:y "0%"
:width "100%"
:height "20px"
:anchor "top center")
:stacking "fg"
:reserve (struts :distance "40px" :side "top")
:windowtype "dock"
:wm-ignore false
:exclusive true
(box :orientation "h"
:class "wrapper"
(centerbox :orientation "h"
:class "bar"
(box :orientation "h"
:halign "start"
:class "rightstuff"
(workspaces :workspace active-workspace)
(box :orientation "h"
:halign "start"
:class "bar-full-volume-align"
(metric :label volume-label
:value volume
:value-text "${volume-label} Volume ${volume}%"
:onclick volume-toggle
:onchange volume-set))
(metric :label "󰂄"
:value "${battery}"
:value-text "󰂄 Battery ${battery}%"))
(box :orientation "h"
:halign "center"
:class "middlestuff"
(day)
(season))
(box :orientation "h"
:halign "end"
:class "leftstuff"
:space-evenly false
(metric :label ""
:value "${EWW_RAM.used_mem_perc}"
:value-text " Ram ${round(EWW_RAM.used_mem_perc, 2)}%")
(metric :label ""
:value "${EWW_CPU.avg}"
:value-text " CPU ${round(EWW_CPU.avg, 2)}%")
(metric :label "󰨣"
:value "${EWW_DISK["/"].used_perc}"
:value-text "󰨣 Disk ${round(EWW_DISK["/"].used_perc, 2)}%")))))

View File

@@ -85,7 +85,6 @@
blender
vesktop
gimp
pureref
gamemode
lutris
pavucontrol

View File

@@ -0,0 +1,139 @@
{
config,
inputs,
pkgs,
...
}: {
imports = [
inputs.dot013-environment.nixosModules.default
../../modules/nixos
./hardware-configuration.nix
./secrets.nix
];
dot013.environment.enable = true;
dot013.environment.interception-tools.device = "/dev/input/by-path/platform-i8042-serio-0-event-kbd";
programs.nh.enable = true;
programs.nh.flake = "/home/guz/nix";
profiles.locale.enable = true;
virtualisation.docker.enable = true;
programs.dconf.enable = true;
programs.hyprland.enable = true;
programs.gnupg.agent = {
enable = true;
pinentryPackage = pkgs.pinentry-gnome3;
settings = {
default-cache-ttl = 3600 * 24;
};
};
services.xserver = {
enable = true;
};
services.displayManager = {
sddm.enable = true;
sddm.wayland.enable = true;
};
services.flatpak.enable = true;
xdg.portal.enable = true;
xdg.portal.extraPortals = with pkgs; [
xdg-desktop-portal-gtk
];
services.tailscale = {
enable = true;
tailnetName = "kiko-liberty";
};
fonts.fontconfig.enable = true;
fonts.packages = with pkgs; [
fira-code
(nerdfonts.override {fonts = ["FiraCode"];})
];
home-manager-helper.enable = true;
home-manager-helper.users."guz" = {
name = "guz";
shell = pkgs.zsh;
hashedPasswordFile = builtins.toString config.sops.secrets."guz/password".path;
home = import ./home.nix;
isNormalUser = true;
extraGroups = ["wheel" "networkmanager" "plugdev"];
};
environment.systemPackages = with pkgs; [
git
libinput
polkit_gnome
];
hardware.bluetooth.enable = true;
hardware.bluetooth.powerOnBoot = true;
services.blueman.enable = true;
# hardware.pulseaudio.enable = true;
nix.settings.experimental-features = ["nix-command" "flakes"];
nix.package = pkgs.nixVersions.nix_2_21;
networking = {
networkmanager.enable = true;
hostName = "fighter";
wireless.enable = false;
dhcpcd.enable = true;
defaultGateway = "192.168.1.1";
interfaces."enp6s0".ipv4.addresses = [
{
address = "192.168.1.7";
prefixLength = 24;
}
];
nameservers = ["8.8.8.8" "1.1.1.1"];
};
# Enable sound with pipewire.
sound.enable = true;
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
# If you want to use JACK applications, uncomment this
#jack.enable = true;
# use the example session manager (no others are packaged yet so this is enabled by default,
# no need to redefine it in your config for now)
#media-session.enable = true;
};
# Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
# Enable the OpenSSH daemon.
services.openssh.enable = true;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "23.11"; # Did you read the comment?
}

50
hosts/fighter/desktop.nix Normal file
View File

@@ -0,0 +1,50 @@
{
config,
pkgs,
lib,
...
}: let
wallpaper = ../../static/guz-wallpaper-default.png;
desktop-boot = pkgs.writeShellScriptBin "desktop-boot" ''
function eww() { ${config.programs.eww.package}/bin/eww "$@"; }
function swww() { ${pkgs.swww}/bin/swww "$@"; }
function swww-daemon() { ${pkgs.swww}/bin/swww-daemon "$@"; }
if [[ "$(eww ping)" -ne "pong" ]]; then
eww daemon &> /dev/null
fi
eww close-all
eww open bar-full
eww reload
(swww-daemon &> /dev/null) & swww img "${/. + wallpaper}"
'';
in
with lib; {
imports = [
../battleship/desktop
];
programs.hyprland.settings = let
monitor-1 = "eDP-1";
in {
exec = mkForce [
"${desktop-boot}/bin/desktop-boot"
"dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP"
"${pkgs.wl-clipboard}/bin/wl-paste --type text --watch ${pkgs.cliphist}/bin/cliphist store"
"${pkgs.wl-clipboard}/bin/wl-paste --type image --watch ${pkgs.cliphist}/bin/cliphist store"
];
monitor = mkForce [
"${monitor-1},1366x768,0x0,1"
];
env = mkForce [];
workspace = mkForce [
"1,monitor:${monitor-1},default:true"
"2,monitor:${monitor-1}"
"3,monitor:${monitor-1}"
"4,monitor:${monitor-1}"
"5,monitor:${monitor-1}"
];
};
}

View File

@@ -0,0 +1,44 @@
# 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 = ["xhci_pci" "ahci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc"];
boot.initrd.kernelModules = [];
boot.kernelModules = [];
boot.extraModulePackages = [];
fileSystems."/" = {
device = "/dev/disk/by-uuid/f1f224e7-bed4-4bcb-9f0b-6619ed0378df";
fsType = "ext4";
};
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/2CF0-2EC0";
fsType = "vfat";
};
swapDevices = [
{device = "/dev/disk/by-uuid/5c00b6ca-8238-4813-939f-43c5f2f168c2";}
];
# 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 = lib.mkDefault true;
# networking.interfaces.enp1s0.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp2s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

27
hosts/fighter/home.nix Normal file
View File

@@ -0,0 +1,27 @@
{...}: {
imports = [
../../modules/home-manager
../../modules/home-manager/programs-old/librewolf
./packages.nix
./desktop.nix
];
profiles.gfonts.enable = true;
programs.bash = {
enable = true;
initExtra = ''
export XDG_DATA_DIRS="$XDG_DATA_DIRS:/usr/share:/var/lib/flatpak/exports/share:$HOME/.local/share/flatpak/exports/share"
export GPG_TTY=$(tty)
'';
};
services.gnome-keyring.enable = true;
fonts.fontconfig.enable = true;
home.sessionVariables = {
EDITOR = "nvim";
};
}

View File

@@ -0,0 +1,83 @@
{
config,
pkgs,
inputs,
...
}: {
imports = [
inputs.dot013-environment.homeManagerModule
inputs.rec-sh.homeManagerModules.rec-sh
];
programs.rec-sh.enable = true;
dot013.environment.enable = true;
dot013.environment.tmux.sessionizer.paths = ["~/.projects"];
programs.brave.enable = true;
programs.brave.extensions = [
{id = "cjpalhdlnbpafiamejdnhcphjbkeiagm";}
{id = "eimadpbcbfnmbkopoojfekhnkhdbieeh";}
];
librewolf = {
enable = true;
profiles = {
guz = {
id = 0;
settings = {
"webgl.disabled" = false;
"browser.startup.homepage" = "https://search.brave.com";
"privacy.clearOnShutdown.history" = false;
"privacy.clearOnShutdown.downloads" = false;
"extensions.activeThemeID" = "firefox-compact-dark@mozilla.org";
"privacy.clearOnShutdown.cookies" = false;
};
extensions = with inputs.firefox-addons.packages."x86_64-linux"; [
darkreader
canvasblocker
smart-referer
libredirect
tridactyl
];
};
};
};
home.file."${config.home.homeDirectory}".text = ''
prefix = $${HOME}/.npm-packages
'';
programs.zsh.initExtra = ''
export PATH=~/.npm-packages/bin:$PATH
'';
services.flatpak.enable = true;
xdg.portal.enable = true;
xdg.portal.extraPortals = with pkgs; [
xdg-desktop-portal-wlr
xdg-desktop-portal-gtk
];
xdg.portal.config = {
common.default = ["gtk"];
};
xdg.portal.xdgOpenUsePortal = true;
services.flatpak.packages = [
"nz.mega.MEGAsync"
"com.bitwarden.desktop"
"org.mozilla.Thunderbird"
];
services.easyeffects.enable = true;
nixpkgs.config.allowUnfree = true;
nixpkgs.config.allowUnfreePredicate = _: true;
home.packages = with pkgs; [
pavucontrol
libreoffice
pinentry
gnome.nautilus
ferdium
act
showmethekey
];
}

45
hosts/fighter/secrets.nix Normal file
View File

@@ -0,0 +1,45 @@
{
config,
inputs,
lib,
pkgs,
...
}: let
lesser-secrets = with builtins;
fromJSON (readFile ../../secrets/battleship-secrets.lesser.decrypted.json);
jsonType = pkgs.formats.json {};
in {
imports = [
inputs.sops-nix.nixosModules.sops
];
options.battleship-secrets = with lib;
with lib.types; {
lesser = mkOption {
type = submodule ({...}: {
freeformType = jsonType.type;
options = {};
});
default = lesser-secrets;
};
};
config = {
environment.systemPackages = with pkgs; [
sops
];
sops.defaultSopsFile = ../../secrets/battleship-secrets.yaml;
sops.defaultSopsFormat = "yaml";
sops.secrets.lon = {
owner = config.users.users.guz.name;
};
sops.secrets.lat = {
owner = config.users.users.guz.name;
};
sops.secrets."guz/password" = {
owner = config.users.users.guz.name;
};
sops.age.keyFile = "/home/guz/.config/sops/age/keys.txt";
};
}