some refactoring

This commit is contained in:
2025-07-18 17:17:35 +02:00
parent 05e7a7d1ca
commit 15793a2c42
19 changed files with 172 additions and 199 deletions

View File

@@ -33,6 +33,7 @@ in {
imports = [
./hardware-configuration.nix
./modules.nix
./options.nix
];
networking.hostName = "bunk";
@@ -46,12 +47,6 @@ in {
environment.variables.NH_FLAKE = "/home/cnst/.nix-config";
programs.hyprland.settings = {
monitor = [
"eDP-1,1920x1200@60,0x0,1,transform,0"
];
};
# https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion
system.stateVersion = lib.mkDefault "23.11";
}

View File

@@ -14,17 +14,15 @@
transform = 0;
bitDepth = 10;
workspace = "1";
primary = true;
}
{
name = "DP-4";
name = "HDMI-A-1";
width = 1920;
height = 1080;
refreshRate = 60;
position = "2560x0";
transform = 3;
# transform = 3;
workspace = "5";
primary = false;
}
{
name = "eDP-1";
@@ -32,7 +30,6 @@
height = 1200;
refreshRate = 60;
workspace = "1";
primary = false;
}
];
theme = {

View File

@@ -33,6 +33,7 @@ in {
imports = [
./hardware-configuration.nix
./modules.nix
./options.nix
];
time.hardwareClockInLocalTime = true;
@@ -44,12 +45,12 @@ in {
GEMINI_API_KEY = config.age.secrets.gcapi.path;
};
programs.hyprland.settings = {
monitor = [
"DP-3,2560x1440@240,0x0,1,transform,0,bitdepth,10"
"DP-4,1920x1080@60,auto,1,transform,3"
];
};
# programs.hyprland.settings = {
# monitor = [
# "DP-3,2560x1440@240,0x0,1,transform,0,bitdepth,10"
# "DP-4,1920x1080@60,auto,1,transform,3"
# ];
# };
# # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion
system.stateVersion = lib.mkDefault "23.11";

View File

@@ -14,17 +14,15 @@
transform = 0;
bitDepth = 10;
workspace = "1";
primary = true;
}
{
name = "DP-4";
name = "HDMI-A-1";
width = 1920;
height = 1080;
refreshRate = 60;
position = "2560x0";
transform = 3;
# transform = 3;
workspace = "5";
primary = false;
}
{
name = "eDP-1";
@@ -32,7 +30,6 @@
height = 1200;
refreshRate = 60;
workspace = "1";
primary = false;
}
];
theme = {

View File

@@ -35,6 +35,7 @@ in {
imports = [
./hardware-configuration.nix
./modules.nix
./options.nix
./server.nix
];

View File

@@ -0,0 +1,7 @@
{
accounts = {
username = "cnst";
mail = "adam@cnst.dev";
sshUser = "sobotka";
};
}

View File

@@ -33,6 +33,7 @@ in {
imports = [
./hardware-configuration.nix
./modules.nix
./options.nix
];
networking.hostName = "toothpc";

22
hosts/toothpc/options.nix Normal file
View File

@@ -0,0 +1,22 @@
{
accounts = {
username = "toothpick";
mail = "place@holder";
sshUser = "toothpc";
};
monitors = [
{
name = "DVI-D-1";
width = 1920;
height = 1080;
refreshRate = 144;
workspace = "1";
}
];
theme = {
background = {
lockscreen = "wallpaper_2";
desktop = "wallpaper_1";
};
};
}

View File

@@ -39,8 +39,8 @@ in {
nixconfig = "cd /home/$USER/.nix-config/";
homemodules = "$EDITOR /home/$USER/.nix-config/users/$USER/modules/{$hostname}mod.nix";
hmod = "$EDITOR /home/$USER/.nix-config/users/$USER/modules/{$hostname}mod.nix";
homeoptions = "$EDITOR /home/$USER/.nix-config/users/$USER/modules/{$hostname}opt.nix";
hopt = "$EDITOR /home/$USER/.nix-config/users/$USER/modules/{$hostname}opt.nix";
nixoptions = "$EDITOR /home/$USER/.nix-config/hosts/$hostname/options.nix";
nopt = "$EDITOR /home/$USER/.nix-config/hosts/$hostname/options.nix";
nixosmodules = "$EDITOR /home/$USER/.nix-config/hosts/$hostname/modules.nix";
nmod = "$EDITOR /home/$USER/.nix-config/hosts/$hostname/modules.nix";
tree = "${getExe eza} --tree --icons=always";

View File

@@ -2,6 +2,7 @@
config,
pkgs,
lib,
osConfig,
...
}: let
inherit (lib) mkIf mkEnableOption;
@@ -14,8 +15,8 @@ in {
home.packages = [pkgs.gh];
programs.git = {
enable = true;
userName = config.accounts.username;
userEmail = config.accounts.mail;
userName = osConfig.accounts.username;
userEmail = osConfig.accounts.mail;
delta = {
enable = true;
options.dark = true;
@@ -53,7 +54,7 @@ in {
];
};
xdg.configFile."git/allowed_signers".text = ''
${config.accounts.mail} namespaces="git" ${config.accounts.sshKey}
${osConfig.accounts.mail} namespaces="git" ${osConfig.accounts.sshKey}
'';
};
}

View File

@@ -3,6 +3,7 @@
pkgs,
config,
lib,
osConfig,
...
}: let
inherit (lib) mkIf mkEnableOption;
@@ -30,7 +31,7 @@ in {
background = [
{
monitor = "";
path = config.theme.background.lockscreen;
path = osConfig.theme.background.lockscreen;
}
];
input-field = [

View File

@@ -3,6 +3,7 @@
lib,
pkgs,
inputs,
osConfig,
...
}: let
inherit (lib) mkIf mkEnableOption;
@@ -41,13 +42,13 @@ in {
];
wallpaper = [
# cnixtop
"DP-3,${config.theme.background.desktop}"
"DP-4,${config.theme.background.desktop}"
# cnixpad
"eDP-1,${config.theme.background.desktop}"
# kima
"DP-3,${osConfig.theme.background.desktop}"
"HDMI-A-1,${osConfig.theme.background.lockscreen}"
# bunk
"eDP-1,${osConfig.theme.background.desktop}"
# toothpc
"DVI-D-1,${config.theme.background.desktop}"
"DVI-D-1,${osConfig.theme.background.desktop}"
];
};
};

View File

@@ -13,7 +13,7 @@ in {
./appearance.nix
./inputs.nix
./keybinds.nix
./rules.nix
./layout.nix
./startup.nix
];

View File

@@ -0,0 +1,112 @@
{
lib,
config,
...
}: let
inherit (lib) mkIf mkEnableOption mkMerge;
host = config.networking.hostName;
cfg = config.nixos.programs.hyprland.rules;
in {
options = {
nixos.programs.hyprland.rules.enable = mkEnableOption "Enables window rule settings in Hyprland";
};
config = mkIf cfg.enable {
programs.hyprland.settings = {
monitor =
map (
m: let
resolution =
if m.width != null && m.height != null
then "${toString m.width}x${toString m.height}@${toString m.refreshRate}"
else "preferred";
position = m.position or "auto";
scale = m.scale;
transformStr =
if m.transform != 0
then ",transform,${toString m.transform}"
else "";
bitdepthStr =
if m.bitDepth != null
then ",bitdepth,${toString m.bitDepth}"
else "";
in "${m.name},${
if m.enabled
then "${resolution},${position},${scale}${transformStr}${bitdepthStr}"
else "disable"
}"
)
config.monitors;
workspace = map (
m: "${m.workspace},monitor:${m.name}"
) (lib.filter (m: m.enabled && m.workspace != null) config.monitors);
windowrule = [
"size 843 650, initialTitle:^(floatcal)$"
"move 100%-w-20 40, initialTitle:^(floatcal)$"
"float, initialTitle:^(floatcal)$"
"size 600 300, title:^(tuirun)$"
"center, title:^(tuirun)$"
"noborder, title:^(tuirun)$"
"float, title:^(tuirun)$"
"size 843 530, class:^(org.keepassxc.KeePassXC)$"
"move 100%-w-20 40, class:^(org.keepassxc.KeePassXC)$"
"float, class:^(org.keepassxc.KeePassXC)$"
"size 50% 70%, class:^(net.nokyan.Resources)$"
"center, class:^(net.nokyan.Resources)$"
"float, class:^(net.nokyan.Resources)$"
"suppressevent maximize, class:.*"
"center, class:^(nwg-look)$"
"float, class:^(nwg-look)$"
"center, class:^(oculante)$"
"float, class:^(oculante)$"
"move 100%-w-20 40, class:^(pavucontrol)$"
"size 741 585, class:^(pavucontrol)$"
"float, class:^(pavucontrol)$"
"center, class:^(xarchiver)$"
"float, class:^(xarchiver)$"
"float, class:^(org.gnome.FileRoller)$"
"float, class:^(org.freedesktop.impl.portal.desktop.kde)$"
"float, class:^(org.corectrl.CoreCtrl)$"
"float, class:^(feh)$"
"float, class:^(polkit-gnome-authentication-agent-1)$"
"float, class:^(org.gnome.Calculator)$"
"float, class:^(com.github.hluk.copyq)$"
"float, class:^(blueman-manager)$"
# "workspace 5 silent, class:^(discord)$"
# "workspace 5 silent, class:^(vesktop)$"
"workspace 4 silent, class:^(steam_app_0)$"
"workspace 4 silent, title:^(World of Warcraft)$"
];
layerrule = [
"animation fade,hyprpicker"
"animation fade,selection"
"animation fade,waybar"
"ignorezero,waybar"
"ignorealpha 0.0,waybar"
"blur,waybar"
"blur,notifications"
"ignorezero,notifications"
"noanim,wallpaper"
"noanim,launcher"
];
};
};
}

View File

@@ -1,102 +0,0 @@
{
lib,
config,
...
}: let
inherit (lib) mkIf mkEnableOption mkMerge;
host = config.networking.hostName;
cfg = config.nixos.programs.hyprland.rules;
in {
options = {
nixos.programs.hyprland.rules.enable = mkEnableOption "Enables window rule settings in Hyprland";
};
config = mkIf cfg.enable (mkMerge [
{
programs.hyprland.settings = {
windowrule = [
"size 843 650, initialTitle:^(floatcal)$"
"move 100%-w-20 40, initialTitle:^(floatcal)$"
"float, initialTitle:^(floatcal)$"
"size 600 300, title:^(tuirun)$"
"center, title:^(tuirun)$"
"noborder, title:^(tuirun)$"
"float, title:^(tuirun)$"
"size 843 530, class:^(org.keepassxc.KeePassXC)$"
"move 100%-w-20 40, class:^(org.keepassxc.KeePassXC)$"
"float, class:^(org.keepassxc.KeePassXC)$"
"size 50% 70%, class:^(net.nokyan.Resources)$"
"center, class:^(net.nokyan.Resources)$"
"float, class:^(net.nokyan.Resources)$"
"suppressevent maximize, class:.*"
"center, class:^(nwg-look)$"
"float, class:^(nwg-look)$"
"center, class:^(oculante)$"
"float, class:^(oculante)$"
"move 100%-w-20 40, class:^(pavucontrol)$"
"size 741 585, class:^(pavucontrol)$"
"float, class:^(pavucontrol)$"
"center, class:^(xarchiver)$"
"float, class:^(xarchiver)$"
"float, class:^(org.gnome.FileRoller)$"
"float, class:^(org.freedesktop.impl.portal.desktop.kde)$"
"float, class:^(org.corectrl.CoreCtrl)$"
"float, class:^(feh)$"
"float, class:^(polkit-gnome-authentication-agent-1)$"
"float, class:^(org.gnome.Calculator)$"
"float, class:^(com.github.hluk.copyq)$"
"float, class:^(blueman-manager)$"
# "workspace 5 silent, class:^(discord)$"
# "workspace 5 silent, class:^(vesktop)$"
"workspace 4 silent, class:^(steam_app_0)$"
"workspace 4 silent, title:^(World of Warcraft)$"
];
layerrule = [
"animation fade,hyprpicker"
"animation fade,selection"
"animation fade,waybar"
"ignorezero,waybar"
"ignorealpha 0.0,waybar"
"blur,waybar"
"blur,notifications"
"ignorezero,notifications"
"noanim,wallpaper"
"noanim,launcher"
];
};
}
(mkIf (host == "kima") {
programs.hyprland.settings.workspace = [
"name:1,monitor:DP-3"
"name:2,monitor:DP-3"
"name:3,monitor:DP-3"
"name:4,monitor:DP-3"
"name:5,monitor:DP-3"
"name:6,monitor:DP-3"
"name:7,monitor:DP-3"
"name:8,monitor:DP-3"
"name:9,monitor:DP-3"
"name:10,monitor:DP-3"
];
})
(mkIf (host == "bunk") {
programs.hyprland.settings.workspace = [];
})
(mkIf (host == "toothpc") {
programs.hyprland.settings.workspace = [];
})
]);
}

View File

@@ -14,10 +14,6 @@ in {
type = types.str;
example = "DP-1";
};
primary = mkOption {
type = types.bool;
default = false;
};
width = mkOption {
type = types.int;
example = 1920;
@@ -60,14 +56,4 @@ in {
);
default = [];
};
config = {
assertions = [
{
assertion =
((lib.length config.monitors) != 0)
-> ((lib.length (lib.filter (m: m.primary) config.monitors)) == 1);
message = "Exactly one monitor must be set to primary.";
}
];
};
}

View File

@@ -3,16 +3,13 @@
if osConfig.networking.hostName == "sobotka"
then [
./sobotkamod.nix
./sobotkaopt.nix
]
else if osConfig.networking.hostName == "bunk"
then [
./bunkmod.nix
./bunkopt.nix
]
else [
./kimamod.nix
./kimaopt.nix
];
in {
imports = hostSpecificImports;

View File

@@ -1,44 +0,0 @@
{
accounts = {
username = "cnst";
mail = "adam@cnst.dev";
sshUser = "sobotka";
};
monitors = [
{
name = "DP-3";
width = 2560;
height = 1440;
refreshRate = 240;
position = "0x0";
transform = 0;
bitDepth = 10;
workspace = "1";
primary = true;
}
{
name = "DP-4";
width = 1920;
height = 1080;
refreshRate = 60;
position = "2560x0";
transform = 3;
workspace = "5";
primary = false;
}
{
name = "eDP-1";
width = 1920;
height = 1200;
refreshRate = 60;
workspace = "1";
primary = false;
}
];
theme = {
background = {
lockscreen = "wallpaper_2";
desktop = "wallpaper_1";
};
};
}

View File

@@ -9,7 +9,7 @@
"${self}/scripts"
inputs.nvf.homeManagerModules.default
self.nixosModules.home
self.nixosModules.options
# self.nixosModules.options
];
homeImports = {