format: format codebase using nixfmt-rfc-style

This commit is contained in:
Tigor Hutasuhut 2024-10-21 12:31:30 +07:00
parent 9b5b84ed5a
commit ebfaa0e940
128 changed files with 1832 additions and 1336 deletions

149
flake.nix
View file

@ -44,16 +44,17 @@
};
};
outputs =
inputs @ { self
, nur
, nixpkgs
, home-manager
, sops-nix
, neovim-nightly-overlay
, nix-index-database
, rust-overlay
, nix-flatpak
, ...
inputs@{
self,
nur,
nixpkgs,
home-manager,
sops-nix,
neovim-nightly-overlay,
nix-index-database,
rust-overlay,
nix-flatpak,
...
}:
let
commonModules = [
@ -78,9 +79,7 @@
"https://cache.nixos.org/"
"https://nix-community.cachix.org"
];
trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
];
trusted-public-keys = [ "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" ];
};
}
sops-nix.nixosModules.sops
@ -99,61 +98,79 @@
};
in
{
nixosConfigurations =
{
castle =
let
profile-path = ./profiles/castle.nix;
hardware-configuration = ./hardware-configuration/castle.nix;
specialArgs = { inherit inputs unstable profile-path hardware-configuration; };
in
nixpkgs.lib.nixosSystem
nixosConfigurations = {
castle =
let
profile-path = ./profiles/castle.nix;
hardware-configuration = ./hardware-configuration/castle.nix;
specialArgs = {
inherit
inputs
unstable
profile-path
hardware-configuration
;
};
in
nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./system
{
system = "x86_64-linux";
modules =
[
./system
{
home-manager.extraSpecialArgs = specialArgs;
home-manager.users.tigor = import ./home;
}
] ++ commonModules;
specialArgs = specialArgs;
};
fort =
let
profile-path = ./profiles/fort.nix;
hardware-configuration = ./hardware-configuration/fort.nix;
specialArgs = { inherit inputs unstable profile-path hardware-configuration; };
in
nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./system
{
home-manager.extraSpecialArgs = specialArgs;
home-manager.users.tigor = import ./home;
}
] ++ commonModules;
specialArgs = specialArgs;
home-manager.extraSpecialArgs = specialArgs;
home-manager.users.tigor = import ./home;
}
] ++ commonModules;
specialArgs = specialArgs;
};
fort =
let
profile-path = ./profiles/fort.nix;
hardware-configuration = ./hardware-configuration/fort.nix;
specialArgs = {
inherit
inputs
unstable
profile-path
hardware-configuration
;
};
homeserver =
let
profile-path = ./profiles/homeserver.nix;
hardware-configuration = ./hardware-configuration/homeserver.nix;
specialArgs = { inherit inputs unstable profile-path hardware-configuration; };
in
nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./system
{
home-manager.extraSpecialArgs = specialArgs;
home-manager.users.homeserver = import ./home;
}
] ++ commonModules;
specialArgs = specialArgs;
in
nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./system
{
home-manager.extraSpecialArgs = specialArgs;
home-manager.users.tigor = import ./home;
}
] ++ commonModules;
specialArgs = specialArgs;
};
homeserver =
let
profile-path = ./profiles/homeserver.nix;
hardware-configuration = ./hardware-configuration/homeserver.nix;
specialArgs = {
inherit
inputs
unstable
profile-path
hardware-configuration
;
};
};
in
nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./system
{
home-manager.extraSpecialArgs = specialArgs;
home-manager.users.homeserver = import ./home;
}
] ++ commonModules;
specialArgs = specialArgs;
};
};
};
}

View file

@ -1,16 +1,26 @@
{ config, lib, pkgs, modulesPath, ... }:
{
config,
lib,
pkgs,
modulesPath,
...
}:
{
imports =
[
(modulesPath + "/installer/scan/not-detected.nix")
];
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
sops.secrets."smb/secrets" = {
owner = config.profile.user.name;
};
boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ];
boot.initrd.availableKernelModules = [
"nvme"
"xhci_pci"
"ahci"
"usbhid"
"usb_storage"
"sd_mod"
];
boot.initrd.kernelModules = [ "dm-snapshot" ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
@ -26,52 +36,47 @@
systemd.packages = with pkgs; [ lact ];
systemd.services.lactd.wantedBy = [ "multi-user.target" ];
system.fsPackages = [ pkgs.bindfs pkgs.cifs-utils ];
fileSystems."/nas" =
{
device = "//192.168.100.5/nas";
fsType = "cifs";
options = [
"_netdev"
"x-systemd.automount"
"noauto"
"x-systemd.idle-timeout=60"
"x-systemd.device-timeout=5s"
"x-systemd.mount-timeout=5s"
"uid=${toString config.profile.user.uid}"
"gid=${toString config.profile.user.gid}"
"credentials=${config.sops.secrets."smb/secrets".path}"
];
};
fileSystems."/" =
{
device = "/dev/disk/by-uuid/6a987bc7-1f00-4494-bcef-b0f8afc62b7b";
fsType = "ext4";
};
fileSystems."/boot" =
{
device = "/dev/disk/by-uuid/812C-A3A9";
fsType = "vfat";
};
fileSystems."/home" =
{
device = "/dev/disk/by-uuid/0add1f95-4cd5-4d44-876e-c1b381b7d133";
fsType = "ext4";
};
fileSystems."/workstation" =
{
device = "/dev/disk/by-uuid/7a3a7a8a-91d5-43fb-a80b-376bacdb54ec";
fsType = "ext4";
};
swapDevices =
[
{ device = "/dev/disk/by-uuid/15139a5f-a695-47a1-bd59-7e530989860c"; }
system.fsPackages = [
pkgs.bindfs
pkgs.cifs-utils
];
fileSystems."/nas" = {
device = "//192.168.100.5/nas";
fsType = "cifs";
options = [
"_netdev"
"x-systemd.automount"
"noauto"
"x-systemd.idle-timeout=60"
"x-systemd.device-timeout=5s"
"x-systemd.mount-timeout=5s"
"uid=${toString config.profile.user.uid}"
"gid=${toString config.profile.user.gid}"
"credentials=${config.sops.secrets."smb/secrets".path}"
];
};
fileSystems."/" = {
device = "/dev/disk/by-uuid/6a987bc7-1f00-4494-bcef-b0f8afc62b7b";
fsType = "ext4";
};
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/812C-A3A9";
fsType = "vfat";
};
fileSystems."/home" = {
device = "/dev/disk/by-uuid/0add1f95-4cd5-4d44-876e-c1b381b7d133";
fsType = "ext4";
};
fileSystems."/workstation" = {
device = "/dev/disk/by-uuid/7a3a7a8a-91d5-43fb-a80b-376bacdb54ec";
fsType = "ext4";
};
swapDevices = [ { device = "/dev/disk/by-uuid/15139a5f-a695-47a1-bd59-7e530989860c"; } ];
# 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

View file

@ -1,32 +1,37 @@
{ config, lib, modulesPath, ... }:
{
config,
lib,
modulesPath,
...
}:
{
imports =
[
(modulesPath + "/installer/scan/not-detected.nix")
];
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usb_storage" "sd_mod" ];
boot.initrd.availableKernelModules = [
"xhci_pci"
"ahci"
"nvme"
"usb_storage"
"sd_mod"
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
# boot.kernelParams = [ "snd-intel-dspcfg.dsp_driver=1" ];
fileSystems."/" =
{
device = "/dev/disk/by-label/NIXROOT";
fsType = "ext4";
};
fileSystems."/" = {
device = "/dev/disk/by-label/NIXROOT";
fsType = "ext4";
};
fileSystems."/boot" =
{
device = "/dev/disk/by-label/NIXBOOT";
fsType = "vfat";
};
fileSystems."/boot" = {
device = "/dev/disk/by-label/NIXBOOT";
fsType = "vfat";
};
swapDevices =
[{ device = "/dev/disk/by-label/NIXSWAP"; }];
swapDevices = [ { device = "/dev/disk/by-label/NIXSWAP"; } ];
networking.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";

View file

@ -1,31 +1,45 @@
# 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, ... }:
{
config,
lib,
pkgs,
modulesPath,
...
}:
{
imports =
[
(modulesPath + "/installer/scan/not-detected.nix")
];
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
config = {
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ];
boot.initrd.availableKernelModules = [
"xhci_pci"
"ahci"
"nvme"
"usbhid"
"usb_storage"
"sd_mod"
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" "nct6775" ];
boot.kernelModules = [
"kvm-amd"
"nct6775"
];
boot.extraModulePackages = [ ];
fileSystems."/" =
{
device = "/dev/disk/by-uuid/439a1beb-1443-495b-9891-012605819803";
fsType = "ext4";
};
fileSystems."/" = {
device = "/dev/disk/by-uuid/439a1beb-1443-495b-9891-012605819803";
fsType = "ext4";
};
fileSystems."/boot" =
{
device = "/dev/disk/by-uuid/47A1-0296";
fsType = "vfat";
options = [ "fmask=0022" "dmask=0022" ];
};
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/47A1-0296";
fsType = "vfat";
options = [
"fmask=0022"
"dmask=0022"
];
};
fileSystems."/nas" = {
device = "/dev/disk/by-label/WD_RED_4T_1";
@ -123,10 +137,11 @@
];
};
services.caddy.virtualHosts."public.tigor.web.id".extraConfig = /*caddy*/ ''
file_server browse
root * /nas/public
'';
services.caddy.virtualHosts."public.tigor.web.id".extraConfig = # caddy
''
file_server browse
root * /nas/public
'';
systemd.tmpfiles.settings = {
"100-nas-public-dir" = {
@ -151,6 +166,8 @@
libvdpau-va-gl
];
};
environment.sessionVariables = { LIBVA_DRIVER_NAME = "iHD"; }; # Force intel-media-driver
environment.sessionVariables = {
LIBVA_DRIVER_NAME = "iHD";
}; # Force intel-media-driver
};
}

View file

@ -1,6 +1,4 @@
{ ... }:
{
imports = [
./protobuf.nix
];
imports = [ ./protobuf.nix ];
}

View file

@ -1,4 +1,9 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
let
cfg = config.profile.home.environments.protobuf;
inherit (lib) mkIf;

View file

@ -1,6 +1,4 @@
{ pkgs, ... }:
{
imports = [
./minecraft.nix
];
imports = [ ./minecraft.nix ];
}

View file

@ -1,4 +1,9 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
let
cfg = config.profile.games.minecraft;
inherit (lib) mkIf;

View file

@ -10,6 +10,8 @@ in
};
programs.zsh.shellAliases = {
vpn-bareksa = "sudo ${pkgs.openvpn}/bin/openvpn --config ${config.sops.secrets."bareksa/openvpn".path}";
vpn-bareksa = "sudo ${pkgs.openvpn}/bin/openvpn --config ${
config.sops.secrets."bareksa/openvpn".path
}";
};
}

View file

@ -1,4 +1,9 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
let
cfg = config.profile.firefox;
in
@ -30,7 +35,7 @@ in
id = 0;
name = "Tigor";
isDefault = true;
extensions = with pkgs.nur.repos.rycee.firefox-addons; [
extensions = with pkgs.nur.repos.rycee.firefox-addons; [
ublock-origin
bitwarden
cookie-autodelete

View file

@ -1,4 +1,9 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
let
cfg = config.profile.gnome;
in

View file

@ -7,9 +7,7 @@ in
programs.alacritty = {
enable = true;
settings = {
import = [
"${config.home.homeDirectory}/.cache/wallust/alacritty.toml"
];
import = [ "${config.home.homeDirectory}/.cache/wallust/alacritty.toml" ];
live_config_reload = true;
font = {
normal = {

View file

@ -1,4 +1,9 @@
{ pkgs, lib, config, ... }:
{
pkgs,
lib,
config,
...
}:
let
cfg = config.profile.hyprland;
in

View file

@ -1,4 +1,9 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
let
cfg = config.profile.hyprland;
inherit (lib) mkIf;

View file

@ -1,4 +1,9 @@
{ lib, pkgs, config, ... }:
{
lib,
pkgs,
config,
...
}:
let
cfg = config.profile.hyprland;
inherit (lib) mkIf;
@ -7,21 +12,19 @@ let
in
{
config = mkIf cfg.enable {
home.packages = with pkgs; [
gnome.gnome-keyring
];
home.packages = with pkgs; [ gnome.gnome-keyring ];
sops.secrets.${secretKey} = { };
wayland.windowManager.hyprland.settings.exec-once =
let
scriptFile = getExe (pkgs.writeShellScriptBin "gnome-keyring.sh" /*sh*/ ''
cat "${config.sops.secrets.${secretKey}.path}" | gnome-keyring-daemon --unlock
gnome-keyring-daemon --start --components=pkcs11,secrets,ssh
'');
scriptFile = getExe (
pkgs.writeShellScriptBin "gnome-keyring.sh" # sh
''
cat "${config.sops.secrets.${secretKey}.path}" | gnome-keyring-daemon --unlock
gnome-keyring-daemon --start --components=pkcs11,secrets,ssh
''
);
in
[
''${scriptFile}''
];
[ ''${scriptFile}'' ];
};
}

View file

@ -1,4 +1,9 @@
{ lib, config, unstable, ... }:
{
lib,
config,
unstable,
...
}:
let
cfg = config.profile.hyprland;
in

View file

@ -1,4 +1,9 @@
{ lib, pkgs, config, ... }:
{
lib,
pkgs,
config,
...
}:
let
cfg = config.profile.hyprland;
in
@ -14,12 +19,8 @@ in
enable = true;
systemd.variables = [ "all" ];
settings = {
env = [
"DBUS_SESSION_BUS_ADDRESS,unix:path=/run/user/${toString config.profile.user.uid}/bus"
];
exec-once = lib.mkOrder 5 [
''${pkgs.dbus}/bin/dbus-update-activation-environment --all''
];
env = [ "DBUS_SESSION_BUS_ADDRESS,unix:path=/run/user/${toString config.profile.user.uid}/bus" ];
exec-once = lib.mkOrder 5 [ ''${pkgs.dbus}/bin/dbus-update-activation-environment --all'' ];
# window decors
general = {
gaps_in = 10;
@ -197,14 +198,15 @@ in
''stayfocused,class:^(lazygit)$''
];
};
extraConfig = /*hyprlang*/ ''
exec-once=foot --server
extraConfig = # hyprlang
''
exec-once=foot --server
exec-once=nm-applet
exec-once=pasystray
exec-once=nm-applet
exec-once=pasystray
source=${config.home.homeDirectory}/.cache/wallust/hyprland.conf
'';
source=${config.home.homeDirectory}/.cache/wallust/hyprland.conf
'';
};
};
}

View file

@ -1,4 +1,9 @@
{ lib, pkgs, config, ... }:
{
lib,
pkgs,
config,
...
}:
let
cfg = config.profile.hyprland;
in

View file

@ -1,18 +1,21 @@
{ lib, unstable, config, ... }:
{
lib,
unstable,
config,
...
}:
let
cfg = config.profile.hyprland;
in
{
config = lib.mkIf cfg.enable {
home.packages = [
unstable.hyprpaper
];
home.packages = [ unstable.hyprpaper ];
home.file.".config/hypr/hyprpaper.conf".text =
let
recent_wallpaper = "${config.home.homeDirectory}/.cache/wallpaper/current";
in
/*hyprlang*/
# hyprlang
''
preload = ${recent_wallpaper}
wallpaper = ,${recent_wallpaper}

View file

@ -1,4 +1,9 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
let
cfg = config.profile.hyprland;
saveDir = "${config.home.homeDirectory}/Pictures/screenshots";
@ -10,10 +15,12 @@ in
satty
];
home.activation.sattyDirCreate = lib.hm.dag.entryAfter [ "writeBoundary" ] /*sh*/ ''
mkdir -p "${saveDir}"
chown ${config.home.username} "${saveDir}"
'';
home.activation.sattyDirCreate =
lib.hm.dag.entryAfter [ "writeBoundary" ] # sh
''
mkdir -p "${saveDir}"
chown ${config.home.username} "${saveDir}"
'';
wayland.windowManager.hyprland.settings.bind =
let

View file

@ -1,4 +1,9 @@
{ config, pkgs, lib, ... }:
{
config,
pkgs,
lib,
...
}:
let
hyprland = config.profile.hyprland;
cfg = config.profile.services.ntfy-sh.client;
@ -6,9 +11,7 @@ let
in
{
config = mkIf (hyprland.enable && cfg.enable) {
home.packages = with pkgs; [
ntfy-sh
];
home.packages = with pkgs; [ ntfy-sh ];
# wayland.windowManager.hyprland.settings.exec-once = [
# "ntfy subscribe --config /etc/ntfy/client.yml --from-config"

View file

@ -1,22 +1,30 @@
{ lib, pkgs, unstable, config, ... }:
{
lib,
pkgs,
unstable,
config,
...
}:
let
cfg = config.profile.hyprland;
inherit (lib.meta) getExe;
wallpaperDir = "${config.home.homeDirectory}/.cache/wallpaper";
draw-wallpaper = pkgs.writeShellScriptBin "draw-wallpaper.sh" /*sh*/ ''
image_file=$1
target="${wallpaperDir}/current"
blur_target="${wallpaperDir}/blurred.png"
square_target="${wallpaperDir}/square.png"
draw-wallpaper =
pkgs.writeShellScriptBin "draw-wallpaper.sh" # sh
''
image_file=$1
target="${wallpaperDir}/current"
blur_target="${wallpaperDir}/blurred.png"
square_target="${wallpaperDir}/square.png"
mkdir -p "${wallpaperDir}"
echo "$image_file" > "${wallpaperDir}/origin.txt"
cp "$image_file" "$target"
swww img "$target"
${unstable.wallust}/bin/wallust run "$target"
${pkgs.graphicsmagick}/bin/gm convert -resize 75% -blur 50x30 "$target" "$blur_target"
${pkgs.imagemagick}/bin/magick "$target" -resize 25% -gravity Center -extent 1:1 "$square_target"
'';
mkdir -p "${wallpaperDir}"
echo "$image_file" > "${wallpaperDir}/origin.txt"
cp "$image_file" "$target"
swww img "$target"
${unstable.wallust}/bin/wallust run "$target"
${pkgs.graphicsmagick}/bin/gm convert -resize 75% -blur 50x30 "$target" "$blur_target"
${pkgs.imagemagick}/bin/magick "$target" -resize 25% -gravity Center -extent 1:1 "$square_target"
'';
in
{
config = lib.mkIf cfg.enable {
@ -29,9 +37,7 @@ in
tomlFormat = pkgs.formats.toml { };
in
tomlFormat.generate "pyprland.toml" {
pyprland.plugins = [
"wallpapers"
];
pyprland.plugins = [ "wallpapers" ];
wallpapers = {
path = cfg.pyprland.wallpaper-dirs;
unique = false;
@ -45,9 +51,7 @@ in
"swww-daemon"
"sleep 0.2 && swww img ${config.home.homeDirectory}/.cache/wallpaper/current"
];
bind = [
"$mod, W, exec, pypr wall next"
];
bind = [ "$mod, W, exec, pypr wall next" ];
};
};
}

View file

@ -1,39 +1,46 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
let
cfg = config.profile.hyprland;
inherit (lib.meta) getExe;
selectWindowScript = pkgs.writeShellScriptBin ''select-window.sh'' /*sh*/ ''
state="$(hyprctl -j clients)"
active_window="$(hyprctl -j activewindow)"
selectWindowScript =
pkgs.writeShellScriptBin ''select-window.sh'' # sh
''
state="$(hyprctl -j clients)"
active_window="$(hyprctl -j activewindow)"
current_addr="$(echo "$active_window" | gojq -r '.address')"
current_addr="$(echo "$active_window" | gojq -r '.address')"
window="$(echo "$state" |
gojq -r '.[] | select(.monitor != -1 ) | "\(.address) \(.workspace.name) \(.title)"' |
grep -v "scratch_term" |
sed "s|$current_addr|focused ->|" |
sort -r |
rofi -dmenu -i -matching fuzzy)"
window="$(echo "$state" |
gojq -r '.[] | select(.monitor != -1 ) | "\(.address) \(.workspace.name) \(.title)"' |
grep -v "scratch_term" |
sed "s|$current_addr|focused ->|" |
sort -r |
rofi -dmenu -i -matching fuzzy)"
addr="$(echo "$window" | awk '{print $1}')"
ws="$(echo "$window" | awk '{print $2}')"
addr="$(echo "$window" | awk '{print $1}')"
ws="$(echo "$window" | awk '{print $2}')"
if [[ "$addr" =~ focused* ]]; then
echo 'already focused, exiting'
exit 0
fi
fullscreen_on_same_ws="$(echo "$state" | gojq -r ".[] | select(.fullscreen == true) | select(.workspace.name == \"$ws\") | .address")"
if [[ "$window" != "" ]]; then
if [[ "$fullscreen_on_same_ws" == "" ]]; then
hyprctl dispatch focuswindow address:''${addr}
else
notify-send 'Complex switch' "$window"
hyprctl --batch "dispatch focuswindow address:''${fullscreen_on_same_ws}; dispatch fullscreen 1;"
if [[ "$addr" =~ focused* ]]; then
echo 'already focused, exiting'
exit 0
fi
fi
'';
fullscreen_on_same_ws="$(echo "$state" | gojq -r ".[] | select(.fullscreen == true) | select(.workspace.name == \"$ws\") | .address")"
if [[ "$window" != "" ]]; then
if [[ "$fullscreen_on_same_ws" == "" ]]; then
hyprctl dispatch focuswindow address:''${addr}
else
notify-send 'Complex switch' "$window"
hyprctl --batch "dispatch focuswindow address:''${fullscreen_on_same_ws}; dispatch fullscreen 1;"
fi
fi
'';
in
{
config = lib.mkIf cfg.enable {

View file

@ -1,4 +1,9 @@
{ lib, pkgs, config, ... }:
{
lib,
pkgs,
config,
...
}:
let
cfg = config.profile.hyprland;
in

View file

@ -1,4 +1,9 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
let
cfg = config.profile.hyprland;
in
@ -36,18 +41,18 @@ in
};
Service =
let
reloadScript = pkgs.writeShellScriptBin "swaync-reload.sh" /*sh*/ ''
${pkgs.swaynotificationcenter}/bin/swaync-client --reload-config
${pkgs.swaynotificationcenter}/bin/swaync-client --reload-css
'';
reloadScript =
pkgs.writeShellScriptBin "swaync-reload.sh" # sh
''
${pkgs.swaynotificationcenter}/bin/swaync-client --reload-config
${pkgs.swaynotificationcenter}/bin/swaync-client --reload-css
'';
in
{
ExecReload = "${lib.meta.getExe reloadScript}";
};
};
home.packages = with pkgs; [
libnotify
];
home.packages = with pkgs; [ libnotify ];
};
}

View file

@ -1,4 +1,9 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
let
cfg = config.profile.hyprland;
in
@ -8,9 +13,7 @@ in
# enable = true;
# display = config.profile.hyprland.swayosd.display;
# };
home.packages = with pkgs; [
swayosd
];
home.packages = with pkgs; [ swayosd ];
wayland.windowManager.hyprland.settings = {
exec-once = [

View file

@ -1,10 +1,11 @@
{ lib
, fetchFromGitea
, rustPlatform
, nix-update-script
, imagemagick
, makeWrapper
, pkgs
{
lib,
fetchFromGitea,
rustPlatform,
nix-update-script,
imagemagick,
makeWrapper,
pkgs,
}:
rustPlatform.buildRustPackage rec {
pname = "wallust";
@ -20,7 +21,10 @@ rustPlatform.buildRustPackage rec {
cargoHash = "sha256-o6VRekazqbKTef6SLjHqs9/z/Q70auvunP+yFDkclpg=";
nativeBuildInputs = [ makeWrapper pkgs.rust-bin.stable."1.79.0".default ];
nativeBuildInputs = [
makeWrapper
pkgs.rust-bin.stable."1.79.0".default
];
postFixup = ''
wrapProgram $out/bin/wallust \
@ -33,7 +37,10 @@ rustPlatform.buildRustPackage rec {
description = "A better pywal";
homepage = "https://codeberg.org/explosion-mental/wallust";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ onemoresuza iynaix ];
maintainers = with lib.maintainers; [
onemoresuza
iynaix
];
downloadPage = "https://codeberg.org/explosion-mental/wallust/releases/tag/${version}";
mainProgram = "wallust";
};

View file

@ -1,4 +1,10 @@
{ pkgs, unstable, lib, config, ... }:
{
pkgs,
unstable,
lib,
config,
...
}:
let
cfg = config.profile.hyprland;
inherit (lib.meta) getExe;
@ -45,83 +51,85 @@ in
recursive = true;
};
home.file.".config/wallust/wallust.toml".source = ((pkgs.formats.toml { }).generate "wallust.toml" {
# See https://codeberg.org/explosion-mental/wallust/src/branch/master/wallust.toml
# for more information about the configuration options.
home.file.".config/wallust/wallust.toml".source = (
(pkgs.formats.toml { }).generate "wallust.toml" {
# See https://codeberg.org/explosion-mental/wallust/src/branch/master/wallust.toml
# for more information about the configuration options.
# How the image is parse, in order to get the colors:
# full - resized - wal - thumb - fastresize - kmeans
backend = wallust.backend;
# How the image is parse, in order to get the colors:
# full - resized - wal - thumb - fastresize - kmeans
backend = wallust.backend;
# What color space to use to produce and select the most prominent colors:
# lab - labmixed - lch - lchmixed
color_space = wallust.colorSpace;
threshold = wallust.threshold;
# What color space to use to produce and select the most prominent colors:
# lab - labmixed - lch - lchmixed
color_space = wallust.colorSpace;
threshold = wallust.threshold;
# Use the most prominent colors in a way that makes sense, a scheme color palette:
# dark - dark16 - darkcomp - darkcomp16
# light - light16 - lightcomp - lightcomp16
# harddark - harddark16 - harddarkcomp - harddarkcomp16
# softdark - softdark16 - softdarkcomp - softdarkcomp16
# softlight - softlight16 - softlightcomp - softlightcomp16
palette = wallust.palette;
# Use the most prominent colors in a way that makes sense, a scheme color palette:
# dark - dark16 - darkcomp - darkcomp16
# light - light16 - lightcomp - lightcomp16
# harddark - harddark16 - harddarkcomp - harddarkcomp16
# softdark - softdark16 - softdarkcomp - softdarkcomp16
# softlight - softlight16 - softlightcomp - softlightcomp16
palette = wallust.palette;
# Ensures a "readable contrast" (OPTIONAL, disabled by default)
# Should only be enabled when you notice an unreadable contrast frequently happening
# with your images. The reference color for the contrast is the background color.
check_contrast = wallust.checkContrast;
# Ensures a "readable contrast" (OPTIONAL, disabled by default)
# Should only be enabled when you notice an unreadable contrast frequently happening
# with your images. The reference color for the contrast is the background color.
check_contrast = wallust.checkContrast;
# Color saturation, between [1% and 100%] (OPTIONAL, disabled by default)
# usually something higher than 50 increases the saturation and below
# decreases it (on a scheme with strong and vivid colors)
# saturation = 50;
# Color saturation, between [1% and 100%] (OPTIONAL, disabled by default)
# usually something higher than 50 increases the saturation and below
# decreases it (on a scheme with strong and vivid colors)
# saturation = 50;
# Alpha value for templating, by default 100 (no other use whatsoever)
alpha = wallust.alpha;
# Alpha value for templating, by default 100 (no other use whatsoever)
alpha = wallust.alpha;
templates =
# Templates requires certain syntax
#
# See: https://codeberg.org/explosion-mental/wallust/wiki/wallust.1-Man-Page
# Note that the documentation is for 3.x and above.
let
out = config.home.homeDirectory + "/.cache/wallust";
in
{
waybar = {
template = "waybar.css";
# target = out + "/waybar.css";
target = "${config.home.homeDirectory}/.config/waybar/style.css";
templates =
# Templates requires certain syntax
#
# See: https://codeberg.org/explosion-mental/wallust/wiki/wallust.1-Man-Page
# Note that the documentation is for 3.x and above.
let
out = config.home.homeDirectory + "/.cache/wallust";
in
{
waybar = {
template = "waybar.css";
# target = out + "/waybar.css";
target = "${config.home.homeDirectory}/.config/waybar/style.css";
};
wlogout = {
template = "wlogout.css";
target = out + "/wlogout.css";
};
hyprland = {
template = "hyprland.conf";
target = out + "/hyprland.conf";
};
kitty = {
template = "kitty.conf";
target = "${config.home.homeDirectory}/.config/kitty/kitty.d/99-colors.conf";
};
base16-nvim = {
template = "base16-nvim.lua";
target = out + "/base16-nvim.lua";
};
rofi = {
template = "rofi.rasi";
target = out + "/rofi.rasi";
};
alacritty = {
template = "alacritty.toml";
target = out + "/alacritty.toml";
};
foot = {
template = "foot.ini";
target = "${config.home.homeDirectory}/.config/foot/colors.ini";
};
};
wlogout = {
template = "wlogout.css";
target = out + "/wlogout.css";
};
hyprland = {
template = "hyprland.conf";
target = out + "/hyprland.conf";
};
kitty = {
template = "kitty.conf";
target = "${config.home.homeDirectory}/.config/kitty/kitty.d/99-colors.conf";
};
base16-nvim = {
template = "base16-nvim.lua";
target = out + "/base16-nvim.lua";
};
rofi = {
template = "rofi.rasi";
target = out + "/rofi.rasi";
};
alacritty = {
template = "alacritty.toml";
target = out + "/alacritty.toml";
};
foot = {
template = "foot.ini";
target = "${config.home.homeDirectory}/.config/foot/colors.ini";
};
};
});
}
);
};
}

View file

@ -1,4 +1,10 @@
{ lib, config, unstable, pkgs, ... }:
{
lib,
config,
unstable,
pkgs,
...
}:
let
cfg = config.profile.hyprland;
modules = (pkgs.formats.json { }).generate "modules.json" {
@ -16,7 +22,11 @@ let
phone = " ";
portable = " ";
car = " ";
default = [ " " " " " " ];
default = [
" "
" "
" "
];
};
on-click = "pavucontrol";
};
@ -37,7 +47,13 @@ let
format-charging = " {capacity}%";
format-plugged = " {capacity}%";
format-alt = "{icon} {time}";
format-icons = [ " " " " " " " " " " ];
format-icons = [
" "
" "
" "
" "
" "
];
};
network = {
format = "{ifname}";
@ -58,7 +74,6 @@ let
tooltip = false;
};
"hyprland/workspaces" = {
on-click = "activate";
active-only = false;
@ -164,12 +179,8 @@ in
margin-right = 0;
spacing = 0;
reload_style_on_change = true;
include = [
modules
];
modules-left = [
"hyprland/window"
];
include = [ modules ];
modules-left = [ "hyprland/window" ];
modules-center = [
"hyprland/workspaces"
"custom/notification"
@ -193,5 +204,3 @@ in
};
};
}

View file

@ -1,4 +1,9 @@
{ lib, config, pkgs, ... }:
{
lib,
config,
pkgs,
...
}:
let
cfg = config.profile.obs;
in

View file

@ -1,14 +1,15 @@
{ pkgs, config, lib, ... }:
{
pkgs,
config,
lib,
...
}:
let
cfg = config.profile.bitwarden;
in
{
config = lib.mkIf cfg.enable {
home.packages = with pkgs; [
bitwarden
];
home.packages = with pkgs; [ bitwarden ];
home.file = {
".config/autostart/bitwarden.desktop" = lib.mkIf cfg.autostart {

View file

@ -1,12 +1,13 @@
{ pkgs, config, lib, ... }:
{
pkgs,
config,
lib,
...
}:
let
cfg = config.profile.home.programs.bruno;
inherit (lib) mkIf;
in
{
config = mkIf cfg.enable {
home.packages = with pkgs; [
bruno
];
};
config = mkIf cfg.enable { home.packages = with pkgs; [ bruno ]; };
}

View file

@ -1,9 +1,12 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
let
cfg = config.profile.dbeaver;
in
{
config = lib.mkIf cfg.enable {
home.packages = [ pkgs.dbeaver-bin ];
};
config = lib.mkIf cfg.enable { home.packages = [ pkgs.dbeaver-bin ]; };
}

View file

@ -1,34 +1,33 @@
{ config, pkgs, lib, ... }:
{
config,
pkgs,
lib,
...
}:
let
inherit (lib) mkIf;
inherit (lib.meta) getExe;
cfg = config.profile.discord;
autostartScript = pkgs.writeShellScriptBin "discord.sh" /*sh*/ ''
sleep 10;
until ${pkgs.unixtools.ping}/bin/ping -c 1 discord.com;
do sleep 1;
done;
vesktop
'';
autostartScript =
pkgs.writeShellScriptBin "discord.sh" # sh
''
sleep 10;
until ${pkgs.unixtools.ping}/bin/ping -c 1 discord.com;
do sleep 1;
done;
vesktop
'';
autostartScriptFile = getExe autostartScript;
in
{
config = mkIf cfg.enable {
home.packages = with pkgs; [
vesktop
];
home.packages = with pkgs; [ vesktop ];
home.file.".config/discord/settings.json".text = builtins.toJSON {
SKIP_HOST_UPDATE = true;
};
home.file.".config/discord/settings.json".text = builtins.toJSON { SKIP_HOST_UPDATE = true; };
wayland.windowManager.hyprland.settings.exec-once = lib.mkIf cfg.autostart [
autostartScriptFile
];
wayland.windowManager.hyprland.settings.exec-once = lib.mkIf cfg.autostart [ autostartScriptFile ];
home.file.".config/autostart/discord.sh" = lib.mkIf cfg.autostart {
source = autostartScriptFile;
};
home.file.".config/autostart/discord.sh" = lib.mkIf cfg.autostart { source = autostartScriptFile; };
services.swaync.settings.scripts._10-discord =
let

View file

@ -1,9 +1,12 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
let
cfg = config.profile.programs.easyeffects;
in
{
config = lib.mkIf cfg.enable {
home.packages = with pkgs; [ easyeffects ];
};
config = lib.mkIf cfg.enable { home.packages = with pkgs; [ easyeffects ]; };
}

View file

@ -1,12 +1,13 @@
{ pkgs, config, lib, ... }:
{
pkgs,
config,
lib,
...
}:
let
cfg = config.profile.home.programs.elisa;
inherit (lib) mkIf;
in
{
config = mkIf cfg.enable {
home.packages = with pkgs; [
kdePackages.elisa
];
};
config = mkIf cfg.enable { home.packages = with pkgs; [ kdePackages.elisa ]; };
}

View file

@ -21,18 +21,19 @@ in
};
};
programs.zsh.initExtra = /*bash*/ ''
function osc7-pwd() {
emulate -L zsh # also sets localoptions for us
setopt extendedglob
local LC_ALL=C
printf '\e]7;file://%s%s\e\' $HOST ''${PWD//(#m)([^@-Za-z&-;_~])/%''${(l:2::0:)$(([##16]#MATCH))}}
}
programs.zsh.initExtra = # bash
''
function osc7-pwd() {
emulate -L zsh # also sets localoptions for us
setopt extendedglob
local LC_ALL=C
printf '\e]7;file://%s%s\e\' $HOST ''${PWD//(#m)([^@-Za-z&-;_~])/%''${(l:2::0:)$(([##16]#MATCH))}}
}
function chpwd-osc7-pwd() {
(( ZSH_SUBSHELL )) || osc7-pwd
}
add-zsh-hook -Uz chpwd chpwd-osc7-pwd
'';
function chpwd-osc7-pwd() {
(( ZSH_SUBSHELL )) || osc7-pwd
}
add-zsh-hook -Uz chpwd chpwd-osc7-pwd
'';
};
}

View file

@ -85,30 +85,14 @@
"#f4dbd6"
"bold"
];
inactiveBorderColor = [
"#a5adcb"
];
optionsTextColor = [
"#8aadf4"
];
selectedLineBgColor = [
"#363a4f"
];
cherryPickedCommitBgColor = [
"#494d64"
];
cherryPickedCommitFgColor = [
"#f4dbd6"
];
unstagedChangesColor = [
"#ed8796"
];
defaultFgColor = [
"#cad3f5"
];
searchingActiveBorderColor = [
"#eed49f"
];
inactiveBorderColor = [ "#a5adcb" ];
optionsTextColor = [ "#8aadf4" ];
selectedLineBgColor = [ "#363a4f" ];
cherryPickedCommitBgColor = [ "#494d64" ];
cherryPickedCommitFgColor = [ "#f4dbd6" ];
unstagedChangesColor = [ "#ed8796" ];
defaultFgColor = [ "#cad3f5" ];
searchingActiveBorderColor = [ "#eed49f" ];
};
};
};

View file

@ -1,9 +1,12 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
let
cfg = config.profile.gh;
in
{
config = lib.mkIf cfg.enable {
home.packages = [ pkgs.gh ];
};
config = lib.mkIf cfg.enable { home.packages = [ pkgs.gh ]; };
}

View file

@ -1,4 +1,10 @@
{ config, lib, pkgs, unstable, ... }:
{
config,
lib,
pkgs,
unstable,
...
}:
let
cfg = config.profile.go;
impl = pkgs.buildGoModule rec {
@ -17,9 +23,7 @@ in
config = lib.mkIf cfg.enable {
programs.go = {
enable = true;
goPrivate = [
"gitlab.bareksa.com"
];
goPrivate = [ "gitlab.bareksa.com" ];
package = unstable.go_1_23;
};
home.packages = with pkgs; [

View file

@ -1,11 +1,12 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
let
cfg = config.profile.jellyfin;
in
{
config = lib.mkIf cfg.enable {
home.packages = [
pkgs.jellyfin-media-player
];
};
config = lib.mkIf cfg.enable { home.packages = [ pkgs.jellyfin-media-player ]; };
}

View file

@ -4,11 +4,12 @@ let
in
{
config = lib.mkIf cfg.enable {
programs.zsh.initExtra = /*bash*/ ''
if [[ "$TERM" == "xterm-kitty" ]]; then
alias ssh="kitty +kitten ssh"
fi
'';
programs.zsh.initExtra = # bash
''
if [[ "$TERM" == "xterm-kitty" ]]; then
alias ssh="kitty +kitten ssh"
fi
'';
programs.kitty = {
enable = true;
settings = {
@ -24,7 +25,7 @@ in
tab_bar_margin_width = toString 0.2;
tab_bar_style = "slant";
background_blur = 40;
background_opacity = toString 0.90;
background_opacity = toString 0.9;
cursor_blink_interval = toString 0.5;
};
keybindings = {

View file

@ -1,9 +1,12 @@
{ config, lib, unstable, ... }:
{
config,
lib,
unstable,
...
}:
let
cfg = config.profile.microsoft-edge;
in
{
config = lib.mkIf cfg.enable {
home.packages = [ unstable.microsoft-edge ];
};
config = lib.mkIf cfg.enable { home.packages = [ unstable.microsoft-edge ]; };
}

View file

@ -1,11 +1,18 @@
{ config, lib, unstable, ... }:
{
config,
lib,
unstable,
...
}:
let
cfg = config.profile.programs.mongodb-compass;
sopsFile = ../../secrets/bareksa.yaml;
in
{
config = lib.mkIf cfg.enable {
sops.secrets."bareksa/mongodb-compass" = { inherit sopsFile; };
sops.secrets."bareksa/mongodb-compass" = {
inherit sopsFile;
};
home.packages = [ unstable.mongodb-compass ];
};
}

View file

@ -1,4 +1,9 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
let
cfg = config.profile.mpv;
in

View file

@ -1,12 +1,16 @@
{ config, unstable, pkgs, lib, ... }:
{
config,
unstable,
pkgs,
lib,
...
}:
let
cfg = config.profile.neovide;
in
{
config = lib.mkIf cfg.enable {
home.packages = [
unstable.neovide
];
home.packages = [ unstable.neovide ];
home.file.".config/neovide/config.toml".source =
let

View file

@ -1,4 +1,10 @@
{ config, pkgs, lib, unstable, ... }:
{
config,
pkgs,
lib,
unstable,
...
}:
let
cfg = config.profile.neovim;
inherit (lib) mkIf;
@ -22,21 +28,23 @@ in
ping = "${pkgs.unixtools.ping}/bin/ping";
host = "github.com";
sleep = "${pkgs.coreutils}/bin/sleep";
script = pkgs.writeScriptBin "clone-nvim.sh" /*bash*/ ''
#!${bash}
script =
pkgs.writeScriptBin "clone-nvim.sh" # bash
''
#!${bash}
if [ -d "${nvimCloneDir}" ]; then
exit 0;
fi
if [ -d "${nvimCloneDir}" ]; then
exit 0;
fi
until ${ping} -c 1 ${host}; do
${sleep} 1;
done
until ${ping} -c 1 ${host}; do
${sleep} 1;
done
mkdir -p ${nvimCloneDir}
mkdir -p ${nvimCloneDir}
${git} clone ${repository} ${nvimCloneDir}
'';
${git} clone ${repository} ${nvimCloneDir}
'';
path = "${script}/bin/clone-nvim.sh";
in
{

View file

@ -1,9 +1,12 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
let
cfg = config.profile.nextcloud;
in
{
config = lib.mkIf cfg.enable {
home.packages = [ pkgs.nextcloud-client ];
};
config = lib.mkIf cfg.enable { home.packages = [ pkgs.nextcloud-client ]; };
}

View file

@ -3,7 +3,5 @@ let
cfg = config.profile.nnn;
in
{
config = lib.mkIf cfg.enable {
programs.nnn.enable = true;
};
config = lib.mkIf cfg.enable { programs.nnn.enable = true; };
}

View file

@ -1,12 +1,13 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
let
cfg = config.profile.home.programs.obsidian;
inherit (lib) mkIf;
in
{
config = mkIf cfg.enable {
home.packages = with pkgs; [
obsidian
];
};
config = mkIf cfg.enable { home.packages = with pkgs; [ obsidian ]; };
}

View file

@ -1,12 +1,11 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
let
cfg = config.profile.services.redis;
inherit (lib) mkIf;
in
lib.mkMerge [
(mkIf cfg.client.cli.enable {
home.packages = [
pkgs.redis
];
})
]
lib.mkMerge [ (mkIf cfg.client.cli.enable { home.packages = [ pkgs.redis ]; }) ]

View file

@ -1,4 +1,9 @@
{ pkgs, lib, config, ... }:
{
pkgs,
lib,
config,
...
}:
let
cfg = config.profile.slack;
autostartScript = pkgs.writeShellScriptBin "slack.sh" ''
@ -11,13 +16,9 @@ in
config = lib.mkIf cfg.enable {
home.packages = with pkgs; [ slack ];
wayland.windowManager.hyprland.settings.exec-once = lib.mkIf cfg.autostart [
autostartScriptFile
];
wayland.windowManager.hyprland.settings.exec-once = lib.mkIf cfg.autostart [ autostartScriptFile ];
home.file.".config/autostart/slack.sh" = lib.mkIf cfg.autostart {
source = autostartScriptFile;
};
home.file.".config/autostart/slack.sh" = lib.mkIf cfg.autostart { source = autostartScriptFile; };
services.swaync.settings.scripts._10-slack =
let

View file

@ -1,11 +1,12 @@
{ pkgs, config, lib, ... }:
{
pkgs,
config,
lib,
...
}:
let
cfg = config.profile.spotify;
in
{
config = lib.mkIf cfg.enable {
home.packages = with pkgs; [
spotify
];
};
config = lib.mkIf cfg.enable { home.packages = with pkgs; [ spotify ]; };
}

View file

@ -35,7 +35,6 @@
format = "[$ssh_symbol$hostname]($style)\\] ";
};
palette = "catppuccin_${flavour}";
} // builtins.fromTOML (builtins.readFile
(catppuccin-starship-repo + /palettes/${flavour}.toml));
} // builtins.fromTOML (builtins.readFile (catppuccin-starship-repo + /palettes/${flavour}.toml));
};
}

View file

@ -1,4 +1,9 @@
{ pkgs, config, lib, ... }:
{
pkgs,
config,
lib,
...
}:
let
cfg = config.profile.tofi;
in

View file

@ -1,4 +1,9 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
let
cfg = config.profile.variety;
in

View file

@ -1,4 +1,9 @@
{ config, lib, unstable, ... }:
{
config,
lib,
unstable,
...
}:
let
cfg = config.profile.vscode;
in

View file

@ -9,22 +9,24 @@ in
enableZshIntegration = true;
enableBashIntegration = true;
extraConfig = /*lua*/ ''
-- take config from ./base_config.lua
local config = require('base_config')
extraConfig = # lua
''
-- take config from ./base_config.lua
local config = require('base_config')
-- and override settings for nixos specific things here.
config.window_background_opacity = ${toString cfg.config.window_background_opacity};
-- and override settings for nixos specific things here.
config.window_background_opacity = ${toString cfg.config.window_background_opacity};
return config
'';
return config
'';
};
programs.zsh.initExtra = /*bash*/ ''
if [ -n "$WEZTERM_PANE" ]; then
alias ssh="wezterm ssh"
fi
'';
programs.zsh.initExtra = # bash
''
if [ -n "$WEZTERM_PANE" ]; then
alias ssh="wezterm ssh"
fi
'';
home.file.".config/wezterm" = {
source = ./.;

View file

@ -1,4 +1,9 @@
{ lib, config, pkgs, ... }:
{
lib,
config,
pkgs,
...
}:
let
cfg = config.profile.whatsapp;
in

View file

@ -1,4 +1,9 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
let
cfg = config.profile.programs.yazi;
inherit (lib) mkIf;
@ -11,7 +16,11 @@ in
settings = {
manager = {
# 1/8 width for parent, 4/8 width for current, 3/8 width for preview
ratio = [ 1 4 3 ];
ratio = [
1
4
3
];
sort_by = "natural";
sort_sensitive = false;
sort_dir_first = true;
@ -22,13 +31,24 @@ in
};
opener = {
edit = [
{ run = ''nvim "$@"''; block = true; desc = "Edit in Neovim"; }
{
run = ''nvim "$@"'';
block = true;
desc = "Edit in Neovim";
}
];
play = [
{ run = ''mpv "$@"''; orphan = true; desc = "Play in MPV"; }
{
run = ''mpv "$@"'';
orphan = true;
desc = "Play in MPV";
}
];
open = [
{ run = ''xdg-open "$@"''; desc = "Open"; }
{
run = ''xdg-open "$@"'';
desc = "Open";
}
];
};
open = {
@ -48,17 +68,29 @@ in
# Multiple openers for a single rule
{
name = "*.html";
use = [ "open" "edit" ];
use = [
"open"
"edit"
];
}
];
append_rules = [
{ name = "*"; use = "open"; }
{
name = "*";
use = "open";
}
];
};
plugin = {
prepend_previewers = [
{ mime = "{image,audio,video}/*"; run = "mediainfo"; }
{ mime = "application/x-subrip"; run = "mediainfo"; }
{
mime = "{image,audio,video}/*";
run = "mediainfo";
}
{
mime = "application/x-subrip";
run = "mediainfo";
}
];
};
};

View file

@ -1,4 +1,10 @@
{ config, lib, pkgs, unstable, ... }:
{
config,
lib,
pkgs,
unstable,
...
}:
let
cfg = config.profile.home.programs.zellij;
plugins = {
@ -26,7 +32,7 @@ in
# autoloaded first after zshenv.
programs.zsh.initExtraFirst = lib.mkOrder 50 (
if cfg.autoAttach then
/*bash*/
# bash
''
if [[ ! -z "$SSH_CLIENT" ]]; then
if [[ -z "$ZELLIJ" ]]; then
@ -47,21 +53,23 @@ in
fi
''
else
/*bash*/ ''
if [[ ! -z "$SSH_CLIENT" ]]; then
if [[ -z "$ZELLIJ" ]]; then
zellij attach -c default
exit
fi
fi
''
# bash
''
if [[ ! -z "$SSH_CLIENT" ]]; then
if [[ -z "$ZELLIJ" ]]; then
zellij attach -c default
exit
fi
fi
''
);
home.file.".config/zellij/config.kdl".text =
let
mod = cfg.mod;
in
/*kdl*/ ''
# kdl
''
theme "catppuccin-mocha";
plugins {

View file

@ -1,5 +1,6 @@
{ plugins, timezone, ... }:
/*kdl*/ ''
# kdl
''
layout {
pane split_direction="vertical" {
pane

View file

@ -1,5 +1,6 @@
{ plugins, timezone, ... }:
/*kdl*/ ''
# kdl
''
layout {
pane split_direction="vertical" {
pane

View file

@ -1,5 +1,6 @@
{ plugins, timezone, ... }:
/*kdl*/ ''
# kdl
''
layout {
pane split_direction="vertical" {
pane

View file

@ -1,5 +1,6 @@
{ plugins, timezone, ... }:
/*kdl*/ ''
# kdl
''
layout {
pane split_direction="vertical" {
pane

View file

@ -1,5 +1,6 @@
{ plugins, timezone, ... }:
/*kdl*/ ''
# kdl
''
layout {
pane split_direction="vertical" {
pane

View file

@ -1,5 +1,6 @@
{ plugins, timezone, ... }:
/*kdl*/ ''
# kdl
''
layout {
pane split_direction="vertical" {
pane

View file

@ -1,12 +1,13 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
let
cfg = config.profile.home.programs.zoom;
inherit (lib) mkIf;
in
{
config = mkIf cfg.enable {
home.packages = with pkgs; [
zoom-us
];
};
config = mkIf cfg.enable { home.packages = with pkgs; [ zoom-us ]; };
}

View file

@ -1,4 +1,9 @@
{ pkgs, lib, config, ... }:
{
pkgs,
lib,
config,
...
}:
let
inherit (lib.strings) optionalString concatStrings;
in
@ -11,13 +16,14 @@ in
];
programs.zsh = {
enable = true;
envExtra = /*bash*/ ''
# Disable loading global RC files in /etc/zsh/*
# Mostly because they are unneeded
# and global rc files has to be small for security reasons (no plugins)
# thus making them saver for Root account to load them.
unsetopt GLOBAL_RCS
'';
envExtra = # bash
''
# Disable loading global RC files in /etc/zsh/*
# Mostly because they are unneeded
# and global rc files has to be small for security reasons (no plugins)
# thus making them saver for Root account to load them.
unsetopt GLOBAL_RCS
'';
autosuggestion.enable = true;
enableCompletion = true;
defaultKeymap = "emacs";
@ -52,38 +58,41 @@ in
size = 40000;
};
completionInit = lib.mkOrder 9999 (concatStrings [
/* bash */
# bash
''
mkdir -p $ZSH_CACHE_DIR/completions
fpath+=$ZSH_CACHE_DIR/completions
fpath+=${pkgs.zsh-completions}/share/zsh/site-functions
''
(optionalString config.profile.podman.enable /*bash*/ ''
if [ ! -f $ZSH_CACHE_DIR/completions/_podman ]; then
podman completion zsh > $ZSH_CACHE_DIR/completions/_podman
fi
'')
(optionalString config.profile.podman.enable # bash
''
if [ ! -f $ZSH_CACHE_DIR/completions/_podman ]; then
podman completion zsh > $ZSH_CACHE_DIR/completions/_podman
fi
''
)
# Value below must be always last in the completionInit
/* bash */
# bash
''
autoload -U compinit && compinit
''
]);
syntaxHighlighting.enable = true;
initExtraFirst = /*bash*/ ''
export ZSH_CACHE_DIR=$HOME/.cache/zsh
initExtraFirst = # bash
''
export ZSH_CACHE_DIR=$HOME/.cache/zsh
# if [ -f $HOME/.config/zsh/.p10k.zsh ]; then
# source $HOME/.config/zsh/.p10k.zsh
# fi
# if [ -f $HOME/.config/zsh/.p10k.zsh ]; then
# source $HOME/.config/zsh/.p10k.zsh
# fi
_ZSH_COLOR_SCHEME_FILE=$HOME/.cache/wallust/sequences
if [ -f "$_ZSH_COLOR_SCHEME_FILE" ]; then
(cat "$_ZSH_COLOR_SCHEME_FILE" &)
fi
'';
_ZSH_COLOR_SCHEME_FILE=$HOME/.cache/wallust/sequences
if [ -f "$_ZSH_COLOR_SCHEME_FILE" ]; then
(cat "$_ZSH_COLOR_SCHEME_FILE" &)
fi
'';
initExtra = concatStrings [
/*bash*/
# bash
''
packfiles() {
find $(NIXPKGS_ALLOW_UNFREE=1 nix build "nixpkgs#$1" --impure --no-link --print-out-paths)

View file

@ -13,9 +13,7 @@
#### Required Options ####
hostname = lib.mkOption {
type = lib.types.str;
};
hostname = lib.mkOption { type = lib.types.str; };
networking.disableWaitOnline = lib.mkEnableOption "disable waiting for network";
networking.externalInterface = lib.mkOption {
type = lib.types.str;
@ -28,12 +26,8 @@
};
user = {
name = lib.mkOption {
type = lib.types.str;
};
fullName = lib.mkOption {
type = lib.types.str;
};
name = lib.mkOption { type = lib.types.str; };
fullName = lib.mkOption { type = lib.types.str; };
uid = lib.mkOption {
type = lib.types.int;
default = 1000;
@ -46,9 +40,7 @@
getty.autoLogin = lib.mkEnableOption "auto-login to getty";
};
system.stateVersion = lib.mkOption {
type = lib.types.str;
};
system.stateVersion = lib.mkOption { type = lib.types.str; };
#### Optionals ####

View file

@ -21,7 +21,10 @@ in
};
displayManager = lib.mkOption {
type = lib.types.enum [ "sddm" "tuigreet" ];
type = lib.types.enum [
"sddm"
"tuigreet"
];
default = "tuigreet";
};
@ -74,12 +77,24 @@ in
wallust = {
backend = lib.mkOption {
type = lib.types.enum [ "full" "resized" "wal" "thumb" "fastresize" "kmeans" ];
type = lib.types.enum [
"full"
"resized"
"wal"
"thumb"
"fastresize"
"kmeans"
];
default = "kmeans";
description = "How the image is parse, in order to get the colors";
};
colorSpace = lib.mkOption {
type = lib.types.enum [ "lab" "labmixed" "lch" "lchmixed" ];
type = lib.types.enum [
"lab"
"labmixed"
"lch"
"lchmixed"
];
default = "lch";
description = "What color space to use to produce and select the most prominent colors";
};

View file

@ -43,7 +43,6 @@
autostart = lib.mkEnableOption "variety autostart";
};
bitwarden = {
enable = lib.mkEnableOption "bitwarden";
autostart = lib.mkEnableOption "bitwarden autostart";

View file

@ -1,4 +1,9 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
let
inherit (lib) mkEnableOption mkOption types;
in

View file

@ -4,9 +4,7 @@ let
secondaryMonitor = "ViewSonic Corporation VX3276-QHD V9W204243765";
in
{
imports = [
../options
];
imports = [ ../options ];
profile = {
hostname = "castle";
@ -36,8 +34,20 @@ in
];
};
waybar.persistent-workspaces = {
DP-1 = [ 1 2 3 4 5 6 7 ];
DP-2 = [ 8 9 10 ];
DP-1 = [
1
2
3
4
5
6
7
];
DP-2 = [
8
9
10
];
};
pyprland.wallpaper-dirs = [ "/nas/redmage/images/windows" ];
wallust.alpha = 80;

View file

@ -1,8 +1,6 @@
{ ... }:
{
imports = [
../options
];
imports = [ ../options ];
profile = {
hostname = "fort";
@ -15,9 +13,7 @@
hyprland = {
enable = true;
settings = {
monitors = [
",preferred,auto,1"
];
monitors = [ ",preferred,auto,1" ];
workspaces = [
"1,default:true"
"2"
@ -32,7 +28,18 @@
];
};
waybar.persistent-workspaces = {
eDP-1 = [ 1 2 3 4 5 6 7 8 9 10 ];
eDP-1 = [
1
2
3
4
5
6
7
8
9
10
];
};
pyprland.wallpaper-dirs = [ "/home/tigor/Syncthing/Redmage/Laptop-Kerja" ];
wallust.alpha = 80;

View file

@ -1,8 +1,6 @@
{ ... }:
{
imports = [
../options
];
imports = [ ../options ];
profile = {
hostname = "homeserver";
@ -23,7 +21,10 @@
openssh.enable = true;
go.enable = true;
networking.firewall.enable = true;
networking.firewall.allowedTCPPorts = [ 80 443 ];
networking.firewall.allowedTCPPorts = [
80
443
];
podman = {
enable = true;
pihole.enable = true;

View file

@ -3,12 +3,13 @@ let
hyprctl = "${pkgs.hyprland}/bin/hyprctl";
gojq = "${pkgs.gojq}/bin/gojq";
in
pkgs.writeShellScriptBin "focus-window.sh" /*sh*/ ''
appname="$SWAYNC_APP_NAME"
state="$(${hyprctl} -j clients)"
window="$(echo "$state" | ${gojq} -r --arg APP "$appname" '.[] | select(.class == $APP) | .address')"
pkgs.writeShellScriptBin "focus-window.sh" # sh
''
appname="$SWAYNC_APP_NAME"
state="$(${hyprctl} -j clients)"
window="$(echo "$state" | ${gojq} -r --arg APP "$appname" '.[] | select(.class == $APP) | .address')"
if [[ "$window" != "" ]]; then
${hyprctl} dispatch focuswindow address:"$window"
fi
''
if [[ "$window" != "" ]]; then
${hyprctl} dispatch focuswindow address:"$window"
fi
''

View file

@ -1,4 +1,10 @@
{ hardware-configuration, profile-path, config, pkgs, ... }:
{
hardware-configuration,
profile-path,
config,
pkgs,
...
}:
{
imports = [
profile-path
@ -16,10 +22,12 @@
networking.hostName = config.profile.hostname;
systemd.services.NetworkManager-wait-online.enable = !config.profile.networking.disableWaitOnline;
nixpkgs.config.allowUnfree = true;
nix.settings.experimental-features = [ "nix-command" "flakes" ];
nix.settings.experimental-features = [
"nix-command"
"flakes"
];
nix.extraOptions = ''
http-connections = 8
connect-timeout = 5
@ -79,6 +87,7 @@
# Tools for nh
nix-output-monitor
nvd
nixfmt-rfc-style
];
services.dbus.implementation = "broker";

View file

@ -12,7 +12,8 @@ in
enable = true;
onCalendar = "weekly"; # Default value
};
packages = [ ]
packages =
[ ]
++ optional cfg.zen-browser.enable "io.github.zen_browser.zen"
++ optional cfg.redisinsight.enable "com.redis.RedisInsight";
};

View file

@ -1,4 +1,9 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
let
cfg = config.profile.keyboard;
in

View file

@ -1,4 +1,9 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
let
cfg = config.profile.android;
username = config.profile.user.name;
@ -7,8 +12,6 @@ in
config = lib.mkIf cfg.enable {
users.users.${username}.extraGroups = [ "adbusers" ];
programs.adb.enable = true;
environment.systemPackages = with pkgs; [
androidenv.androidPkgs_9_0.platform-tools
];
environment.systemPackages = with pkgs; [ androidenv.androidPkgs_9_0.platform-tools ];
};
}

View file

@ -1,9 +1,12 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
let
cfg = config.profile.brightnessctl;
in
{
config = lib.mkIf cfg.enable {
environment.systemPackages = [ pkgs.brightnessctl ];
};
config = lib.mkIf cfg.enable { environment.systemPackages = [ pkgs.brightnessctl ]; };
}

View file

@ -1,23 +1,22 @@
{ pkgs, ... }:
{
fonts = {
packages = with pkgs;
[
# icon fonts
material-design-icons
packages = with pkgs; [
# icon fonts
material-design-icons
# normal fonts
noto-fonts
noto-fonts-cjk
noto-fonts-emoji
noto-fonts-color-emoji
# normal fonts
noto-fonts
noto-fonts-cjk
noto-fonts-emoji
noto-fonts-color-emoji
nerdfonts
nerdfonts
# (nerdfonts.override {
# fonts = [ "FiraCode" "JetBrainsMono" "Iosevka" ];
# })
];
# (nerdfonts.override {
# fonts = [ "FiraCode" "JetBrainsMono" "Iosevka" ];
# })
];
# use fonts specified by user rather than default ones
enableDefaultPackages = false;
@ -26,9 +25,18 @@
# the reason there's Noto Color Emoji everywhere is to override DejaVu's
# B&W emojis that would sometimes show instead of some Color emojis
fontconfig.defaultFonts = {
serif = [ "Noto Serif" "Noto Color Emoji" ];
sansSerif = [ "Noto Sans" "Noto Color Emoji" ];
monospace = [ "JetBrainsMono Nerd Font" "Noto Color Emoji" ];
serif = [
"Noto Serif"
"Noto Color Emoji"
];
sansSerif = [
"Noto Sans"
"Noto Color Emoji"
];
monospace = [
"JetBrainsMono Nerd Font"
"Noto Color Emoji"
];
emoji = [ "Noto Color Emoji" ];
};
};

View file

@ -1,4 +1,10 @@
{ inputs, config, lib, pkgs, ... }:
{
inputs,
config,
lib,
pkgs,
...
}:
let
cfg = config.profile.hyprland;
hyprlandPkg = inputs.hyprland.packages."${pkgs.system}".hyprland;
@ -68,9 +74,7 @@ in
services.dbus.enable = true;
xdg.portal = {
enable = true;
extraPortals = with pkgs; [
xdg-desktop-portal-gtk
];
extraPortals = with pkgs; [ xdg-desktop-portal-gtk ];
};
programs.file-roller.enable = true;

View file

@ -1,4 +1,9 @@
{ pkgs, config, lib, ... }:
{
pkgs,
config,
lib,
...
}:
let
cfg = config.profile.kde;
in
@ -24,8 +29,7 @@ in
haruna
];
environment.etc."chromium/native-messaging-hosts/org.kde.plasma.browser_integration.json".source =
"${pkgs.plasma-browser-integration}/etc/chromium/native-messaging-hosts/org.kde.plasma.browser_integration.json";
environment.etc."chromium/native-messaging-hosts/org.kde.plasma.browser_integration.json".source = "${pkgs.plasma-browser-integration}/etc/chromium/native-messaging-hosts/org.kde.plasma.browser_integration.json";
# Configure keymap in X11
services.xserver = {

View file

@ -24,11 +24,13 @@
enable = true;
};
environment.etc."systemd/resolved.conf.d/10-bareksa.conf".source = (pkgs.formats.ini { }).generate "10-bareksa.conf" {
Resolve = {
# This dns server is only available when VPN is connected.
DNS = "192.168.3.215";
Domains = "~bareksa.local";
};
};
environment.etc."systemd/resolved.conf.d/10-bareksa.conf".source =
(pkgs.formats.ini { }).generate "10-bareksa.conf"
{
Resolve = {
# This dns server is only available when VPN is connected.
DNS = "192.168.3.215";
Domains = "~bareksa.local";
};
};
}

View file

@ -1,4 +1,9 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
let
cfg = config.profile.openssh;
inherit (lib.meta) getExe;
@ -39,30 +44,33 @@ lib.mkMerge [
};
};
sops.secrets."ntfy/tokens/homeserver" = { sopsFile = ../../secrets/ntfy.yaml; };
sops.secrets."ntfy/tokens/homeserver" = {
sopsFile = ../../secrets/ntfy.yaml;
};
sops.templates."ntfy-ssh-login.sh" = {
content = builtins.readFile (lib.meta.getExe (pkgs.writeShellScriptBin "ntfy-ssh-login.sh" /*sh*/ ''
if [ "$PAM_TYPE" == "open_session" ]; then
${getExe pkgs.curl} -X POST \
-H "X-Priority: 4" \
-H "X-Tags: warning" \
-H "Authorization: Bearer ${config.sops.placeholder."ntfy/tokens/homeserver"}" \
-H "X-Title: SSH login" \
-d "$PAM_USER from $PAM_RHOST" \
https://ntfy.tigor.web.id/ssh
fi
''));
content = builtins.readFile (
lib.meta.getExe (
pkgs.writeShellScriptBin "ntfy-ssh-login.sh" # sh
''
if [ "$PAM_TYPE" == "open_session" ]; then
${getExe pkgs.curl} -X POST \
-H "X-Priority: 4" \
-H "X-Tags: warning" \
-H "Authorization: Bearer ${config.sops.placeholder."ntfy/tokens/homeserver"}" \
-H "X-Title: SSH login" \
-d "$PAM_USER from $PAM_RHOST" \
https://ntfy.tigor.web.id/ssh
fi
''
)
);
};
security.pam.services.sshd.text = lib.mkDefault (lib.mkAfter ''
session optional pam_exec.so ${getExe pkgs.bash} ${config.sops.templates."ntfy-ssh-login.sh".path}
'');
security.pam.services.sshd.text = lib.mkDefault (
lib.mkAfter ''
session optional pam_exec.so ${getExe pkgs.bash} ${config.sops.templates."ntfy-ssh-login.sh".path}
''
);
})
{
profile.services.ntfy-sh.client.settings.subscribe = [
{
topic = "ssh";
}
];
}
{ profile.services.ntfy-sh.client.settings.subscribe = [ { topic = "ssh"; } ]; }
]

View file

@ -1,4 +1,9 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
let
cfg = config.profile.printing;
username = config.profile.user.name;
@ -11,4 +16,4 @@ in
drivers = [ pkgs.brlaser ]; # Brother Laser Printer
};
};
}
}

View file

@ -1,4 +1,9 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
let
cfg = config.profile.scanner;
username = config.profile.user.name;
@ -6,15 +11,11 @@ in
{
config = lib.mkIf cfg.enable {
users.users.${username}.extraGroups = [ "scanner" ];
environment.systemPackages = with pkgs; [
skanlite
];
environment.systemPackages = with pkgs; [ skanlite ];
hardware.sane = {
enable = true;
brscan4.enable = true; # Brother Scanner
extraBackends = with pkgs; [
sane-airscan
];
extraBackends = with pkgs; [ sane-airscan ];
};
};
}

View file

@ -1,4 +1,9 @@
{ config, pkgs, lib, ... }:
{
config,
pkgs,
lib,
...
}:
let
cfg = config.profile.vial;
in

View file

@ -1,4 +1,9 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
let
cfg = config.profile.programs.yazi;
inherit (lib) mkIf;
@ -16,7 +21,11 @@ in
yazi = {
manager = {
# 1/8 width for parent, 4/8 width for current, 3/8 width for preview
ratio = [ 1 4 3 ];
ratio = [
1
4
3
];
sort_by = "natural";
sort_sensitive = false;
sort_dir_first = true;
@ -27,13 +36,24 @@ in
};
opener = {
edit = [
{ run = ''nvim "$@"''; block = true; desc = "Edit in Neovim"; }
{
run = ''nvim "$@"'';
block = true;
desc = "Edit in Neovim";
}
];
play = [
{ run = ''mpv "$@"''; orphan = true; desc = "Play in MPV"; }
{
run = ''mpv "$@"'';
orphan = true;
desc = "Play in MPV";
}
];
open = [
{ run = ''xdg-open "$@"''; desc = "Open"; }
{
run = ''xdg-open "$@"'';
desc = "Open";
}
];
};
open = {
@ -53,11 +73,17 @@ in
# Multiple openers for a single rule
{
name = "*.html";
use = [ "open" "edit" ];
use = [
"open"
"edit"
];
}
];
append_rules = [
{ name = "*"; use = "open"; }
{
name = "*";
use = "open";
}
];
};
};

View file

@ -1,4 +1,10 @@
{ lib, stdenv, fetchzip, gettext, ... }:
{
lib,
stdenv,
fetchzip,
gettext,
...
}:
stdenv.mkDerivation rec {
pname = "cockpit-podman";
@ -9,11 +15,12 @@ stdenv.mkDerivation rec {
sha256 = "sha256-qLt6x9W+M/DztzcFxyWZLHUTM1ZsPCOykO+6o/URa6c=";
};
nativeBuildInputs = [
gettext
];
nativeBuildInputs = [ gettext ];
makeFlags = [ "DESTDIR=$(out)" "PREFIX=" ];
makeFlags = [
"DESTDIR=$(out)"
"PREFIX="
];
postPatch = ''
substituteInPlace Makefile \

View file

@ -1,4 +1,9 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
let
cfg = config.profile.podman;
username = config.profile.user.name;
@ -34,7 +39,6 @@ in
};
};
# Taken IP-Range Subnets
#
# 10.88.0.2 -> Redmage

View file

@ -31,9 +31,7 @@ in
TZ = "Asia/Jakarta";
# MEMOS_PUBLIC = "true";
};
volumes = [
"${rootVolume}:/var/opt/memos"
];
volumes = [ "${rootVolume}:/var/opt/memos" ];
extraOptions = [
"--network=podman"
"--ip=${ip}"

View file

@ -5,34 +5,35 @@ let
inherit (lib) mkIf;
in
{
virtualisation.oci-containers.containers."metrics" = mkIf (cfg.enable && config.profile.services.telemetry.enable) {
image = "quay.io/navidys/prometheus-podman-exporter";
hostname = "metrics";
autoStart = true;
user = "0:0";
environment = {
TZ = "Asia/Jakarta";
CONTAINER_HOST = "unix:///run/podman/podman.sock";
};
volumes = [
"/run/podman/podman.sock:/run/podman/podman.sock"
];
extraOptions = [
"--network=podman"
"--ip=${ip}"
"--security-opt=label=disable"
];
labels = {
"io.containers.autoupdate" = "registry";
};
};
environment.etc."alloy/config.alloy".text = /*hcl*/ ''
prometheus.scrape "podman" {
targets = [{__address__ = "${ip}:9882"}]
virtualisation.oci-containers.containers."metrics" =
mkIf (cfg.enable && config.profile.services.telemetry.enable)
{
image = "quay.io/navidys/prometheus-podman-exporter";
hostname = "metrics";
autoStart = true;
user = "0:0";
environment = {
TZ = "Asia/Jakarta";
CONTAINER_HOST = "unix:///run/podman/podman.sock";
};
volumes = [ "/run/podman/podman.sock:/run/podman/podman.sock" ];
extraOptions = [
"--network=podman"
"--ip=${ip}"
"--security-opt=label=disable"
];
labels = {
"io.containers.autoupdate" = "registry";
};
};
environment.etc."alloy/config.alloy".text = # hcl
''
prometheus.scrape "podman" {
targets = [{__address__ = "${ip}:9882"}]
job_name = "podman"
job_name = "podman"
forward_to = [prometheus.remote_write.mimir.receiver]
}
'';
forward_to = [prometheus.remote_write.mimir.receiver]
}
'';
}

View file

@ -1,4 +1,9 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
let
name = "minecraft";
podman = config.profile.podman;
@ -24,33 +29,36 @@ let
in
{
config = mkIf (podman.enable && podman.${name}.enable) {
services.caddy.virtualHosts.${domain}.extraConfig = /*html*/ ''
header Content-Type text/html
respond <<EOF
<!DOCTYPE html>
<html>
<head>
<title>Minecraft Server</title>
</head>
<body>
<h1>Congrats! The minecraft server should be up!</h1>
<h2>
This server is invitation only.
Please contact the server owner for more info.
</h2>
<p>Server Address: <b>${domain}</b></p>
<p>Bedrock Server Port: <b>19132</b></p>
<p>Java Server Port: <b>25565</b></p>
</body>
</html>
EOF 200
'';
services.caddy.virtualHosts.${domain}.extraConfig = # html
''
header Content-Type text/html
respond <<EOF
<!DOCTYPE html>
<html>
<head>
<title>Minecraft Server</title>
</head>
<body>
<h1>Congrats! The minecraft server should be up!</h1>
<h2>
This server is invitation only.
Please contact the server owner for more info.
</h2>
<p>Server Address: <b>${domain}</b></p>
<p>Bedrock Server Port: <b>19132</b></p>
<p>Java Server Port: <b>25565</b></p>
</body>
</html>
EOF 200
'';
# Minecraft only autoupdates at startup
#
# To keep up with the update, restart the server at 4am everyday.
systemd =
let serviceName = "podman-${name}"; in
let
serviceName = "podman-${name}";
in
{
tmpfiles.settings."${serviceName}-mount".${rootVolume}.d = {
group = config.profile.user.name;
@ -88,9 +96,7 @@ in
"19132:19132/udp"
"19132:19132"
];
volumes = [
"${rootVolume}:/minecraft"
];
volumes = [ "${rootVolume}:/minecraft" ];
extraOptions = [
"--network=podman"
"--ip=${ip}"

View file

@ -24,9 +24,7 @@ in
environment = {
TZ = "Asia/Jakarta";
};
volumes = [
"/tmp:/tmp"
];
volumes = [ "/tmp:/tmp" ];
extraOptions = [
"--network=podman"
"--ip=${ip}"

View file

@ -34,16 +34,12 @@ in
ZO_DATA_DIR = "/data";
ZO_WEB_URL = "https://${domain}";
};
volumes = [
"${rootVolume}/data:/data"
];
volumes = [ "${rootVolume}/data:/data" ];
extraOptions = [
"--network=podman"
"--ip=${ip}"
];
environmentFiles = [
config.sops.secrets."openobserve/env".path
];
environmentFiles = [ config.sops.secrets."openobserve/env".path ];
labels = {
"io.containers.autoupdate" = "registry";
};

View file

@ -27,7 +27,9 @@ in
#
# This works by collecting all the virtual hosts defined in caddy
# and check if the length of the list changes, if it does, we restart the pihole container.
systemd.services."podman-${name}".restartTriggers = attrsets.mapAttrsToList (name: _: name) config.services.caddy.virtualHosts;
systemd.services."podman-${name}".restartTriggers = attrsets.mapAttrsToList (
name: _: name
) config.services.caddy.virtualHosts;
environment.etc."pihole/custom.list" = {
# Copy file instead of symlink
mode = "0444";
@ -46,7 +48,9 @@ in
''
192.168.100.5 vpn.tigor.web.id
${strings.concatStringsSep "\n" (
attrsets.mapAttrsToList (name: _: "192.168.100.5 ${strings.removePrefix "https://" name}") config.services.caddy.virtualHosts
attrsets.mapAttrsToList (
name: _: "192.168.100.5 ${strings.removePrefix "https://" name}"
) config.services.caddy.virtualHosts
)}
'';
};
@ -72,9 +76,7 @@ in
"pihole-dnsmasq:/etc/dnsmasq.d"
"/etc/pihole/custom.list:/etc/pihole/custom.list"
];
environmentFiles = [
config.sops.secrets."pihole/env".path
];
environmentFiles = [ config.sops.secrets."pihole/env".path ];
extraOptions = [
"--ip=${ip}"
"--network=podman"

View file

@ -1,4 +1,9 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
let
name = "qbittorrent";
domain = "${name}.tigor.web.id";
@ -24,56 +29,64 @@ lib.mkMerge [
chown ${uid}:${gid} ${volume} ${volume}/{config,downloads,progress,watch}
'';
sops = {
secrets =
let
opts = { sopsFile = ../../secrets/ntfy.yaml; };
opts = {
sopsFile = ../../secrets/ntfy.yaml;
};
in
{
"ntfy/tokens/homeserver" = opts;
};
templates = {
"qbittorrent-ntfy-env".content = /*sh*/ ''
NTFY_TOKEN=${config.sops.placeholder."ntfy/tokens/homeserver"}
'';
"qbittorrent-ntfy-env".content = # sh
''
NTFY_TOKEN=${config.sops.placeholder."ntfy/tokens/homeserver"}
'';
};
};
virtualisation.oci-containers.containers.${name} =
let
finish-notify-script = pkgs.writeScriptBin "notify-finish.sh" (optionalString config.services.ntfy-sh.enable /*sh*/ ''
#!/bin/bash
# $1 = %N | Torrent Name
# $2 = %L | Category
# $3 = %G | Tags
# $4 = %F | Content Path
# $5 = %R | Root Path
# $6 = %D | Save Path
# $7 = %C | Number of files
# $8 = %Z | Torrent Size
# $9 = %T | Current Tracker
# $10 = %I | Info Hash v1
# $11 = %J | Info Hash v2
# $12 = %K | Torrent ID
finish-notify-script = pkgs.writeScriptBin "notify-finish.sh" (
optionalString config.services.ntfy-sh.enable # sh
''
#!/bin/bash
# $1 = %N | Torrent Name
# $2 = %L | Category
# $3 = %G | Tags
# $4 = %F | Content Path
# $5 = %R | Root Path
# $6 = %D | Save Path
# $7 = %C | Number of files
# $8 = %Z | Torrent Size
# $9 = %T | Current Tracker
# $10 = %I | Info Hash v1
# $11 = %J | Info Hash v2
# $12 = %K | Torrent ID
size=$(echo $8 | numfmt --to=iec)
curl -X POST \
-H "Authorization: Bearer $NTFY_TOKEN" \
-H "X-Title: $1" \
-H "X-Tags: white_check_mark,$2" \
-d "Number of Files: $7, Size: $size" \
https://ntfy.tigor.web.id/qbittorrent?priority=4
'');
start-notify-script = pkgs.writeScriptBin "notify-start.sh" (optionalString config.services.ntfy-sh.enable /*sh*/ ''
#!/bin/bash
curl -X POST \
-H "Authorization: Bearer $NTFY_TOKEN" \
-H "X-Title: $1" \
-H "X-Tags: rocket,$2" \
-d "Starts downloading" \
https://ntfy.tigor.web.id/qbittorrent
'');
size=$(echo $8 | numfmt --to=iec)
curl -X POST \
-H "Authorization: Bearer $NTFY_TOKEN" \
-H "X-Title: $1" \
-H "X-Tags: white_check_mark,$2" \
-d "Number of Files: $7, Size: $size" \
https://ntfy.tigor.web.id/qbittorrent?priority=4
''
);
start-notify-script = pkgs.writeScriptBin "notify-start.sh" (
optionalString config.services.ntfy-sh.enable # sh
''
#!/bin/bash
curl -X POST \
-H "Authorization: Bearer $NTFY_TOKEN" \
-H "X-Title: $1" \
-H "X-Tags: rocket,$2" \
-d "Starts downloading" \
https://ntfy.tigor.web.id/qbittorrent
''
);
in
{
inherit image;
@ -102,19 +115,11 @@ lib.mkMerge [
"--ip=${ip}"
"--network=podman"
];
environmentFiles = [
config.sops.templates."qbittorrent-ntfy-env".path
];
environmentFiles = [ config.sops.templates."qbittorrent-ntfy-env".path ];
labels = {
"io.containers.autoupdate" = "registry";
};
};
})
{
profile.services.ntfy-sh.client.settings.subscribe = [
{
topic = "qbittorrent";
}
];
}
{ profile.services.ntfy-sh.client.settings.subscribe = [ { topic = "qbittorrent"; } ]; }
]

Some files were not shown because too many files have changed in this diff Show more