From 42238dc24f47971a61e0c6c14d90d506ec04ac66 Mon Sep 17 00:00:00 2001 From: Noa Aarts Date: Thu, 7 Nov 2024 20:48:01 +0100 Subject: [PATCH] nixfmt all --- flake.nix | 13 ++- modules/applications/default.nix | 7 +- modules/applications/firefox.nix | 7 +- modules/applications/git.nix | 12 ++- modules/applications/thunderbird.nix | 11 +- modules/automapaper/default.nix | 141 ++++++++++++------------ modules/dunst.nix | 8 +- modules/games/default.nix | 7 +- modules/games/lutris.nix | 7 +- modules/games/minecraft.nix | 7 +- modules/games/steam.nix | 7 +- modules/plasma/default.nix | 21 ++-- modules/waybar/addname.nix | 3 +- modules/waybar/clock.nix | 7 +- modules/waybar/default.nix | 138 ++++++++++++------------ modules/waybar/spotify.nix | 7 +- modules/waybar/temperature.nix | 6 +- modules/waybar/wireplumber.nix | 6 +- modules/websites/default.nix | 155 +++++++++++++-------------- modules/wofi.nix | 8 +- 20 files changed, 333 insertions(+), 245 deletions(-) diff --git a/flake.nix b/flake.nix index e94ad43..b9c8e93 100644 --- a/flake.nix +++ b/flake.nix @@ -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 = { lambdaOS = nixpkgs.lib.nixosSystem { @@ -125,4 +135,3 @@ }; }; } - diff --git a/modules/applications/default.nix b/modules/applications/default.nix index a489544..00bf28a 100644 --- a/modules/applications/default.nix +++ b/modules/applications/default.nix @@ -1,4 +1,9 @@ -{ lib, config, pkgs, ... }: +{ + lib, + config, + pkgs, + ... +}: let cfg = config.modules.apps; in diff --git a/modules/applications/firefox.nix b/modules/applications/firefox.nix index a6469dc..4dc3b85 100644 --- a/modules/applications/firefox.nix +++ b/modules/applications/firefox.nix @@ -1,4 +1,9 @@ -{ lib, config, pkgs, ... }: +{ + lib, + config, + pkgs, + ... +}: let cfg = config.modules.apps.firefox; in diff --git a/modules/applications/git.nix b/modules/applications/git.nix index 7fc6c57..32319be 100644 --- a/modules/applications/git.nix +++ b/modules/applications/git.nix @@ -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; diff --git a/modules/applications/thunderbird.nix b/modules/applications/thunderbird.nix index 6400f6d..279ae92 100644 --- a/modules/applications/thunderbird.nix +++ b/modules/applications/thunderbird.nix @@ -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" = { diff --git a/modules/automapaper/default.nix b/modules/automapaper/default.nix index 13f2207..62c2d39 100644 --- a/modules/automapaper/default.nix +++ b/modules/automapaper/default.nix @@ -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 + ); + }; } - diff --git a/modules/dunst.nix b/modules/dunst.nix index 3a8d1ef..bd3a105 100644 --- a/modules/dunst.nix +++ b/modules/dunst.nix @@ -1,4 +1,10 @@ -{ config, lib, pkgs, inputs, ... }: +{ + config, + lib, + pkgs, + inputs, + ... +}: let cfg = config.modules.dunst; in diff --git a/modules/games/default.nix b/modules/games/default.nix index 2307f85..c577705 100644 --- a/modules/games/default.nix +++ b/modules/games/default.nix @@ -1,4 +1,9 @@ -{ lib, config, pkgs, ... }: +{ + lib, + config, + pkgs, + ... +}: let cfg = config.modules.games; in diff --git a/modules/games/lutris.nix b/modules/games/lutris.nix index 1c8f74b..b598882 100644 --- a/modules/games/lutris.nix +++ b/modules/games/lutris.nix @@ -1,4 +1,9 @@ -{ lib, config, pkgs, ... }: +{ + lib, + config, + pkgs, + ... +}: let cfg = config.modules.games.lutris; in diff --git a/modules/games/minecraft.nix b/modules/games/minecraft.nix index 7fac063..e04c1be 100644 --- a/modules/games/minecraft.nix +++ b/modules/games/minecraft.nix @@ -1,4 +1,9 @@ -{ lib, config, pkgs, ... }: +{ + lib, + config, + pkgs, + ... +}: let cfg = config.modules.games.minecraft; in diff --git a/modules/games/steam.nix b/modules/games/steam.nix index 986987f..f99bad7 100644 --- a/modules/games/steam.nix +++ b/modules/games/steam.nix @@ -1,4 +1,9 @@ -{ lib, config, pkgs, ... }: +{ + lib, + config, + pkgs, + ... +}: { options.modules.games.steam = { enable = lib.mkEnableOption "enable steam"; diff --git a/modules/plasma/default.nix b/modules/plasma/default.nix index 33ef304..261a34b 100644 --- a/modules/plasma/default.nix +++ b/modules/plasma/default.nix @@ -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 = "*"; + }; } diff --git a/modules/waybar/addname.nix b/modules/waybar/addname.nix index 4d6ca8b..f02d3c6 100644 --- a/modules/waybar/addname.nix +++ b/modules/waybar/addname.nix @@ -1,5 +1,4 @@ -lib: name: -{ +lib: name: { left = lib.mkOption { type = with lib.types; listOf (enum [ name ]); }; diff --git a/modules/waybar/clock.nix b/modules/waybar/clock.nix index 425b6a5..099f57a 100644 --- a/modules/waybar/clock.nix +++ b/modules/waybar/clock.nix @@ -1,4 +1,9 @@ -{ lib, config, pkgs, ... }: +{ + lib, + config, + pkgs, + ... +}: let name = "clock"; in diff --git a/modules/waybar/default.nix b/modules/waybar/default.nix index 1db0a0b..13b638d 100644 --- a/modules/waybar/default.nix +++ b/modules/waybar/default.nix @@ -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; + } + ''; + }; + }; } diff --git a/modules/waybar/spotify.nix b/modules/waybar/spotify.nix index 4d722c9..1fa8036 100644 --- a/modules/waybar/spotify.nix +++ b/modules/waybar/spotify.nix @@ -1,4 +1,9 @@ -{ lib, config, pkgs, ... }: +{ + lib, + config, + pkgs, + ... +}: let name = "custom/spotify"; in diff --git a/modules/waybar/temperature.nix b/modules/waybar/temperature.nix index ac43eba..7a43c2f 100644 --- a/modules/waybar/temperature.nix +++ b/modules/waybar/temperature.nix @@ -15,7 +15,11 @@ in hwmon-path = "/sys/class/hwmon/hwmon3/temp1_input"; critical-threshold = 80; format = "{temperatureC}°C {icon}"; - format-icons = [ "" "" "" ]; + format-icons = [ + "" + "" + "" + ]; }; }; } diff --git a/modules/waybar/wireplumber.nix b/modules/waybar/wireplumber.nix index f5d0f31..3e14238 100644 --- a/modules/waybar/wireplumber.nix +++ b/modules/waybar/wireplumber.nix @@ -15,7 +15,11 @@ in format = "{volume}% {icon}"; format-muted = ""; on-click = "helvum"; - format-icons = [ "" "" "" ]; + format-icons = [ + "" + "" + "" + ]; }; style = '' #wireplumber { diff --git a/modules/websites/default.nix b/modules/websites/default.nix index 42287db..8b1b676 100644 --- a/modules/websites/default.nix +++ b/modules/websites/default.nix @@ -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 = { diff --git a/modules/wofi.nix b/modules/wofi.nix index 3e618cb..bf21efc 100644 --- a/modules/wofi.nix +++ b/modules/wofi.nix @@ -1,4 +1,10 @@ -{ lib, config, pkgs, inputs, ... }: +{ + lib, + config, + pkgs, + inputs, + ... +}: let cfg = config.modules.wofi; in