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

@ -77,7 +77,17 @@
}; };
outputs = { self, nixpkgs, nix-colors, automapaper, disko, hyprland, lazy, ... }@inputs: outputs =
{
self,
nixpkgs,
nix-colors,
automapaper,
disko,
hyprland,
lazy,
...
}@inputs:
{ {
nixosConfigurations = { nixosConfigurations = {
lambdaOS = nixpkgs.lib.nixosSystem { lambdaOS = nixpkgs.lib.nixosSystem {
@ -125,4 +135,3 @@
}; };
}; };
} }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,4 +1,10 @@
{ config, lib, pkgs, inputs, ... }: {
config,
lib,
pkgs,
inputs,
...
}:
let let
cfg = config.modules.plasma; cfg = config.modules.plasma;
in in
@ -7,13 +13,12 @@ in
enable = lib.mkEnableOption "enable kde plasma 6"; enable = lib.mkEnableOption "enable kde plasma 6";
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
services = { services = {
desktopManager.plasma6.enable = true; desktopManager.plasma6.enable = true;
displayManager.defaultSession = "hyprland"; 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 { left = lib.mkOption {
type = with lib.types; listOf (enum [ name ]); type = with lib.types; listOf (enum [ name ]);
}; };

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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