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

42
flake.lock generated
View File

@@ -23,11 +23,11 @@
]
},
"locked": {
"lastModified": 1724413718,
"narHash": "sha256-kQl3BwFxJhn2sAEH9Jbu/F2RyOk9Vj/LK92DNZUM4vw=",
"lastModified": 1724940297,
"narHash": "sha256-Cc4MvoXnA4068/XVqFkBeqG+SKwsI9TolrQFXIvodL8=",
"owner": "dot013",
"repo": "environment",
"rev": "ddb66dfb78566d5cb8987929989b650bc223f17a",
"rev": "5285ed78254d191fe298f2256b00a3aa9b954660",
"type": "github"
},
"original": {
@@ -45,11 +45,11 @@
},
"locked": {
"dir": "pkgs/firefox-addons",
"lastModified": 1724436616,
"narHash": "sha256-1KbjwGl52UWjakxRfyfiYg0VAfhAzN3hTyUgZMnkzdc=",
"lastModified": 1725190550,
"narHash": "sha256-wztoBEipe+oTrGeP7B7N+WP1FfRlLvJhFuiLJt4FYsQ=",
"owner": "rycee",
"repo": "nur-expressions",
"rev": "a37b0991fbb2ffdef16325e5f81bd4dbbf940412",
"rev": "c0a6c29b335f318c50205c5cf2f4109f68618eb2",
"type": "gitlab"
},
"original": {
@@ -381,11 +381,11 @@
]
},
"locked": {
"lastModified": 1723950649,
"narHash": "sha256-dHMkGjwwCGj0c2MKyCjRXVBXq2Sz3TWbbM23AS7/5Hc=",
"lastModified": 1725161148,
"narHash": "sha256-WfAHq3Ag3vLNFfWxKHjFBFdPI6JIideWFJod9mx1eoo=",
"owner": "Mic92",
"repo": "nix-index-database",
"rev": "392828aafbed62a6ea6ccab13728df2e67481805",
"rev": "32058e9138248874773630c846563b1a78ee7a5b",
"type": "github"
},
"original": {
@@ -403,11 +403,11 @@
]
},
"locked": {
"lastModified": 1724377000,
"narHash": "sha256-TITxaXuhO8vDScZoE7i7E2BTXoJzZmKTk6qRkmI2d+o=",
"lastModified": 1725241333,
"narHash": "sha256-XbDeVD4LSkRwGeWwBxfILMpf0fIkrLIH7IF9GF6b9IM=",
"owner": "Infinidoge",
"repo": "nix-minecraft",
"rev": "b464de49b4d6ea8faf1988e02fc59c4908a7ff91",
"rev": "8c23a0dba95398c5cbd48d4eac5ce6a8f3be8a61",
"type": "github"
},
"original": {
@@ -418,11 +418,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1724316499,
"narHash": "sha256-Qb9MhKBUTCfWg/wqqaxt89Xfi6qTD3XpTzQ9eXi3JmE=",
"lastModified": 1725001927,
"narHash": "sha256-eV+63gK0Mp7ygCR0Oy4yIYSNcum2VQwnZamHxYTNi+M=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "797f7dc49e0bc7fab4b57c021cdf68f595e47841",
"rev": "6e99f2a27d600612004fbd2c3282d614bfee6421",
"type": "github"
},
"original": {
@@ -465,11 +465,11 @@
},
"nixpkgs-unstable": {
"locked": {
"lastModified": 1724224976,
"narHash": "sha256-Z/ELQhrSd7bMzTO8r7NZgi9g5emh+aRKoCdaAv5fiO0=",
"lastModified": 1725103162,
"narHash": "sha256-Ym04C5+qovuQDYL/rKWSR+WESseQBbNAe5DsXNx5trY=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "c374d94f1536013ca8e92341b540eba4c22f9c62",
"rev": "12228ff1752d7b7624a54e9c1af4b222b3c1073b",
"type": "github"
},
"original": {
@@ -525,11 +525,11 @@
"nixpkgs-stable": "nixpkgs-stable"
},
"locked": {
"lastModified": 1723501126,
"narHash": "sha256-N9IcHgj/p1+2Pvk8P4Zc1bfrMwld5PcosVA0nL6IGdE=",
"lastModified": 1725201042,
"narHash": "sha256-lj5pxOwidP0W//E7IvyhbhXrnEUW99I07+QpERnzTS4=",
"owner": "Mic92",
"repo": "sops-nix",
"rev": "be0eec2d27563590194a9206f551a6f73d52fa34",
"rev": "5db5921e40ae382d6716dce591ea23b0a39d96f7",
"type": "github"
},
"original": {

View File

@@ -101,6 +101,7 @@
in {
nixosConfigurations = create-host [
"battleship"
"fighter"
# "cruiser"
# "spacestation"
];

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";
};
}

View File

@@ -6,6 +6,7 @@
...
}: let
cfg = config.programs.hyprland;
system = pkgs.stdenv.hostPlatform.system;
in {
imports = [];
options.programs.hyprland = with lib;
@@ -21,12 +22,12 @@ in {
xwayland.enable = mkDefault true;
package = mkDefault (
if cfg.useFlakes
then inputs.hyprland.packages."${pkgs.system}".hyprland
then inputs.hyprland.packages."${system}".hyprland
else pkgs.hyprland
);
portalPackage = mkDefault (
if cfg.useFlakes
then inputs.xdg-desktop-portal-hyprland.packages."${pkgs.system}".xdg-desktop-portal-hyprland
then inputs.xdg-desktop-portal-hyprland.packages."${system}".xdg-desktop-portal-hyprland
else pkgs.xdg-desktop-portal-hyprland
);
};