nixfmt all

This commit is contained in:
Noa Aarts 2024-11-07 20:48:01 +01:00
parent 980500842d
commit 42238dc24f
Signed by: noa
GPG key ID: 1850932741EFF672
20 changed files with 333 additions and 245 deletions

View file

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

View file

@ -1,4 +1,9 @@
{ lib, config, pkgs, ... }:
{
lib,
config,
pkgs,
...
}:
let
cfg = config.modules.apps.firefox;
in

View file

@ -1,4 +1,9 @@
{ lib, config, pkgs, ... }:
{
lib,
config,
pkgs,
...
}:
let
cfg = config.modules.apps.git;
in
@ -18,14 +23,15 @@ in
do_sign = lib.mkEnableOption "enable commit signing";
};
config = lib.mkIf cfg.enable {
programs.git = {
enable = true;
userName = cfg.name;
userEmail = cfg.email;
extraConfig = {
init = { defaultBranch = "main"; };
init = {
defaultBranch = "main";
};
safe.directory = "/etc/nixos";
pull.rebase = false;
commit.gpgsign = cfg.do_sign;

View file

@ -1,4 +1,9 @@
{ lib, config, pkgs, ... }:
{
lib,
config,
pkgs,
...
}:
let
cfg = config.modules.apps.thunderbird;
in
@ -7,10 +12,10 @@ in
enable = lib.mkEnableOption "enable thunderbird";
};
config = lib.mkIf cfg.enable {
accounts.email.accounts =
let gpg_key = "A16CDCBF1472541F";
let
gpg_key = "A16CDCBF1472541F";
in
{
"noa-voorwaarts" = {

View file

@ -1,4 +1,11 @@
{ lib, config, pkgs, inputs, nix-colors, ... }:
{
lib,
config,
pkgs,
inputs,
nix-colors,
...
}:
let
cfg = config.modules.automapaper;
in
@ -7,34 +14,33 @@ in
enable = lib.mkEnableOption "enable automapaper";
hyprland = lib.mkEnableOption "enable hyprland exec-once integration";
default-configuration = {
init = lib.mkOption
{
type = lib.types.str;
description = "the shader executed to get the state for the initialisation, and re-initialisation steps";
default = ''
#version 310 es
precision highp float;
init = lib.mkOption {
type = lib.types.str;
description = "the shader executed to get the state for the initialisation, and re-initialisation steps";
default = ''
#version 310 es
precision highp float;
uniform float time;
uniform vec2 resolution;
uniform float time;
uniform vec2 resolution;
out vec4 stateColor;
out vec4 stateColor;
float PHI = 1.61803398874989484820459; // Φ = Golden Ratio
float PHI = 1.61803398874989484820459; // Φ = Golden Ratio
float gold_noise(in vec2 xy, in float seed){
return fract(tan(distance(xy*PHI, xy)*seed)*xy.x);
}
float gold_noise(in vec2 xy, in float seed){
return fract(tan(distance(xy*PHI, xy)*seed)*xy.x);
}
void main( void ) {
void main( void ) {
vec2 position = gl_FragCoord.xy;
float color = gold_noise(position.xy, fract(time));
vec2 position = gl_FragCoord.xy;
float color = gold_noise(position.xy, fract(time));
stateColor = vec4(step(0.3, color), 0,0,step(0.3, color));
}'';
};
stateColor = vec4(step(0.3, color), 0,0,step(0.3, color));
}'';
};
state = lib.mkOption {
type = lib.types.str;
description = "the shader executed to increment the state to the next generation";
@ -136,52 +142,49 @@ in
};
};
config = lib.mkIf cfg.enable
{
wayland.windowManager.hyprland.settings.exec-once =
let
mkDisplayConfig = conf:
let
init = builtins.toFile "init.frag" conf.init;
state = builtins.toFile "state.frag" conf.state;
display = builtins.toFile "display.frag" conf.display;
in
''
[display]
name="${conf.name}"
horizontal=${builtins.toString conf.horizontal}
vertical=${builtins.toString conf.vertical}
tps=${builtins.toString conf.tps}
state_frag="${state}"
init_frag="${init}"
display_frag="${display}"
cycles=${builtins.toString conf.cycles}
frames_per_tick=${builtins.toString conf.frames_per_tick}
'';
confFile =
let
def = config.modules.automapaper.default-configuration;
in
conf: builtins.toFile "${conf.name}.toml" (mkDisplayConfig {
name = conf.name;
horizontal = builtins.div conf.horizontal def.horizontal;
vertical = builtins.div conf.vertical def.vertical;
tps = def.tps;
state = def.state;
init = def.init;
display = def.display;
cycles = def.cycles;
frames_per_tick = def.frames_per_tick;
});
in
lib.mkIf cfg.hyprland (
builtins.map
(
conf:
"${inputs.automapaper.packages.${pkgs.system}.default}/bin/automapaper -C ${confFile conf}"
)
config.modules.hyprland.displays
);
};
config = lib.mkIf cfg.enable {
wayland.windowManager.hyprland.settings.exec-once =
let
mkDisplayConfig =
conf:
let
init = builtins.toFile "init.frag" conf.init;
state = builtins.toFile "state.frag" conf.state;
display = builtins.toFile "display.frag" conf.display;
in
''
[display]
name="${conf.name}"
horizontal=${builtins.toString conf.horizontal}
vertical=${builtins.toString conf.vertical}
tps=${builtins.toString conf.tps}
state_frag="${state}"
init_frag="${init}"
display_frag="${display}"
cycles=${builtins.toString conf.cycles}
frames_per_tick=${builtins.toString conf.frames_per_tick}
'';
confFile =
let
def = config.modules.automapaper.default-configuration;
in
conf:
builtins.toFile "${conf.name}.toml" (mkDisplayConfig {
name = conf.name;
horizontal = builtins.div conf.horizontal def.horizontal;
vertical = builtins.div conf.vertical def.vertical;
tps = def.tps;
state = def.state;
init = def.init;
display = def.display;
cycles = def.cycles;
frames_per_tick = def.frames_per_tick;
});
in
lib.mkIf cfg.hyprland (
builtins.map (
conf: "${inputs.automapaper.packages.${pkgs.system}.default}/bin/automapaper -C ${confFile conf}"
) config.modules.hyprland.displays
);
};
}

View file

@ -1,4 +1,10 @@
{ config, lib, pkgs, inputs, ... }:
{
config,
lib,
pkgs,
inputs,
...
}:
let
cfg = config.modules.dunst;
in

View file

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

View file

@ -1,4 +1,9 @@
{ lib, config, pkgs, ... }:
{
lib,
config,
pkgs,
...
}:
let
cfg = config.modules.games.lutris;
in

View file

@ -1,4 +1,9 @@
{ lib, config, pkgs, ... }:
{
lib,
config,
pkgs,
...
}:
let
cfg = config.modules.games.minecraft;
in

View file

@ -1,4 +1,9 @@
{ lib, config, pkgs, ... }:
{
lib,
config,
pkgs,
...
}:
{
options.modules.games.steam = {
enable = lib.mkEnableOption "enable steam";

View file

@ -1,4 +1,10 @@
{ config, lib, pkgs, inputs, ... }:
{
config,
lib,
pkgs,
inputs,
...
}:
let
cfg = config.modules.plasma;
in
@ -7,13 +13,12 @@ in
enable = lib.mkEnableOption "enable kde plasma 6";
};
config = lib.mkIf cfg.enable {
services = {
desktopManager.plasma6.enable = true;
displayManager.defaultSession = "hyprland";
};
services = {
desktopManager.plasma6.enable = true;
displayManager.defaultSession = "hyprland";
};
xdg.portal.config.common.default = "*";
};
xdg.portal.config.common.default = "*";
};
}

View file

@ -1,5 +1,4 @@
lib: name:
{
lib: name: {
left = lib.mkOption {
type = with lib.types; listOf (enum [ name ]);
};

View file

@ -1,4 +1,9 @@
{ lib, config, pkgs, ... }:
{
lib,
config,
pkgs,
...
}:
let
name = "clock";
in

View file

@ -1,4 +1,9 @@
{ config, pkgs, lib, ... }:
{
config,
pkgs,
lib,
...
}:
let
cfg = config.modules.waybar;
in
@ -41,73 +46,72 @@ in
../../common/colors.nix
];
config =
lib.mkIf cfg.enable
{
modules.waybar.enabled = (
let
mods = config.modules.waybar.modules;
allmodules = mods.left ++ mods.center ++ mods.right;
namedmodules = builtins.map
(n: { name = n; value = { enable = true; }; })
allmodules;
createmodules = builtins.listToAttrs namedmodules;
in
createmodules
);
home.packages = with pkgs;
[
font-awesome
];
programs.waybar = {
enable = true;
package = cfg.package;
settings = {
mainBar = {
layer = "top";
position = "top";
height = 39;
margin-top = 8;
margin-left = 10;
margin-right = 10;
output = builtins.map (display: display.name) config.modules.hyprland.displays;
modules-left = cfg.modules.left;
modules-center = cfg.modules.center;
modules-right = cfg.modules.right;
};
config = lib.mkIf cfg.enable {
modules.waybar.enabled = (
let
mods = config.modules.waybar.modules;
allmodules = mods.left ++ mods.center ++ mods.right;
namedmodules = builtins.map (n: {
name = n;
value = {
enable = true;
};
style = ''
* {
font-family: "Maple Mono NF";
font-size: 14px;
}
}) allmodules;
createmodules = builtins.listToAttrs namedmodules;
in
createmodules
);
button {
/* Use box-shadow instead of border so the text isn't offset */
box-shadow: inset 0 -1px transparent;
/* Avoid rounded borders under each button name */
border: none;
border-radius: 0;
}
button:hover {
background: inherit;
border-radius: 999px;
}
tooltip {
background-color: #${config.colorScheme.palette.base00};
border: 1px solid;
border-color: #${config.colorScheme.palette.taskbarText};
border-radius: 10px;
color: #${config.colorScheme.palette.base05};
}
tooltip label {
padding: 5px;
}
'';
home.packages = with pkgs; [
font-awesome
];
programs.waybar = {
enable = true;
package = cfg.package;
settings = {
mainBar = {
layer = "top";
position = "top";
height = 39;
margin-top = 8;
margin-left = 10;
margin-right = 10;
output = builtins.map (display: display.name) config.modules.hyprland.displays;
modules-left = cfg.modules.left;
modules-center = cfg.modules.center;
modules-right = cfg.modules.right;
};
}
;
};
style = ''
* {
font-family: "Maple Mono NF";
font-size: 14px;
}
button {
/* Use box-shadow instead of border so the text isn't offset */
box-shadow: inset 0 -1px transparent;
/* Avoid rounded borders under each button name */
border: none;
border-radius: 0;
}
button:hover {
background: inherit;
border-radius: 999px;
}
tooltip {
background-color: #${config.colorScheme.palette.base00};
border: 1px solid;
border-color: #${config.colorScheme.palette.taskbarText};
border-radius: 10px;
color: #${config.colorScheme.palette.base05};
}
tooltip label {
padding: 5px;
}
'';
};
};
}

View file

@ -1,4 +1,9 @@
{ lib, config, pkgs, ... }:
{
lib,
config,
pkgs,
...
}:
let
name = "custom/spotify";
in

View file

@ -15,7 +15,11 @@ in
hwmon-path = "/sys/class/hwmon/hwmon3/temp1_input";
critical-threshold = 80;
format = "{temperatureC}°C {icon}";
format-icons = [ "" "" "" ];
format-icons = [
""
""
""
];
};
};
}

View file

@ -15,7 +15,11 @@ in
format = "{volume}% {icon}";
format-muted = "";
on-click = "helvum";
format-icons = [ "" "" "" ];
format-icons = [
""
""
""
];
};
style = ''
#wireplumber {

View file

@ -1,106 +1,103 @@
{ config, options, lib, ... }:
{
config,
options,
lib,
...
}:
let
cfg = config.modules.websites;
in
{
options.modules.websites =
{
enable = lib.mkEnableOption "enable web hosting";
certMail = lib.mkOption {
type = lib.types.str;
description = "the email address the certificate will be requested to";
};
mainDomains = lib.mkOption {
description = "nginx domains for which a certificate is needed";
type = with lib.types; attrsOf (submodule {
options.modules.websites = {
enable = lib.mkEnableOption "enable web hosting";
certMail = lib.mkOption {
type = lib.types.str;
description = "the email address the certificate will be requested to";
};
mainDomains = lib.mkOption {
description = "nginx domains for which a certificate is needed";
type =
with lib.types;
attrsOf (submodule {
options =
let
proxyOption = lib.mkOption { type = str; description = "what url to proxy the requests to"; };
proxyOption = lib.mkOption {
type = str;
description = "what url to proxy the requests to";
};
in
{
enable = lib.mkEnableOption "enable this website";
extra_sites = lib.mkOption {
description = "extra sites that use this certificate";
type = attrsOf
(submodule {
options = {
enable = lib.mkEnableOption "enable this website";
proxy = proxyOption;
};
});
type = attrsOf (submodule {
options = {
enable = lib.mkEnableOption "enable this website";
proxy = proxyOption;
};
});
};
proxy = proxyOption;
};
});
};
};
};
config = lib.mkIf cfg.enable (
let
hostnames = lib.lists.flatten (
lib.attrsets.mapAttrsToList
(
name: config:
[ name ] ++ lib.attrsets.mapAttrsToList (n: c: lib.mkIf c.enable n) config.extra_sites
)
cfg.mainDomains
lib.attrsets.mapAttrsToList (
name: config: [ name ] ++ lib.attrsets.mapAttrsToList (n: c: lib.mkIf c.enable n) config.extra_sites
) cfg.mainDomains
);
certs = lib.attrsets.mapAttrs
(
name: config:
lib.mkIf config.enable {
extraDomainNames = lib.attrsets.mapAttrsToList
(
domain_name: domain_config: lib.mkIf domain_config.enable domain_name
)
config.extra_sites;
webroot = lib.traceVal "/var/lib/acme/acme-challenge/${name}";
}
)
cfg.mainDomains;
hosts = lib.attrsets.concatMapAttrs
(
name: config:
let
extra = ''
client_max_body_size 50000M;
certs = lib.attrsets.mapAttrs (
name: config:
lib.mkIf config.enable {
extraDomainNames = lib.attrsets.mapAttrsToList (
domain_name: domain_config: lib.mkIf domain_config.enable domain_name
) config.extra_sites;
webroot = lib.traceVal "/var/lib/acme/acme-challenge/${name}";
}
) cfg.mainDomains;
hosts = lib.attrsets.concatMapAttrs (
name: config:
let
extra = ''
client_max_body_size 50000M;
proxy_redirect off;
proxy_redirect off;
proxy_read_timeout 600s;
proxy_send_timeout 600s;
send_timeout 600s;'';
proxy = url: {
forceSSL = true;
useACMEHost = name;
extraConfig = extra;
locations."/" = {
proxyWebsockets = true;
proxyPass = url;
};
};
in
lib.trace name (lib.mkIf config.enable (
lib.mkMerge [
{
${name} = {
forceSSL = true;
enableACME = true;
extraConfig = extra;
locations."/" = {
proxyWebsockets = true;
proxyPass = config.proxy;
};
proxy_read_timeout 600s;
proxy_send_timeout 600s;
send_timeout 600s;'';
proxy = url: {
forceSSL = true;
useACMEHost = name;
extraConfig = extra;
locations."/" = {
proxyWebsockets = true;
proxyPass = url;
};
};
in
lib.trace name (
lib.mkIf config.enable (
lib.mkMerge [
{
${name} = {
forceSSL = true;
enableACME = true;
extraConfig = extra;
locations."/" = {
proxyWebsockets = true;
proxyPass = config.proxy;
};
}
(lib.attrsets.mapAttrs
(n: c:
lib.traceSeq c (proxy c.proxy)
)
config.extra_sites)
]
))
};
}
(lib.attrsets.mapAttrs (n: c: lib.traceSeq c (proxy c.proxy)) config.extra_sites)
]
)
)
cfg.mainDomains;
) cfg.mainDomains;
in
{
networking.hosts = {

View file

@ -1,4 +1,10 @@
{ lib, config, pkgs, inputs, ... }:
{
lib,
config,
pkgs,
inputs,
...
}:
let
cfg = config.modules.wofi;
in