Merge branch 'master' of ssh://git.joshuabell.xyz:3032/ringofstorms/dotfiles

This commit is contained in:
RingOfStorms (Joshua Bell) 2025-10-28 12:02:17 -05:00
commit 1761e26ff6
200 changed files with 5150 additions and 7625 deletions

View file

@ -1,196 +0,0 @@
{
config,
lib,
...
}:
let
name = "forgejo";
hostDataDir = "/var/lib/${name}";
hostAddress = "10.0.0.1";
containerAddress = "10.0.0.2";
hostAddress6 = "fc00::1";
containerAddress6 = "fc00::2";
binds = [
# Postgres data, must use postgres user in container and host
{
host = "${hostDataDir}/postgres";
# Adjust based on container postgres data dir
container = "/var/lib/postgresql/17";
user = "postgres";
uid = config.ids.uids.postgres;
gid = config.ids.gids.postgres;
}
# Postgres backups
{
host = "${hostDataDir}/backups/postgres";
container = "/var/backup/postgresql";
user = "postgres";
uid = config.ids.uids.postgres;
gid = config.ids.gids.postgres;
}
# App data, uses custom user uid
{
host = "${hostDataDir}/data";
container = "/var/lib/forgejo";
user = "forgejo";
uid = 115;
gid = 115;
}
];
uniqueUsers = lib.foldl' (
acc: bind: if lib.lists.any (item: item.user == bind.user) acc then acc else acc ++ [ bind ]
) [ ] binds;
users = {
users = lib.listToAttrs (
lib.map (u: {
name = u.user;
value = {
isSystemUser = true;
name = u.user;
uid = u.uid;
group = u.user;
};
}) uniqueUsers
);
groups = lib.listToAttrs (
lib.map (g: {
name = g.user;
value.gid = g.gid;
}) uniqueUsers
);
};
in
{
# Ensure users exists on host machine with same IDs as container
inherit users;
# Ensure directories exist on host machine
system.activationScripts.createMediaServerDirs = ''
${lib.concatStringsSep "\n" (
lib.map (bind: ''
mkdir -p ${bind.host}
chown -R ${toString bind.user}:${toString bind.gid} ${bind.host}
chmod -R 750 ${bind.host}
'') binds
)}
'';
containers.${name} = {
ephemeral = true;
autoStart = true;
privateNetwork = true;
hostAddress = hostAddress;
localAddress = containerAddress;
hostAddress6 = hostAddress6;
localAddress6 = containerAddress6;
bindMounts = lib.foldl (
acc: bind:
{
"${bind.container}" = {
hostPath = bind.host;
isReadOnly = false;
};
}
// acc
) { } binds;
config =
{ config, pkgs, ... }:
{
system.stateVersion = "24.11";
networking = {
firewall = {
enable = true;
allowedTCPPorts = [
3000
3032
];
};
# Use systemd-resolved inside the container
# Workaround for bug https://github.com/NixOS/nixpkgs/issues/162686
useHostResolvConf = lib.mkForce false;
};
services.resolved.enable = true;
# Ensure users exist on container
inherit users;
services.postgresql = {
enable = true;
package = pkgs.postgresql_17.withJIT;
enableJIT = true;
authentication = ''
local all all trust
host all all 127.0.0.1/8 trust
host all all ::1/128 trust
host all all fc00::1/128 trust
'';
};
# Backup database
services.postgresqlBackup = {
enable = true;
};
services.forgejo = {
enable = true;
dump = {
enable = false;
type = "tar.gz";
};
database = {
type = "postgres";
};
settings = {
DEFAULT = {
APP_NAME = "Josh's Git";
};
server = {
PROTOCOL = "http";
DOMAIN = "git.joshuabell.xyz";
HTTP_ADDR = "0.0.0.0";
HTTP_PORT = 3000;
START_SSH_SERVER = true;
SSH_DOMAIN = "git.joshuabell.xyz";
SSH_LISTEN_HOST = "0.0.0.0";
SSH_LISTEN_PORT = 3032; # actual listen port
SSH_PORT = 3032; # used in UI
BUILTIN_SSH_SERVER_USER = "git";
LANDING_PAGE = "explore";
};
service = {
DISABLE_REGISTRATION = true;
ENABLE_BASIC_AUTHENTICATION = false;
DISABLE_USERS_PAGE = true;
DISABLE_ORGANIZATIONS_PAGE = true;
};
repository = {
# ENABLE_PUSH_CREATE_USER = true;
# ENABLE_PUSH_CREATE_ORG = true;
DISABLE_STARS = true;
DEFAULT_PRIVATE = "private";
};
admin = {
DISABLE_REGULAR_ORG_CREATION = true;
USER_DISABLED_FEATURES = "deletion";
};
other = {
SHOW_FOOTER_POWERED_BY = false;
SHOW_FOOTER_VERSION = false;
SHOW_FOOTER_TEMPLATE_LOAD_TIME = false;
};
migrations = {
ALLOWED_DOMAINS = "*.github.com,github.com";
ALLOW_LOCALNETWORKS = true;
};
};
};
};
};
}

View file

@ -1,7 +0,0 @@
docker run \
-e hostname=https://obsidiansync.joshuabell.xyz \
-e database=obsidian_sync \
-e username=obsidian_admin \
-e password=$REPLACE \
docker.io/oleduc/docker-obsidian-livesync-couchdb:master \
deno -A /scripts/generate_setupuri.ts

View file

@ -1,61 +0,0 @@
{
config,
pkgs,
...
}:
let
cfg = config.services.obsidian_sync;
in
{
options.services.obsidian_sync =
let
lib = pkgs.lib;
in
{
port = lib.mkOption {
type = lib.types.port;
default = 5984;
description = "Port number for Obsidian Sync CouchDB server";
};
dataDir = lib.mkOption {
type = lib.types.path;
default = "/var/lib/obsidian_sync";
description = "Directory to store Obsidian Sync data";
};
serverUrl = lib.mkOption {
type = lib.types.str;
description = "URL of the Obsidian Sync server";
};
dockerEnvFiles = lib.mkOption {
type = lib.types.listOf lib.types.path;
default = [ ];
description = "List of environment files to be used by the Obsidian Sync container. When provided you must supply chouchdb user/password env files they will not be supplied by default.";
};
};
config = {
virtualisation.oci-containers.containers = {
#############
# obsidian_sync #
#############
obsidian_sync = {
user = "root";
image = "docker.io/oleduc/docker-obsidian-livesync-couchdb:master";
ports = [
"${toString cfg.port}:${toString cfg.port}"
];
environment = {
SERVER_URL = cfg.serverUrl;
COUCHDB_DATABASE = "obsidian_sync";
COUCHDB_USER = pkgs.lib.mkIf (cfg.dockerEnvFiles == [ ]) "adminu";
COUCHDB_PASSWORD = pkgs.lib.mkIf (cfg.dockerEnvFiles == [ ]) "Password123";
};
environmentFiles = cfg.dockerEnvFiles;
volumes = [
"${cfg.dataDir}/data:/opt/couchdb/data"
"${cfg.dataDir}/config:/opt/couchdb/etc/local.d"
];
};
};
};
}

View file

@ -1,52 +0,0 @@
{
config,
lib,
hyprland,
hyprlandPkgs,
...
}:
let
ccfg = import ../config.nix;
cfg_path = [
ccfg.custom_config_key
"homeManager"
];
cfg = lib.attrsets.getAttrFromPath cfg_path config;
in
{
options =
{ }
// lib.attrsets.setAttrByPath cfg_path {
users = lib.mkOption {
type = lib.types.attrsOf lib.types.attrs;
default = { };
description = "Home manager users to configure. Should match nix options of home-manager.users.<name>.*";
};
stateVersion = lib.mkOption {
type = lib.types.str;
default = "25.05";
description = "Home manager state version";
};
};
config = {
# Home manager options
security.polkit.enable = true;
home-manager.useUserPackages = true;
home-manager.useGlobalPkgs = true;
home-manager.backupFileExtension = "bak";
home-manager.extraSpecialArgs = {
inherit hyprland hyprlandPkgs;
};
home-manager.users = lib.mapAttrs' (name: userConfig: {
inherit name;
value = userConfig // {
home.stateVersion = cfg.stateVersion;
programs.home-manager.enable = true;
home.username = name;
home.homeDirectory = lib.mkForce (if name == "root" then "/root" else "/home/${name}");
};
}) cfg.users;
};
}

View file

@ -1,61 +0,0 @@
{ config, lib, ... }:
{
options.components.foot = {
font_size = lib.mkOption {
type = lib.types.float;
default = 12.0;
description = "Font size for Foot terminal";
};
alpha = lib.mkOption {
type = lib.types.float;
default = 0.94;
description = "Background opacity for Foot terminal (1.0 = opaque)";
};
};
config = {
programs.foot = {
enable = true;
# This renders to ~/.config/foot/foot.ini
settings = {
main = {
# Use the same font and size as your Kitty config
font = "JetBrainsMonoNL Nerd Font:size=${toString config.components.foot.font_size}";
# Initial window size in character cells (Kitty used 160c x 55c)
"initial-window-size-chars" = "160x55";
};
colors = {
# Background opacity (1.0 = opaque)
alpha = toString config.components.foot.alpha;
# Foreground/background
foreground = "e0e0e0";
background = "262626";
# 16-color palette
# normal (07)
regular0 = "1f1f1f"; # black
regular1 = "f38ba8"; # red
regular2 = "a6e3a1"; # green
regular3 = "f9e2af"; # yellow
regular4 = "89b4fa"; # blue
regular5 = "cba6f7"; # magenta
regular6 = "89dceb"; # cyan
regular7 = "e0e0e0"; # white
# bright (815)
bright0 = "565656"; # bright black
bright1 = "f38ba8"; # bright red
bright2 = "a6e3a1"; # bright green
bright3 = "f9e2af"; # bright yellow
bright4 = "89b4fa"; # bright blue
bright5 = "cba6f7"; # bright magenta
bright6 = "89dceb"; # bright cyan
bright7 = "ffffff"; # bright white
};
};
};
};
}

View file

@ -1,65 +0,0 @@
{ config, lib, ... }:
{
options.components.kitty = {
font_size = lib.mkOption {
type = lib.types.float;
default = 12.0;
description = "Font size for Kitty terminal";
};
};
config = {
# Enable Kitty terminal
programs.kitty = {
enable = true;
settings = {
# Window settings
background_opacity = 1.0;
os_window_class = "kitty";
remember_window_size = false;
placement_strategy = "center";
initial_window_width = "160c";
initial_window_height = "55c";
# Remove window borders
hide_window_decorations = "titlebar-only";
tab_title_template = "none";
active_tab_title_template = "none";
draw_minimal_borders = "yes";
window_border_width = "0.1pt";
# Colors (Catppuccin Coal)
foreground = "#e0e0e0";
background = "#262626";
color0 = "#1f1f1f";
color1 = "#f38ba8";
color2 = "#a6e3a1";
color3 = "#f9e2af";
color4 = "#89b4fa";
color5 = "#cba6f7";
color6 = "#89dceb";
color7 = "#e0e0e0";
color8 = "#565656";
color9 = "#f38ba8";
color10 = "#a6e3a1";
color11 = "#f9e2af";
color12 = "#89b4fa";
color13 = "#cba6f7";
color14 = "#89dceb";
color15 = "#ffffff";
# Font settings
font_family = "JetBrainsMonoNL Nerd Font";
font_size = config.components.kitty.font_size;
bold_font = "auto";
italic_font = "auto";
italic_bold_font = "auto";
};
# If you want to include extra configuration this way instead of through the main `settings` attribute
extraConfig = ''
# You can add additional config here if needed
'';
};
};
}

View file

@ -1,18 +0,0 @@
{ ... }:
{
programs.zsh.shellAliases = {
# Nix deprecations
nix-hash = "echo 'The functionality of nix-hash may be covered by various subcommands or options in the new `nix` command.'";
nix-build = "echo 'Use `nix build` instead.'";
nix-info = "echo 'Use `nix flake info` or other `nix` subcommands to obtain system and Nix information.'";
nix-channel = "echo 'Channels are being phased out in favor of flakes. Use `nix flake` subcommands.'";
nix-instantiate = "echo 'Use `nix eval` or `nix-instantiate` with flakes.'";
nix-collect-garbage = "echo 'Use `nix store gc` instead.'";
nix-prefetch-url = "echo 'Use `nix-prefetch` or fetchers in Nix expressions.'";
nix-copy-closure = "echo 'Use `nix copy` instead.'";
nix-shell = "echo 'Use `nix shell` instead.'";
# nix-daemon # No direct replacement: The Nix daemon is still in use and managed by the system service manager.
nix-store = "echo 'Use `nix store` subcommands for store operations.'";
nix-env = "echo 'Use `nix profile` instead'";
};
}

View file

@ -1,4 +0,0 @@
{ ... }:
{
programs.obs-studio.enable = true;
}

View file

@ -1,35 +0,0 @@
{ config, lib, ... }:
let
ccfg = import ../config.nix;
cfg = config.${ccfg.custom_config_key}.boot;
in
{
imports = [
./grub.nix
./systemd.nix
];
config = {
assertions = [
(
let
enabledBootloaders = lib.filter (x: x.enabled) [
{
name = "systemd";
enabled = cfg.systemd.enable;
}
{
name = "grub";
enabled = cfg.grub.enable;
}
];
in
{
assertion = lib.length enabledBootloaders <= 1;
message =
"Only one bootloader can be enabled at a time. Enabled: "
+ lib.concatStringsSep ", " (map (x: x.name) enabledBootloaders);
}
)
];
};
}

View file

@ -1,35 +0,0 @@
{
config,
lib,
...
}:
let
ccfg = import ../config.nix;
cfg_path = [
ccfg.custom_config_key
"boot"
"grub"
];
cfg = lib.attrsets.getAttrFromPath cfg_path config;
in
{
options =
{ }
// lib.attrsets.setAttrByPath cfg_path {
enable = lib.mkEnableOption "Grub bootloader";
device = lib.mkOption {
type = lib.types.str;
default = "/dev/sda";
description = ''
The device to install GRUB on.
'';
};
};
config = lib.mkIf cfg.enable {
boot.loader.grub = {
enable = true;
device = cfg.device;
};
};
}

View file

@ -1,33 +0,0 @@
{
config,
lib,
...
}:
let
ccfg = import ../config.nix;
cfg_path = [
ccfg.custom_config_key
"boot"
"systemd"
];
cfg = lib.attrsets.getAttrFromPath cfg_path config;
in
{
options =
{ }
// lib.attrsets.setAttrByPath cfg_path {
enable = lib.mkEnableOption "Systemd bootloader";
};
config = lib.mkIf cfg.enable {
boot.loader = {
systemd-boot = {
enable = true;
consoleMode = "keep";
};
timeout = 5;
efi = {
canTouchEfiVariables = true;
};
};
};
}

View file

@ -1,3 +0,0 @@
{
custom_config_key = "ringofstorms_common";
}

View file

@ -1,57 +0,0 @@
{
config,
lib,
pkgs,
...
}:
let
ccfg = import ../../config.nix;
cfg_path = [ ccfg.custom_config_key "desktopEnvironment" "cosmic" ];
cfg = lib.attrsets.getAttrFromPath cfg_path config;
in
with lib;
{
options = {}
// lib.attrsets.setAttrByPath cfg_path {
enable = lib.mkEnableOption "COSMIC desktop environment (System76)";
terminalCommand = mkOption {
type = lib.types.str;
default = "foot";
description = "The terminal command to use.";
};
};
config = lib.mkIf cfg.enable {
services.greetd = {
enable = true;
vt = 2;
# settings.default_session = {
# command = "${pkgs.greetd.tuigreet}/bin/tuigreet --time --remember --remember-session --cmd '${pkgs.dbus}/bin/dbus-run-session ${pkgs.cosmic}/bin/cosmic-session'";
# user = "greeter";
# };
};
# Caps Lock as Escape for console/tty
console.useXkbConfig = true;
services.xserver.xkb = {
layout = "us";
options = "caps:escape";
};
environment.systemPackages = with pkgs; [
wl-clipboard
wofi
btop
];
xdg.portal.enable = true;
environment.sessionVariables = {
NIXOS_OZONE_WL = "1";
GTK_THEME = "Adwaita:dark";
};
qt = { enable = true; platformTheme = "gtk2"; style = "adwaita-dark"; };
hardware.graphics.enable = true;
};
}

View file

@ -1,45 +0,0 @@
{ config, lib, ... }:
let
ccfg = import ../config.nix;
cfg = config.${ccfg.custom_config_key}.desktopEnvironment;
in
{
imports = [
./gnome
./hyprland
./sway
./cosmic
];
config = {
assertions = [
(
let
enabledDEs = lib.filter (x: x.enabled) [
{
name = "gnome";
enabled = cfg.gnome.enable;
}
{
name = "hyprland";
enabled = cfg.hyprland.enable;
}
{
name = "sway";
enabled = cfg.sway.enable;
}
{
name = "cosmic";
enabled = cfg.cosmic.enable;
}
];
in
{
assertion = lib.length enabledDEs <= 1;
message =
"Only one desktop environment can be enabled at a time. Enabled: "
+ lib.concatStringsSep ", " (map (x: x.name) enabledDEs);
}
)
];
};
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 70 B

View file

@ -1,208 +0,0 @@
{ cfg }:
{
lib,
pkgs,
...
}:
{
config = lib.mkIf cfg.enable {
home-manager.sharedModules = [
(
{ lib, ... }:
with lib.hm.gvariant;
{
# use `dconf dump /` before and after and diff the files for easy editing of dconf below
# dconf dump / > /tmp/dconf_dump_start && watch -n0.5 "dconf dump / > /tmp/dconf_dump_current && \diff --color /tmp/dconf_dump_start /tmp/dconf_dump_current -U12"
# To get nix specific diff:
# \diff -u /tmp/dconf_dump_start /tmp/dconf_dump_current | grep '^+[^+]' | sed 's/^+//' | dconf2nix
# OR (Must be logged into user directly, no SU to user will work): `dconf watch /`
# OR get the exact converted nixConfig from `dconf dump / | dconf2nix | less` and search with forward slash
dconf.settings = {
"org/gnome/shell" = {
favorite-apps = [ ];
enabled-extensions = with pkgs.gnomeExtensions; [
vertical-workspaces.extensionUuid
compact-top-bar.extensionUuid
tray-icons-reloaded.extensionUuid
vitals.extensionUuid
] ++ lib.optionals cfg.enableRotate [
screen-rotate.extensionUuid
];
};
# Plugin Settings
"org/gnome/shell/extensions/vertical-workspaces" = {
animation-speed-factor = 42;
center-dash-to-ws = false;
dash-bg-color = 0;
dash-position = 2;
dash-position-adjust = 0;
hot-corner-action = 0;
startup-state = 1;
ws-switcher-wraparound = true;
};
"org/gnome/shell/extensions/compact-top-bar" = {
fade-text-on-fullscreen = true;
};
"org/gnome/shell/extensions/vitals" = {
position-in-panel = 1;
};
# Built in settings
"org/gnome/desktop/session" = {
idle-delay = mkUint32 0;
};
"org/gnome/desktop/wm/preferences" = {
resize-with-right-button = true;
button-layout = "maximize:appmenu,close";
audible-bell = false;
wrap-around = true;
};
"org/gnome/settings-daemon/plugins/media-keys" = {
# Disable the lock screen shortcut
screensaver = [ "" ];
custom-keybindings = [
"/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/"
"/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1/"
];
};
"org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0" = {
binding = "<Super>Return";
command = cfg.terminalCommand;
name = "Launch terminal";
};
"org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1" = {
binding = "<Super>Space";
command = "wofi";
name = "Launcher";
};
"org/gnome/desktop/wm/keybindings" = {
minimize = [ "" ];
move-to-workspace-1 = [ "" ];
move-to-workspace-2 = [ "" ];
move-to-workspace-3 = [ "" ];
move-to-workspace-4 = [ "" ];
move-to-workspace-last = [ "" ];
move-to-workspace-down = [ "<Control><Super>j" ];
move-to-workspace-up = [ "<Control><Super>k" ];
# move-to-workspace-left = [ "<Control><Super>h" ];
# move-to-workspace-right = [ "<Control><Super>l" ];
switch-input-source = [ ];
switch-input-source-backward = [ ];
switch-to-workspace-1 = [ "<Super>1" ];
switch-to-workspace-2 = [ "<Super>2" ];
switch-to-workspace-3 = [ "<Super>3" ];
switch-to-workspace-4 = [ "<Super>4" ];
switch-to-workspace-last = [ "" ];
switch-to-workspace-down = [ "<Super>j" ];
switch-to-workspace-up = [ "<Super>k" ];
# switch-to-workspace-left = [ "<Super>k" ];
# switch-to-workspace-right = [ "<Super>j" ];
# move-to-monitor-down = [ "<Control><Super><Shift>j" ];
# move-to-monitor-up = [ "<Control><Super><Shift>k" ];
move-to-monitor-left = [ "<Control><Super>h" ];
move-to-monitor-right = [ "<Control><Super>l" ];
unmaximize = [ "<Super><Shift>j" ];
maximize = [ "<Super><Shift>k" ];
};
"org/gnome/mutter" = {
dynamic-workspaces = true;
edge-tiling = true;
workspaces-only-on-primary = true;
center-new-windows = true;
};
"org/gnome/mutter/keybindings" = {
toggle-tiled-right = [ "<Super><Shift>l" ];
toggle-tiled-left = [ "<Super><Shift>h" ];
};
"org/gnome/settings-daemon/plugins/power" = {
power-button-action = "nothing";
sleep-inactive-ac-type = "nothing";
sleep-inactive-battery-type = "nothing";
idle-brightness = 15;
power-saver-profile-on-low-battery = false;
};
"org/gnome/desktop/background" = {
color-shading-type = "solid";
picture-options = "zoom";
picture-uri = "file://" + (./black.png);
picture-uri-dark = "file://" + (./black.png);
primary-color = "#000000000000";
secondary-color = "#000000000000";
};
"org/gnome/desktop/screensaver" = {
lock-enabled = false;
idle-activation-enabled = false;
picture-options = "zoom";
picture-uri = "file://" + (./black.png);
picture-uri-dark = "file://" + (./black.png);
};
"org/gnome/desktop/applications/terminal" = {
exec = "alacritty";
};
"org/gnome/settings-daemon/plugins/color" = {
night-light-enabled = false;
night-light-schedule-automatic = false;
};
"org/gnome/shell/keybindings" = {
shift-overview-down = [ "" ];
shift-overview-up = [ "" ];
switch-to-application-1 = [ "" ];
switch-to-application-2 = [ "" ];
switch-to-application-3 = [ "" ];
switch-to-application-4 = [ "" ];
switch-to-application-5 = [ "" ];
switch-to-application-6 = [ "" ];
switch-to-application-7 = [ "" ];
switch-to-application-8 = [ "" ];
switch-to-application-9 = [ "" ];
toggle-quick-settings = [ "" ];
toggle-application-view = [ "" ];
};
"org/gtk/gtk4/settings/file-chooser" = {
show-hidden = true;
};
"org/gnome/desktop/interface" = {
accent-color = "orange";
show-battery-percentage = true;
clock-show-date = true;
clock-show-seconds = true;
clock-show-weekday = true;
color-scheme = "prefer-dark";
cursor-size = 24;
enable-animations = true;
enable-hot-corners = false;
font-antialiasing = "grayscale";
font-hinting = "slight";
gtk-theme = "Adwaita-dark";
# icon-theme = "Yaru-magenta-dark";
};
"org/gnome/desktop/notifications" = {
application-children = [ "org-gnome-tweaks" ];
};
"org/gnome/desktop/notifications/application/org-gnome-tweaks" = {
application-id = "org.gnome.tweaks.desktop";
};
"org/gnome/desktop/peripherals/mouse" = {
natural-scroll = false;
};
"org/gnome/desktop/peripherals/touchpad" = {
disable-while-typing = true;
two-finger-scrolling-enabled = true;
natural-scroll = true;
};
"org/gnome/tweaks" = {
show-extensions-notice = false;
};
};
}
)
];
};
}

View file

@ -1,86 +0,0 @@
{
config,
lib,
pkgs,
...
}:
let
ccfg = import ../../config.nix;
cfg_path = [
ccfg.custom_config_key
"desktopEnvironment"
"gnome"
];
cfg = lib.attrsets.getAttrFromPath cfg_path config;
in
with lib;
{
options =
{ }
// lib.attrsets.setAttrByPath cfg_path {
enable = lib.mkEnableOption "gnome desktop environment";
terminalCommand = mkOption {
type = lib.types.str;
default = "kitty";
description = "The terminal command to use.";
};
enableRotate = lib.mkEnableOption "enable screen rotation";
};
imports = [
(import ./dconf.nix { inherit cfg; })
(import ./wofi.nix { inherit cfg; })
];
config = lib.mkIf cfg.enable {
services.xserver = {
enable = true;
desktopManager.gnome.enable = true;
displayManager.gdm = {
enable = true;
autoSuspend = false;
wayland = true;
};
};
services.gnome.gnome-initial-setup.enable = false;
environment.gnome.excludePackages = with pkgs; [
gnome-backgrounds
gnome-video-effects
gnome-maps
gnome-music
gnome-tour
gnome-text-editor
gnome-user-docs
];
environment.systemPackages = with pkgs; [
dconf-editor
dconf2nix
gnome-tweaks
wayland
wayland-utils
wl-clipboard
numix-cursor-theme
gnomeExtensions.vertical-workspaces
gnomeExtensions.compact-top-bar
gnomeExtensions.tray-icons-reloaded
gnomeExtensions.vitals
] ++ lib.optionals cfg.enableRotate [
gnomeExtensions.screen-rotate
];
environment.sessionVariables = {
NIXOS_OZONE_WL = "1";
GTK_THEME = "Adwaita:dark";
};
qt = {
enable = true;
platformTheme = "gnome";
style = "adwaita-dark";
};
hardware.graphics = {
enable = true;
};
};
}

View file

@ -1,51 +0,0 @@
window {
margin: 0px;
border: 1px solid #171717;
background-color: #262626;
}
#input {
margin: 5px;
border: none;
color: #e0e0e0;
background-color: #1f1f1f;
}
#inner-box {
margin: 5px;
border: none;
background-color: #171717;
}
#outer-box {
margin: 5px;
border: none;
background-color: #191919;
}
#scroll {
margin: 0px;
border: none;
}
#text {
margin: 5px;
border: none;
color: #e0e0e0;
}
#entry.activatable #text {
color: #cccccc;
}
#entry>* {
color: #e0e0e0;
}
#entry:selected {
background-color: #4f4f4f;
}
#entry:selected #text {
font-weight: bold;
}

View file

@ -1,31 +0,0 @@
{ cfg }:
{ lib, ... }:
{
config = lib.mkIf cfg.enable {
home-manager.sharedModules = [
(
{ lib, ... }:
{
programs.wofi = {
enable = true;
settings = {
width = "28%";
height = "38%";
show = "drun";
location = "center";
gtk_dark = true;
valign = "center";
key_backward = "Ctrl+k";
key_forward = "Ctrl+j";
insensitive = true;
prompt = "Run";
allow_images = true;
};
style = builtins.readFile ./wofi.css;
};
}
)
];
};
}

View file

@ -1,170 +0,0 @@
{
config,
lib,
pkgs,
hyprland,
hyprlandPkgs,
...
}:
let
ccfg = import ../../config.nix;
cfg_path = [
ccfg.custom_config_key
"desktopEnvironment"
"hyprland"
];
cfg = lib.attrsets.getAttrFromPath cfg_path config;
in
with lib;
{
options =
{ }
// lib.attrsets.setAttrByPath cfg_path {
enable = lib.mkEnableOption "hyprland desktop environment";
terminalCommand = mkOption {
type = lib.types.str;
default = "foot";
description = "The terminal command to use.";
};
extraOptions = mkOption {
type = lib.types.attrs;
default = { };
description = "Extra options for Hyprland configuration.";
};
hyprpaperSettings = lib.mkOption {
type = lib.types.attrs;
default = { };
description = "Extra options for hyprpaper configuration.";
};
swaync = {
enable = lib.mkEnableOption "Enable Swaync (notification center for Hyprland)";
};
waybar = {
enable = lib.mkEnableOption "Enable Waybar (status bar for Hyprland)";
};
};
config = lib.mkIf cfg.enable {
# Enable for all users
home-manager = {
sharedModules = [
hyprland.homeManagerModules.default
./home_manager
];
};
services.greetd = {
enable = true;
vt = 2;
settings = {
default_session = {
command = "${pkgs.greetd.tuigreet}/bin/tuigreet --time --remember --remember-session --cmd '${pkgs.dbus}/bin/dbus-run-session ${hyprlandPkgs.hyprland}/bin/Hyprland'";
user = "greeter";
};
};
};
# Caps Lock as Escape for console/tty
console.useXkbConfig = true;
services.xserver.xkb = {
layout = "us";
options = "caps:escape";
};
environment.systemPackages = with pkgs; [
wl-clipboard
wl-clip-persist
wofi # application launcher
nemo # file manager (x11)
# nautilus # file manager
feh # image viewer (x11)
# imv # image viewer
networkmanager # network management
upower # power management
brightnessctl # screen/keyboard brightness control
wireplumber # media session manager
libgtop # system monitor library
bluez # Bluetooth support
power-profiles-daemon # power profiles
grim
slurp
hyprpicker
grimblast # screenshot tool
wf-recorder # screen recording tool
btop # system monitor
];
services.blueman.enable = config.hardware.bluetooth.enable;
programs.hyprland = {
enable = true;
# xwayland.enable = false;
# withUWSM = true;
# set the flake package
package = hyprlandPkgs.hyprland;
# make sure to also set the portal package, so that they are in sync
# This is set below now in xdf portal directly so we can also add things like gtk
# portalPackage = hyprlandPkgs.xdg-desktop-portal-hyprland;
};
xdg.portal = {
enable = true;
extraPortals = lib.mkForce [
hyprlandPkgs.xdg-desktop-portal-hyprland
# hyprlandPkgs.xdg-desktop-portal-wlr
hyprlandPkgs.xdg-desktop-portal-gtk
];
config.common.default = [
"hyprland"
# "wlr"
"gtk"
];
};
# Enable PipeWire + WirePlumber so xdg-desktop-portal can do screencast
services.pipewire = {
enable = true;
# Enable WirePlumber session manager via the pipewire module option
wireplumber = {
enable = true;
};
};
hardware.graphics = {
enable = true;
package = hyprlandPkgs.mesa;
# if you also want 32-bit support (e.g for Steam)
# enable32Bit = true;
package32 = hyprlandPkgs.pkgsi686Linux.mesa;
};
# Environment variables
environment.sessionVariables = {
GTK_THEME = "Adwaita:dark";
XDG_SESSION_TYPE = "wayland";
# XDG_CURRENT_DESKTOP = "sway";
# XDG_SESSION_DESKTOP = "sway";
# prefer EGL renderer (can be changed back to "auto" if needed)
WLR_RENDERER = "egl";
# Tell apps to run native wayland
NIXOS_OZONE_WL = "1";
ELECTRON_OZONE_PLATFORM_HINT = "wayland";
ELECTRON_ENABLE_WAYLAND = "1";
ELECTRON_DISABLE_SANDBOX = "0";
GDK_BACKEND = "wayland,x11"; # GTK
QT_QPA_PLATFORM = "wayland;xcb"; # Qt 5/6
MOZ_ENABLE_WAYLAND = "1"; # Firefox
SDL_VIDEODRIVER = "wayland"; # SDL apps/games
CLUTTER_BACKEND = "wayland";
};
# Qt theming
qt = {
enable = true;
platformTheme = "gtk2";
style = "adwaita-dark";
};
};
}

View file

@ -1,22 +0,0 @@
{
osConfig,
lib,
...
}:
let
ccfg = import ../../../config.nix;
cfg_path = [
ccfg.custom_config_key
"desktopEnvironment"
"hyprland"
];
cfg = lib.attrsets.getAttrFromPath cfg_path osConfig;
in
{
config = {
services.hyprpaper = {
enable = true;
settings = cfg.hyprpaperSettings;
};
};
}

View file

@ -1,251 +0,0 @@
{
lib,
osConfig,
...
}:
let
ccfg = import ../../../config.nix;
cfg_path = [
ccfg.custom_config_key
"desktopEnvironment"
"hyprland"
"swaync"
];
cfg = lib.attrsets.getAttrFromPath cfg_path osConfig;
in
{
config = lib.mkIf cfg.enable {
services.swaync = {
enable = true;
settings = {
ignore = [
"com.spotify.Client"
];
positionX = "right";
positionY = "top";
layer = "overlay";
control-center-layer = "top";
layer-shell = true;
cssPriority = "application";
control-center-margin-top = 0;
control-center-margin-bottom = 0;
control-center-margin-right = 0;
control-center-margin-left = 0;
notification-2fa-action = true;
notification-inline-replies = false;
notification-icon-size = 64;
notification-body-image-height = 100;
notification-body-image-width = 200;
timeout = 10;
timeout-low = 5;
timeout-critical = 0;
control-center-width = 500;
control-center-height = 600;
notification-window-width = 500;
keyboard-shortcuts = true;
image-visibility = "when-available";
transition-time = 200;
hide-on-clear = false;
hide-on-action = true;
script-fail-notify = true;
widgets = [
"inhibitors"
"title"
"dnd"
"volume"
"backlight"
"mpris"
"buttons-grid#quick"
"notifications"
];
# Widget configurations
widget-config = {
inhibitors = {
text = "Inhibitors";
button-text = "Clear All";
clear-all-button = true;
};
title = {
text = "Notifications";
clear-all-button = true;
button-text = "Clear All";
};
dnd.text = "Do Not Disturb";
mpris = {
image-size = 96;
image-radius = 12;
};
volume = {
label = "󰕾";
show-per-app = true;
};
backlight = {
label = "󰃟";
device = "intel_backlight";
};
"buttons-grid#quick" = {
columns = 4; # adjust: 3/4/5
icon-size = 20; # tweak to taste
actions = [
# Power
{
label = "󰐥";
tooltip = "Shutdown";
command = "confirm-action 'systemctl poweroff' 'Shutdown?'";
}
{
label = "󰜉";
tooltip = "Reboot";
command = "confirm-action 'systemctl reboot' 'Reboot?'";
}
{
label = "󰍃";
tooltip = "Logout";
command = "confirm-action 'hyprctl dispatch exit' 'Logout?'";
}
];
};
};
};
# Custom CSS for the control center
style = ''
.control-center {
background: #1a1b26;
border: 2px solid #7dcae4;
border-radius: 12px;
}
.control-center-list {
background: transparent;
}
.control-center .notification-row:focus,
.control-center .notification-row:hover {
opacity: 1;
background: #24283b;
}
.notification {
border-radius: 8px;
margin: 6px 12px;
box-shadow: 0 0 0 1px rgba(125, 196, 228, 0.3), 0 1px 3px 1px rgba(0, 0, 0, 0.7), 0 2px 6px 2px rgba(0, 0, 0, 0.3);
padding: 0;
}
/* Widget styling */
.widget-title {
margin: 8px;
font-size: 1.5rem;
color: #c0caf5;
}
.widget-dnd {
margin: 8px;
font-size: 1.1rem;
color: #c0caf5;
}
.widget-dnd > switch {
font-size: initial;
border-radius: 8px;
background: #414868;
border: 1px solid #7dcae4;
}
.widget-dnd > switch:checked {
background: #7dcae4;
}
.widget-mpris {
color: #c0caf5;
background: #24283b;
padding: 8px;
margin: 8px;
border-radius: 8px;
}
.widget-mpris-player {
padding: 8px;
margin: 8px;
}
.widget-mpris-title {
font-weight: bold;
font-size: 1.25rem;
}
.widget-mpris-subtitle {
font-size: 1.1rem;
color: #9ece6a;
}
.widget-volume {
background: #24283b;
padding: 8px;
margin: 8px;
border-radius: 8px;
color: #c0caf5;
}
.widget-backlight {
background: #24283b;
padding: 8px;
margin: 8px;
border-radius: 8px;
color: #c0caf5;
}
.widget-menubar {
background: #24283b;
padding: 8px;
margin: 8px;
border-radius: 8px;
color: #c0caf5;
}
.widget-menubar .menu-item button {
background: #1f2335;
color: #c0caf5;
border-radius: 8px;
padding: 6px 10px;
margin: 4px;
border: 1px solid #2e3440;
font-family: "JetBrainsMonoNL Nerd Font";
}
.widget-menubar .menu-item button:hover {
background: #414868;
border-color: #7dcae4;
}
.topbar-buttons button {
border: none;
background: transparent;
color: #c0caf5;
font-size: 1.1rem;
border-radius: 8px;
margin: 0 4px;
padding: 8px;
}
.topbar-buttons button:hover {
background: #414868;
}
.topbar-buttons button:active {
background: #7dcae4;
color: #1a1b26;
}
'';
};
};
}

View file

@ -1,18 +0,0 @@
{
osConfig,
lib,
pkgs,
...
}:
let
ccfg = import ../../../config.nix;
cfg_path = [
ccfg.custom_config_key
"desktopEnvironment"
"hyprland"
];
cfg = lib.attrsets.getAttrFromPath cfg_path osConfig;
in
{
}

View file

@ -1,258 +0,0 @@
{ lib, osConfig, ... }:
let
ccfg = import ../../../config.nix;
cfg_path = [
ccfg.custom_config_key
"desktopEnvironment"
"hyprland"
"waybar"
];
cfg = lib.attrsets.getAttrFromPath cfg_path osConfig;
in
{
config = lib.mkIf cfg.enable {
programs.waybar = {
enable = true;
systemd.enable = true;
settings = {
mainBar = {
layer = "top";
position = "top";
height = 28;
spacing = 6;
margin-top = 0;
margin-bottom = 0;
margin-left = 10;
margin-right = 10;
modules-left = [
"hyprland/workspaces"
];
modules-center = [
"clock"
"temperature"
"cpu"
"memory"
"disk"
];
modules-right = [
"battery"
"battery#bat2"
"pulseaudio"
"network"
"bluetooth"
"power-profiles-daemon"
"backlight"
"custom/notifications"
"tray"
"custom/power"
];
"hyprland/workspaces" = {
format = "{icon}";
format-icons = {
"1" = "";
"2" = "";
"3" = "";
"4" = "";
"5" = "";
"6" = "";
"7" = "";
"8" = "";
"9" = "";
"10" = "";
"11" = "";
"12" = "";
"13" = "";
"14" = "";
"15" = "";
"16" = "";
"17" = "";
"18" = "";
"19" = "";
"20" = "";
};
disable-scroll = false;
};
# CENTER
clock = {
format = "{:%b %d, %H:%M}";
tooltip-format = "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>";
};
temperature = {
thermal-zone = 2;
hwmon-path = "/sys/class/hwmon/hwmon2/temp1_input";
critical-threshold = 80;
format-critical = "󰔏 {temperatureC}°C";
format = "󰔏 {temperatureC}°C";
};
cpu = {
format = "󰻠 {usage}%";
tooltip = true;
on-click = "btop";
};
memory = {
format = "󰍛 {}%";
on-click = "btop";
};
disk = {
interval = 30;
format = "󰋊 {percentage_used}%";
path = "/";
on-click = "btop";
};
# RIGHT
"battery" = {
"states" = {
# "good"= 95;
"warning" = 30;
"critical" = 15;
};
"format" = "{capacity}% {icon}";
"format-full" = "{capacity}% {icon}";
"format-charging" = "{capacity}% ";
"format-plugged" = "{capacity}% ";
"format-alt" = "{time} {icon}";
# "format-good"= ""; // An empty format will hide the module
# "format-full"= "";
"format-icons" = [
""
""
""
""
""
];
};
"battery#bat2" = {
"bat" = "BAT2";
};
pulseaudio = {
format = "{icon} {volume}%";
format-bluetooth = "󰂰 {volume}%";
format-bluetooth-muted = "󰂲 ";
format-muted = "󰖁 ";
format-source = "󰍬 {volume}%";
format-source-muted = "󰍭 ";
format-icons = {
headphone = "󰋋";
hands-free = "󰂑";
headset = "󰂑";
phone = "󰏲";
portable = "󰦧";
car = "󰄋";
default = [
"󰕿"
"󰖀"
"󰕾"
];
};
scroll-step = 5;
on-click = "pavucontrol";
on-click-right = "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle";
};
network = {
format-wifi = "󰤨 {essid} ({signalStrength}%)";
format-ethernet = "󰈀 {ipaddr}/{cidr}";
tooltip-format = "{ifname} via {gwaddr} ";
format-linked = "󰈀 {ifname} (No IP)";
format-disconnected = "󰖪 Disconnected";
# on-click = "wofi-wifi-menu";
# on-click-right = "nmcli radio wifi toggle";
};
bluetooth = {
format = "󰂯 {status}";
format-connected = "󰂱 {device_alias}";
format-connected-battery = "󰂱 {device_alias} {device_battery_percentage}%";
tooltip-format = "{controller_alias}\t{controller_address}\n\n{num_connections} connected";
tooltip-format-connected = "{controller_alias}\t{controller_address}\n\n{num_connections} connected\n\n{device_enumerate}";
tooltip-format-enumerate-connected = "{device_alias}\t{device_address}";
tooltip-format-enumerate-connected-battery = "{device_alias}\t{device_address}\t{device_battery_percentage}%";
# on-click = "wofi-bluetooth-menu";
# on-click-right = "bluetoothctl power toggle";
};
"power-profiles-daemon" = {
format = "{icon}";
"tooltip-format" = "Power profile: {profile}\nDriver: {driver}";
tooltip = true;
"format-icons" = {
default = "";
performance = "";
balanced = "";
"power-saver" = "";
};
};
backlight = {
format = "{percent}% {icon}";
"format-icons" = [
""
""
""
""
""
""
""
""
""
];
};
"custom/notifications" = {
format = "{icon} {}";
format-icons = {
notification = "";
none = "";
dnd-notification = "󰂛";
dnd-none = "󰂛";
inhibited-notification = "";
inhibited-none = "";
dnd-inhibited-notification = "󰂛";
dnd-inhibited-none = "󰂛";
};
return-type = "json";
exec-if = "which swaync-client";
exec = "swaync-client -swb";
on-click = "swaync-client -t -sw";
on-click-right = "swaync-client -d -sw";
escape = true;
tooltip = false;
};
"sway/language" = {
format = "{}";
};
"tray" = {
"spacing" = 10;
};
"custom/power" = {
format = " ";
tooltip = false;
menu = "on-click";
"menu-file" = ./waybar/power_menu.xml;
"menu-actions" = {
shutdown = "shutdown 0";
reboot = "reboot";
logout = "loginctl terminate-session $(loginctl list-sessions | grep seat0 | awk '{print $1}')";
};
};
};
};
style = builtins.readFile ./waybar/waybar.css;
};
};
}

View file

@ -1,158 +0,0 @@
{
config,
lib,
pkgs,
...
}:
let
ccfg = import ../../config.nix;
cfg_path = [
ccfg.custom_config_key
"desktopEnvironment"
"sway"
];
cfg = lib.attrsets.getAttrFromPath cfg_path config;
in
with lib;
{
options =
{ }
// lib.attrsets.setAttrByPath cfg_path {
enable = lib.mkEnableOption "sway (Wayland i3) desktop environment";
terminalCommand = mkOption {
type = lib.types.str;
default = "foot";
description = "The terminal command to use.";
};
extraOptions = mkOption {
type = lib.types.attrs;
default = { };
description = "Extra options for Sway configuration.";
};
swaync = {
enable = lib.mkEnableOption "Enable Sway Notification Center";
};
waybar = {
enable = lib.mkEnableOption "Enable Waybar (status bar for Sway)";
};
};
config = lib.mkIf cfg.enable {
# Enable for all users via Home Manager fragments in this module
home-manager = {
sharedModules = [ ./home_manager ];
};
services.greetd = {
enable = true;
vt = 2;
settings = {
default_session = {
command = "${pkgs.greetd.tuigreet}/bin/tuigreet --time --remember --remember-session --cmd '${pkgs.dbus}/bin/dbus-run-session ${pkgs.sway}/bin/sway'";
user = "greeter";
};
};
};
# Caps Lock as Escape for console/tty and Wayland
console.useXkbConfig = true;
services.xserver.xkb = {
layout = "us";
options = "caps:escape";
};
# Core packages and tools
environment.systemPackages = with pkgs; [
wl-clipboard
wl-clip-persist
wofi # application launcher
nemo # file manager (x11)
feh # image viewer (x11)
networkmanager
upower
brightnessctl
wireplumber
libgtop
bluez
power-profiles-daemon
grim
slurp
wf-recorder
btop
pavucontrol
];
services.blueman.enable = config.hardware.bluetooth.enable;
programs.sway = {
enable = true;
wrapperFeatures.gtk = true; # include GTK integration env
extraPackages = with pkgs; [
xwayland # allow legacy X11 apps
];
};
xdg.portal = {
enable = true;
extraPortals = lib.mkForce [
pkgs.xdg-desktop-portal-wlr
pkgs.xdg-desktop-portal-gtk
];
config.common.default = [
"wlr"
"gtk"
];
};
# Enable PipeWire + WirePlumber so xdg-desktop-portal can do screencast
services.pipewire = {
enable = true;
# Enable WirePlumber session manager via the pipewire module option
wireplumber = {
enable = true;
};
};
# Ensure graphics/OpenGL are enabled so Sway uses GPU-backed rendering
hardware.graphics = {
enable = true;
# Keep defaults; Sway runs fine with mesa in system
};
hardware.opengl = {
enable = true;
# extraPackages can be used to force vendor-specific mesa/drivers if needed
extraPackages = with pkgs; [];
};
# Environment variables
environment.sessionVariables = lib.mkMerge [
{
GTK_THEME = "Adwaita:dark";
XDG_SESSION_TYPE = "wayland";
XDG_CURRENT_DESKTOP = "sway";
XDG_SESSION_DESKTOP = "sway";
# prefer EGL renderer (can be changed back to "auto" if needed)
WLR_RENDERER = "egl";
# Tell apps to run native wayland
NIXOS_OZONE_WL = "1";
ELECTRON_OZONE_PLATFORM_HINT = "wayland";
ELECTRON_ENABLE_WAYLAND = "1";
ELECTRON_DISABLE_SANDBOX = "0";
GDK_BACKEND = "wayland,x11"; # GTK
QT_QPA_PLATFORM = "wayland;xcb"; # Qt 5/6
MOZ_ENABLE_WAYLAND = "1"; # Firefox
SDL_VIDEODRIVER = "wayland"; # SDL apps/games
CLUTTER_BACKEND = "wayland";
}
];
# Qt theming
qt = {
enable = true;
platformTheme = "gtk2";
style = "adwaita-dark";
};
};
}

View file

@ -1,190 +0,0 @@
{
config,
osConfig,
lib,
...
}:
let
ccfg = import ../../../config.nix;
cfg_path = [
ccfg.custom_config_key
"desktopEnvironment"
"sway"
];
cfg = lib.attrsets.getAttrFromPath cfg_path osConfig;
in
{
wayland.windowManager.sway = {
enable = true;
xwayland = true;
config = lib.mkMerge [
rec {
modifier = "Mod4"; # SUPER
terminal = cfg.terminalCommand;
menu = "wofi --show drun";
# Per-output workspace mapping (user can extend via extraOptions)
# Example (left as defaults): users can add `output HDMI-A-1 workspace 1,3,5` in extraOptions
input = {
"type:keyboard" = {
xkb_layout = "us";
xkb_options = "caps:escape";
};
"type:touchpad" = {
natural_scroll = "enabled";
tap = "enabled";
dwt = "enabled";
};
# Disable focus follows mouse to avoid accidental focus changes
# In Sway this behavior is controlled by focus_follows_mouse
};
focus = {
followMouse = "no";
# onWindowActivation = "urgent"; # don't steal focus; mark urgent instead
};
gaps = {
inner = 2;
outer = 5;
smartGaps = false;
smartBorders = "on";
};
colors = {
focused = {
background = "#444444";
border = "#555555";
childBorder = "#444444";
indicator = "#595959";
text = "#f1f1f1";
};
unfocused = {
background = "#222222";
border = "#333333";
childBorder = "#222222";
indicator = "#292d2e";
text = "#888888";
};
};
window = {
border = 1;
titlebar = false;
commands = [
# Bitwarden chrome popup as floating example from Hyprland rules
{
criteria = {
app_id = "chrome-nngceckbapebfimnlniiiahkandclblb-Default";
};
command = "floating enable";
}
{
criteria = {
app_id = "pavucontrol";
};
command = "floating enable, move position center, resize set 620 1200";
}
{
criteria = {
class = "Google-chrome";
window_role = "pop-up";
};
command = "floating enable, move position center, resize set 720 480";
}
{
criteria = {
window_role = "pop-up";
};
command = "floating enable, move position center, resize set 640 420";
}
{
criteria = {
window_role = "About";
};
command = "floating enable, move position center, resize set 640 420";
}
];
};
# Keybindings mirroring Hyprland
keybindings = {
# Apps
"${modifier}+return" = "exec ${cfg.terminalCommand}";
"${modifier}+space" = "exec pkill wofi || wofi --show drun";
"${modifier}+q" = "kill";
"${modifier}+shift+Escape" = "exit";
"${modifier}+shift+q" = "exec swaylock";
"${modifier}+f" = "floating toggle";
# Focus
"${modifier}+h" = "focus left";
"${modifier}+l" = "focus right";
"${modifier}+k" = "focus up";
"${modifier}+j" = "focus down";
# Workspaces (numbers and vim-like mirror)
"${modifier}+1" = "workspace number 1";
"${modifier}+n" = "workspace number 1";
"${modifier}+2" = "workspace number 2";
"${modifier}+m" = "workspace number 2";
"${modifier}+3" = "workspace number 3";
"${modifier}+comma" = "workspace number 3";
"${modifier}+4" = "workspace number 4";
"${modifier}+period" = "workspace number 4";
"${modifier}+5" = "workspace number 5";
"${modifier}+slash" = "workspace number 5";
"${modifier}+6" = "workspace number 6";
"${modifier}+7" = "workspace number 7";
"${modifier}+8" = "workspace number 8";
"${modifier}+9" = "workspace number 9";
"${modifier}+0" = "workspace number 10";
# Move windows
"${modifier}+shift+h" = "move left";
"${modifier}+shift+l" = "move right";
"${modifier}+shift+k" = "move up";
"${modifier}+shift+j" = "move down";
"${modifier}+shift+1" = "move container to workspace number 1";
"${modifier}+shift+n" = "move container to workspace number 1";
"${modifier}+shift+2" = "move container to workspace number 2";
"${modifier}+shift+m" = "move container to workspace number 2";
"${modifier}+shift+3" = "move container to workspace number 3";
"${modifier}+shift+comma" = "move container to workspace number 3";
"${modifier}+shift+4" = "move container to workspace number 4";
"${modifier}+shift+period" = "move container to workspace number 4";
"${modifier}+shift+5" = "move container to workspace number 5";
"${modifier}+shift+slash" = "move container to workspace number 5";
"${modifier}+shift+6" = "move container to workspace number 6";
"${modifier}+shift+7" = "move container to workspace number 7";
"${modifier}+shift+8" = "move container to workspace number 8";
"${modifier}+shift+9" = "move container to workspace number 9";
"${modifier}+shift+0" = "move container to workspace number 10";
"${modifier}+left" = "resize shrink width 10 px or 10 ppt";
"${modifier}+down" = "resize shrink height 10 px or 10 ppt";
"${modifier}+up" = "resize grow height 10 px or 10 ppt";
"${modifier}+right" = "resize grow width 10 px or 10 ppt";
# Mouse bindings (Mod + drag)
"${modifier}+button1" = "move";
"${modifier}+button3" = "resize";
# Screenshot
"Print" = "exec grim -g \"$(slurp)\" - | wl-copy";
};
bars = [ ]; # Use Waybar via Home Manager
startup = [
{
command = "exec sh -c 'sleep 0.01; swaymsg workspace number 7 ; sleep 0.01; swaymsg workspace number 1'";
}
{ command = "pgrep waybar >/dev/null || waybar"; }
];
}
cfg.extraOptions
];
};
}

View file

@ -1,112 +0,0 @@
{ lib, osConfig, ... }:
let
ccfg = import ../../../config.nix;
cfg_path = [
ccfg.custom_config_key
"desktopEnvironment"
"sway"
"swaync"
];
cfg = lib.attrsets.getAttrFromPath cfg_path osConfig;
in
{
config = lib.mkIf cfg.enable {
services.swaync = {
enable = true;
settings = {
ignore = [ "com.spotify.Client" ];
positionX = "right";
positionY = "top";
layer = "overlay";
control-center-layer = "top";
layer-shell = true;
cssPriority = "application";
control-center-margin-top = 0;
control-center-margin-bottom = 0;
control-center-margin-right = 0;
control-center-margin-left = 0;
notification-2fa-action = true;
notification-inline-replies = false;
notification-icon-size = 64;
notification-body-image-height = 100;
notification-body-image-width = 200;
timeout = 10;
timeout-low = 5;
timeout-critical = 0;
control-center-width = 500;
control-center-height = 600;
notification-window-width = 500;
keyboard-shortcuts = true;
image-visibility = "when-available";
transition-time = 200;
hide-on-clear = false;
hide-on-action = true;
script-fail-notify = true;
widgets = [
"inhibitors"
"title"
"dnd"
"volume"
"backlight"
"mpris"
"buttons-grid#quick"
"notifications"
];
widget-config = {
inhibitors = {
text = "Inhibitors";
button-text = "Clear All";
clear-all-button = true;
};
title = {
text = "Notifications";
clear-all-button = true;
button-text = "Clear All";
};
dnd.text = "Do Not Disturb";
mpris = {
image-size = 96;
image-radius = 12;
};
volume = {
label = "󰕾";
show-per-app = true;
};
backlight = {
label = "󰃟";
device = "intel_backlight";
};
# "buttons-grid#quick" = {
# columns = 4;
# icon-size = 20;
# actions = [
# { label = "󰐥"; tooltip = "Shutdown"; command = "confirm-action 'systemctl poweroff' 'Shutdown?'"; }
# { label = "󰜉"; tooltip = "Reboot"; command = "confirm-action 'systemctl reboot' 'Reboot?'"; }
# { label = "󰍃"; tooltip = "Logout"; command = "confirm-action 'swaymsg exit' 'Logout?'"; }
# ];
# };
};
};
style = ''
.control-center { background: #1a1b26; border: 2px solid #7dcae4; border-radius: 12px; }
.control-center-list { background: transparent; }
.control-center .notification-row:focus, .control-center .notification-row:hover { opacity: 1; background: #24283b; }
.notification { border-radius: 8px; margin: 6px 12px; box-shadow: 0 0 0 1px rgba(125,196,228,.3), 0 1px 3px 1px rgba(0,0,0,.7), 0 2px 6px 2px rgba(0,0,0,.3); padding: 0; }
.widget-title { margin: 8px; font-size: 1.5rem; color: #c0caf5; }
.widget-dnd { margin: 8px; font-size: 1.1rem; color: #c0caf5; }
.widget-dnd > switch { font-size: initial; border-radius: 8px; background: #414868; border: 1px solid #7dcae4; }
.widget-dnd > switch:checked { background: #7dcae4; }
.widget-mpris { color: #c0caf5; background: #24283b; padding: 8px; margin: 8px; border-radius: 8px; }
.widget-mpris-player { padding: 8px; margin: 8px; }
.widget-mpris-title { font-weight: bold; font-size: 1.25rem; }
.widget-mpris-subtitle { font-size: 1.1rem; color: #9ece6a; }
.widget-volume, .widget-backlight, .widget-menubar { background: #24283b; padding: 8px; margin: 8px; border-radius: 8px; color: #c0caf5; }
.widget-menubar .menu-item button { background: #1f2335; color: #c0caf5; border-radius: 8px; padding: 6px 10px; margin: 4px; border: 1px solid #2e3440; font-family: "JetBrainsMonoNL Nerd Font"; }
.widget-menubar .menu-item button:hover { background: #414868; border-color: #7dcae4; }
.topbar-buttons button { border: none; background: transparent; color: #c0caf5; font-size: 1.1rem; border-radius: 8px; margin: 0 4px; padding: 8px; }
.topbar-buttons button:hover { background: #414868; }
.topbar-buttons button:active { background: #7dcae4; color: #1a1b26; }
'';
};
};
}

View file

@ -1,259 +0,0 @@
{ lib, osConfig, ... }:
let
ccfg = import ../../../config.nix;
cfg_path = [
ccfg.custom_config_key
"desktopEnvironment"
"sway"
"waybar"
];
cfg = lib.attrsets.getAttrFromPath cfg_path osConfig;
in
{
config = lib.mkIf cfg.enable {
programs.waybar = {
enable = true;
systemd.enable = true;
settings = {
mainBar = {
layer = "top";
position = "top";
height = 28;
spacing = 6;
margin-top = 0;
margin-bottom = 0;
margin-left = 10;
margin-right = 10;
modules-left = [
"sway/workspaces"
];
modules-center = [
"clock"
"temperature"
"cpu"
"memory"
"disk"
];
modules-right = [
"battery"
"battery#bat2"
"pulseaudio"
"network"
"bluetooth"
"power-profiles-daemon"
"backlight"
"custom/notifications"
"sway/language"
"tray"
"custom/power"
];
"sway/workspaces" = {
format = "{icon}";
format-icons = {
"1" = "";
"2" = "";
"3" = "";
"4" = "";
"5" = "";
"6" = "";
"7" = "";
"8" = "";
"9" = "";
"10" = "";
"11" = "";
"12" = "";
"13" = "";
"14" = "";
"15" = "";
"16" = "";
"17" = "";
"18" = "";
"19" = "";
"20" = "";
};
disable-scroll = false;
};
# CENTER
clock = {
format = "{:%b %d, %H:%M}";
tooltip-format = "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>";
};
temperature = {
thermal-zone = 2;
hwmon-path = "/sys/class/hwmon/hwmon2/temp1_input";
critical-threshold = 80;
format-critical = "󰔏 {temperatureC}°C";
format = "󰔏 {temperatureC}°C";
};
cpu = {
format = "󰻠 {usage}%";
tooltip = true;
on-click = "btop";
};
memory = {
format = "󰍛 {}%";
on-click = "btop";
};
disk = {
interval = 30;
format = "󰋊 {percentage_used}%";
path = "/";
on-click = "btop";
};
# RIGHT
"battery" = {
"states" = {
# "good"= 95;
"warning" = 30;
"critical" = 15;
};
"format" = "{capacity}% {icon}";
"format-full" = "{capacity}% {icon}";
"format-charging" = "{capacity}% ";
"format-plugged" = "{capacity}% ";
"format-alt" = "{time} {icon}";
# "format-good"= ""; // An empty format will hide the module
# "format-full"= "";
"format-icons" = [
""
""
""
""
""
];
};
"battery#bat2" = {
"bat" = "BAT2";
};
pulseaudio = {
format = "{icon} {volume}%";
format-bluetooth = "󰂰 {volume}%";
format-bluetooth-muted = "󰂲 ";
format-muted = "󰖁 ";
format-source = "󰍬 {volume}%";
format-source-muted = "󰍭 ";
format-icons = {
headphone = "󰋋";
hands-free = "󰂑";
headset = "󰂑";
phone = "󰏲";
portable = "󰦧";
car = "󰄋";
default = [
"󰕿"
"󰖀"
"󰕾"
];
};
scroll-step = 5;
on-click = "pavucontrol";
on-click-right = "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle";
};
network = {
format-wifi = "󰤨 {essid} ({signalStrength}%)";
format-ethernet = "󰈀 {ipaddr}/{cidr}";
tooltip-format = "{ifname} via {gwaddr} ";
format-linked = "󰈀 {ifname} (No IP)";
format-disconnected = "󰖪 Disconnected";
# on-click = "wofi-wifi-menu";
# on-click-right = "nmcli radio wifi toggle";
};
bluetooth = {
format = "󰂯 {status}";
format-connected = "󰂱 {device_alias}";
format-connected-battery = "󰂱 {device_alias} {device_battery_percentage}%";
tooltip-format = "{controller_alias}\t{controller_address}\n\n{num_connections} connected";
tooltip-format-connected = "{controller_alias}\t{controller_address}\n\n{num_connections} connected\n\n{device_enumerate}";
tooltip-format-enumerate-connected = "{device_alias}\t{device_address}";
tooltip-format-enumerate-connected-battery = "{device_alias}\t{device_address}\t{device_battery_percentage}%";
# on-click = "wofi-bluetooth-menu";
# on-click-right = "bluetoothctl power toggle";
};
"power-profiles-daemon" = {
format = "{icon}";
"tooltip-format" = "Power profile: {profile}\nDriver: {driver}";
tooltip = true;
"format-icons" = {
default = "";
performance = "";
balanced = "";
"power-saver" = "";
};
};
backlight = {
format = "{percent}% {icon}";
"format-icons" = [
""
""
""
""
""
""
""
""
""
];
};
"custom/notifications" = {
format = "{icon} {}";
format-icons = {
notification = "";
none = "";
dnd-notification = "󰂛";
dnd-none = "󰂛";
inhibited-notification = "";
inhibited-none = "";
dnd-inhibited-notification = "󰂛";
dnd-inhibited-none = "󰂛";
};
return-type = "json";
exec-if = "which swaync-client";
exec = "swaync-client -swb";
on-click = "swaync-client -t -sw";
on-click-right = "swaync-client -d -sw";
escape = true;
tooltip = false;
};
"sway/language" = {
format = "{}";
};
"tray" = {
"spacing" = 10;
};
"custom/power" = {
format = " ";
tooltip = false;
menu = "on-click";
"menu-file" = ./waybar/power_menu.xml;
"menu-actions" = {
shutdown = "shutdown 0";
reboot = "reboot";
logout = "loginctl terminate-session $(loginctl list-sessions | grep seat0 | awk '{print $1}')";
};
};
};
};
style = builtins.readFile ./waybar/waybar.css;
};
};
}

681
common/flake.lock generated
View file

@ -1,681 +0,0 @@
{
"nodes": {
"agenix": {
"inputs": {
"darwin": "darwin",
"home-manager": "home-manager_2",
"nixpkgs": [
"ragenix",
"nixpkgs"
],
"systems": "systems_2"
},
"locked": {
"lastModified": 1736955230,
"narHash": "sha256-uenf8fv2eG5bKM8C/UvFaiJMZ4IpUFaQxk9OH5t/1gA=",
"owner": "ryantm",
"repo": "agenix",
"rev": "e600439ec4c273cf11e06fe4d9d906fb98fa097c",
"type": "github"
},
"original": {
"owner": "ryantm",
"repo": "agenix",
"type": "github"
}
},
"aquamarine": {
"inputs": {
"hyprutils": [
"hyprland",
"hyprutils"
],
"hyprwayland-scanner": [
"hyprland",
"hyprwayland-scanner"
],
"nixpkgs": [
"hyprland",
"nixpkgs"
],
"systems": [
"hyprland",
"systems"
]
},
"locked": {
"lastModified": 1759499898,
"narHash": "sha256-UNzYHLWfkSzLHDep5Ckb5tXc0fdxwPIrT+MY4kpQttM=",
"owner": "hyprwm",
"repo": "aquamarine",
"rev": "655e067f96fd44b3f5685e17f566b0e4d535d798",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "aquamarine",
"type": "github"
}
},
"crane": {
"locked": {
"lastModified": 1741481578,
"narHash": "sha256-JBTSyJFQdO3V8cgcL08VaBUByEU6P5kXbTJN6R0PFQo=",
"owner": "ipetkov",
"repo": "crane",
"rev": "bb1c9567c43e4434f54e9481eb4b8e8e0d50f0b5",
"type": "github"
},
"original": {
"owner": "ipetkov",
"repo": "crane",
"type": "github"
}
},
"darwin": {
"inputs": {
"nixpkgs": [
"ragenix",
"agenix",
"nixpkgs"
]
},
"locked": {
"lastModified": 1700795494,
"narHash": "sha256-gzGLZSiOhf155FW7262kdHo2YDeugp3VuIFb4/GGng0=",
"owner": "lnl7",
"repo": "nix-darwin",
"rev": "4b9b83d5a92e8c1fbfd8eb27eda375908c11ec4d",
"type": "github"
},
"original": {
"owner": "lnl7",
"ref": "master",
"repo": "nix-darwin",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1747046372,
"narHash": "sha256-CIVLLkVgvHYbgI2UpXvIIBJ12HWgX+fjA8Xf8PUmqCY=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "9100a0f413b0c601e0533d1d94ffd501ce2e7885",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems_3"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"gitignore": {
"inputs": {
"nixpkgs": [
"hyprland",
"pre-commit-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1709087332,
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1758463745,
"narHash": "sha256-uhzsV0Q0I9j2y/rfweWeGif5AWe0MGrgZ/3TjpDYdGA=",
"owner": "rycee",
"repo": "home-manager",
"rev": "3b955f5f0a942f9f60cdc9cacb7844335d0f21c3",
"type": "github"
},
"original": {
"owner": "rycee",
"ref": "release-25.05",
"repo": "home-manager",
"type": "github"
}
},
"home-manager_2": {
"inputs": {
"nixpkgs": [
"ragenix",
"agenix",
"nixpkgs"
]
},
"locked": {
"lastModified": 1703113217,
"narHash": "sha256-7ulcXOk63TIT2lVDSExj7XzFx09LpdSAPtvgtM7yQPE=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "3bfaacf46133c037bb356193bd2f1765d9dc82c1",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"hyprcursor": {
"inputs": {
"hyprlang": [
"hyprland",
"hyprlang"
],
"nixpkgs": [
"hyprland",
"nixpkgs"
],
"systems": [
"hyprland",
"systems"
]
},
"locked": {
"lastModified": 1753964049,
"narHash": "sha256-lIqabfBY7z/OANxHoPeIrDJrFyYy9jAM4GQLzZ2feCM=",
"owner": "hyprwm",
"repo": "hyprcursor",
"rev": "44e91d467bdad8dcf8bbd2ac7cf49972540980a5",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "hyprcursor",
"type": "github"
}
},
"hyprgraphics": {
"inputs": {
"hyprutils": [
"hyprland",
"hyprutils"
],
"nixpkgs": [
"hyprland",
"nixpkgs"
],
"systems": [
"hyprland",
"systems"
]
},
"locked": {
"lastModified": 1759490292,
"narHash": "sha256-T6iWzDOXp8Wv0KQOCTHpBcmAOdHJ6zc/l9xaztW6Ivc=",
"owner": "hyprwm",
"repo": "hyprgraphics",
"rev": "9431db625cd9bb66ac55525479dce694101d6d7a",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "hyprgraphics",
"type": "github"
}
},
"hyprland": {
"inputs": {
"aquamarine": "aquamarine",
"hyprcursor": "hyprcursor",
"hyprgraphics": "hyprgraphics",
"hyprland-protocols": "hyprland-protocols",
"hyprland-qtutils": "hyprland-qtutils",
"hyprlang": "hyprlang",
"hyprutils": "hyprutils",
"hyprwayland-scanner": "hyprwayland-scanner",
"nixpkgs": "nixpkgs_2",
"pre-commit-hooks": "pre-commit-hooks",
"systems": "systems",
"xdph": "xdph"
},
"locked": {
"lastModified": 1759837778,
"narHash": "sha256-12GZqSrRYyhKl7NpNMUQECDi/Zyx17QZhhQ7+mBJMns=",
"owner": "hyprwm",
"repo": "Hyprland",
"rev": "5ba2d2217b649c4ca2db7e3f383b3f6af6e70d65",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "Hyprland",
"type": "github"
}
},
"hyprland-protocols": {
"inputs": {
"nixpkgs": [
"hyprland",
"nixpkgs"
],
"systems": [
"hyprland",
"systems"
]
},
"locked": {
"lastModified": 1749046714,
"narHash": "sha256-kymV5FMnddYGI+UjwIw8ceDjdeg7ToDVjbHCvUlhn14=",
"owner": "hyprwm",
"repo": "hyprland-protocols",
"rev": "613878cb6f459c5e323aaafe1e6f388ac8a36330",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "hyprland-protocols",
"type": "github"
}
},
"hyprland-qt-support": {
"inputs": {
"hyprlang": [
"hyprland",
"hyprland-qtutils",
"hyprlang"
],
"nixpkgs": [
"hyprland",
"hyprland-qtutils",
"nixpkgs"
],
"systems": [
"hyprland",
"hyprland-qtutils",
"systems"
]
},
"locked": {
"lastModified": 1749154592,
"narHash": "sha256-DO7z5CeT/ddSGDEnK9mAXm1qlGL47L3VAHLlLXoCjhE=",
"owner": "hyprwm",
"repo": "hyprland-qt-support",
"rev": "4c8053c3c888138a30c3a6c45c2e45f5484f2074",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "hyprland-qt-support",
"type": "github"
}
},
"hyprland-qtutils": {
"inputs": {
"hyprland-qt-support": "hyprland-qt-support",
"hyprlang": [
"hyprland",
"hyprlang"
],
"hyprutils": [
"hyprland",
"hyprland-qtutils",
"hyprlang",
"hyprutils"
],
"nixpkgs": [
"hyprland",
"nixpkgs"
],
"systems": [
"hyprland",
"systems"
]
},
"locked": {
"lastModified": 1759080228,
"narHash": "sha256-RgDoAja0T1hnF0pTc56xPfLfFOO8Utol2iITwYbUhTk=",
"owner": "hyprwm",
"repo": "hyprland-qtutils",
"rev": "629b15c19fa4082e4ce6be09fdb89e8c3312aed7",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "hyprland-qtutils",
"type": "github"
}
},
"hyprlang": {
"inputs": {
"hyprutils": [
"hyprland",
"hyprutils"
],
"nixpkgs": [
"hyprland",
"nixpkgs"
],
"systems": [
"hyprland",
"systems"
]
},
"locked": {
"lastModified": 1758927902,
"narHash": "sha256-LZgMds7M94+vuMql2bERQ6LiFFdhgsEFezE4Vn+Ys3A=",
"owner": "hyprwm",
"repo": "hyprlang",
"rev": "4dafa28d4f79877d67a7d1a654cddccf8ebf15da",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "hyprlang",
"type": "github"
}
},
"hyprutils": {
"inputs": {
"nixpkgs": [
"hyprland",
"nixpkgs"
],
"systems": [
"hyprland",
"systems"
]
},
"locked": {
"lastModified": 1759490926,
"narHash": "sha256-7IbZGJ5qAAfZsGhBHIsP8MBsfuFYS0hsxYHVkkeDG5Q=",
"owner": "hyprwm",
"repo": "hyprutils",
"rev": "94cce794344538c4d865e38682684ec2bbdb2ef3",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "hyprutils",
"type": "github"
}
},
"hyprwayland-scanner": {
"inputs": {
"nixpkgs": [
"hyprland",
"nixpkgs"
],
"systems": [
"hyprland",
"systems"
]
},
"locked": {
"lastModified": 1755184602,
"narHash": "sha256-RCBQN8xuADB0LEgaKbfRqwm6CdyopE1xIEhNc67FAbw=",
"owner": "hyprwm",
"repo": "hyprwayland-scanner",
"rev": "b3b0f1f40ae09d4447c20608e5a4faf8bf3c492d",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "hyprwayland-scanner",
"type": "github"
}
},
"nix-flatpak": {
"locked": {
"lastModified": 1739444422,
"narHash": "sha256-iAVVHi7X3kWORftY+LVbRiStRnQEob2TULWyjMS6dWg=",
"owner": "gmodena",
"repo": "nix-flatpak",
"rev": "5e54c3ca05a7c7d968ae1ddeabe01d2a9bc1e177",
"type": "github"
},
"original": {
"owner": "gmodena",
"ref": "latest",
"repo": "nix-flatpak",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1753345091,
"narHash": "sha256-CdX2Rtvp5I8HGu9swBmYuq+ILwRxpXdJwlpg8jvN4tU=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "3ff0e34b1383648053bba8ed03f201d3466f90c9",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-25.05",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1759381078,
"narHash": "sha256-gTrEEp5gEspIcCOx9PD8kMaF1iEmfBcTbO0Jag2QhQs=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "7df7ff7d8e00218376575f0acdcc5d66741351ee",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 1741379970,
"narHash": "sha256-Wh7esNh7G24qYleLvgOSY/7HlDUzWaL/n4qzlBePpiw=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "36fd87baa9083f34f7f5027900b62ee6d09b1f2f",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"pre-commit-hooks": {
"inputs": {
"flake-compat": "flake-compat",
"gitignore": "gitignore",
"nixpkgs": [
"hyprland",
"nixpkgs"
]
},
"locked": {
"lastModified": 1758108966,
"narHash": "sha256-ytw7ROXaWZ7OfwHrQ9xvjpUWeGVm86pwnEd1QhzawIo=",
"owner": "cachix",
"repo": "git-hooks.nix",
"rev": "54df955a695a84cd47d4a43e08e1feaf90b1fd9b",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "git-hooks.nix",
"type": "github"
}
},
"ragenix": {
"inputs": {
"agenix": "agenix",
"crane": "crane",
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs_3",
"rust-overlay": "rust-overlay"
},
"locked": {
"lastModified": 1744897914,
"narHash": "sha256-GIVU92o2TZBnKQXTb76zpQbWR4zjU2rFqWKNIIpXnqA=",
"owner": "yaxitech",
"repo": "ragenix",
"rev": "40f2e17ecaeab4d78ec323e96a04548c0aaa5223",
"type": "github"
},
"original": {
"owner": "yaxitech",
"repo": "ragenix",
"type": "github"
}
},
"root": {
"inputs": {
"home-manager": "home-manager",
"hyprland": "hyprland",
"nix-flatpak": "nix-flatpak",
"ragenix": "ragenix"
}
},
"rust-overlay": {
"inputs": {
"nixpkgs": [
"ragenix",
"nixpkgs"
]
},
"locked": {
"lastModified": 1741400194,
"narHash": "sha256-tEpgT+q5KlGjHSm8MnINgTPErEl8YDzX3Eps8PVc09g=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "16b6045a232fea0e9e4c69e55a6e269607dd8e3f",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
},
"systems": {
"locked": {
"lastModified": 1689347949,
"narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=",
"owner": "nix-systems",
"repo": "default-linux",
"rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default-linux",
"type": "github"
}
},
"systems_2": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"systems_3": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"xdph": {
"inputs": {
"hyprland-protocols": [
"hyprland",
"hyprland-protocols"
],
"hyprlang": [
"hyprland",
"hyprlang"
],
"hyprutils": [
"hyprland",
"hyprutils"
],
"hyprwayland-scanner": [
"hyprland",
"hyprwayland-scanner"
],
"nixpkgs": [
"hyprland",
"nixpkgs"
],
"systems": [
"hyprland",
"systems"
]
},
"locked": {
"lastModified": 1755354946,
"narHash": "sha256-zdov5f/GcoLQc9qYIS1dUTqtJMeDqmBmo59PAxze6e4=",
"owner": "hyprwm",
"repo": "xdg-desktop-portal-hyprland",
"rev": "a10726d6a8d0ef1a0c645378f983b6278c42eaa0",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "xdg-desktop-portal-hyprland",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

View file

@ -1,85 +0,0 @@
{
inputs = {
# NOTE if you add/change any inputs here also add them in the TOP level repo's flake.nix
home-manager.url = "github:rycee/home-manager/release-25.05";
ragenix.url = "github:yaxitech/ragenix";
nix-flatpak.url = "github:gmodena/nix-flatpak/?ref=latest";
hyprland.url = "github:hyprwm/Hyprland";
};
outputs =
{
home-manager,
ragenix,
nix-flatpak,
hyprland,
...
}:
{
nixosModules = {
default =
{
config,
lib,
pkgs,
...
}:
{
imports = [
home-manager.nixosModules.default
ragenix.nixosModules.age
nix-flatpak.nixosModules.nix-flatpak
hyprland.nixosModules.default
./_home_manager
./options.nix
./general
./boot
./desktop_environment
./users
./programs
./secrets
];
config = {
nixpkgs.overlays = [
# (final: prev: {
# wayland-protocols =
# nixpkgs-unstable.legacyPackages.${prev.stdenv.hostPlatform.system}.wayland-protocols;
# })
];
_module.args = {
inherit ragenix;
inherit hyprland;
hyprlandPkgs = import hyprland.inputs.nixpkgs {
system = pkgs.stdenv.hostPlatform.system;
config = config.nixpkgs.config or { };
};
};
};
};
containers = {
forgejo = import ./_containers/forgejo.nix;
};
};
homeManagerModules = {
zsh = import ./_home_manager/mods/zsh.nix;
tmux = import ./_home_manager/mods/tmux/tmux.nix;
atuin = import ./_home_manager/mods/atuin.nix;
zoxide = import ./_home_manager/mods/zoxide.nix;
starship = import ./_home_manager/mods/starship.nix;
direnv = import ./_home_manager/mods/direnv.nix;
ssh = import ./_home_manager/mods/ssh.nix;
git = import ./_home_manager/mods/git.nix;
nix_deprecations = import ./_home_manager/mods/nix_deprecations.nix;
alacritty = import ./_home_manager/mods/alacritty.nix;
foot = import ./_home_manager/mods/foot.nix;
kitty = import ./_home_manager/mods/kitty.nix;
launcher_rofi = import ./_home_manager/mods/launcher_rofi.nix;
obs = import ./_home_manager/mods/obs.nix;
postgres = import ./_home_manager/mods/postgres.nix;
slicer = import ./_home_manager/mods/slicer.nix;
};
};
}

View file

@ -1,211 +0,0 @@
{
config,
lib,
...
}:
let
ccfg = import ../config.nix;
cfg_path = [
ccfg.custom_config_key
"general"
];
cfg = lib.attrsets.getAttrFromPath cfg_path config;
top_cfg = config.${ccfg.custom_config_key};
in
{
options =
{ }
// lib.attrsets.setAttrByPath cfg_path {
flakeOptions = lib.mkOption {
type = lib.types.bool;
default = true;
description = "Enable nix flake options";
};
unfree = lib.mkOption {
type = lib.types.bool;
default = true;
description = "Enable unfree packages";
};
readWindowsDrives = lib.mkOption {
type = lib.types.bool;
default = true;
description = "Read windows drives";
};
disableRemoteBuildsOnLio = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Disable remote builds on lio";
};
timezone = lib.mkOption {
type = lib.types.str;
default = "America/Chicago";
description = "Timezone";
};
defaultLocal = lib.mkOption {
type = lib.types.str;
default = "en_US.UTF-8";
description = "Default locale";
};
fastShutdown = lib.mkOption {
type = lib.types.bool;
default = true;
description = "Fast shutdown";
};
enableSleep = lib.mkEnableOption (lib.mdDoc "Enable auto sleeping");
hideBootLogs = lib.mkEnableOption (lib.mdDoc "Hide boot logs on startup");
};
imports = [
./shell/common.nix
./fonts.nix
./tty_caps_esc.nix
./reporting.nix
];
config = {
# name this computer
networking = {
hostName = top_cfg.systemName;
nftables.enable = true;
nftables.flushRuleset = true;
firewall.enable = true;
};
# Enable flakes
nix.settings.experimental-features = lib.mkIf cfg.flakeOptions [
"nix-command"
"flakes"
];
# Allow unfree
nixpkgs.config.allowUnfree = cfg.unfree;
nixpkgs.config.allowUnfreePredicate = (pkg: cfg.unfree);
environment.variables = lib.mkIf cfg.unfree {
NIXPKGS_ALLOW_UNFREE = "1";
};
# allow mounting ntfs filesystems
boot.supportedFilesystems = lib.mkIf cfg.readWindowsDrives [ "ntfs" ];
# make shutdown faster for waiting
systemd.extraConfig = lib.mkIf cfg.fastShutdown ''
DefaultTimeoutStopSec=8s
'';
nix.settings = {
max-jobs = "auto";
# Fallback quickly if substituters are not available.
connect-timeout = 5;
download-attempts = 3;
download-buffer-size = 524288000; # default is 67108864, this increases to ~500MB
# The default at 10 is rarely enough.
log-lines = 50;
# Avoid disk full issues
max-free = (3000 * 1024 * 1024);
min-free = (1000 * 1024 * 1024);
# Avoid copying unnecessary stuff over SSH
builders-use-substitutes = true;
auto-optimise-store = true;
trusted-users = [
"root"
"@wheel"
];
substituters = [
"https://cache.nixos.org/"
"https://hyprland.cachix.org"
"https://cosmic.cachix.org/"
"https://nix-community.cachix.org"
];
trusted-substituters = config.nix.settings.substituters;
trusted-public-keys = [
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
"cosmic.cachix.org-1:Dya9IyXD4xdBehWjrkPv6rtxpmMdRel02smYzA85dPE="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
];
};
nix.extraOptions = ''
keep-outputs = true
keep-derivations = true
${lib.optionalString (
# TODO revisit this should it move?
config ? age && config.age ? secrets && config.age.secrets ? github_read_token
) "!include ${config.age.secrets.github_read_token.path}"}
'';
# Enable zsh
programs.zsh.enable = true;
environment.pathsToLink = [ "/share/zsh" ];
# nix helper
programs.nh = {
enable = true;
# clean.enable = true; # TODO revist does this solve my re-building issues?
clean.extraArgs = "--keep 10";
# `flake` path is set in users/default.nix for the primary user if set
};
# Remote build off home lio computer
programs.ssh.extraConfig = lib.mkIf (!cfg.disableRemoteBuildsOnLio) ''
Host lio_
PubkeyAcceptedKeyTypes ssh-ed25519
ServerAliveInterval 60
IPQoS throughput
${lib.optionalString (
config ? age && config.age ? secrets && config.age.secrets ? nix2lio
) "IdentityFile ${config.age.secrets.nix2lio.path}"}
'';
nix = {
distributedBuilds = lib.mkIf (!cfg.disableRemoteBuildsOnLio) true;
buildMachines = lib.mkIf (!cfg.disableRemoteBuildsOnLio) [
{
hostName = "lio";
system = "x86_64-linux";
protocol = "ssh-ng";
maxJobs = 32;
speedFactor = 2;
supportedFeatures = [
"nixos-test"
"benchmark"
"big-parallel"
"kvm"
"uid-range" # Often helpful
];
mandatoryFeatures = [ ];
}
];
};
# TODO can I make this Roaming automatically somehow?
time.timeZone = cfg.timezone;
# Select internationalization properties.
i18n.defaultLocale = cfg.defaultLocal;
i18n.extraLocaleSettings = {
LC_ADDRESS = cfg.defaultLocal;
LC_IDENTIFICATION = cfg.defaultLocal;
LC_MEASUREMENT = cfg.defaultLocal;
LC_MONETARY = cfg.defaultLocal;
LC_NAME = cfg.defaultLocal;
LC_NUMERIC = cfg.defaultLocal;
LC_PAPER = cfg.defaultLocal;
LC_TELEPHONE = cfg.defaultLocal;
LC_TIME = cfg.defaultLocal;
};
# Turn off sleep
systemd.sleep.extraConfig = lib.mkIf (!cfg.enableSleep) ''
[Sleep]
AllowSuspend=no
AllowHibernation=no
AllowSuspendThenHibernate=no
AllowHybridSleep=no
'';
# Hide boot logs
boot.initrd.verbose = cfg.hideBootLogs;
boot.consoleLogLevel = lib.mkIf cfg.hideBootLogs 3;
boot.kernelParams = lib.mkIf cfg.hideBootLogs [
"quiet"
"loglevel=3"
"systemd.show_status=false"
];
};
}

View file

@ -1,59 +0,0 @@
{
pkgs,
lib,
config,
...
}:
let
hasNewJetbrainsMono =
if builtins.hasAttr "nerd-fonts" pkgs then
builtins.hasAttr "jetbrains-mono" pkgs."nerd-fonts"
else
false;
jetbrainsMonoFont =
if hasNewJetbrainsMono then
pkgs.nerd-fonts.jetbrains-mono
else
(pkgs.nerdfonts.override { fonts = [ "JetBrainsMono" ]; });
ccfg = import ../config.nix;
cfg_path = [
ccfg.custom_config_key
"general"
];
cfg = lib.attrsets.getAttrFromPath cfg_path config;
in
{
options =
{ }
// lib.attrsets.setAttrByPath cfg_path {
jetbrainsMonoFont = lib.mkOption {
type = lib.types.bool;
default = true;
description = "Enable jetbrains mono font";
};
japaneseFonts = lib.mkOption {
type = lib.types.bool;
default = true;
description = "Enable japanese fonts";
};
};
config = {
fonts.packages =
lib.optionals cfg.jetbrainsMonoFont [
jetbrainsMonoFont
]
++ lib.optionals cfg.japaneseFonts (
with pkgs;
[
ipafont
kochi-substitute
noto-fonts-cjk-sans # Or another CJK font
]
);
fonts.fontconfig.enable = true;
};
}

View file

@ -1,80 +0,0 @@
{
lib,
config,
...
}:
let
ccfg = import ../config.nix;
cfg_path = [
ccfg.custom_config_key
"general"
"reporting"
];
cfg = lib.attrsets.getAttrFromPath cfg_path config;
in
{
options =
{ }
// lib.attrsets.setAttrByPath cfg_path {
enable = lib.mkEnableOption "Reporting node info and logs to grafana";
lokiUrl = lib.mkOption {
type = lib.types.str;
default = "http://h001.net.joshuabell.xyz:3100/loki/api/v1/push";
description = "URL of the Loki instance to send logs to";
};
};
config = lib.mkIf cfg.enable {
services.prometheus.exporters.node = {
enable = true;
port = 9100;
};
# Create necessary directories with appropriate permissions
systemd.tmpfiles.rules = [
"d /tmp/positions 1777 - - -" # World-writable directory for positions file
"f /tmp/positions.yaml 0666 - - -" # World-writable positions file
];
users.groups.systemd-journal.members = [ "promtail" ];
services.promtail = {
enable = true;
extraFlags = [
"-config.expand-env=true"
];
configuration = {
server = {
http_listen_port = 9080;
grpc_listen_port = 0;
};
positions = {
filename = "/tmp/positions.yaml"; # Changed from /var/lib/promtail/positions.yaml
};
clients = [
{
url = cfg.lokiUrl;
}
];
scrape_configs = [
{
job_name = "journal";
journal = {
json = false;
max_age = "12h";
path = "/var/log/journal";
labels = {
job = "systemd-journal";
host = config.networking.hostName;
};
};
relabel_configs = [
{
source_labels = [ "__journal__systemd_unit" ];
target_label = "unit";
}
];
}
];
};
};
};
}

View file

@ -1,73 +0,0 @@
{
lib,
pkgs,
...
}:
with lib;
{
config = {
environment.systemPackages = with pkgs; [
# Basics
vim
nano
wget
curl
jq
fastfetch
bat
htop
unzip
git
fzf
ripgrep
lsof
killall
hdparm
speedtest-cli
lf
];
environment.shellAliases = {
n = "nvim";
nn = "nvim --headless '+SessionDelete' +qa > /dev/null 2>&1 && nvim";
bat = "bat --theme Coldark-Dark";
cat = "bat --pager=never -p";
# TODO this may not be needed now that I am using `nh` clean mode (see /hosts/_common/configuration.nix#programs.nh)
nix-boot-clean = "find '/boot/loader/entries' -type f ! -name 'windows.conf' | head -n -4 | xargs -I {} rm {}; nix store gc; nixos-rebuild boot; echo; df";
ndr = "nix-direnv-reload";
# general unix
date_compact = "date +'%Y%m%d'";
date_short = "date +'%Y-%m-%d'";
ls = "ls --color -Gah";
ll = "ls --color -Galhtr";
lss = "du --max-depth=0 -h {.,}* 2>/dev/null | sort -hr";
psg = "ps aux | head -n 1 && ps aux | grep -v 'grep' | grep";
cl = "clear";
# git
status = "git status";
diff = "git diff";
branches = "git branch -a";
gcam = "git commit -a -m";
gcm = "git commit -m";
stashes = "git stash list";
bd = "branch default";
li = "link_ignored";
bx = "branchdel";
b = "branch";
# ripgrep
rg = "rg --no-ignore";
rgf = "rg --files --glob '!/nix/store/**' 2>/dev/null | rg";
};
environment.shellInit = lib.concatStringsSep "\n\n" [
(builtins.readFile ./common.sh)
(builtins.readFile ./tmux_helpers.sh)
(builtins.readFile ./branch.func.sh)
(builtins.readFile ./branchd.func.sh)
(builtins.readFile ./link_ignored.func.sh)
];
};
}

View file

@ -1,33 +0,0 @@
{
lib,
pkgs,
config,
...
}:
let
ccfg = import ../config.nix;
cfg_path = [
ccfg.custom_config_key
"general"
];
cfg = lib.attrsets.getAttrFromPath cfg_path config;
in
{
options =
{ }
// lib.attrsets.setAttrByPath cfg_path {
ttyCapsEscape = lib.mkOption {
type = lib.types.bool;
default = true;
description = "Enable caps for escape key";
};
};
config = lib.mkIf cfg.ttyCapsEscape {
services.xserver.xkb.options = "caps:escape";
console = {
earlySetup = true;
packages = with pkgs; [ terminus_font ];
useXkbConfig = true; # use xkb.options in tty. (caps -> escape)
};
};
}

View file

@ -1,18 +0,0 @@
{
config,
lib,
...
}:
let
ccfg = import ./config.nix;
cfg_path = "${ccfg.custom_config_key}";
cfg = config.${cfg_path};
in
{
options.${cfg_path} = {
systemName = lib.mkOption {
type = lib.types.str;
description = "The name of the system.";
};
};
}

View file

@ -1,43 +0,0 @@
{ config, lib, ... }:
let
ccfg = import ../config.nix;
cfg = config.${ccfg.custom_config_key}.programs;
in
{
imports = [
./qFlipper.nix
./rustDev.nix
./uhkAgent.nix
./tailnet.nix
./ssh.nix
./docker.nix
./podman.nix
./incus.nix
./flatpaks.nix
./virt-manager.nix
];
config = {
assertions = [
(
let
enabledVirtualizers = lib.filter (x: x.enabled) [
{
name = "docker";
enabled = cfg.docker.enable;
}
{
name = "podman";
enabled = cfg.podman.enable;
}
];
in
{
assertion = lib.length enabledVirtualizers <= 1;
message =
"Only one virtualizer can be enabled at a time. Enabled: "
+ lib.concatStringsSep ", " (map (x: x.name) enabledVirtualizers);
}
)
];
};
}

View file

@ -1,36 +0,0 @@
{
config,
lib,
...
}:
let
ccfg = import ../config.nix;
cfg_path = [
ccfg.custom_config_key
"programs"
"docker"
];
cfg = lib.attrsets.getAttrFromPath cfg_path config;
users_cfg = config.${ccfg.custom_config_key}.users;
in
{
options =
{ }
// lib.attrsets.setAttrByPath cfg_path {
enable = lib.mkEnableOption "docker";
};
config = lib.mkIf cfg.enable {
virtualisation.docker = {
enable = true;
autoPrune.enable = true;
};
# TODO add admins?
users.extraGroups.docker.members = lib.mkIf (users_cfg.primary != null) [ users_cfg.primary ];
environment.shellAliases = {
dockerv = "docker volume";
dockeri = "docker image";
dockerc = "docker container";
};
};
}

View file

@ -1,66 +0,0 @@
{
config,
lib,
...
}:
let
ccfg = import ../config.nix;
cfg_path = [
ccfg.custom_config_key
"programs"
"flatpaks"
];
cfg = lib.attrsets.getAttrFromPath cfg_path config;
in
{
options =
{ }
// lib.attrsets.setAttrByPath cfg_path {
enable = lib.mkEnableOption "flatpaks";
packages = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ ];
description = "List of Flatpak package names to install.";
};
};
config = lib.mkIf cfg.enable {
services.flatpak = {
enable = true;
packages = cfg.packages;
overrides = {
global = {
Context.sockets = [
"wayland"
"x11"
];
Context.devices = [ "dri" ]; # allow GPU access if desired
Environment = {
XCURSOR_PATH = "/run/host/user-share/icons:/run/host/share/icons";
GTK_THEME = "Adwaita:dark";
# Force wayland as much as possible.
ELECTRON_OZONE_PLATFORM_HINT = "auto"; # or 'auto'
GTK_USE_PORTAL = "1";
OZONE_PLATFORM = "wayland";
QT_QPA_PLATFORM = "xcb"; # force XCB for Flatpaks (XWayland)
};
};
"org.signal.Signal" = {
Environment = {
SIGNAL_PASSWORD_STORE = "gnome-libsecret";
};
Context = {
sockets = [
"xfg-settings"
];
};
};
"com.google.Chrome" = {
Environment = {
CHROME_EXTRA_ARGS = "--enable-features=WaylandWindowDecorations --ozone-platform-hint=auto";
};
};
};
};
};
}

View file

@ -1,33 +0,0 @@
{
config,
lib,
...
}:
let
ccfg = import ../config.nix;
cfg_path = [
ccfg.custom_config_key
"programs"
"incus"
];
cfg = lib.attrsets.getAttrFromPath cfg_path config;
users_cfg = config.${ccfg.custom_config_key}.users;
in
{
options =
{ }
// lib.attrsets.setAttrByPath cfg_path {
enable = lib.mkEnableOption "incus";
};
config = lib.mkIf cfg.enable {
virtualisation.incus = {
enable = true;
agent.enable = true;
ui.enable = true;
};
users.extraGroups.incus_admin.members = lib.mkIf (users_cfg.primary != null) [ users_cfg.primary ];
users.extraGroups.incus.members = lib.mkIf (users_cfg.primary != null) [ users_cfg.primary ];
};
}

View file

@ -1,32 +0,0 @@
{
config,
lib,
...
}:
let
ccfg = import ../config.nix;
cfg_path = [
ccfg.custom_config_key
"programs"
"podman"
];
cfg = lib.attrsets.getAttrFromPath cfg_path config;
users_cfg = config.${ccfg.custom_config_key}.users;
in
{
options =
{ }
// lib.attrsets.setAttrByPath cfg_path {
enable = lib.mkEnableOption "podman";
};
config = lib.mkIf cfg.enable {
virtualisation.podman = {
enable = true;
dockerSocket.enable = true;
autoPrune.enable = true;
};
# TODO add admins?
users.extraGroups.podman.members = lib.mkIf (users_cfg.primary != null) [ users_cfg.primary ];
};
}

View file

@ -1,33 +0,0 @@
{
config,
lib,
pkgs,
...
}:
let
ccfg = import ../config.nix;
cfg_path = [
ccfg.custom_config_key
"programs"
"qFlipper"
];
cfg = lib.attrsets.getAttrFromPath cfg_path config;
in
{
options =
{ }
// lib.attrsets.setAttrByPath cfg_path {
enable = lib.mkEnableOption "qFlipper";
};
config = lib.mkIf cfg.enable {
hardware.flipperzero.enable = true;
environment.systemPackages = with pkgs; [ qFlipper ];
services.udev.extraRules = ''
#Flipper Zero serial port
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="5740", ATTRS{manufacturer}=="Flipper Devices Inc.", GROUP="users", TAG+="uaccess"
#Flipper Zero DFU
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", ATTRS{manufacturer}=="STMicroelectronics", GROUP="users", TAG+="uaccess"
'';
};
}

View file

@ -1,53 +0,0 @@
{
config,
lib,
pkgs,
...
}:
let
ccfg = import ../config.nix;
cfg_path = [
ccfg.custom_config_key
"programs"
"rustDev"
];
cfg = lib.attrsets.getAttrFromPath cfg_path config;
in
{
options =
{ }
// lib.attrsets.setAttrByPath cfg_path {
enable = lib.mkEnableOption "rust development tools";
repl = lib.mkOption {
type = lib.types.bool;
default = true;
description = "Enable the evcxr repl for `rust` command.";
};
# TODO?
# channel = lib.mkOption {
# type = lib.types.str;
# default = "stable";
# description = "The Rust release channel to use (e.g., stable, beta, nightly).";
# };
# version = lib.mkOption {
# type = lib.types.str;
# default = "latest";
# description = "The specific version of Rust to use. Use 'latest' for the latest stable release.";
# };
};
config = lib.mkIf cfg.enable {
environment.systemPackages =
with pkgs;
[
rustup
gcc
]
++ (if cfg.repl then [ pkgs.evcxr ] else [ ]);
environment.shellAliases = lib.mkIf cfg.repl {
rust = "evcxr";
};
};
}

View file

@ -1,97 +0,0 @@
{
config,
lib,
pkgs,
...
}:
let
ccfg = import ../config.nix;
cfg_path = [
ccfg.custom_config_key
"programs"
"ssh"
];
cfg = lib.attrsets.getAttrFromPath cfg_path config;
users_cfg = config.${ccfg.custom_config_key}.users;
in
{
options =
{ }
// lib.attrsets.setAttrByPath cfg_path {
enable = lib.mkEnableOption "ssh";
sshPortOpen = lib.mkOption {
type = lib.types.bool;
default = true;
description = "Open the ssh port.";
};
fail2Ban = lib.mkOption {
type = lib.types.bool;
default = true;
description = "Enable fail2ban.";
};
allowPasswordLogin = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Allow root password login.";
};
};
config = lib.mkIf cfg.enable {
environment.systemPackages = with pkgs; [
openssh
autossh
];
# Use fail2ban
services.fail2ban = lib.mkIf cfg.fail2Ban {
enable = true;
# Ignore my tailnet
ignoreIP = [
"100.64.0.0/10"
];
};
# Open ports in the firewall if enabled.
networking.firewall.allowedTCPPorts = lib.mkIf cfg.sshPortOpen [
22 # sshd
];
# Enable the OpenSSH daemon.
services.openssh = {
enable = true;
settings = {
LogLevel = "VERBOSE";
PermitRootLogin = "yes";
PasswordAuthentication = cfg.allowPasswordLogin;
};
};
# Ensure SSH key pair generation for non-root users
systemd.services = lib.mapAttrs' (name: _: {
name = "generate_ssh_key_${name}";
value = {
description = "Generate SSH key pair for ${name}";
wantedBy = [ "multi-user.target" ];
serviceConfig = {
User = name;
Type = "oneshot";
};
script = ''
#!/run/current-system/sw/bin/bash
if [ ! -f /home/${name}/.ssh/id_ed25519 ]; then
if [ -v DRY_RUN ]; then
echo "DRY_RUN is set. Would generate SSH key for ${name}.";
else
echo "Generating SSH key for ${name}.";
mkdir -p /home/${name}/.ssh;
chmod 700 /home/${name}/.ssh;
/run/current-system/sw/bin/ssh-keygen -t ed25519 -f /home/${name}/.ssh/id_ed25519 -N "";
fi
else
echo "SSH key already exists for ${name}.";
fi
'';
};
}) users_cfg.users;
};
}

View file

@ -1,53 +0,0 @@
{
config,
lib,
pkgs,
...
}:
let
ccfg = import ../config.nix;
cfg_path = [
ccfg.custom_config_key
"programs"
"tailnet"
];
cfg = lib.attrsets.getAttrFromPath cfg_path config;
in
{
options =
{ }
// lib.attrsets.setAttrByPath cfg_path {
enable = lib.mkEnableOption "enable tailnet";
useHeadscale = lib.mkOption {
type = lib.types.bool;
default = true;
description = "Whether to use headscale login server.";
};
enableExitNode = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Whether to enable exit node.";
};
};
config = lib.mkIf cfg.enable {
environment.systemPackages = with pkgs; [ tailscale ];
services.tailscale = {
enable = true;
openFirewall = true;
useRoutingFeatures = if cfg.enableExitNode then "both" else "client";
authKeyFile = lib.mkIf (
config ? age && config.age ? secrets && config.age.secrets ? headscale_auth
) config.age.secrets.headscale_auth.path;
extraUpFlags =
(lib.optionals cfg.useHeadscale [
"--login-server=https://headscale.joshuabell.xyz"
])
++ (lib.optionals cfg.enableExitNode [ "--advertise-exit-node" ]);
};
networking.firewall.trustedInterfaces = [ config.services.tailscale.interfaceName ];
networking.firewall.checkReversePath = "loose";
};
}

View file

@ -1,31 +0,0 @@
{
config,
lib,
pkgs,
...
}:
let
ccfg = import ../config.nix;
cfg_path = [
ccfg.custom_config_key
"programs"
"uhkAgent"
];
cfg = lib.attrsets.getAttrFromPath cfg_path config;
in
{
options =
{ }
// lib.attrsets.setAttrByPath cfg_path {
enable = lib.mkEnableOption "uhk agent (ultimate hacking keyboard)";
};
config = lib.mkIf cfg.enable {
environment.systemPackages = with pkgs; [
uhk-agent
uhk-udev-rules
];
services.udev.packages = [ pkgs.uhk-udev-rules ];
};
}

View file

@ -1,42 +0,0 @@
{
config,
lib,
...
}:
let
ccfg = import ../config.nix;
cfg_path = [
ccfg.custom_config_key
"programs"
"virt-manager"
];
cfg = lib.attrsets.getAttrFromPath cfg_path config;
users_cfg = config.${ccfg.custom_config_key}.users;
in
{
options =
{ }
// lib.attrsets.setAttrByPath cfg_path {
enable = lib.mkEnableOption "Enable virt manager/quemu";
users = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = builtins.attrNames users_cfg;
description = "Users to configure for virt-manager.";
};
};
config = lib.mkIf cfg.enable {
services.qemuGuest.enable = true;
services.spice-vdagentd.enable = true;
programs.virt-manager = {
enable = true;
};
virtualisation = {
libvirtd.enable = true;
spiceUSBRedirection.enable = true;
};
users.groups.libvirtd.members = cfg.users;
};
}

View file

@ -1,77 +0,0 @@
{
config,
ragenix,
lib,
pkgs,
...
}:
let
ccfg = import ../config.nix;
cfg_path = [
ccfg.custom_config_key
"secrets"
];
cfg = lib.attrsets.getAttrFromPath cfg_path config;
users_cfg = config.${ccfg.custom_config_key}.users;
secretsRaw = import ./secrets/secrets.nix;
systemName = lib.attrsets.getAttrFromPath [
ccfg.custom_config_key
"systemName"
] config;
authorityMarker = "authority";
# Key matches this host if its trailing comment contains "@<host>"
matchesThisSystem = key: lib.strings.hasInfix "@${systemName}" key;
# Key is the authority key if its comment contains the marker string
matchesAuthority = key: lib.strings.hasInfix authorityMarker key;
keepSecret =
attrs:
let
keys = attrs.publicKeys or [ ];
in
lib.any (k: matchesThisSystem k) keys;
# Any secrets that should be world-readable even after auto-import
worldReadable = [
"zitadel_master_key"
"openwebui_env"
"vaultwarden_env"
];
# Keep only secrets intended for this host (or that include the authority key)
filteredSecrets = lib.attrsets.filterAttrs (_name: attrs: keepSecret attrs) secretsRaw;
in
{
options =
{ }
// lib.attrsets.setAttrByPath cfg_path {
enable = lib.mkEnableOption "secrets";
};
config = lib.mkIf cfg.enable {
environment.systemPackages = [
ragenix.packages.${pkgs.system}.default
pkgs.rage
];
age = {
secrets = lib.attrsets.mapAttrs' (
name: _attrs:
let
base = lib.removeSuffix ".age" name;
in
lib.nameValuePair base (
{
file = ./. + "/secrets/${name}";
owner = users_cfg.primary;
}
// lib.optionalAttrs (lib.elem base worldReadable) {
mode = "444";
}
)
) filteredSecrets;
};
};
}

View file

@ -1,56 +0,0 @@
{
config,
lib,
...
}:
let
ccfg = import ../config.nix;
cfg_path = [
ccfg.custom_config_key
"users"
];
cfg = lib.attrsets.getAttrFromPath cfg_path config;
top_cfg = config.${ccfg.custom_config_key};
in
{
options =
{ }
// lib.attrsets.setAttrByPath cfg_path {
admins = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ ];
example = [ "josh" ];
description = ''
List of users to be added to the system.
'';
};
primary = lib.mkOption {
type = lib.types.str;
default = lib.optionalString (cfg.admins != [ ] && cfg.admins != null) (
builtins.elemAt cfg.admins 0
);
description = "The primary user of the system.";
};
users = lib.mkOption {
type = lib.types.attrsOf lib.types.attrs;
default = { };
description = "Normal users to configure (not for system users). Should match nix options of users.userser.<name>.*";
};
};
config = {
users.users = lib.mapAttrs (
name: userConfig:
userConfig
// {
inherit name;
isNormalUser = lib.mkIf (name != "root") true;
initialPassword =
if (lib.hasAttr "initialPassword" userConfig) then userConfig.initialPassword else "password1";
extraGroups =
lib.optionals (builtins.elem name cfg.admins) [ "wheel" ] ++ (userConfig.extraGroups or [ ]);
}
) cfg.users;
programs.nh.flake = lib.mkIf (lib.hasAttr "primary" cfg) "/home/${cfg.primary}/.config/nixos-config/hosts/${top_cfg.systemName}";
};
}

679
flake.lock generated
View file

@ -1,511 +1,12 @@
{
"nodes": {
"agenix": {
"inputs": {
"darwin": "darwin",
"home-manager": "home-manager_2",
"nixpkgs": [
"ragenix",
"nixpkgs"
],
"systems": "systems_2"
},
"locked": {
"lastModified": 1736955230,
"narHash": "sha256-uenf8fv2eG5bKM8C/UvFaiJMZ4IpUFaQxk9OH5t/1gA=",
"owner": "ryantm",
"repo": "agenix",
"rev": "e600439ec4c273cf11e06fe4d9d906fb98fa097c",
"type": "github"
},
"original": {
"owner": "ryantm",
"repo": "agenix",
"type": "github"
}
},
"aquamarine": {
"inputs": {
"hyprutils": [
"hyprland",
"hyprutils"
],
"hyprwayland-scanner": [
"hyprland",
"hyprwayland-scanner"
],
"nixpkgs": [
"hyprland",
"nixpkgs"
],
"systems": [
"hyprland",
"systems"
]
},
"locked": {
"lastModified": 1755946532,
"narHash": "sha256-POePremlUY5GyA1zfbtic6XLxDaQcqHN6l+bIxdT5gc=",
"owner": "hyprwm",
"repo": "aquamarine",
"rev": "81584dae2df6ac79f6b6dae0ecb7705e95129ada",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "aquamarine",
"type": "github"
}
},
"crane": {
"locked": {
"lastModified": 1741481578,
"narHash": "sha256-JBTSyJFQdO3V8cgcL08VaBUByEU6P5kXbTJN6R0PFQo=",
"owner": "ipetkov",
"repo": "crane",
"rev": "bb1c9567c43e4434f54e9481eb4b8e8e0d50f0b5",
"type": "github"
},
"original": {
"owner": "ipetkov",
"repo": "crane",
"type": "github"
}
},
"darwin": {
"inputs": {
"nixpkgs": [
"ragenix",
"agenix",
"nixpkgs"
]
},
"locked": {
"lastModified": 1700795494,
"narHash": "sha256-gzGLZSiOhf155FW7262kdHo2YDeugp3VuIFb4/GGng0=",
"owner": "lnl7",
"repo": "nix-darwin",
"rev": "4b9b83d5a92e8c1fbfd8eb27eda375908c11ec4d",
"type": "github"
},
"original": {
"owner": "lnl7",
"ref": "master",
"repo": "nix-darwin",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1747046372,
"narHash": "sha256-CIVLLkVgvHYbgI2UpXvIIBJ12HWgX+fjA8Xf8PUmqCY=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "9100a0f413b0c601e0533d1d94ffd501ce2e7885",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems_3"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"gitignore": {
"inputs": {
"nixpkgs": [
"hyprland",
"pre-commit-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1709087332,
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1758463745,
"narHash": "sha256-uhzsV0Q0I9j2y/rfweWeGif5AWe0MGrgZ/3TjpDYdGA=",
"owner": "rycee",
"repo": "home-manager",
"rev": "3b955f5f0a942f9f60cdc9cacb7844335d0f21c3",
"type": "github"
},
"original": {
"owner": "rycee",
"ref": "release-25.05",
"repo": "home-manager",
"type": "github"
}
},
"home-manager_2": {
"inputs": {
"nixpkgs": [
"ragenix",
"agenix",
"nixpkgs"
]
},
"locked": {
"lastModified": 1703113217,
"narHash": "sha256-7ulcXOk63TIT2lVDSExj7XzFx09LpdSAPtvgtM7yQPE=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "3bfaacf46133c037bb356193bd2f1765d9dc82c1",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"hyprcursor": {
"inputs": {
"hyprlang": [
"hyprland",
"hyprlang"
],
"nixpkgs": [
"hyprland",
"nixpkgs"
],
"systems": [
"hyprland",
"systems"
]
},
"locked": {
"lastModified": 1753964049,
"narHash": "sha256-lIqabfBY7z/OANxHoPeIrDJrFyYy9jAM4GQLzZ2feCM=",
"owner": "hyprwm",
"repo": "hyprcursor",
"rev": "44e91d467bdad8dcf8bbd2ac7cf49972540980a5",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "hyprcursor",
"type": "github"
}
},
"hyprgraphics": {
"inputs": {
"hyprutils": [
"hyprland",
"hyprutils"
],
"nixpkgs": [
"hyprland",
"nixpkgs"
],
"systems": [
"hyprland",
"systems"
]
},
"locked": {
"lastModified": 1758192433,
"narHash": "sha256-CR6RnqEJSTiFgA6KQY4TTLUWbZ8RBnb+hxQqesuQNzQ=",
"owner": "hyprwm",
"repo": "hyprgraphics",
"rev": "c44e749dd611521dee940d00f7c444ee0ae4cfb7",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "hyprgraphics",
"type": "github"
}
},
"hyprland": {
"inputs": {
"aquamarine": "aquamarine",
"hyprcursor": "hyprcursor",
"hyprgraphics": "hyprgraphics",
"hyprland-protocols": "hyprland-protocols",
"hyprland-qtutils": "hyprland-qtutils",
"hyprlang": "hyprlang",
"hyprutils": "hyprutils",
"hyprwayland-scanner": "hyprwayland-scanner",
"nixpkgs": "nixpkgs_2",
"pre-commit-hooks": "pre-commit-hooks",
"systems": "systems",
"xdph": "xdph"
},
"locked": {
"lastModified": 1759094452,
"narHash": "sha256-j7IOTFnQRDjX4PzYb2p6CPviAc8cDrcorzGpM8J89uM=",
"owner": "hyprwm",
"repo": "Hyprland",
"rev": "f854b5bffbdd13cfe7edad0ee157d6947ff99619",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "Hyprland",
"type": "github"
}
},
"hyprland-protocols": {
"inputs": {
"nixpkgs": [
"hyprland",
"nixpkgs"
],
"systems": [
"hyprland",
"systems"
]
},
"locked": {
"lastModified": 1749046714,
"narHash": "sha256-kymV5FMnddYGI+UjwIw8ceDjdeg7ToDVjbHCvUlhn14=",
"owner": "hyprwm",
"repo": "hyprland-protocols",
"rev": "613878cb6f459c5e323aaafe1e6f388ac8a36330",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "hyprland-protocols",
"type": "github"
}
},
"hyprland-qt-support": {
"inputs": {
"hyprlang": [
"hyprland",
"hyprland-qtutils",
"hyprlang"
],
"nixpkgs": [
"hyprland",
"hyprland-qtutils",
"nixpkgs"
],
"systems": [
"hyprland",
"hyprland-qtutils",
"systems"
]
},
"locked": {
"lastModified": 1749154592,
"narHash": "sha256-DO7z5CeT/ddSGDEnK9mAXm1qlGL47L3VAHLlLXoCjhE=",
"owner": "hyprwm",
"repo": "hyprland-qt-support",
"rev": "4c8053c3c888138a30c3a6c45c2e45f5484f2074",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "hyprland-qt-support",
"type": "github"
}
},
"hyprland-qtutils": {
"inputs": {
"hyprland-qt-support": "hyprland-qt-support",
"hyprlang": [
"hyprland",
"hyprlang"
],
"hyprutils": [
"hyprland",
"hyprland-qtutils",
"hyprlang",
"hyprutils"
],
"nixpkgs": [
"hyprland",
"nixpkgs"
],
"systems": [
"hyprland",
"systems"
]
},
"locked": {
"lastModified": 1757694755,
"narHash": "sha256-j+w5QUUr2QT/jkxgVKecGYV8J7fpzXCMgzEEr6LG9ug=",
"owner": "hyprwm",
"repo": "hyprland-qtutils",
"rev": "5ffdfc13ed03df1dae5084468d935f0a3f2c9a4c",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "hyprland-qtutils",
"type": "github"
}
},
"hyprlang": {
"inputs": {
"hyprutils": [
"hyprland",
"hyprutils"
],
"nixpkgs": [
"hyprland",
"nixpkgs"
],
"systems": [
"hyprland",
"systems"
]
},
"locked": {
"lastModified": 1756810301,
"narHash": "sha256-wgZ3VW4VVtjK5dr0EiK9zKdJ/SOqGIBXVG85C3LVxQA=",
"owner": "hyprwm",
"repo": "hyprlang",
"rev": "3d63fb4a42c819f198deabd18c0c2c1ded1de931",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "hyprlang",
"type": "github"
}
},
"hyprutils": {
"inputs": {
"nixpkgs": [
"hyprland",
"nixpkgs"
],
"systems": [
"hyprland",
"systems"
]
},
"locked": {
"lastModified": 1756117388,
"narHash": "sha256-oRDel6pNl/T2tI+nc/USU9ZP9w08dxtl7hiZxa0C/Wc=",
"owner": "hyprwm",
"repo": "hyprutils",
"rev": "b2ae3204845f5f2f79b4703b441252d8ad2ecfd0",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "hyprutils",
"type": "github"
}
},
"hyprwayland-scanner": {
"inputs": {
"nixpkgs": [
"hyprland",
"nixpkgs"
],
"systems": [
"hyprland",
"systems"
]
},
"locked": {
"lastModified": 1755184602,
"narHash": "sha256-RCBQN8xuADB0LEgaKbfRqwm6CdyopE1xIEhNc67FAbw=",
"owner": "hyprwm",
"repo": "hyprwayland-scanner",
"rev": "b3b0f1f40ae09d4447c20608e5a4faf8bf3c492d",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "hyprwayland-scanner",
"type": "github"
}
},
"nix-flatpak": {
"locked": {
"lastModified": 1739444422,
"narHash": "sha256-iAVVHi7X3kWORftY+LVbRiStRnQEob2TULWyjMS6dWg=",
"owner": "gmodena",
"repo": "nix-flatpak",
"rev": "5e54c3ca05a7c7d968ae1ddeabe01d2a9bc1e177",
"type": "github"
},
"original": {
"owner": "gmodena",
"ref": "latest",
"repo": "nix-flatpak",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1753345091,
"narHash": "sha256-CdX2Rtvp5I8HGu9swBmYuq+ILwRxpXdJwlpg8jvN4tU=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "3ff0e34b1383648053bba8ed03f201d3466f90c9",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-25.05",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1758198701,
"narHash": "sha256-7To75JlpekfUmdkUZewnT6MoBANS0XVypW6kjUOXQwc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "0147c2f1d54b30b5dd6d4a8c8542e8d7edf93b5d",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 1758690382,
"narHash": "sha256-NY3kSorgqE5LMm1LqNwGne3ZLMF2/ILgLpFr1fS4X3o=",
"lastModified": 1760524057,
"narHash": "sha256-EVAqOteLBFmd7pKkb0+FIUyzTF61VKi7YmvP1tw4nEw=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "e643668fd71b949c53f8626614b21ff71a07379d",
"rev": "544961dfcce86422ba200ed9a0b00dd4b1486ec5",
"type": "github"
},
"original": {
@ -515,181 +16,9 @@
"type": "github"
}
},
"nixpkgs_4": {
"locked": {
"lastModified": 1741379970,
"narHash": "sha256-Wh7esNh7G24qYleLvgOSY/7HlDUzWaL/n4qzlBePpiw=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "36fd87baa9083f34f7f5027900b62ee6d09b1f2f",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"pre-commit-hooks": {
"inputs": {
"flake-compat": "flake-compat",
"gitignore": "gitignore",
"nixpkgs": [
"hyprland",
"nixpkgs"
]
},
"locked": {
"lastModified": 1758108966,
"narHash": "sha256-ytw7ROXaWZ7OfwHrQ9xvjpUWeGVm86pwnEd1QhzawIo=",
"owner": "cachix",
"repo": "git-hooks.nix",
"rev": "54df955a695a84cd47d4a43e08e1feaf90b1fd9b",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "git-hooks.nix",
"type": "github"
}
},
"ragenix": {
"inputs": {
"agenix": "agenix",
"crane": "crane",
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs_4",
"rust-overlay": "rust-overlay"
},
"locked": {
"lastModified": 1744897914,
"narHash": "sha256-GIVU92o2TZBnKQXTb76zpQbWR4zjU2rFqWKNIIpXnqA=",
"owner": "yaxitech",
"repo": "ragenix",
"rev": "40f2e17ecaeab4d78ec323e96a04548c0aaa5223",
"type": "github"
},
"original": {
"owner": "yaxitech",
"repo": "ragenix",
"type": "github"
}
},
"root": {
"inputs": {
"home-manager": "home-manager",
"hyprland": "hyprland",
"nix-flatpak": "nix-flatpak",
"nixpkgs": "nixpkgs_3",
"ragenix": "ragenix"
}
},
"rust-overlay": {
"inputs": {
"nixpkgs": [
"ragenix",
"nixpkgs"
]
},
"locked": {
"lastModified": 1741400194,
"narHash": "sha256-tEpgT+q5KlGjHSm8MnINgTPErEl8YDzX3Eps8PVc09g=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "16b6045a232fea0e9e4c69e55a6e269607dd8e3f",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
},
"systems": {
"locked": {
"lastModified": 1689347949,
"narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=",
"owner": "nix-systems",
"repo": "default-linux",
"rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default-linux",
"type": "github"
}
},
"systems_2": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"systems_3": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"xdph": {
"inputs": {
"hyprland-protocols": [
"hyprland",
"hyprland-protocols"
],
"hyprlang": [
"hyprland",
"hyprlang"
],
"hyprutils": [
"hyprland",
"hyprutils"
],
"hyprwayland-scanner": [
"hyprland",
"hyprwayland-scanner"
],
"nixpkgs": [
"hyprland",
"nixpkgs"
],
"systems": [
"hyprland",
"systems"
]
},
"locked": {
"lastModified": 1755354946,
"narHash": "sha256-zdov5f/GcoLQc9qYIS1dUTqtJMeDqmBmo59PAxze6e4=",
"owner": "hyprwm",
"repo": "xdg-desktop-portal-hyprland",
"rev": "a10726d6a8d0ef1a0c645378f983b6278c42eaa0",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "xdg-desktop-portal-hyprland",
"type": "github"
"nixpkgs": "nixpkgs"
}
}
},

View file

@ -1,24 +1,13 @@
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
# Manually synced with common/flake.nix inputs
# =====
home-manager.url = "github:rycee/home-manager/release-25.05";
ragenix.url = "github:yaxitech/ragenix";
nix-flatpak.url = "github:gmodena/nix-flatpak/?ref=latest";
hyprland.url = "github:hyprwm/Hyprland";
# ======
};
outputs =
{
nixpkgs,
home-manager,
ragenix,
nix-flatpak,
...
}@inputs:
}:
let
# Utilities
inherit (nixpkgs) lib;
@ -26,8 +15,6 @@
forAllSystems = lib.genAttrs lib.systems.flakeExposed;
# Create a mapping from system to corresponding nixpkgs : https://nixos.wiki/wiki/Overlays#In_a_Nix_flake
nixpkgsFor = forAllSystems (system: nixpkgs.legacyPackages.${system});
commonFlake = (import ./common/flake.nix).outputs inputs;
in
{
devShells = forAllSystems (
@ -69,6 +56,5 @@
};
}
);
}
// commonFlake;
};
}

16
flakes/common/flake.nix Normal file
View file

@ -0,0 +1,16 @@
{
description = "Common NixOS configuration modules and Home Manager modules that require not other inputs beyond nixpkgs or home-manager itself. This is made by me for me and not designed to be general purpose for anyone else, but could be useful nontheless.";
inputs = { };
outputs =
{
...
}:
let
utils = import ./utils.nix;
in
with utils;
{
nixosModules = importAll ./nix_modules;
homeManagerModules = importAll ./hm_modules;
};
}

View file

@ -6,6 +6,7 @@
window = {
decorations = "None";
dynamic_title = false;
opacity = 0.94;
};
colors = {
primary = {

View file

@ -1,16 +1,18 @@
{ ... }:
# TODO setup auto secret/login for sync
{
programs.atuin = {
enable = true;
enableZshIntegration = true;
enableZshIntegration = true; # TODO make dynamic?
flags = [ "--disable-up-arrow" ];
settings = {
workspaces = true;
exit-mode = "return-query";
enter_accept = true;
sync_address = "https://atuin.joshuabell.xyz";
sync = { records = true; };
sync = {
records = true;
};
};
};
}

View file

@ -0,0 +1,4 @@
{ ... }:
{
imports = [ ./i3.nix ./polybar.nix ];
}

View file

@ -0,0 +1,88 @@
{ pkgs, ... }:
{
xsession.enable = true;
xsession.windowManager.i3 = {
enable = true;
package = pkgs.i3;
extraConfig = ''
focus_follows_mouse no
default_border pixel 1
default_floating_border pixel 1
floating_modifier Mod4
'';
config = rec {
modifier = "Mod4";
terminal = "kitty";
menu = "rofi -show drun";
focus.followMouse = false;
gaps = {
inner = 2;
outer = 5;
smartBorders = "on";
};
keybindings = {
"${modifier}+Return" = "exec ${terminal}";
"${modifier}+space" = "exec pkill rofi || rofi -show drun";
"${modifier}+q" = "kill";
"${modifier}+shift+Escape" = "exit";
"${modifier}+shift+q" = "exec i3lock";
"${modifier}+f" = "floating toggle";
"${modifier}+h" = "focus left";
"${modifier}+l" = "focus right";
"${modifier}+k" = "focus up";
"${modifier}+j" = "focus down";
"${modifier}+1" = "workspace number 1";
"${modifier}+n" = "workspace number 1";
"${modifier}+2" = "workspace number 2";
"${modifier}+m" = "workspace number 2";
"${modifier}+3" = "workspace number 3";
"${modifier}+comma" = "workspace number 3";
"${modifier}+4" = "workspace number 4";
"${modifier}+period" = "workspace number 4";
"${modifier}+5" = "workspace number 5";
"${modifier}+slash" = "workspace number 5";
"${modifier}+6" = "workspace number 6";
"${modifier}+7" = "workspace number 7";
"${modifier}+8" = "workspace number 8";
"${modifier}+9" = "workspace number 9";
"${modifier}+0" = "workspace number 10";
"${modifier}+shift+h" = "move left";
"${modifier}+shift+l" = "move right";
"${modifier}+shift+k" = "move up";
"${modifier}+shift+j" = "move down";
"${modifier}+shift+1" = "move container to workspace number 1";
"${modifier}+shift+n" = "move container to workspace number 1";
"${modifier}+shift+2" = "move container to workspace number 2";
"${modifier}+shift+m" = "move container to workspace number 2";
"${modifier}+shift+3" = "move container to workspace number 3";
"${modifier}+shift+comma" = "move container to workspace number 3";
"${modifier}+shift+4" = "move container to workspace number 4";
"${modifier}+shift+period" = "move container to workspace number 4";
"${modifier}+shift+5" = "move container to workspace number 5";
"${modifier}+shift+slash" = "move container to workspace number 5";
"${modifier}+shift+6" = "move container to workspace number 6";
"${modifier}+shift+7" = "move container to workspace number 7";
"${modifier}+shift+8" = "move container to workspace number 8";
"${modifier}+shift+9" = "move container to workspace number 9";
"${modifier}+shift+0" = "move container to workspace number 10";
"${modifier}+Left" = "resize shrink width 10 px or 10 ppt";
"${modifier}+Down" = "resize shrink height 10 px or 10 ppt";
"${modifier}+Up" = "resize grow height 10 px or 10 ppt";
"${modifier}+Right" = "resize grow width 10 px or 10 ppt";
"Print" = "exec sh -c 'maim -s | xclip -selection clipboard -t image/png'";
};
bars = [ ];
startup = [ ];
};
};
}

View file

@ -0,0 +1,306 @@
{ lib, pkgs, ... }:
let
mf = "#3b3b3bcc";
bg = "#00000000";
fg = "#FFFFFF";
polybarRun = pkgs.writeShellScriptBin "pbr" ''
polybar -m | while IFS=: read -r mon rest; do
if echo "$rest" | ${pkgs.gnugrep}/bin/grep -q "(primary)"; then
MONITOR="$mon" polybar -r primary &
else
MONITOR="$mon" polybar -r others &
fi
done
wait
'';
in
{
services.polybar = {
enable = true;
package = pkgs.polybar.override {
i3Support = true;
iwSupport = true;
pulseSupport = true;
};
script = "${polybarRun}/bin/pbr";
settings = {
"global/wm" = {
margin-bottom = 0;
margin-top = 5;
};
"bar/main" = {
monitor = "\${env:MONITOR}";
width = "100%";
height = 20;
radius = 0;
background = bg;
foreground = fg;
font-0 = "JetBrainsMono Nerd Font:size=11;2";
font-1 = "Noto Sans CJK JP:size=11;2";
cursor-click = "pointer";
enable-ipc = true;
};
"bar/primary" = {
"inherit" = "bar/main";
modules-left = "i3";
modules-center = "clock temperature cpu memory filesystem";
modules-right = "volume tray powermenu";
# modules-right = "volume network bluetooth backlight tray powermenu";
};
"bar/others" = {
"inherit" = "bar/main";
modules-left = "i3";
modules-center = "clock temperature cpu memory filesystem";
modules-right = "";
};
"settings" = {
screenchange-reload = true;
compositing-background = "source";
compositing-foreground = "over";
compositing-overline = "over";
comppositing-underline = "over";
compositing-border = "over";
pseudo-transparency = true;
};
"module/i3" = {
type = "internal/i3";
index-sort = true;
pin-workspaces = true;
strip-wsnumbers = true;
wrapping-scroll = false;
format = "<label-state>";
ws-icon-0 = "1;";
ws-icon-1 = "2;";
ws-icon-2 = "3;";
ws-icon-3 = "4;";
ws-icon-4 = "5;";
ws-icon-5 = "6;";
ws-icon-6 = "7;";
ws-icon-7 = "8;";
ws-icon-8 = "9;";
ws-icon-9 = "10;";
label-unfocused = "%icon%";
label-focused = "%icon%";
label-focused-background = mf;
label-visible = "%icon%";
label-urgent = "%icon%";
label-occupied = "%icon%";
label-unfocused-padding = 1;
label-focused-padding = 1;
label-visible-padding = 1;
label-urgent-padding = 1;
label-occupied-padding = 1;
};
"module/clock" = {
type = "internal/date";
interval = 10;
date = "%b %d, %H:%M";
format = "<label>";
label = "%date%";
};
"module/temperature" = {
type = "internal/temperature";
interval = 5;
thermal-zone = 2;
hwmon-path = "/sys/class/hwmon/hwmon2/temp1_input";
warn-temperature = 80;
format = "<label>";
format-prefix = " ";
label = "󰔏 %temperature-c%";
};
"module/cpu" = {
type = "internal/cpu";
interval = 2;
format = "<label>";
format-prefix = " ";
label = "󰻠 %percentage%%";
};
"module/memory" = {
type = "internal/memory";
interval = 5;
format = "<label>";
format-prefix = " ";
label = "󰍛 %percentage_used%%";
};
"module/filesystem" = {
type = "internal/fs";
interval = 30;
mount-0 = "/";
format-mounted = "<label-mounted>";
label-mounted = "󰋊 %percentage_used%%";
format-mounted-prefix = " ";
};
# "module/battery" = {
# type = "internal/battery";
# battery = "BAT0";
# adapter = "AC";
# full-at = 98;
# format-charging = "%percentage%% ";
# format-discharging = "%percentage%% %icon%";
# format-full = "%percentage%% ";
# ramp-capacity-0 = "";
# ramp-capacity-1 = "";
# ramp-capacity-2 = "";
# ramp-capacity-3 = "";
# ramp-capacity-4 = "";
# };
#
# "module/battery2" = {
# type = "internal/battery";
# battery = "BAT2";
# adapter = "AC";
# full-at = 98;
# format-charging = "%percentage%% ";
# format-discharging = "%percentage%% %icon%";
# format-full = "%percentage%% ";
# ramp-capacity-0 = "";
# ramp-capacity-1 = "";
# ramp-capacity-2 = "";
# ramp-capacity-3 = "";
# ramp-capacity-4 = "";
# };
# "module/volumea" = {
# type = "custom/script";
# format = "<label>";
# exec = "/bin/sh";
# exec-args = [
# "-c"
# "${pkgs.wireplumber}/bin/wpctl get-volume @DEFAULT_AUDIO_SINK@ 2>/dev/null | awk '{printf \"󰕿 %d%%\", $2*100}'"
# ];
# interval = 2;
# click-left = "${pkgs.pavucontrol}/bin/pavucontrol";
# click-right = "${pkgs.wireplumber}/bin/wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle";
# scroll-up = "${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.05+";
# scroll-down = "${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.05-";
# };
"module/volume" = {
type = "internal/alsa";
};
# "module/wifi" = {
# type = "internal/network";
# interface = "wlp11s0";
# unknown-as-up = true;
# accumulate-stats = true;
# interval = 3;
# format-connected = "󰤨 %essid% (%signal%%)";
# format-wired = "󰈀 %local_ip%";
# format-disconnected = "󰖪 Disconnected";
# };
# "module/network" = {
# type = "internal/network";
# interface = "eno1";
#
# interval = "1.0";
#
# accumulate-stats = true;
# unknown-as-up = true;
#
# format-connected = "<label-connected>";
# format-connected-background = mf;
# format-connected-underline = bg;
# format-connected-overline = bg;
# format-connected-padding = 2;
# format-connected-margin = 0;
#
# format-disconnected = "<label-disconnected>";
# format-disconnected-background = mf;
# format-disconnected-underline = bg;
# format-disconnected-overline = bg;
# format-disconnected-padding = 2;
# format-disconnected-margin = 0;
#
# label-connected = "D %downspeed:2% | U %upspeed:2%";
# label-disconnected = "DISCONNECTED";
# };
# "module/bluetooth" = {
# type = "custom/script";
# format = "<label>";
# format-prefix = " ";
# exec = "/bin/sh";
# exec-args = [
# "-c"
# "${pkgs.bluez}/bin/bluetoothctl info | grep -q 'Connected: yes' && echo '󰂱' || echo '󰂯 off'"
# ];
# interval = 5;
# click-left = "blueman-manager";
# };
# "module/backlight" = {
# type = "custom/script";
# format = "<label>";
# format-prefix = " ";
# exec = "/bin/sh";
# exec-args = [
# "-c"
# "${pkgs.brightnessctl}/bin/brightnessctl -m | cut -d, -f4"
# ];
#
# interval = 2;
# label = "%output%% ";
# scroll-up = "${pkgs.brightnessctl}/bin/brightnessctl set +5%";
# scroll-down = "${pkgs.brightnessctl}/bin/brightnessctl set 5%-";
# };
"module/powermenu" = {
type = "custom/menu";
expand-right = "false";
format = "<label-toggle> <menu>";
format-background = mf;
format-padding = 1;
label-open = " ";
label-close = " ";
label-separator = "|";
menu-0-0 = "󰍃 Logout";
menu-0-0-exec = "i3-msg exit";
menu-0-1 = " Reboot";
menu-0-1-exec = "systemctl reboot";
menu-0-2 = " Shutdown";
menu-0-2-exec = "systemctl poweroff";
};
"module/tray" = {
type = "internal/tray";
tray-foreground = fg;
tray-spacing = 4;
tray-size = "90%";
tray-position = "right";
};
};
};
home.packages = [
polybarRun
pkgs.playerctl
pkgs.brightnessctl
pkgs.blueman
pkgs.bluez
pkgs.noto-fonts-cjk-sans
];
}

View file

@ -0,0 +1,180 @@
{
config,
...
}:
{
wayland.windowManager.sway = {
enable = true;
xwayland = true;
systemd.enable = true;
config = rec {
modifier = "Mod4"; # SUPER
terminal = "foot";
menu = "wofi --show drun";
# Per-output workspace mapping (user can extend via extraOptions)
# Example (left as defaults): users can add `output HDMI-A-1 workspace 1,3,5` in extraOptions
input = {
"type:keyboard" = {
xkb_layout = "us";
xkb_options = "caps:escape";
};
"type:touchpad" = {
natural_scroll = "enabled";
tap = "enabled";
dwt = "enabled";
};
# Disable focus follows mouse to avoid accidental focus changes
# In Sway this behavior is controlled by focus_follows_mouse
};
focus = {
followMouse = "no";
# onWindowActivation = "urgent"; # don't steal focus; mark urgent instead
};
gaps = {
inner = 2;
outer = 5;
smartGaps = false;
smartBorders = "on";
};
colors = {
focused = {
background = "#444444";
border = "#555555";
childBorder = "#444444";
indicator = "#595959";
text = "#f1f1f1";
};
unfocused = {
background = "#222222";
border = "#333333";
childBorder = "#222222";
indicator = "#292d2e";
text = "#888888";
};
};
window = {
border = 1;
titlebar = false;
commands = [
# Bitwarden chrome popup as floating example from Hyprland rules
{
criteria = {
app_id = "chrome-nngceckbapebfimnlniiiahkandclblb-Default";
};
command = "floating enable";
}
{
criteria = {
app_id = "pavucontrol";
};
command = "floating enable, move position center, resize set 620 1200";
}
{
criteria = {
class = "Google-chrome";
window_role = "pop-up";
};
command = "floating enable, move position center, resize set 720 480";
}
{
criteria = {
window_role = "pop-up";
};
command = "floating enable, move position center, resize set 640 420";
}
{
criteria = {
window_role = "About";
};
command = "floating enable, move position center, resize set 640 420";
}
];
};
# Keybindings mirroring Hyprland
keybindings = {
# Apps
"${modifier}+return" = "exec ${config.wayland.windowManager.sway.config.terminal}";
"${modifier}+space" = "exec pkill wofi || wofi --show drun";
"${modifier}+q" = "kill";
"${modifier}+shift+Escape" = "exit";
"${modifier}+shift+q" = "exec swaylock";
"${modifier}+f" = "floating toggle";
# Focus
"${modifier}+h" = "focus left";
"${modifier}+l" = "focus right";
"${modifier}+k" = "focus up";
"${modifier}+j" = "focus down";
# Workspaces (numbers and vim-like mirror)
"${modifier}+1" = "workspace number 1";
"${modifier}+n" = "workspace number 1";
"${modifier}+2" = "workspace number 2";
"${modifier}+m" = "workspace number 2";
"${modifier}+3" = "workspace number 3";
"${modifier}+comma" = "workspace number 3";
"${modifier}+4" = "workspace number 4";
"${modifier}+period" = "workspace number 4";
"${modifier}+5" = "workspace number 5";
"${modifier}+slash" = "workspace number 5";
"${modifier}+6" = "workspace number 6";
"${modifier}+7" = "workspace number 7";
"${modifier}+8" = "workspace number 8";
"${modifier}+9" = "workspace number 9";
"${modifier}+0" = "workspace number 10";
# Move windows
"${modifier}+shift+h" = "move left";
"${modifier}+shift+l" = "move right";
"${modifier}+shift+k" = "move up";
"${modifier}+shift+j" = "move down";
"${modifier}+shift+1" = "move container to workspace number 1";
"${modifier}+shift+n" = "move container to workspace number 1";
"${modifier}+shift+2" = "move container to workspace number 2";
"${modifier}+shift+m" = "move container to workspace number 2";
"${modifier}+shift+3" = "move container to workspace number 3";
"${modifier}+shift+comma" = "move container to workspace number 3";
"${modifier}+shift+4" = "move container to workspace number 4";
"${modifier}+shift+period" = "move container to workspace number 4";
"${modifier}+shift+5" = "move container to workspace number 5";
"${modifier}+shift+slash" = "move container to workspace number 5";
"${modifier}+shift+6" = "move container to workspace number 6";
"${modifier}+shift+7" = "move container to workspace number 7";
"${modifier}+shift+8" = "move container to workspace number 8";
"${modifier}+shift+9" = "move container to workspace number 9";
"${modifier}+shift+0" = "move container to workspace number 10";
"${modifier}+left" = "resize shrink width 10 px or 10 ppt";
"${modifier}+down" = "resize shrink height 10 px or 10 ppt";
"${modifier}+up" = "resize grow height 10 px or 10 ppt";
"${modifier}+right" = "resize grow width 10 px or 10 ppt";
# Mouse bindings (Mod + drag)
"${modifier}+button1" = "move";
"${modifier}+button3" = "resize";
# Screenshot
"Print" = "exec grim -g \"$(slurp)\" - | wl-copy";
};
bars = [ ]; # Use Waybar via Home Manager
startup = [
{
command = "exec sh -c 'sleep 0.01; swaymsg workspace number 7 ; sleep 0.01; swaymsg workspace number 1'";
}
# Waybar is managed by Home Manager systemd unit
# { command = "pgrep waybar >/dev/null || waybar"; }
];
};
};
}

View file

@ -0,0 +1,100 @@
{ ... }:
{
services.swaync = {
enable = true;
settings = {
ignore = [ "com.spotify.Client" ];
positionX = "right";
positionY = "top";
layer = "overlay";
control-center-layer = "top";
layer-shell = true;
cssPriority = "application";
control-center-margin-top = 0;
control-center-margin-bottom = 0;
control-center-margin-right = 0;
control-center-margin-left = 0;
notification-2fa-action = true;
notification-inline-replies = false;
notification-icon-size = 64;
notification-body-image-height = 100;
notification-body-image-width = 200;
timeout = 10;
timeout-low = 5;
timeout-critical = 0;
control-center-width = 500;
control-center-height = 600;
notification-window-width = 500;
keyboard-shortcuts = true;
image-visibility = "when-available";
transition-time = 200;
hide-on-clear = false;
hide-on-action = true;
script-fail-notify = true;
widgets = [
"inhibitors"
"title"
"dnd"
"volume"
"backlight"
"mpris"
"buttons-grid#quick"
"notifications"
];
widget-config = {
inhibitors = {
text = "Inhibitors";
button-text = "Clear All";
clear-all-button = true;
};
title = {
text = "Notifications";
clear-all-button = true;
button-text = "Clear All";
};
dnd.text = "Do Not Disturb";
mpris = {
image-size = 96;
image-radius = 12;
};
volume = {
label = "󰕾";
show-per-app = true;
};
backlight = {
label = "󰃟";
device = "intel_backlight";
};
# "buttons-grid#quick" = {
# columns = 4;
# icon-size = 20;
# actions = [
# { label = "󰐥"; tooltip = "Shutdown"; command = "confirm-action 'systemctl poweroff' 'Shutdown?'"; }
# { label = "󰜉"; tooltip = "Reboot"; command = "confirm-action 'systemctl reboot' 'Reboot?'"; }
# { label = "󰍃"; tooltip = "Logout"; command = "confirm-action 'swaymsg exit' 'Logout?'"; }
# ];
# };
};
};
style = ''
.control-center { background: #1a1b26; border: 2px solid #7dcae4; border-radius: 12px; }
.control-center-list { background: transparent; }
.control-center .notification-row:focus, .control-center .notification-row:hover { opacity: 1; background: #24283b; }
.notification { border-radius: 8px; margin: 6px 12px; box-shadow: 0 0 0 1px rgba(125,196,228,.3), 0 1px 3px 1px rgba(0,0,0,.7), 0 2px 6px 2px rgba(0,0,0,.3); padding: 0; }
.widget-title { margin: 8px; font-size: 1.5rem; color: #c0caf5; }
.widget-dnd { margin: 8px; font-size: 1.1rem; color: #c0caf5; }
.widget-dnd > switch { font-size: initial; border-radius: 8px; background: #414868; border: 1px solid #7dcae4; }
.widget-dnd > switch:checked { background: #7dcae4; }
.widget-mpris { color: #c0caf5; background: #24283b; padding: 8px; margin: 8px; border-radius: 8px; }
.widget-mpris-player { padding: 8px; margin: 8px; }
.widget-mpris-title { font-weight: bold; font-size: 1.25rem; }
.widget-mpris-subtitle { font-size: 1.1rem; color: #9ece6a; }
.widget-volume, .widget-backlight, .widget-menubar { background: #24283b; padding: 8px; margin: 8px; border-radius: 8px; color: #c0caf5; }
.widget-menubar .menu-item button { background: #1f2335; color: #c0caf5; border-radius: 8px; padding: 6px 10px; margin: 4px; border: 1px solid #2e3440; font-family: "JetBrainsMonoNL Nerd Font"; }
.widget-menubar .menu-item button:hover { background: #414868; border-color: #7dcae4; }
.topbar-buttons button { border: none; background: transparent; color: #c0caf5; font-size: 1.1rem; border-radius: 8px; margin: 0 4px; padding: 8px; }
.topbar-buttons button:hover { background: #414868; }
.topbar-buttons button:active { background: #7dcae4; color: #1a1b26; }
'';
};
}

View file

@ -0,0 +1,246 @@
{ ... }:
{
programs.waybar = {
enable = true;
systemd.enable = true;
settings = {
mainBar = {
layer = "top";
position = "top";
height = 28;
spacing = 6;
margin-top = 0;
margin-bottom = 0;
margin-left = 10;
margin-right = 10;
modules-left = [
"sway/workspaces"
];
modules-center = [
"clock"
"temperature"
"cpu"
"memory"
"disk"
];
modules-right = [
"battery"
"battery#bat2"
"pulseaudio"
"network"
"bluetooth"
"power-profiles-daemon"
"backlight"
"custom/notifications"
"sway/language"
"tray"
"custom/power"
];
"sway/workspaces" = {
format = "{icon}";
format-icons = {
"1" = "";
"2" = "";
"3" = "";
"4" = "";
"5" = "";
"6" = "";
"7" = "";
"8" = "";
"9" = "";
"10" = "";
"11" = "";
"12" = "";
"13" = "";
"14" = "";
"15" = "";
"16" = "";
"17" = "";
"18" = "";
"19" = "";
"20" = "";
};
disable-scroll = false;
};
# CENTER
clock = {
format = "{:%b %d, %H:%M}";
tooltip-format = "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>";
};
temperature = {
thermal-zone = 2;
hwmon-path = "/sys/class/hwmon/hwmon2/temp1_input";
critical-threshold = 80;
format-critical = "󰔏 {temperatureC}°C";
format = "󰔏 {temperatureC}°C";
};
cpu = {
format = "󰻠 {usage}%";
tooltip = true;
on-click = "btop";
};
memory = {
format = "󰍛 {}%";
on-click = "btop";
};
disk = {
interval = 30;
format = "󰋊 {percentage_used}%";
path = "/";
on-click = "btop";
};
# RIGHT
"battery" = {
"states" = {
# "good"= 95;
"warning" = 30;
"critical" = 15;
};
"format" = "{capacity}% {icon}";
"format-full" = "{capacity}% {icon}";
"format-charging" = "{capacity}% ";
"format-plugged" = "{capacity}% ";
"format-alt" = "{time} {icon}";
# "format-good"= ""; // An empty format will hide the module
# "format-full"= "";
"format-icons" = [
""
""
""
""
""
];
};
"battery#bat2" = {
"bat" = "BAT2";
};
pulseaudio = {
format = "{icon} {volume}%";
format-bluetooth = "󰂰 {volume}%";
format-bluetooth-muted = "󰂲 ";
format-muted = "󰖁 ";
format-source = "󰍬 {volume}%";
format-source-muted = "󰍭 ";
format-icons = {
headphone = "󰋋";
hands-free = "󰂑";
headset = "󰂑";
phone = "󰏲";
portable = "󰦧";
car = "󰄋";
default = [
"󰕿"
"󰖀"
"󰕾"
];
};
scroll-step = 5;
on-click = "pavucontrol";
on-click-right = "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle";
};
network = {
format-wifi = "󰤨 {essid} ({signalStrength}%)";
format-ethernet = "󰈀 {ipaddr}/{cidr}";
tooltip-format = "{ifname} via {gwaddr} ";
format-linked = "󰈀 {ifname} (No IP)";
format-disconnected = "󰖪 Disconnected";
# on-click = "wofi-wifi-menu";
# on-click-right = "nmcli radio wifi toggle";
};
bluetooth = {
format = "󰂯 {status}";
format-connected = "󰂱 {device_alias}";
format-connected-battery = "󰂱 {device_alias} {device_battery_percentage}%";
tooltip-format = "{controller_alias}\t{controller_address}\n\n{num_connections} connected";
tooltip-format-connected = "{controller_alias}\t{controller_address}\n\n{num_connections} connected\n\n{device_enumerate}";
tooltip-format-enumerate-connected = "{device_alias}\t{device_address}";
tooltip-format-enumerate-connected-battery = "{device_alias}\t{device_address}\t{device_battery_percentage}%";
# on-click = "wofi-bluetooth-menu";
# on-click-right = "bluetoothctl power toggle";
};
"power-profiles-daemon" = {
format = "{icon}";
"tooltip-format" = "Power profile: {profile}\nDriver: {driver}";
tooltip = true;
"format-icons" = {
default = "";
performance = "";
balanced = "";
"power-saver" = "";
};
};
backlight = {
format = "{percent}% {icon}";
"format-icons" = [
""
""
""
""
""
""
""
""
""
];
};
"custom/notifications" = {
format = "{icon} {}";
format-icons = {
notification = "";
none = "";
dnd-notification = "󰂛";
dnd-none = "󰂛";
inhibited-notification = "";
inhibited-none = "";
dnd-inhibited-notification = "󰂛";
dnd-inhibited-none = "󰂛";
};
return-type = "json";
exec-if = "which swaync-client";
exec = "swaync-client -swb";
on-click = "swaync-client -t -sw";
on-click-right = "swaync-client -d -sw";
escape = true;
tooltip = false;
};
"sway/language" = {
format = "{}";
};
"tray" = {
"spacing" = 10;
};
"custom/power" = {
format = " ";
tooltip = false;
menu = "on-click";
"menu-file" = ./waybar/power_menu.xml;
"menu-actions" = {
shutdown = "shutdown 0";
reboot = "reboot";
logout = "loginctl terminate-session $(loginctl list-sessions | grep seat0 | awk '{print $1}')";
};
};
};
};
style = builtins.readFile ./waybar/waybar.css;
};
}

View file

@ -0,0 +1,47 @@
{ ... }:
{
programs.foot = {
enable = true;
# This renders to ~/.config/foot/foot.ini
settings = {
main = {
# Use the same font and size as your Kitty config
font = "JetBrainsMonoNL Nerd Font:size=12";
# Initial window size in character cells (Kitty used 160c x 55c)
"initial-window-size-chars" = "160x55";
};
colors = {
# Background opacity (1.0 = opaque)
alpha = "0.94";
# Foreground/background
foreground = "e0e0e0";
background = "262626";
# 16-color palette
# normal (07)
regular0 = "1f1f1f"; # black
regular1 = "f38ba8"; # red
regular2 = "a6e3a1"; # green
regular3 = "f9e2af"; # yellow
regular4 = "89b4fa"; # blue
regular5 = "cba6f7"; # magenta
regular6 = "89dceb"; # cyan
regular7 = "e0e0e0"; # white
# bright (815)
bright0 = "565656"; # bright black
bright1 = "f38ba8"; # bright red
bright2 = "a6e3a1"; # bright green
bright3 = "f9e2af"; # bright yellow
bright4 = "89b4fa"; # bright blue
bright5 = "cba6f7"; # bright magenta
bright6 = "89dceb"; # bright cyan
bright7 = "ffffff"; # bright white
};
};
};
}

View file

@ -0,0 +1,56 @@
{ ... }:
{
# Enable Kitty terminal
programs.kitty = {
enable = true;
settings = {
# Window settings
background_opacity = 0.9;
os_window_class = "kitty";
remember_window_size = false;
placement_strategy = "center";
initial_window_width = "160c";
initial_window_height = "55c";
# Remove window borders
hide_window_decorations = "titlebar-only";
tab_title_template = "none";
active_tab_title_template = "none";
draw_minimal_borders = "yes";
window_border_width = "0.1pt";
# Colors (Catppuccin Coal)
foreground = "#e0e0e0";
background = "#262626";
color0 = "#1f1f1f";
color1 = "#f38ba8";
color2 = "#a6e3a1";
color3 = "#f9e2af";
color4 = "#89b4fa";
color5 = "#cba6f7";
color6 = "#89dceb";
color7 = "#e0e0e0";
color8 = "#565656";
color9 = "#f38ba8";
color10 = "#a6e3a1";
color11 = "#f9e2af";
color12 = "#89b4fa";
color13 = "#cba6f7";
color14 = "#89dceb";
color15 = "#ffffff";
# Font settings
font_family = "JetBrainsMonoNL Nerd Font";
font_size = 12.0;
bold_font = "auto";
italic_font = "auto";
italic_bold_font = "auto";
};
# If you want to include extra configuration this way instead of through the main `settings` attribute
extraConfig = ''
# You can add additional config here if needed
'';
};
}

View file

@ -68,9 +68,4 @@
}
];
};
home.shellAliases = {
t = "tmux";
tat = "tmux attach-session";
};
}

View file

@ -0,0 +1,10 @@
{
...
}:
{
boot.loader.grub = {
enable = true;
device = "/dev/sda";
};
}

View file

@ -0,0 +1,15 @@
{
...
}:
{
boot.loader = {
systemd-boot = {
enable = true;
consoleMode = "keep";
};
timeout = 5;
efi = {
canTouchEfiVariables = true;
};
};
}

View file

@ -0,0 +1,42 @@
{
pkgs,
...
}:
{
# Caps Lock as Escape for console/tty and Wayland
console.useXkbConfig = true;
services.xserver.xkb = {
layout = "us";
options = "caps:escape";
};
xdg.portal = {
enable = true;
extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
config.common.default = [ "gtk" ];
};
services.xserver = {
enable = true;
windowManager.i3 = {
enable = true;
extraPackages = with pkgs; [
dmenu
maim
xclip
];
};
displayManager = {
lightdm.enable = true;
};
};
services.displayManager.defaultSession = "none+i3";
hardware.graphics.enable = true;
security.rtkit.enable = true;
# Applets/services for tray widgets
programs.nm-applet.enable = true;
services.blueman.enable = true;
services.upower.enable = true;
}

View file

@ -0,0 +1,116 @@
{
config,
lib,
pkgs,
...
}:
{
# Caps Lock as Escape for console/tty and Wayland
console.useXkbConfig = true;
services.xserver.xkb = {
layout = "us";
options = "caps:escape";
};
xdg.portal = {
enable = true;
extraPortals = lib.mkForce [
pkgs.xdg-desktop-portal-wlr
pkgs.xdg-desktop-portal-gtk
];
config.common.default = [
"wlr"
"gtk"
];
};
services.greetd = {
enable = true;
vt = 2;
settings = {
default_session = {
command = "${pkgs.greetd.tuigreet}/bin/tuigreet --time --remember --remember-session --cmd '${pkgs.dbus}/bin/dbus-run-session ${pkgs.sway}/bin/sway'";
user = "greeter";
};
};
};
# Core packages and tools
environment.systemPackages = with pkgs; [
wl-clipboard
wl-clip-persist
wofi # application launcher
nemo # file manager (x11)
feh # image viewer (x11)
networkmanager
upower
brightnessctl
wireplumber
libgtop
bluez
power-profiles-daemon
grim
slurp
wf-recorder
btop
pavucontrol
];
services.blueman.enable = config.hardware.bluetooth.enable;
programs.sway = {
enable = true;
wrapperFeatures.gtk = true; # include GTK integration env
extraPackages = with pkgs; [
xwayland # allow legacy X11 apps
];
};
# Enable PipeWire + WirePlumber so xdg-desktop-portal can do screencast
services.pipewire = {
enable = true;
# Enable WirePlumber session manager via the pipewire module option
wireplumber = {
enable = true;
};
};
# Ensure graphics/OpenGL are enabled so Sway uses GPU-backed rendering
hardware.graphics = {
enable = true;
# extraPackages can be used to force vendor-specific mesa/drivers if needed
# Keep defaults; Sway runs fine with mesa in system
# extraPackages = with pkgs; [];
};
# Environment variables
environment.sessionVariables = lib.mkMerge [
{
GTK_THEME = "Adwaita:dark";
XDG_SESSION_TYPE = "wayland";
XDG_CURRENT_DESKTOP = "sway";
XDG_SESSION_DESKTOP = "sway";
# prefer EGL renderer (can be changed back to "auto" if needed)
WLR_RENDERER = "egl";
# Tell apps to run native wayland
NIXOS_OZONE_WL = "1";
ELECTRON_OZONE_PLATFORM_HINT = "wayland";
ELECTRON_ENABLE_WAYLAND = "1";
ELECTRON_DISABLE_SANDBOX = "0";
GDK_BACKEND = "wayland,x11"; # GTK
QT_QPA_PLATFORM = "wayland;xcb"; # Qt 5/6
MOZ_ENABLE_WAYLAND = "1"; # Firefox
SDL_VIDEODRIVER = "wayland"; # SDL apps/games
CLUTTER_BACKEND = "wayland";
}
];
# Qt theming
qt = {
enable = true;
platformTheme = "gtk2";
style = "adwaita-dark";
};
}

View file

@ -0,0 +1,17 @@
{
config,
...
}:
{
virtualisation.docker = {
enable = true;
autoPrune.enable = true;
};
users.extraGroups.docker.members = builtins.attrNames config.users.users;
environment.shellAliases = {
dockerv = "docker volume";
dockeri = "docker image";
dockerc = "docker container";
};
}

View file

@ -0,0 +1,57 @@
{
lib,
pkgs,
...
}:
with lib;
{
environment.systemPackages = with pkgs; [
# Essentials
vim
nano
wget
curl
traceroute
dig
fastfetch
jq
bat
htop
unzip
fzf
ripgrep
lsof
killall
speedtest-cli
];
environment.shellAliases = {
n = "nvim";
nn = "nvim --headless '+SessionDelete' +qa > /dev/null 2>&1 && nvim";
bat = "bat --theme Coldark-Dark";
cat = "bat --pager=never -p";
# TODO this may not be needed now that I am using `nh` clean mode (see /hosts/_common/configuration.nix#programs.nh)
nix-boot-clean = "find '/boot/loader/entries' -type f ! -name 'windows.conf' | head -n -4 | xargs -I {} rm {}; nix store gc; nixos-rebuild boot; echo; df";
ndr = "nix-direnv-reload";
# general unix
date_compact = "date +'%Y%m%d'";
date_short = "date +'%Y-%m-%d'";
time_compact = "date +'%Y%m%d%H%M%'";
time_short = "date +'%Y-%m-%dT%H:%M:%S'";
ls = "ls --color -Gah";
ll = "ls --color -Galhtr";
lss = "du --max-depth=0 -h {.,}* 2>/dev/null | sort -hr";
psg = "ps aux | head -n 1 && ps aux | grep -v 'grep' | grep";
# ripgrep
rg = "rg --no-ignore";
rgf = "rg --files --glob '!/nix/store/**' 2>/dev/null | rg";
};
environment.shellInit = lib.concatStringsSep "\n\n" [
(builtins.readFile ./unix_utils.func.sh)
(builtins.readFile ./nixpkg.func.sh)
];
}

View file

@ -0,0 +1,13 @@
# nix
alias nixpkgs=nixpkg
nixpkg () {
if [ $# -eq 0 ]; then
echo "Error: No arguments provided. Please specify at least one package."
return 1
fi
cmd="nix shell"
for pkg in "$@"; do
cmd="$cmd \"nixpkgs#$pkg\""
done
eval $cmd
}

View file

@ -0,0 +1,65 @@
# Check if ~/.config/environment exists and source all files within it
if [ -d "$HOME/.config/environment" ]; then
for file in "$HOME/.config/environment/"*; do
if [ -r "$file" ]; then
if ! . "$file"; then
echo "Failed to source $file"
fi
fi
done
fi
htop_psg () {
htop -p $(psg $1 | awk '{r=r s $2;s=","} END{print r}')
}
htop_pid () {
htop -p $(ps -ef | awk -v proc=$1 '$3 == proc { cnt++;if (cnt == 1) { printf "%s",$2 } else { printf ",%s",$2 } }')
}
psg_kill() {
ps aux | grep -v "grep" | grep "${1}" | awk '{print $2}' | while read -r pid; do
if [ -n "${pid}" ]; then
echo "killing ${pid}"
kill -9 "${pid}" &> /dev/null
fi
done
}
psg_terminate() {
ps aux | grep -v "grep" | grep "${1}" | awk '{print $2}' | while read -r pid; do
if [ -n "${pid}" ]; then
echo "Terminating ${pid}"
kill -15 "${pid}" &> /dev/null
fi
done
}
psg_skill() {
ps aux | grep -v "grep" | grep "${1}" | awk '{print $2}' | while read -r pid; do
if [ -n "${pid}" ]; then
echo "Killing ${pid}"
sudo kill -9 "${pid}" &> /dev/null
fi
done
}
mail_clear() {
: > /var/mail/$USER
}
speedtest_fs () {
dir=$(pwd)
drive=$(df -h ${dir} | awk 'NR==2 {print $1}')
echo Testing read speeds on drive ${drive}
sudo hdparm -Tt ${drive}
test_file=$(date +%u%m%d)
test_file="${dir}/speedtest_fs_${test_file}"
echo
echo Testing write speeds into test file: ${test_file}
dd if=/dev/zero of=${test_file} bs=8k count=10k; rm -f ${test_file}
}
speedtest_internet () {
speedtest-cli
}

View file

View file

@ -0,0 +1,153 @@
copy_ignored() {
local DRY_RUN=0
local USE_FZF=1
local -a PATTERNS=()
while [ $# -gt 0 ]; do
case "$1" in
--dry-run) DRY_RUN=1; shift ;;
--no-fzf) USE_FZF=0; shift ;;
-h|--help) copy_ignored_usage; return 0 ;;
--) shift; break ;;
*) PATTERNS+=("$1"); shift ;;
esac
done
copy_ignored_usage() {
cat <<EOF
Usage: copy_ignored [--dry-run] [--no-fzf] [pattern ...]
Interactively or non-interactively copy files/dirs into the current worktree
for files/dirs that exist in the main repository root but are git-ignored /
untracked.
EOF
}
# Determine the main repo root using git-common-dir (handles worktrees)
local common_dir repo_root
if ! common_dir=$(git rev-parse --git-common-dir 2>/dev/null); then
echo "Error: not in a git repository." >&2
return 2
fi
if [ "${common_dir#/}" = "$common_dir" ]; then
common_dir="$(pwd)/$common_dir"
fi
repo_root="${common_dir%%/.git*}"
if [ -z "$repo_root" ]; then
echo "Error: unable to determine repository root." >&2
return 2
fi
local -a candidates=()
while IFS= read -r -d '' file; do
candidates+=("$file")
done < <(git -C "$repo_root" ls-files --others --ignored --exclude-standard -z || true)
if [ ${#candidates[@]} -eq 0 ]; then
echo "No untracked/ignored files found in $repo_root"
return 0
fi
local -a tops=()
for c in "${candidates[@]}"; do
c="${c%/}"
local top="${c%%/*}"
[ -z "$top" ] && continue
local found=0
for existing in "${tops[@]}"; do
[ "$existing" = "$top" ] && found=1 && break
done
[ "$found" -eq 0 ] && tops+=("$top")
done
if [ ${#tops[@]} -eq 0 ]; then
echo "No top-level ignored/untracked entries found in $repo_root"
return 0
fi
local -a filtered
if [ ${#PATTERNS[@]} -gt 0 ]; then
for t in "${tops[@]}"; do
for p in "${PATTERNS[@]}"; do
if [[ "$t" == *"$p"* ]]; then
filtered+=("$t")
break
fi
done
done
else
filtered=("${tops[@]}")
fi
if [ ${#filtered[@]} -eq 0 ]; then
echo "No candidates match the provided patterns." >&2
return 0
fi
local -a chosen
if command -v fzf >/dev/null 2>&1 && [ "$USE_FZF" -eq 1 ]; then
local selected
selected=$(printf "%s\n" "${filtered[@]}" | fzf --multi --height=40% --border --prompt="Select files to copy: " --preview "if [ -f '$repo_root'/{} ]; then bat --color always --paging=never --style=plain '$repo_root'/{}; else ls -la '$repo_root'/{}; fi")
if [ -z "$selected" ]; then
echo "No files selected." && return 0
fi
chosen=()
while IFS= read -r line; do
chosen+=("$line")
done <<EOF
$selected
EOF
else
chosen=("${filtered[@]}")
fi
local worktree_root
worktree_root=$(pwd)
echo "Repository root: $repo_root"
echo "Worktree root : $worktree_root"
local -a created=()
local -a skipped=()
local -a errors=()
for rel in "${chosen[@]}"; do
rel=${rel%%$'\n'}
local src="${repo_root}/${rel}"
local dst="${worktree_root}/${rel}"
if [ ! -e "$src" ]; then
errors+=("$rel (source missing)")
continue
fi
if [ -e "$dst" ]; then
echo "Skipping $rel (destination exists)"
skipped+=("$rel")
continue
fi
mkdir -p "$(dirname "$dst")"
if [ "$DRY_RUN" -eq 1 ]; then
if [ -d "$src" ]; then
echo "DRY RUN: cp -r '$src' '$dst'"
else
echo "DRY RUN: cp '$src' '$dst'"
fi
else
local copy_result=0
if [ -d "$src" ]; then
if cp -r "$src" "$dst"; then
copy_result=0
else
copy_result=1
fi
else
if cp "$src" "$dst"; then
copy_result=0
else
copy_result=1
fi
fi
if [ "$copy_result" -eq 0 ]; then
echo "Copied: $rel"
created+=("$rel")
else
echo "Failed to copy: $rel" >&2
errors+=("$rel (copy failed)")
fi
fi
done
echo
echo "Summary:"
echo " Copied: ${#created[@]}"
[ ${#created[@]} -gt 0 ] && printf ' %s\n' "${created[@]}"
echo " Skipped: ${#skipped[@]}"
[ ${#skipped[@]} -gt 0 ] && printf ' %s\n' "${skipped[@]}"
echo " Errors: ${#errors[@]}"
[ ${#errors[@]} -gt 0 ] && printf ' %s\n' "${errors[@]}"
return 0
}

View file

@ -0,0 +1,34 @@
{
lib,
pkgs,
...
}:
with lib;
{
environment.systemPackages = with pkgs; [
git
];
environment.shellAliases = {
# git
status = "git status";
diff = "git diff";
branches = "git branch -a";
gcam = "git commit -a -m";
gcm = "git commit -m";
stashes = "git stash list";
bd = "branch default";
li = "link_ignored";
ci = "copy_ignored";
bx = "branchdel";
b = "branch";
};
environment.shellInit = lib.concatStringsSep "\n\n" [
(builtins.readFile ./utils.func.sh)
(builtins.readFile ./branch.func.sh)
(builtins.readFile ./branchd.func.sh)
(builtins.readFile ./link_ignored.func.sh)
(builtins.readFile ./copy_ignored.func.sh)
];
}

View file

@ -1,70 +1,3 @@
# Check if ~/.config/environment exists and source all files within it
if [ -d "$HOME/.config/environment" ]; then
for file in "$HOME/.config/environment/"*; do
if [ -r "$file" ]; then
if ! . "$file"; then
echo "Failed to source $file"
fi
fi
done
fi
# Basics
htop_psg () {
htop -p $(psg $1 | awk '{r=r s $2;s=","} END{print r}')
}
htop_pid () {
htop -p $(ps -ef | awk -v proc=$1 '$3 == proc { cnt++;if (cnt == 1) { printf "%s",$2 } else { printf ",%s",$2 } }')
}
psg_kill() {
ps aux | grep -v "grep" | grep "${1}" | awk '{print $2}' | while read -r pid; do
if [ -n "${pid}" ]; then
echo "killing ${pid}"
kill -9 "${pid}" &> /dev/null
fi
done
}
psg_terminate() {
ps aux | grep -v "grep" | grep "${1}" | awk '{print $2}' | while read -r pid; do
if [ -n "${pid}" ]; then
echo "Terminating ${pid}"
kill -15 "${pid}" &> /dev/null
fi
done
}
psg_skill() {
ps aux | grep -v "grep" | grep "${1}" | awk '{print $2}' | while read -r pid; do
if [ -n "${pid}" ]; then
echo "Killing ${pid}"
sudo kill -9 "${pid}" &> /dev/null
fi
done
}
mail_clear() {
: > /var/mail/$USER
}
speedtest_fs () {
dir=$(pwd)
drive=$(df -h ${dir} | awk 'NR==2 {print $1}')
echo Testing read speeds on drive ${drive}
sudo hdparm -Tt ${drive}
test_file=$(date +%u%m%d)
test_file="${dir}/speedtest_fs_${test_file}"
echo
echo Testing write speeds into test file: ${test_file}
dd if=/dev/zero of=${test_file} bs=8k count=10k; rm -f ${test_file}
}
speedtest_internet () {
speedtest-cli
}
# git
getdefault () {
git remote show origin | grep "HEAD branch" | sed 's/.*: //'
@ -145,7 +78,7 @@ stash() {
read -e -p "Stash label [default: $default_label]: " label
fi
label=${label:-$default_label}
git stash push -m "$label"
git stash push -u -k -m "$label"
}
pop() {
@ -172,20 +105,6 @@ delstash() {
git stash drop "$stash_ref"
}
# nix
alias nixpkgs=nixpkg
nixpkg () {
if [ $# -eq 0 ]; then
echo "Error: No arguments provided. Please specify at least one package."
return 1
fi
cmd="nix shell"
for pkg in "$@"; do
cmd="$cmd \"nixpkgs#$pkg\""
done
eval $cmd
}
# Marks some files as in "git" but they won't actually get pushed up to the git repo
# Usefull for `gintent .envrc flake.lock flake.nix` to add nix items required by flakes in a git repo that won't want flakes added
gintent() {
@ -212,9 +131,3 @@ gintent_undo() {
done
}
alias gintentnix_undo="gintent_undo .envrc flake.lock flake.nix"
# Aider
aider () {
http_proxy="" all_proxy="" https_proxy="" AZURE_API_BASE=http://100.64.0.8 AZURE_API_VERSION=2025-01-01-preview AZURE_API_KEY=1 nix run "nixpkgs#aider-chat-full" -- aider --dark-mode --no-gitignore --no-check-update --no-auto-commits --model azure/gpt-4.1-2025-04-14 $@
}

View file

@ -0,0 +1,88 @@
{
config,
lib,
pkgs,
...
}:
{
environment.systemPackages = with pkgs; [
openssh
autossh
];
# name this computer
networking = {
# hostName = top_cfg.systemName;
nftables.enable = true;
# Clears firewall rules on reboot, only ones set in config will be remade
nftables.flushRuleset = true;
firewall.enable = true;
};
# TODO invesitgate onensnitch usage and rules I may want. It is cumbersome with flushRuleset above...
# services.opensnitch = {
# enable = true;
# settings = {
# Firewall = if config.networking.nftables.enable then "nftables" else "iptables";
# InterceptUknown = true;
# ProcMonitorMethod = "ebpf";
# DefaultAction = "deny";
# };
# rules = {
#
# };
# };
# Use fail2ban
services.fail2ban = {
enable = true;
# Ignore my tailnet
ignoreIP = [
"100.64.0.0/10"
];
};
# Open ports in the firewall if enabled.
networking.firewall.allowedTCPPorts = [
22 # sshd
];
# Enable the OpenSSH daemon.
services.openssh = {
enable = true;
settings = {
LogLevel = "VERBOSE";
# TODO revisit allowing root login
PermitRootLogin = "yes";
PasswordAuthentication = false;
};
};
# Ensure SSH key pair generation for non-root users
systemd.services = lib.mapAttrs' (name: _: {
name = "generate_ssh_key_${name}";
value = {
description = "Generate SSH key pair for ${name}";
wantedBy = [ "multi-user.target" ];
serviceConfig = {
User = name;
Type = "oneshot";
};
script = ''
#!/run/current-system/sw/bin/bash
if [ ! -f /home/${name}/.ssh/id_ed25519 ]; then
if [ -v DRY_RUN ]; then
echo "DRY_RUN is set. Would generate SSH key for ${name}.";
else
echo "Generating SSH key for ${name}.";
mkdir -p /home/${name}/.ssh;
chmod 700 /home/${name}/.ssh;
/run/current-system/sw/bin/ssh-keygen -t ed25519 -f /home/${name}/.ssh/id_ed25519 -N "";
fi
else
echo "SSH key already exists for ${name}.";
fi
'';
};
}) (lib.filterAttrs (n: u: u.isNormalUser or false) config.users.users);
}

View file

@ -0,0 +1,33 @@
{
pkgs,
...
}:
let
hasNewJetbrainsMono =
if builtins.hasAttr "nerd-fonts" pkgs then
builtins.hasAttr "jetbrains-mono" pkgs."nerd-fonts"
else
false;
jetbrainsMonoFont =
if hasNewJetbrainsMono then
pkgs.nerd-fonts.jetbrains-mono
else
(pkgs.nerdfonts.override { fonts = [ "JetBrainsMono" ]; });
in
{
config = {
fonts.fontconfig.enable = true;
fonts.packages = [
jetbrainsMonoFont
]
# TODO verify if these are needed/working
# ++ (with pkgs; [
# ipafont
# kochi-substitute
# noto-fonts-cjk-sans # Or another CJK font
# ])
;
};
}

View file

@ -0,0 +1,62 @@
{
config,
lib,
...
}:
{
# Enable flakes
nix.settings.experimental-features = [
"nix-command"
"flakes"
];
# Allow unfree if set in config
nixpkgs.config.allowUnfreePredicate = lib.mkIf config.nixpkgs.config.allowUnfree (pkg: true);
environment.variables = lib.mkIf config.nixpkgs.config.allowUnfree {
NIXPKGS_ALLOW_UNFREE = "1";
};
nix.settings = {
max-jobs = "auto";
# Fallback quickly if substituters are not available.
connect-timeout = 5;
download-attempts = 3;
download-buffer-size = 524288000; # default is 67108864, this increases to ~500MB
# The default at 10 is rarely enough.
log-lines = 50;
# Avoid disk full issues
max-free = (3000 * 1024 * 1024);
min-free = (1000 * 1024 * 1024);
# Avoid copying unnecessary stuff over SSH
builders-use-substitutes = true;
auto-optimise-store = true;
trusted-users = [
"root"
"@wheel"
];
substituters = [
"https://cache.nixos.org/"
"https://nix-community.cachix.org"
];
trusted-substituters = config.nix.settings.substituters;
trusted-public-keys = [
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
];
};
nix.extraOptions = ''
keep-outputs = true
keep-derivations = true
${lib.optionalString (
# TODO revisit this should it move?
config ? age && config.age ? secrets && config.age.secrets ? github_read_token
) "!include ${config.age.secrets.github_read_token.path}"}
'';
# nix helper
programs.nh = {
enable = true;
# clean.enable = true; # TODO revist does this solve my re-building issues?
clean.extraArgs = "--keep 10";
};
}

View file

@ -0,0 +1,11 @@
{ ... }:
{
# Turn off sleep
systemd.sleep.extraConfig = ''
[Sleep]
AllowSuspend=no
AllowHibernation=no
AllowSuspendThenHibernate=no
AllowHybridSleep=no
'';
}

View file

@ -0,0 +1,11 @@
{
config,
...
}:
{
virtualisation.podman = {
enable = true;
autoPrune.enable = true;
};
users.extraGroups.docker.members = builtins.attrNames config.users.users;
}

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