diff --git a/flake.nix b/flake.nix index 832b9ef4..5be9124b 100644 --- a/flake.nix +++ b/flake.nix @@ -188,21 +188,23 @@ }; }; - outputs = inputs: let - lib = inputs.snowfall-lib.mkLib { - inherit inputs; - src = ./.; - - snowfall = { - meta = { - name = "plusultra"; - title = "Plus Ultra"; + outputs = + inputs: + let + lib = inputs.snowfall-lib.mkLib { + inherit inputs; + src = ./.; + + snowfall = { + meta = { + name = "plusultra"; + title = "Plus Ultra"; + }; + + namespace = "plusultra"; }; - - namespace = "plusultra"; }; - }; - in + in lib.mkFlake { channels-config = { allowUnfree = true; @@ -242,13 +244,13 @@ nixos-hardware.nixosModules.framework-11th-gen-intel ]; - deploy = lib.mkDeploy {inherit (inputs) self;}; + deploy = lib.mkDeploy { inherit (inputs) self; }; + + checks = builtins.mapAttrs ( + system: deploy-lib: deploy-lib.deployChecks inputs.self.deploy + ) inputs.deploy-rs.lib; - checks = - builtins.mapAttrs - (system: deploy-lib: - deploy-lib.deployChecks inputs.self.deploy) - inputs.deploy-rs.lib; + outputs-builder = channels: { formatter = channels.nixpkgs.nixfmt-rfc-style; }; } // { self = inputs.self; diff --git a/homes/aarch64-darwin/short@halite/default.nix b/homes/aarch64-darwin/short@halite/default.nix index f3e6655d..c7d82c4e 100644 --- a/homes/aarch64-darwin/short@halite/default.nix +++ b/homes/aarch64-darwin/short@halite/default.nix @@ -2,12 +2,13 @@ lib, pkgs, config, - osConfig ? {}, + osConfig ? { }, format ? "unknown", namespace, ... }: -with lib.${namespace}; { +with lib.${namespace}; +{ plusultra = { user = { enable = true; @@ -27,9 +28,7 @@ with lib.${namespace}; { }; }; - home.sessionPath = [ - "$HOME/bin" - ]; + home.sessionPath = [ "$HOME/bin" ]; home.stateVersion = "22.11"; } diff --git a/homes/x86_64-linux/short/default.nix b/homes/x86_64-linux/short/default.nix index bae25f0d..9502f5ce 100644 --- a/homes/x86_64-linux/short/default.nix +++ b/homes/x86_64-linux/short/default.nix @@ -2,12 +2,13 @@ lib, pkgs, config, - osConfig ? {}, + osConfig ? { }, format ? "unknown", namespace, ... }: -with lib.${namespace}; { +with lib.${namespace}; +{ plusultra = { cli-apps = { zsh = enabled; diff --git a/lib/audio/default.nix b/lib/audio/default.nix index ebe8154c..3e5e61c6 100644 --- a/lib/audio/default.nix +++ b/lib/audio/default.nix @@ -4,62 +4,96 @@ rec { ## Renames an alsa device from a given `name` using the new `description`. ## #@ { name: String, description: String } -> { matches: List, apply_properties: Attrs } - mkAlsaRename = { name, description }: { - matches = [ - [ - [ "device.name" "matches" name ] - ] - ]; - # actions = { "update-props" = { "node.description" = description; }; }; - apply_properties = { - "device.description" = description; + mkAlsaRename = + { name, description }: + { + matches = [ + [ + [ + "device.name" + "matches" + name + ] + ] + ]; + # actions = { "update-props" = { "node.description" = description; }; }; + apply_properties = { + "device.description" = description; + }; }; - }; ## Create a pipewire audio node. ## #@ { name: String, factory: String ? "adapter", ... } -> { factory: String, args: Attrs } - mkAudioNode = args@{ name, factory ? "adapter", ... }: { - inherit factory; - args = (builtins.removeAttrs args [ "name" "description" ]) // { - "node.name" = name; - "node.description" = args.description or args."node.description"; - "factory.name" = args."factory.name" or "support.null-audio-sink"; + mkAudioNode = + args@{ + name, + factory ? "adapter", + ... + }: + { + inherit factory; + args = + (builtins.removeAttrs args [ + "name" + "description" + ]) + // { + "node.name" = name; + "node.description" = args.description or args."node.description"; + "factory.name" = args."factory.name" or "support.null-audio-sink"; + }; }; - }; ## Create a virtual pipewire audio node. ## #@ { name: String, ... } -> { factory: "adapter", args: Attrs } - mkVirtualAudioNode = args@{ name, ... }: - mkAudioNode (args // { - name = "virtual-${lib.toLower name}-audio"; - description = "${name} (Virtual)"; - "media.class" = args.class or args."media.class" or "Audio/Duplex"; - "object.linger" = args."object.linger" or true; - "audio.position" = args."audio.position" or [ "FL" "FR" ]; - "monitor.channel-volumes" = args."monitor.channel-volumes" or true; - }); + mkVirtualAudioNode = + args@{ name, ... }: + mkAudioNode ( + args + // { + name = "virtual-${lib.toLower name}-audio"; + description = "${name} (Virtual)"; + "media.class" = args.class or args."media.class" or "Audio/Duplex"; + "object.linger" = args."object.linger" or true; + "audio.position" = + args."audio.position" or [ + "FL" + "FR" + ]; + "monitor.channel-volumes" = args."monitor.channel-volumes" or true; + } + ); ## Connect two pipewire audio nodes ## #@ { name: String?, from: String, to: String, ... } -> { name: "libpipewire-module-loopback", args: Attrs } - mkBridgeAudioModule = args@{ from, to, ... }: { - name = "libpipewire-module-loopback"; - args = (builtins.removeAttrs args [ "from" "to" "name" ]) // { - "node.name" = - if args ? name then - "${args.name}-bridge" - else - "${lib.toLower from}-to-${lib.toLower to}-bridge"; - "audio.position" = args."audio.position" or [ "FL" "FR" ]; - "capture.props" = { - "node.target" = from; - } // (args."capture.props" or { }); - "playback.props" = { - "node.target" = to; - "monitor.channel-volumes" = true; - } // (args."playback.props" or { }); + mkBridgeAudioModule = + args@{ from, to, ... }: + { + name = "libpipewire-module-loopback"; + args = + (builtins.removeAttrs args [ + "from" + "to" + "name" + ]) + // { + "node.name" = + if args ? name then "${args.name}-bridge" else "${lib.toLower from}-to-${lib.toLower to}-bridge"; + "audio.position" = + args."audio.position" or [ + "FL" + "FR" + ]; + "capture.props" = { + "node.target" = from; + } // (args."capture.props" or { }); + "playback.props" = { + "node.target" = to; + "monitor.channel-volumes" = true; + } // (args."playback.props" or { }); + }; }; - }; } diff --git a/lib/colors/default.nix b/lib/colors/default.nix index f9fbd014..76ba0300 100644 --- a/lib/colors/default.nix +++ b/lib/colors/default.nix @@ -2,10 +2,10 @@ lib, inputs, snowfall-inputs, -}: rec { +}: +rec { colors = { - without-hash = color: - builtins.substring 1 (builtins.stringLength color) color; + without-hash = color: builtins.substring 1 (builtins.stringLength color) color; nord = { nord0 = "#2E3440"; diff --git a/lib/default.nix b/lib/default.nix index 61216dec..326bfed9 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -1,4 +1,8 @@ -{ lib, inputs, snowfall-inputs }: +{ + lib, + inputs, + snowfall-inputs, +}: rec { ## Override a package's metadata @@ -13,7 +17,8 @@ rec { ## ``` ## #@ Attrs -> Package -> Package - override-meta = meta: package: + override-meta = + meta: package: package.overrideAttrs (attrs: { meta = (attrs.meta or { }) // meta; }); diff --git a/lib/deploy/default.nix b/lib/deploy/default.nix index 9597997b..9c49f98e 100644 --- a/lib/deploy/default.nix +++ b/lib/deploy/default.nix @@ -2,9 +2,11 @@ lib, inputs, namespace, -}: let +}: +let inherit (inputs) deploy-rs; -in rec { +in +rec { ## Create deployment configuration for use with deploy-rs. ## ## ```nix @@ -17,46 +19,42 @@ in rec { ## ``` ## #@ { self: Flake, overrides: Attrs ? {} } -> Attrs - mkDeploy = { - self, - overrides ? {}, - }: let - hosts = self.nixosConfigurations or {}; - names = builtins.attrNames hosts; - nodes = - lib.foldl - (result: name: let - host = hosts.${name}; - user = host.config.${namespace}.user.name or null; - inherit (host.pkgs) system; - in + mkDeploy = + { + self, + overrides ? { }, + }: + let + hosts = self.nixosConfigurations or { }; + names = builtins.attrNames hosts; + nodes = lib.foldl ( + result: name: + let + host = hosts.${name}; + user = host.config.${namespace}.user.name or null; + inherit (host.pkgs) system; + in result // { - ${name} = - (overrides.${name} or {}) - // { - hostname = overrides.${name}.hostname or "${name}"; - profiles = - (overrides.${name}.profiles or {}) + ${name} = (overrides.${name} or { }) // { + hostname = overrides.${name}.hostname or "${name}"; + profiles = (overrides.${name}.profiles or { }) // { + system = + (overrides.${name}.profiles.system or { }) // { - system = - (overrides.${name}.profiles.system or {}) - // { - path = deploy-rs.lib.${system}.activate.nixos host; - } - // lib.optionalAttrs (user != null) { - user = "root"; - sshUser = user; - } - // lib.optionalAttrs - (host.config.${namespace}.security.doas.enable or false) - { - sudo = "doas -u"; - }; - }; + path = deploy-rs.lib.${system}.activate.nixos host; + } + // lib.optionalAttrs (user != null) { + user = "root"; + sshUser = user; + } + // lib.optionalAttrs (host.config.${namespace}.security.doas.enable or false) { sudo = "doas -u"; }; }; - }) - {} - names; - in {inherit nodes;}; + }; + } + ) { } names; + in + { + inherit nodes; + }; } diff --git a/lib/module/default.nix b/lib/module/default.nix index 48e53c69..a55477d5 100644 --- a/lib/module/default.nix +++ b/lib/module/default.nix @@ -1,6 +1,7 @@ { lib, ... }: -with lib; rec { +with lib; +rec { ## Create a NixOS module option. ## ## ```nix @@ -8,7 +9,8 @@ with lib; rec { ## ``` ## #@ Type -> Any -> String - mkOpt = type: default: description: + mkOpt = + type: default: description: mkOption { inherit type default description; }; ## Create a NixOS module option without a description. diff --git a/lib/network/default.nix b/lib/network/default.nix index 5b1033a0..29944e7e 100644 --- a/lib/network/default.nix +++ b/lib/network/default.nix @@ -1,4 +1,8 @@ -{ lib, inputs, snowfall-inputs }: +{ + lib, + inputs, + snowfall-inputs, +}: let inherit (inputs.nixpkgs.lib) assertMsg last; @@ -9,14 +13,17 @@ in # Type: String -> Attrs # Usage: get-address-parts "bismuth:3000" # result: { host = "bismuth"; port = "3000"; } - get-address-parts = address: + get-address-parts = + address: let address-parts = builtins.split ":" address; ip = builtins.head address-parts; host = if ip == "" then "127.0.0.1" else ip; port = if builtins.length address-parts != 3 then "" else last address-parts; in - { inherit host port; }; + { + inherit host port; + }; ## Create proxy configuration for NGINX virtual hosts. ## @@ -33,22 +40,23 @@ in ## #@ { port: Int ? null, host: String ? "127.0.0.1", proxy-web-sockets: Bool ? false, extra-config: Attrs ? { } } -> Attrs create-proxy = - { port ? null - , host ? "127.0.0.1" - , proxy-web-sockets ? false - , extra-config ? { } + { + port ? null, + host ? "127.0.0.1", + proxy-web-sockets ? false, + extra-config ? { }, }: - assert assertMsg (port != "" && port != null) "port cannot be empty"; - assert assertMsg (host != "") "host cannot be empty"; - extra-config // { - locations = (extra-config.locations or { }) // { - "/" = (extra-config.locations."/" or { }) // { - proxyPass = - "http://${host}${if port != null then ":${builtins.toString port}" else ""}"; + assert assertMsg (port != "" && port != null) "port cannot be empty"; + assert assertMsg (host != "") "host cannot be empty"; + extra-config + // { + locations = (extra-config.locations or { }) // { + "/" = (extra-config.locations."/" or { }) // { + proxyPass = "http://${host}${if port != null then ":${builtins.toString port}" else ""}"; - proxyWebsockets = proxy-web-sockets; - }; + proxyWebsockets = proxy-web-sockets; }; }; + }; }; } diff --git a/modules/darwin/apps/firefox/default.nix b/modules/darwin/apps/firefox/default.nix index f957d922..c48c13ce 100644 --- a/modules/darwin/apps/firefox/default.nix +++ b/modules/darwin/apps/firefox/default.nix @@ -7,7 +7,8 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.apps.firefox; defaultSettings = { "browser.aboutwelcome.enabled" = false; @@ -19,13 +20,12 @@ with lib.${namespace}; let "browser.aboutConfig.showWarning" = false; "browser.ssb.enabled" = true; }; -in { +in +{ options.${namespace}.apps.firefox = with types; { enable = mkBoolOpt false "Whether or not to enable Firefox."; - extraConfig = - mkOpt str "" "Extra configuration for the user profile JS file."; - userChrome = - mkOpt str "" "Extra configuration for the user chrome CSS file."; + extraConfig = mkOpt str "" "Extra configuration for the user profile JS file."; + userChrome = mkOpt str "" "Extra configuration for the user chrome CSS file."; settings = mkOpt attrs defaultSettings "Settings to apply to the profile."; }; diff --git a/modules/darwin/apps/iterm2/default.nix b/modules/darwin/apps/iterm2/default.nix index 4e7aa339..75752685 100644 --- a/modules/darwin/apps/iterm2/default.nix +++ b/modules/darwin/apps/iterm2/default.nix @@ -7,16 +7,14 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.apps.iterm2; -in { +in +{ options.${namespace}.apps.iterm2 = with types; { enable = mkBoolOpt false "Whether or not to enable iTerm2."; }; - config = mkIf cfg.enable { - environment.systemPackages = with pkgs; [ - iterm2 - ]; - }; + config = mkIf cfg.enable { environment.systemPackages = with pkgs; [ iterm2 ]; }; } diff --git a/modules/darwin/apps/vscode/default.nix b/modules/darwin/apps/vscode/default.nix index e8ad08d4..a475944c 100644 --- a/modules/darwin/apps/vscode/default.nix +++ b/modules/darwin/apps/vscode/default.nix @@ -7,13 +7,14 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.apps.vscode; -in { +in +{ options.${namespace}.apps.vscode = with types; { enable = mkBoolOpt false "Whether or not to enable vscode."; }; - config = - mkIf cfg.enable {environment.systemPackages = with pkgs; [vscode];}; + config = mkIf cfg.enable { environment.systemPackages = with pkgs; [ vscode ]; }; } diff --git a/modules/darwin/cli-apps/neovim/default.nix b/modules/darwin/cli-apps/neovim/default.nix index 80499cb2..c87f4665 100644 --- a/modules/darwin/cli-apps/neovim/default.nix +++ b/modules/darwin/cli-apps/neovim/default.nix @@ -1,4 +1,4 @@ -inputs @ { +inputs@{ options, config, lib, @@ -7,9 +7,11 @@ inputs @ { ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.cli-apps.neovim; -in { +in +{ options.${namespace}.cli-apps.neovim = with types; { enable = mkBoolOpt false "Whether or not to enable neovim."; }; diff --git a/modules/darwin/desktop/addons/firefox-nordic-theme/default.nix b/modules/darwin/desktop/addons/firefox-nordic-theme/default.nix index 12036b8b..d0a033e5 100644 --- a/modules/darwin/desktop/addons/firefox-nordic-theme/default.nix +++ b/modules/darwin/desktop/addons/firefox-nordic-theme/default.nix @@ -7,19 +7,19 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.desktop.addons.firefox-nordic-theme; profileDir = ".mozilla/firefox/${config.${namespace}.user.name}"; -in { +in +{ options.${namespace}.desktop.addons.firefox-nordic-theme = with types; { enable = mkBoolOpt false "Whether to enable the Nordic theme for firefox."; }; config = mkIf cfg.enable { plusultra.apps.firefox = { - extraConfig = - builtins.readFile - "${pkgs.plusultra.firefox-nordic-theme}/configuration/user.js"; + extraConfig = builtins.readFile "${pkgs.plusultra.firefox-nordic-theme}/configuration/user.js"; userChrome = '' @import "${pkgs.plusultra.firefox-nordic-theme}/userChrome.css"; ''; diff --git a/modules/darwin/desktop/addons/skhd/default.nix b/modules/darwin/desktop/addons/skhd/default.nix index 1ff9c6a8..5996f5d2 100644 --- a/modules/darwin/desktop/addons/skhd/default.nix +++ b/modules/darwin/desktop/addons/skhd/default.nix @@ -6,10 +6,12 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.desktop.addons.skhd; - mkScript = name: file: + mkScript = + name: file: pkgs.writeShellApplication { inherit name; checkPhase = ""; @@ -17,7 +19,8 @@ with lib.${namespace}; let }; open-iterm2 = mkScript "open-iterm2" ./scripts/open-iterm2.sh; -in { +in +{ options.${namespace}.desktop.addons.skhd = { enable = mkEnableOption "skhd"; }; diff --git a/modules/darwin/desktop/addons/spacebar/default.nix b/modules/darwin/desktop/addons/spacebar/default.nix index ad5f2fad..13b56f62 100644 --- a/modules/darwin/desktop/addons/spacebar/default.nix +++ b/modules/darwin/desktop/addons/spacebar/default.nix @@ -6,9 +6,11 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.desktop.addons.spacebar; -in { +in +{ options.${namespace}.desktop.addons.spacebar = { enable = mkEnableOption "Spacebar"; }; diff --git a/modules/darwin/desktop/yabai/default.nix b/modules/darwin/desktop/yabai/default.nix index 3a406e96..ec216a96 100644 --- a/modules/darwin/desktop/yabai/default.nix +++ b/modules/darwin/desktop/yabai/default.nix @@ -4,15 +4,19 @@ config, namespace, ... -}: let +}: +let cfg = config.${namespace}.desktop.yabai; inherit (lib) types mkEnableOption mkIf; inherit (lib.${namespace}) mkOpt enabled; -in { +in +{ options.${namespace}.desktop.yabai = { enable = mkEnableOption "Yabai"; - enable-scripting-addition = mkOpt types.bool true "Whether to enable the scripting addition for Yabai. (Requires SIP to be disabled)"; + enable-scripting-addition = + mkOpt types.bool true + "Whether to enable the scripting addition for Yabai. (Requires SIP to be disabled)"; }; config = mkIf cfg.enable { diff --git a/modules/darwin/home/default.nix b/modules/darwin/home/default.nix index 387eada7..bf6b0a48 100644 --- a/modules/darwin/home/default.nix +++ b/modules/darwin/home/default.nix @@ -8,22 +8,22 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.home; -in { +in +{ # imports = with inputs; [ # home-manager.darwinModules.home-manager # ]; options.${namespace}.home = with types; { - file = - mkOpt attrs {} - "A set of files to be managed by home-manager's ."; + file = mkOpt attrs { } "A set of files to be managed by home-manager's ."; configFile = - mkOpt attrs {} - "A set of files to be managed by home-manager's ."; - extraOptions = mkOpt attrs {} "Options to pass directly to home-manager."; - homeConfig = mkOpt attrs {} "Final config for home-manager."; + mkOpt attrs { } + "A set of files to be managed by home-manager's ."; + extraOptions = mkOpt attrs { } "Options to pass directly to home-manager."; + homeConfig = mkOpt attrs { } "Final config for home-manager."; }; config = { @@ -34,7 +34,9 @@ in { xdg.configFile = mkAliasDefinitions options.${namespace}.home.configFile; }; - snowfallorg.user.${config.${namespace}.user.name}.home.config = mkAliasDefinitions options.${namespace}.home.extraOptions; + snowfallorg.user.${config.${namespace}.user.name}.home.config = + mkAliasDefinitions + options.${namespace}.home.extraOptions; home-manager = { useUserPackages = true; diff --git a/modules/darwin/nix/default.nix b/modules/darwin/nix/default.nix index ca439365..832b22c1 100644 --- a/modules/darwin/nix/default.nix +++ b/modules/darwin/nix/default.nix @@ -7,9 +7,11 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.nix; -in { +in +{ options.${namespace}.nix = with types; { enable = mkBoolOpt true "Whether or not to manage nix configuration."; package = mkOpt package pkgs.nixUnstable "Which nix package to use."; @@ -23,51 +25,58 @@ in { nix-prefetch-git ]; - nix = let - users = ["root" config.${namespace}.user.name]; - in { - package = cfg.package; + nix = + let + users = [ + "root" + config.${namespace}.user.name + ]; + in + { + package = cfg.package; - settings = { - experimental-features = "nix-command flakes"; - http-connections = 50; - warn-dirty = false; - log-lines = 50; + settings = { + experimental-features = "nix-command flakes"; + http-connections = 50; + warn-dirty = false; + log-lines = 50; - # Large builds apparently fail due to an issue with darwin: - # https://github.com/NixOS/nix/issues/4119 - sandbox = false; + # Large builds apparently fail due to an issue with darwin: + # https://github.com/NixOS/nix/issues/4119 + sandbox = false; - # This appears to break on darwin - # https://github.com/NixOS/nix/issues/7273 - auto-optimise-store = false; + # This appears to break on darwin + # https://github.com/NixOS/nix/issues/7273 + auto-optimise-store = false; - allow-import-from-derivation = true; + allow-import-from-derivation = true; - trusted-users = users; - allowed-users = users; + trusted-users = users; + allowed-users = users; - # NOTE: This configuration is generated by nix-installer so I'm adding it here in - # case it becomes important. - extra-nix-path = "nixpkgs=flake:nixpkgs"; - build-users-group = "nixbld"; - }; - #// (lib.optionalAttrs config.${namespace}.tools.direnv.enable { - # keep-outputs = true; - # keep-derivations = true; - #}); + # NOTE: This configuration is generated by nix-installer so I'm adding it here in + # case it becomes important. + extra-nix-path = "nixpkgs=flake:nixpkgs"; + build-users-group = "nixbld"; + }; + #// (lib.optionalAttrs config.${namespace}.tools.direnv.enable { + # keep-outputs = true; + # keep-derivations = true; + #}); - gc = { - automatic = true; - interval = {Day = 7;}; - options = "--delete-older-than 30d"; - user = config.${namespace}.user.name; - }; + gc = { + automatic = true; + interval = { + Day = 7; + }; + options = "--delete-older-than 30d"; + user = config.${namespace}.user.name; + }; - # flake-utils-plus - generateRegistryFromInputs = true; - generateNixPathFromInputs = true; - linkInputs = true; - }; + # flake-utils-plus + generateRegistryFromInputs = true; + generateNixPathFromInputs = true; + linkInputs = true; + }; }; } diff --git a/modules/darwin/security/gpg/default.nix b/modules/darwin/security/gpg/default.nix index 312e79d0..9920b14d 100644 --- a/modules/darwin/security/gpg/default.nix +++ b/modules/darwin/security/gpg/default.nix @@ -5,7 +5,8 @@ inputs, namespace, ... -}: let +}: +let inherit (lib) types mkEnableOption mkIf; inherit (lib.${namespace}) mkOpt; @@ -28,7 +29,7 @@ sha256 = "1h48yqffpaz437f3c9hfryf23r95rr319lrb3y79kxpxbc9hihxb"; }; - guideHTML = pkgs.runCommand "yubikey-guide" {} '' + guideHTML = pkgs.runCommand "yubikey-guide" { } '' ${pkgs.pandoc}/bin/pandoc \ --standalone \ --metadata title="Yubikey Guide" \ @@ -45,16 +46,15 @@ reload-yubikey = pkgs.writeShellScriptBin "reload-yubikey" '' ${pkgs.gnupg}/bin/gpg-connect-agent "scd serialno" "learn --force" /bye ''; -in { +in +{ options.${namespace}.security.gpg = { enable = mkEnableOption "GPG"; agentTimeout = mkOpt types.int 5 "The amount of time to wait before continuing with shell init."; }; config = mkIf cfg.enable { - environment.systemPackages = with pkgs; [ - gnupg - ]; + environment.systemPackages = with pkgs; [ gnupg ]; environment.shellInit = '' export GPG_TTY="$(tty)" diff --git a/modules/darwin/services/nix-daemon/default.nix b/modules/darwin/services/nix-daemon/default.nix index 472c53f5..4f3dae6a 100644 --- a/modules/darwin/services/nix-daemon/default.nix +++ b/modules/darwin/services/nix-daemon/default.nix @@ -3,17 +3,17 @@ config, namespace, ... -}: let +}: +let inherit (lib) types mkIf; inherit (lib.${namespace}) mkOpt enabled; cfg = config.${namespace}.services.nix-daemon; -in { +in +{ options.${namespace}.services.nix-daemon = { enable = mkOpt types.bool true "Whether to enable the Nix daemon."; }; - config = mkIf cfg.enable { - services.nix-daemon = enabled; - }; + config = mkIf cfg.enable { services.nix-daemon = enabled; }; } diff --git a/modules/darwin/suites/common/default.nix b/modules/darwin/suites/common/default.nix index 421a15bb..a2126bd1 100644 --- a/modules/darwin/suites/common/default.nix +++ b/modules/darwin/suites/common/default.nix @@ -7,9 +7,11 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.suites.common; -in { +in +{ options.${namespace}.suites.common = with types; { enable = mkBoolOpt false "Whether or not to enable common configuration."; }; diff --git a/modules/darwin/suites/development/default.nix b/modules/darwin/suites/development/default.nix index b48464d8..c3299e08 100644 --- a/modules/darwin/suites/development/default.nix +++ b/modules/darwin/suites/development/default.nix @@ -7,13 +7,13 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.suites.development; -in { +in +{ options.${namespace}.suites.development = with types; { - enable = - mkBoolOpt false - "Whether or not to enable common development configuration."; + enable = mkBoolOpt false "Whether or not to enable common development configuration."; }; config = mkIf cfg.enable { diff --git a/modules/darwin/system/fonts/default.nix b/modules/darwin/system/fonts/default.nix index 5f84ccef..21ea684b 100644 --- a/modules/darwin/system/fonts/default.nix +++ b/modules/darwin/system/fonts/default.nix @@ -7,12 +7,14 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.system.fonts; -in { +in +{ options.${namespace}.system.fonts = with types; { enable = mkBoolOpt false "Whether or not to manage fonts."; - fonts = mkOpt (listOf package) [] "Custom font packages to install."; + fonts = mkOpt (listOf package) [ ] "Custom font packages to install."; }; config = mkIf cfg.enable { @@ -24,13 +26,14 @@ in { fonts = { fontDir = enabled; - fonts = with pkgs; + fonts = + with pkgs; [ noto-fonts noto-fonts-cjk-sans noto-fonts-cjk-serif noto-fonts-emoji - (nerdfonts.override {fonts = ["Hack"];}) + (nerdfonts.override { fonts = [ "Hack" ]; }) ] ++ cfg.fonts; }; diff --git a/modules/darwin/system/input/default.nix b/modules/darwin/system/input/default.nix index b91fcb39..eff75ff5 100644 --- a/modules/darwin/system/input/default.nix +++ b/modules/darwin/system/input/default.nix @@ -7,9 +7,11 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.system.input; -in { +in +{ options.${namespace}.system.input = with types; { enable = mkEnableOption "macOS input"; }; @@ -47,7 +49,7 @@ in { home.activation = { # Disable special keys when using Option as a modifier. # https://superuser.com/questions/941286/disable-default-option-key-binding - disableSpecialKeys = lib.home-manager.hm.dag.entryAfter ["writeBoundary"] '' + disableSpecialKeys = lib.home-manager.hm.dag.entryAfter [ "writeBoundary" ] '' set +e $DRY_RUN_CMD /usr/bin/sudo mkdir -p $HOME/Library/KeyBindings $DRY_RUN_CMD /usr/bin/sudo cp '${builtins.toPath ./DefaultKeyBinding.dict}' "$HOME/Library/KeyBindings/DefaultKeyBinding.dict" diff --git a/modules/darwin/system/interface/default.nix b/modules/darwin/system/interface/default.nix index 11967411..38e51ad6 100644 --- a/modules/darwin/system/interface/default.nix +++ b/modules/darwin/system/interface/default.nix @@ -7,9 +7,11 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.system.interface; -in { +in +{ options.${namespace}.system.interface = with types; { enable = mkEnableOption "macOS interface"; }; diff --git a/modules/darwin/tools/flake/default.nix b/modules/darwin/tools/flake/default.nix index cf6ff3fe..f9a8fda0 100644 --- a/modules/darwin/tools/flake/default.nix +++ b/modules/darwin/tools/flake/default.nix @@ -6,16 +6,14 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.tools.flake; -in { +in +{ options.${namespace}.tools.flake = { enable = mkEnableOption "Flake"; }; - config = mkIf cfg.enable { - environment.systemPackages = with pkgs; [ - snowfallorg.flake - ]; - }; + config = mkIf cfg.enable { environment.systemPackages = with pkgs; [ snowfallorg.flake ]; }; } diff --git a/modules/darwin/tools/git/default.nix b/modules/darwin/tools/git/default.nix index cea343d6..160d3c94 100644 --- a/modules/darwin/tools/git/default.nix +++ b/modules/darwin/tools/git/default.nix @@ -7,21 +7,22 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.tools.git; gpg = config.${namespace}.security.gpg; user = config.${namespace}.user; -in { +in +{ options.${namespace}.tools.git = with types; { enable = mkBoolOpt false "Whether or not to install and configure git."; userName = mkOpt types.str user.fullName "The name to configure git with."; userEmail = mkOpt types.str user.email "The email to configure git with."; - signingKey = - mkOpt types.str "9762169A1B35EA68" "The key ID to sign commits with."; + signingKey = mkOpt types.str "9762169A1B35EA68" "The key ID to sign commits with."; }; config = mkIf cfg.enable { - environment.systemPackages = with pkgs; [git]; + environment.systemPackages = with pkgs; [ git ]; plusultra.home.extraOptions = { programs.git = { @@ -33,10 +34,18 @@ in { signByDefault = mkIf gpg.enable true; }; extraConfig = { - init = {defaultBranch = "main";}; - pull = {rebase = true;}; - push = {autoSetupRemote = true;}; - core = {whitespace = "trailing-space,space-before-tab";}; + init = { + defaultBranch = "main"; + }; + pull = { + rebase = true; + }; + push = { + autoSetupRemote = true; + }; + core = { + whitespace = "trailing-space,space-before-tab"; + }; safe = { directory = "${config.users.users.${user.name}.home}/work/config"; }; diff --git a/modules/darwin/tools/java/default.nix b/modules/darwin/tools/java/default.nix index 48099e8c..7459b2da 100644 --- a/modules/darwin/tools/java/default.nix +++ b/modules/darwin/tools/java/default.nix @@ -7,16 +7,14 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.tools.java; -in { +in +{ options.${namespace}.tools.java = with types; { enable = mkBoolOpt false "Whether or not to enable Java."; }; - config = mkIf cfg.enable { - environment.systemPackages = with pkgs; [ - jdk - ]; - }; + config = mkIf cfg.enable { environment.systemPackages = with pkgs; [ jdk ]; }; } diff --git a/modules/darwin/tools/node/default.nix b/modules/darwin/tools/node/default.nix index 009d579d..773f0a83 100644 --- a/modules/darwin/tools/node/default.nix +++ b/modules/darwin/tools/node/default.nix @@ -7,16 +7,17 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.tools.node; -in { +in +{ options.${namespace}.tools.node = with types; { enable = mkBoolOpt false "Whether or not to install and configure git"; pkg = mkOpt package pkgs.nodejs "The NodeJS package to use"; prettier = { enable = mkBoolOpt true "Whether or not to install Prettier"; - pkg = - mkOpt package pkgs.nodePackages.prettier "The NodeJS package to use"; + pkg = mkOpt package pkgs.nodePackages.prettier "The NodeJS package to use"; }; yarn = { enable = mkBoolOpt true "Whether or not to install Yarn"; @@ -33,8 +34,9 @@ in { }; config = mkIf cfg.enable { - environment.systemPackages = with pkgs; - [cfg.pkg] + environment.systemPackages = + with pkgs; + [ cfg.pkg ] ++ (lib.optional cfg.prettier.enable cfg.prettier.pkg) ++ (lib.optional cfg.yarn.enable cfg.yarn.pkg) ++ (lib.optional cfg.pnpm.enable cfg.pnpm.pkg) diff --git a/modules/darwin/tools/python/default.nix b/modules/darwin/tools/python/default.nix index 64c0faa5..b88af0ba 100644 --- a/modules/darwin/tools/python/default.nix +++ b/modules/darwin/tools/python/default.nix @@ -7,21 +7,16 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.tools.python; -in { +in +{ options.${namespace}.tools.python = with types; { enable = mkBoolOpt false "Whether or not to enable Python."; }; config = mkIf cfg.enable { - environment.systemPackages = with pkgs; [ - ( - python311.withPackages (ps: - with ps; [ - numpy - ]) - ) - ]; + environment.systemPackages = with pkgs; [ (python311.withPackages (ps: with ps; [ numpy ])) ]; }; } diff --git a/modules/darwin/user/default.nix b/modules/darwin/user/default.nix index a52097c7..aacd78cb 100644 --- a/modules/darwin/user/default.nix +++ b/modules/darwin/user/default.nix @@ -4,7 +4,8 @@ pkgs, namespace, ... -}: let +}: +let inherit (lib) types mkIf mkDefault; inherit (lib.${namespace}) mkOpt; @@ -12,7 +13,8 @@ is-linux = pkgs.stdenv.isLinux; is-darwin = pkgs.stdenv.isDarwin; -in { +in +{ options.${namespace}.user = { name = mkOpt types.str "short" "The user account."; diff --git a/modules/home/cli-apps/home-manager/default.nix b/modules/home/cli-apps/home-manager/default.nix index 3d8db343..ba4303ed 100644 --- a/modules/home/cli-apps/home-manager/default.nix +++ b/modules/home/cli-apps/home-manager/default.nix @@ -3,17 +3,17 @@ config, namespace, ... -}: let +}: +let inherit (lib) mkEnableOption mkIf; inherit (lib.${namespace}) enabled; cfg = config.${namespace}.cli-apps.home-manager; -in { +in +{ options.${namespace}.cli-apps.home-manager = { enable = mkEnableOption "home-manager"; }; - config = mkIf cfg.enable { - programs.home-manager = enabled; - }; + config = mkIf cfg.enable { programs.home-manager = enabled; }; } diff --git a/modules/home/cli-apps/neovim/default.nix b/modules/home/cli-apps/neovim/default.nix index 09839935..f993d17e 100644 --- a/modules/home/cli-apps/neovim/default.nix +++ b/modules/home/cli-apps/neovim/default.nix @@ -4,11 +4,13 @@ pkgs, namespace, ... -}: let +}: +let inherit (lib) mkEnableOption mkIf; cfg = config.${namespace}.cli-apps.neovim; -in { +in +{ options.${namespace}.cli-apps.neovim = { enable = mkEnableOption "Neovim"; }; diff --git a/modules/home/cli-apps/tmux/default.nix b/modules/home/cli-apps/tmux/default.nix index d8936f64..534e68f2 100644 --- a/modules/home/cli-apps/tmux/default.nix +++ b/modules/home/cli-apps/tmux/default.nix @@ -6,16 +6,14 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.cli-apps.tmux; -in { +in +{ options.${namespace}.cli-apps.tmux = { enable = mkEnableOption "Tmux"; }; - config = mkIf cfg.enable { - home.packages = with pkgs; [ - plusultra.tmux - ]; - }; + config = mkIf cfg.enable { home.packages = with pkgs; [ plusultra.tmux ]; }; } diff --git a/modules/home/cli-apps/zsh/default.nix b/modules/home/cli-apps/zsh/default.nix index 7a1dafd1..ca1cdcdb 100644 --- a/modules/home/cli-apps/zsh/default.nix +++ b/modules/home/cli-apps/zsh/default.nix @@ -4,7 +4,8 @@ pkgs, namespace, ... -}: let +}: +let inherit (lib) mkEnableOption mkIf; cfg = config.${namespace}.cli-apps.zsh; @@ -30,7 +31,8 @@ clear fi ''; -in { +in +{ options.${namespace}.cli-apps.zsh = { enable = mkEnableOption "ZSH"; }; diff --git a/modules/home/home/default.nix b/modules/home/home/default.nix index d9482842..bd26296a 100644 --- a/modules/home/home/default.nix +++ b/modules/home/home/default.nix @@ -1,8 +1,9 @@ { lib, - osConfig ? {}, + osConfig ? { }, namespace, ... -}: { +}: +{ home.stateVersion = lib.mkDefault (osConfig.system.stateVersion or "23.11"); } diff --git a/modules/home/host/default.nix b/modules/home/host/default.nix index 0b543288..90920b73 100644 --- a/modules/home/host/default.nix +++ b/modules/home/host/default.nix @@ -6,10 +6,12 @@ format ? "unknown", namespace, ... -}: let +}: +let inherit (lib) types; inherit (lib.${namespace}) mkOpt; -in { +in +{ options.${namespace}.host = { name = mkOpt (types.nullOr types.str) host "The host name."; }; diff --git a/modules/home/tools/direnv/default.nix b/modules/home/tools/direnv/default.nix index b283a632..f34f2798 100644 --- a/modules/home/tools/direnv/default.nix +++ b/modules/home/tools/direnv/default.nix @@ -7,9 +7,11 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.tools.direnv; -in { +in +{ options.${namespace}.tools.direnv = with types; { enable = mkBoolOpt false "Whether or not to enable direnv."; }; diff --git a/modules/home/tools/git/default.nix b/modules/home/tools/git/default.nix index d4eaba94..dbfc0d90 100644 --- a/modules/home/tools/git/default.nix +++ b/modules/home/tools/git/default.nix @@ -1,8 +1,9 @@ -{ lib -, config -, pkgs -, namespace -, ... +{ + lib, + config, + pkgs, + namespace, + ... }: let inherit (lib) types mkEnableOption mkIf; @@ -16,8 +17,7 @@ in enable = mkEnableOption "Git"; userName = mkOpt types.str user.fullName "The name to configure git with."; userEmail = mkOpt types.str user.email "The email to configure git with."; - signingKey = - mkOpt types.str "9762169A1B35EA68" "The key ID to sign commits with."; + signingKey = mkOpt types.str "9762169A1B35EA68" "The key ID to sign commits with."; signByDefault = mkOpt types.bool true "Whether to sign commits by default."; }; @@ -31,10 +31,18 @@ in inherit (cfg) signByDefault; }; extraConfig = { - init = { defaultBranch = "main"; }; - pull = { rebase = true; }; - push = { autoSetupRemote = true; }; - core = { whitespace = "trailing-space,space-before-tab"; }; + init = { + defaultBranch = "main"; + }; + pull = { + rebase = true; + }; + push = { + autoSetupRemote = true; + }; + core = { + whitespace = "trailing-space,space-before-tab"; + }; safe = { directory = "${user.home}/work/config/.git"; }; diff --git a/modules/home/tools/ssh/default.nix b/modules/home/tools/ssh/default.nix index d1708e47..2929fc95 100644 --- a/modules/home/tools/ssh/default.nix +++ b/modules/home/tools/ssh/default.nix @@ -4,10 +4,12 @@ pkgs, namespace, ... -}: let +}: +let inherit (lib) types mkEnableOption mkIf; cfg = config.${namespace}.tools.ssh; -in { +in +{ options.${namespace}.tools.ssh = { enable = mkEnableOption "SSH"; }; diff --git a/modules/home/user/default.nix b/modules/home/user/default.nix index 008c4e23..7af0077f 100644 --- a/modules/home/user/default.nix +++ b/modules/home/user/default.nix @@ -3,10 +3,16 @@ config, pkgs, namespace, - osConfig ? {}, + osConfig ? { }, ... -}: let - inherit (lib) types mkIf mkDefault mkMerge; +}: +let + inherit (lib) + types + mkIf + mkDefault + mkMerge + ; inherit (lib.${namespace}) mkOpt; cfg = config.${namespace}.user; @@ -15,12 +21,14 @@ is-darwin = pkgs.stdenv.isDarwin; home-directory = - if cfg.name == null - then null - else if is-darwin - then "/Users/${cfg.name}" - else "/home/${cfg.name}"; -in { + if cfg.name == null then + null + else if is-darwin then + "/Users/${cfg.name}" + else + "/home/${cfg.name}"; +in +{ options.${namespace}.user = { enable = mkOpt types.bool true "Whether to configure the user account."; name = mkOpt (types.nullOr types.str) (config.snowfallorg.user.name or "short") "The user account."; diff --git a/modules/nixos/apps/_1password/default.nix b/modules/nixos/apps/_1password/default.nix index e1ac7275..8fd65dce 100644 --- a/modules/nixos/apps/_1password/default.nix +++ b/modules/nixos/apps/_1password/default.nix @@ -7,9 +7,11 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.apps._1password; -in { +in +{ options.${namespace}.apps._1password = with types; { enable = mkBoolOpt false "Whether or not to enable 1password."; }; @@ -20,7 +22,7 @@ in { _1password-gui = { enable = true; - polkitPolicyOwners = [config.${namespace}.user.name]; + polkitPolicyOwners = [ config.${namespace}.user.name ]; }; }; }; diff --git a/modules/nixos/apps/ardour/default.nix b/modules/nixos/apps/ardour/default.nix index 3ce992f1..49acd0f7 100644 --- a/modules/nixos/apps/ardour/default.nix +++ b/modules/nixos/apps/ardour/default.nix @@ -7,13 +7,14 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.apps.ardour; -in { +in +{ options.${namespace}.apps.ardour = with types; { enable = mkBoolOpt false "Whether or not to enable Ardour."; }; - config = - mkIf cfg.enable {environment.systemPackages = with pkgs; [ardour];}; + config = mkIf cfg.enable { environment.systemPackages = with pkgs; [ ardour ]; }; } diff --git a/modules/nixos/apps/blender/default.nix b/modules/nixos/apps/blender/default.nix index 7c42ada2..46842600 100644 --- a/modules/nixos/apps/blender/default.nix +++ b/modules/nixos/apps/blender/default.nix @@ -7,13 +7,14 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.apps.blender; -in { +in +{ options.${namespace}.apps.blender = with types; { enable = mkBoolOpt false "Whether or not to enable Blender."; }; - config = - mkIf cfg.enable {environment.systemPackages = with pkgs; [blender];}; + config = mkIf cfg.enable { environment.systemPackages = with pkgs; [ blender ]; }; } diff --git a/modules/nixos/apps/bottles/default.nix b/modules/nixos/apps/bottles/default.nix index 1192f013..bc03b09f 100644 --- a/modules/nixos/apps/bottles/default.nix +++ b/modules/nixos/apps/bottles/default.nix @@ -7,13 +7,14 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.apps.bottles; -in { +in +{ options.${namespace}.apps.bottles = with types; { enable = mkBoolOpt false "Whether or not to enable Bottles."; }; - config = - mkIf cfg.enable {environment.systemPackages = with pkgs; [bottles];}; + config = mkIf cfg.enable { environment.systemPackages = with pkgs; [ bottles ]; }; } diff --git a/modules/nixos/apps/cadence/default.nix b/modules/nixos/apps/cadence/default.nix index 780b7a56..6490ec52 100644 --- a/modules/nixos/apps/cadence/default.nix +++ b/modules/nixos/apps/cadence/default.nix @@ -7,13 +7,14 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.apps.cadence; -in { +in +{ options.${namespace}.apps.cadence = with types; { enable = mkBoolOpt false "Whether or not to enable Cadence."; }; - config = - mkIf cfg.enable {environment.systemPackages = with pkgs; [cadence];}; + config = mkIf cfg.enable { environment.systemPackages = with pkgs; [ cadence ]; }; } diff --git a/modules/nixos/apps/discord/default.nix b/modules/nixos/apps/discord/default.nix index 4b5b87db..2bb4116a 100644 --- a/modules/nixos/apps/discord/default.nix +++ b/modules/nixos/apps/discord/default.nix @@ -8,7 +8,8 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.apps.discord; discord = lib.replugged.makeDiscordPlugged { inherit pkgs; @@ -24,16 +25,13 @@ with lib.${namespace}; let inherit (inputs) discord-nord-theme; }; }; -in { +in +{ options.${namespace}.apps.discord = with types; { enable = mkBoolOpt false "Whether or not to enable Discord."; canary.enable = mkBoolOpt false "Whether or not to enable Discord Canary."; - chromium.enable = - mkBoolOpt false - "Whether or not to enable the Chromium version of Discord."; - firefox.enable = - mkBoolOpt false - "Whether or not to enable the Firefox version of Discord."; + chromium.enable = mkBoolOpt false "Whether or not to enable the Chromium version of Discord."; + firefox.enable = mkBoolOpt false "Whether or not to enable the Firefox version of Discord."; native.enable = mkBoolOpt false "Whether or not to enable the native version of Discord."; }; diff --git a/modules/nixos/apps/dolphin/default.nix b/modules/nixos/apps/dolphin/default.nix index c31eb99d..7a8b8b1f 100644 --- a/modules/nixos/apps/dolphin/default.nix +++ b/modules/nixos/apps/dolphin/default.nix @@ -7,17 +7,19 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.apps.dolphin; -in { +in +{ options.${namespace}.apps.dolphin = with types; { enable = mkBoolOpt false "Whether or not to enable Dolphin."; }; config = mkIf cfg.enable { - environment.systemPackages = with pkgs; [dolphin-emu]; + environment.systemPackages = with pkgs; [ dolphin-emu ]; # Enable GameCube controller support. - services.udev.packages = [pkgs.dolphinEmu]; + services.udev.packages = [ pkgs.dolphinEmu ]; }; } diff --git a/modules/nixos/apps/doukutsu-rs/default.nix b/modules/nixos/apps/doukutsu-rs/default.nix index 115b97fd..5d6034b9 100644 --- a/modules/nixos/apps/doukutsu-rs/default.nix +++ b/modules/nixos/apps/doukutsu-rs/default.nix @@ -7,7 +7,8 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.apps.doukutsu-rs; desktopItem = pkgs.makeDesktopItem { name = "doukutsu-rs"; @@ -16,10 +17,14 @@ with lib.${namespace}; let exec = "${pkgs.plusultra.doukutsu-rs}/bin/doukutsu-rs"; icon = ./icon.png; type = "Application"; - categories = ["Game" "AdventureGame"]; + categories = [ + "Game" + "AdventureGame" + ]; terminal = false; }; -in { +in +{ options.${namespace}.apps.doukutsu-rs = with types; { enable = mkBoolOpt false "Whether or not to enable doukutsu-rs."; }; diff --git a/modules/nixos/apps/element/default.nix b/modules/nixos/apps/element/default.nix index 4dd29ea2..e6359740 100644 --- a/modules/nixos/apps/element/default.nix +++ b/modules/nixos/apps/element/default.nix @@ -7,14 +7,14 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.apps.element; -in { +in +{ options.${namespace}.apps.element = with types; { enable = mkBoolOpt false "Whether or not to enable Element."; }; - config = mkIf cfg.enable { - environment.systemPackages = with pkgs; [element-desktop]; - }; + config = mkIf cfg.enable { environment.systemPackages = with pkgs; [ element-desktop ]; }; } diff --git a/modules/nixos/apps/etcher/default.nix b/modules/nixos/apps/etcher/default.nix index c941bf1e..8e0131af 100644 --- a/modules/nixos/apps/etcher/default.nix +++ b/modules/nixos/apps/etcher/default.nix @@ -7,9 +7,11 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.apps.etcher; -in { +in +{ options.${namespace}.apps.etcher = with types; { enable = mkBoolOpt false "Whether or not to enable etcher."; }; diff --git a/modules/nixos/apps/expressvpn/default.nix b/modules/nixos/apps/expressvpn/default.nix index b25a0315..762d6e8f 100644 --- a/modules/nixos/apps/expressvpn/default.nix +++ b/modules/nixos/apps/expressvpn/default.nix @@ -6,27 +6,29 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.apps.expressvpn; -in { +in +{ options.${namespace}.apps.expressvpn = { enable = mkEnableOption "Express VPN"; }; config = mkIf cfg.enable { - environment.systemPackages = with pkgs; - [ - plusultra.expressvpn - ] - ++ optionals config.${namespace}.desktop.gnome.enable [ - gnomeExtensions.evpn-shell-assistant - ]; + environment.systemPackages = + with pkgs; + [ plusultra.expressvpn ] + ++ optionals config.${namespace}.desktop.gnome.enable [ gnomeExtensions.evpn-shell-assistant ]; - boot.kernelModules = ["tun"]; + boot.kernelModules = [ "tun" ]; systemd.services.expressvpn = { - wantedBy = ["multi-user.target"]; - after = ["network.target" "network-online.target"]; + wantedBy = [ "multi-user.target" ]; + after = [ + "network.target" + "network-online.target" + ]; description = "ExpressVPN Daemon"; diff --git a/modules/nixos/apps/firefox/default.nix b/modules/nixos/apps/firefox/default.nix index 81085536..a1c4a878 100644 --- a/modules/nixos/apps/firefox/default.nix +++ b/modules/nixos/apps/firefox/default.nix @@ -7,7 +7,8 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.apps.firefox; defaultSettings = { "browser.aboutwelcome.enabled" = false; @@ -19,13 +20,12 @@ with lib.${namespace}; let "browser.aboutConfig.showWarning" = false; "browser.ssb.enabled" = true; }; -in { +in +{ options.${namespace}.apps.firefox = with types; { enable = mkBoolOpt false "Whether or not to enable Firefox."; - extraConfig = - mkOpt str "" "Extra configuration for the user profile JS file."; - userChrome = - mkOpt str "" "Extra configuration for the user chrome CSS file."; + extraConfig = mkOpt str "" "Extra configuration for the user profile JS file."; + userChrome = mkOpt str "" "Extra configuration for the user chrome CSS file."; settings = mkOpt attrs defaultSettings "Settings to apply to the profile."; }; @@ -49,11 +49,9 @@ in { enable = true; # package = pkgs.firefox; - nativeMessagingHosts = - [pkgs.browserpass] - ++ optional - config.${namespace}.desktop.gnome.enable - pkgs.gnomeExtensions.gsconnect; + nativeMessagingHosts = [ + pkgs.browserpass + ] ++ optional config.${namespace}.desktop.gnome.enable pkgs.gnomeExtensions.gsconnect; profiles.${config.${namespace}.user.name} = { inherit (cfg) extraConfig userChrome settings; diff --git a/modules/nixos/apps/frappe-books/default.nix b/modules/nixos/apps/frappe-books/default.nix index 6c1b6cff..bc3f9b15 100644 --- a/modules/nixos/apps/frappe-books/default.nix +++ b/modules/nixos/apps/frappe-books/default.nix @@ -7,14 +7,14 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.apps.frappe-books; -in { +in +{ options.${namespace}.apps.frappe-books = with types; { enable = mkBoolOpt false "Whether or not to enable FrappeBooks."; }; - config = mkIf cfg.enable { - environment.systemPackages = with pkgs; [plusultra.frappe-books]; - }; + config = mkIf cfg.enable { environment.systemPackages = with pkgs; [ plusultra.frappe-books ]; }; } diff --git a/modules/nixos/apps/freetube/default.nix b/modules/nixos/apps/freetube/default.nix index 9e859df5..bfa3c44b 100644 --- a/modules/nixos/apps/freetube/default.nix +++ b/modules/nixos/apps/freetube/default.nix @@ -7,13 +7,14 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.apps.freetube; -in { +in +{ options.${namespace}.apps.freetube = with types; { enable = mkBoolOpt false "Whether or not to enable FreeTube."; }; - config = - mkIf cfg.enable {environment.systemPackages = with pkgs; [freetube];}; + config = mkIf cfg.enable { environment.systemPackages = with pkgs; [ freetube ]; }; } diff --git a/modules/nixos/apps/gimp/default.nix b/modules/nixos/apps/gimp/default.nix index e30d106c..56af0552 100644 --- a/modules/nixos/apps/gimp/default.nix +++ b/modules/nixos/apps/gimp/default.nix @@ -7,13 +7,14 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.apps.gimp; -in { +in +{ options.${namespace}.apps.gimp = with types; { enable = mkBoolOpt false "Whether or not to enable Gimp."; }; - config = - mkIf cfg.enable {environment.systemPackages = with pkgs; [gimp];}; + config = mkIf cfg.enable { environment.systemPackages = with pkgs; [ gimp ]; }; } diff --git a/modules/nixos/apps/gparted/default.nix b/modules/nixos/apps/gparted/default.nix index c5a42056..9d57f20d 100644 --- a/modules/nixos/apps/gparted/default.nix +++ b/modules/nixos/apps/gparted/default.nix @@ -7,13 +7,14 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.apps.gparted; -in { +in +{ options.${namespace}.apps.gparted = with types; { enable = mkBoolOpt false "Whether or not to enable gparted."; }; - config = - mkIf cfg.enable {environment.systemPackages = with pkgs; [gparted];}; + config = mkIf cfg.enable { environment.systemPackages = with pkgs; [ gparted ]; }; } diff --git a/modules/nixos/apps/hey/default.nix b/modules/nixos/apps/hey/default.nix index ba7d0dd8..b7e95cfe 100644 --- a/modules/nixos/apps/hey/default.nix +++ b/modules/nixos/apps/hey/default.nix @@ -7,12 +7,14 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.apps.hey; -in { +in +{ options.${namespace}.apps.hey = with types; { enable = mkBoolOpt false "Whether or not to enable HEY."; }; - config = mkIf cfg.enable {environment.systemPackages = with pkgs.plusultra; [hey];}; + config = mkIf cfg.enable { environment.systemPackages = with pkgs.plusultra; [ hey ]; }; } diff --git a/modules/nixos/apps/inkscape/default.nix b/modules/nixos/apps/inkscape/default.nix index f935c577..2811e4b6 100644 --- a/modules/nixos/apps/inkscape/default.nix +++ b/modules/nixos/apps/inkscape/default.nix @@ -7,14 +7,19 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.apps.inkscape; -in { +in +{ options.${namespace}.apps.inkscape = with types; { enable = mkBoolOpt false "Whether or not to enable Inkscape."; }; config = mkIf cfg.enable { - environment.systemPackages = with pkgs; [inkscape-with-extensions google-fonts]; + environment.systemPackages = with pkgs; [ + inkscape-with-extensions + google-fonts + ]; }; } diff --git a/modules/nixos/apps/logseq/default.nix b/modules/nixos/apps/logseq/default.nix index b33609c3..47335c05 100644 --- a/modules/nixos/apps/logseq/default.nix +++ b/modules/nixos/apps/logseq/default.nix @@ -7,13 +7,14 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.apps.logseq; -in { +in +{ options.${namespace}.apps.logseq = with types; { enable = mkBoolOpt false "Whether or not to enable logseq."; }; - config = - mkIf cfg.enable {environment.systemPackages = with pkgs; [logseq];}; + config = mkIf cfg.enable { environment.systemPackages = with pkgs; [ logseq ]; }; } diff --git a/modules/nixos/apps/looking-glass-client/default.nix b/modules/nixos/apps/looking-glass-client/default.nix index 869d8f61..e1723393 100644 --- a/modules/nixos/apps/looking-glass-client/default.nix +++ b/modules/nixos/apps/looking-glass-client/default.nix @@ -7,17 +7,18 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.apps.looking-glass-client; user = config.${namespace}.user; -in { +in +{ options.${namespace}.apps.looking-glass-client = with types; { - enable = - mkBoolOpt false "Whether or not to enable the Looking Glass client."; + enable = mkBoolOpt false "Whether or not to enable the Looking Glass client."; }; config = mkIf cfg.enable { - environment.systemPackages = with pkgs; [looking-glass-client]; + environment.systemPackages = with pkgs; [ looking-glass-client ]; environment.etc."looking-glass-client.ini" = { user = "+${toString config.users.users.${user.name}.uid}"; diff --git a/modules/nixos/apps/lutris/default.nix b/modules/nixos/apps/lutris/default.nix index b63af48b..9289544f 100644 --- a/modules/nixos/apps/lutris/default.nix +++ b/modules/nixos/apps/lutris/default.nix @@ -7,9 +7,11 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.apps.lutris; -in { +in +{ options.${namespace}.apps.lutris = with types; { enable = mkBoolOpt false "Whether or not to enable Lutris."; }; diff --git a/modules/nixos/apps/obs/default.nix b/modules/nixos/apps/obs/default.nix index e799ec2e..e632f3aa 100644 --- a/modules/nixos/apps/obs/default.nix +++ b/modules/nixos/apps/obs/default.nix @@ -7,9 +7,11 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.apps.obs; -in { +in +{ options.${namespace}.apps.obs = with types; { enable = mkBoolOpt false "Whether or not to enable support for OBS."; }; diff --git a/modules/nixos/apps/pcsx2/default.nix b/modules/nixos/apps/pcsx2/default.nix index 2b03445a..2e9ecbcf 100644 --- a/modules/nixos/apps/pcsx2/default.nix +++ b/modules/nixos/apps/pcsx2/default.nix @@ -7,13 +7,14 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.apps.pcsx2; -in { +in +{ options.${namespace}.apps.pcsx2 = with types; { enable = mkBoolOpt false "Whether or not to enable PCSX2."; }; - config = - mkIf cfg.enable {environment.systemPackages = with pkgs; [pcsx2];}; + config = mkIf cfg.enable { environment.systemPackages = with pkgs; [ pcsx2 ]; }; } diff --git a/modules/nixos/apps/pitivi/default.nix b/modules/nixos/apps/pitivi/default.nix index 794877d5..172dd2aa 100644 --- a/modules/nixos/apps/pitivi/default.nix +++ b/modules/nixos/apps/pitivi/default.nix @@ -7,13 +7,14 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.apps.pitivi; -in { +in +{ options.${namespace}.apps.pitivi = with types; { enable = mkBoolOpt false "Whether or not to enable Pitivi."; }; - config = - mkIf cfg.enable {environment.systemPackages = with pkgs; [pitivi];}; + config = mkIf cfg.enable { environment.systemPackages = with pkgs; [ pitivi ]; }; } diff --git a/modules/nixos/apps/pocketcasts/default.nix b/modules/nixos/apps/pocketcasts/default.nix index 9251c9a8..79537327 100644 --- a/modules/nixos/apps/pocketcasts/default.nix +++ b/modules/nixos/apps/pocketcasts/default.nix @@ -7,14 +7,14 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.apps.pocketcasts; -in { +in +{ options.${namespace}.apps.pocketcasts = with types; { enable = mkBoolOpt false "Whether or not to enable Pocketcasts."; }; - config = mkIf cfg.enable { - environment.systemPackages = with pkgs.plusultra; [pocketcasts]; - }; + config = mkIf cfg.enable { environment.systemPackages = with pkgs.plusultra; [ pocketcasts ]; }; } diff --git a/modules/nixos/apps/prismlauncher/default.nix b/modules/nixos/apps/prismlauncher/default.nix index 04835b37..2893cb0f 100644 --- a/modules/nixos/apps/prismlauncher/default.nix +++ b/modules/nixos/apps/prismlauncher/default.nix @@ -7,13 +7,14 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.apps.prismlauncher; -in { +in +{ options.${namespace}.apps.prismlauncher = with types; { enable = mkBoolOpt false "Whether or not to enable Prism Launcher."; }; - config = - mkIf cfg.enable {environment.systemPackages = with pkgs; [prismlauncher];}; + config = mkIf cfg.enable { environment.systemPackages = with pkgs; [ prismlauncher ]; }; } diff --git a/modules/nixos/apps/protontricks/default.nix b/modules/nixos/apps/protontricks/default.nix index ae879a45..67ed8738 100644 --- a/modules/nixos/apps/protontricks/default.nix +++ b/modules/nixos/apps/protontricks/default.nix @@ -7,14 +7,14 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.apps.protontricks; -in { +in +{ options.${namespace}.apps.protontricks = with types; { enable = mkBoolOpt false "Whether or not to enable Protontricks."; }; - config = mkIf cfg.enable { - environment.systemPackages = with pkgs; [protontricks]; - }; + config = mkIf cfg.enable { environment.systemPackages = with pkgs; [ protontricks ]; }; } diff --git a/modules/nixos/apps/r2modman/default.nix b/modules/nixos/apps/r2modman/default.nix index e782434f..2d679bed 100644 --- a/modules/nixos/apps/r2modman/default.nix +++ b/modules/nixos/apps/r2modman/default.nix @@ -7,13 +7,14 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.apps.r2modman; -in { +in +{ options.${namespace}.apps.r2modman = with types; { enable = mkBoolOpt false "Whether or not to enable r2modman."; }; - config = - mkIf cfg.enable {environment.systemPackages = with pkgs; [r2modman];}; + config = mkIf cfg.enable { environment.systemPackages = with pkgs; [ r2modman ]; }; } diff --git a/modules/nixos/apps/rpcs3/default.nix b/modules/nixos/apps/rpcs3/default.nix index a533f408..917def09 100644 --- a/modules/nixos/apps/rpcs3/default.nix +++ b/modules/nixos/apps/rpcs3/default.nix @@ -7,14 +7,14 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.apps.rpcs3; -in { +in +{ options.${namespace}.apps.rpcs3 = with types; { enable = mkBoolOpt false "Whether or not to enable rpcs3."; }; - config = mkIf cfg.enable { - environment.systemPackages = with pkgs; [rpcs3]; - }; + config = mkIf cfg.enable { environment.systemPackages = with pkgs; [ rpcs3 ]; }; } diff --git a/modules/nixos/apps/steam/default.nix b/modules/nixos/apps/steam/default.nix index cbf4cd3f..16a09027 100644 --- a/modules/nixos/apps/steam/default.nix +++ b/modules/nixos/apps/steam/default.nix @@ -7,9 +7,11 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.apps.steam; -in { +in +{ options.${namespace}.apps.steam = with types; { enable = mkBoolOpt false "Whether or not to enable support for Steam."; }; @@ -21,11 +23,9 @@ in { hardware.steam-hardware.enable = true; # Enable GameCube controller support. - services.udev.packages = [pkgs.dolphinEmu]; + services.udev.packages = [ pkgs.dolphinEmu ]; - environment.systemPackages = with pkgs.plusultra; [ - steam - ]; + environment.systemPackages = with pkgs.plusultra; [ steam ]; environment.sessionVariables = { STEAM_EXTRA_COMPAT_TOOLS_PATHS = "$HOME/.steam/root/compatibilitytools.d"; diff --git a/modules/nixos/apps/steamtinkerlaunch/default.nix b/modules/nixos/apps/steamtinkerlaunch/default.nix index 87b73ea1..e8860d99 100644 --- a/modules/nixos/apps/steamtinkerlaunch/default.nix +++ b/modules/nixos/apps/steamtinkerlaunch/default.nix @@ -4,18 +4,16 @@ config, namespace, ... -}: let +}: +let cfg = config.${namespace}.apps.steamtinkerlaunch; inherit (lib) mkIf mkEnableOption; -in { +in +{ options.${namespace}.apps.steamtinkerlaunch = { enable = mkEnableOption "Steam Tinker Launch"; }; - config = mkIf cfg.enable { - environment.systemPackages = with pkgs; [ - steamtinkerlaunch - ]; - }; + config = mkIf cfg.enable { environment.systemPackages = with pkgs; [ steamtinkerlaunch ]; }; } diff --git a/modules/nixos/apps/twitter/default.nix b/modules/nixos/apps/twitter/default.nix index 8c289d13..582ded52 100644 --- a/modules/nixos/apps/twitter/default.nix +++ b/modules/nixos/apps/twitter/default.nix @@ -7,13 +7,14 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.apps.twitter; -in { +in +{ options.${namespace}.apps.twitter = with types; { enable = mkBoolOpt false "Whether or not to enable Twitter."; }; - config = - mkIf cfg.enable {environment.systemPackages = with pkgs.plusultra; [twitter];}; + config = mkIf cfg.enable { environment.systemPackages = with pkgs.plusultra; [ twitter ]; }; } diff --git a/modules/nixos/apps/ubports-installer/default.nix b/modules/nixos/apps/ubports-installer/default.nix index 7710f493..059c7d1a 100644 --- a/modules/nixos/apps/ubports-installer/default.nix +++ b/modules/nixos/apps/ubports-installer/default.nix @@ -7,20 +7,18 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.apps.ubports-installer; -in { +in +{ options.${namespace}.apps.ubports-installer = with types; { enable = mkBoolOpt false "Whether or not to enable the UBPorts Installer."; }; config = mkIf cfg.enable { - environment.systemPackages = with pkgs.plusultra; [ - ubports-installer - ]; + environment.systemPackages = with pkgs.plusultra; [ ubports-installer ]; - services.udev.packages = with pkgs.plusultra; [ - ubports-installer-udev-rules - ]; + services.udev.packages = with pkgs.plusultra; [ ubports-installer-udev-rules ]; }; } diff --git a/modules/nixos/apps/virtualbox/default.nix b/modules/nixos/apps/virtualbox/default.nix index d9d6e3c1..da34b7ac 100644 --- a/modules/nixos/apps/virtualbox/default.nix +++ b/modules/nixos/apps/virtualbox/default.nix @@ -7,9 +7,11 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.apps.virtualbox; -in { +in +{ options.${namespace}.apps.virtualbox = with types; { enable = mkBoolOpt false "Whether or not to enable Virtualbox."; }; @@ -20,6 +22,6 @@ in { enableExtensionPack = true; }; - plusultra.user.extraGroups = ["vboxusers"]; + plusultra.user.extraGroups = [ "vboxusers" ]; }; } diff --git a/modules/nixos/apps/vlc/default.nix b/modules/nixos/apps/vlc/default.nix index 66fa9006..b07991f9 100644 --- a/modules/nixos/apps/vlc/default.nix +++ b/modules/nixos/apps/vlc/default.nix @@ -7,12 +7,14 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.apps.vlc; -in { +in +{ options.${namespace}.apps.vlc = with types; { enable = mkBoolOpt false "Whether or not to enable vlc."; }; - config = mkIf cfg.enable {environment.systemPackages = with pkgs; [vlc];}; + config = mkIf cfg.enable { environment.systemPackages = with pkgs; [ vlc ]; }; } diff --git a/modules/nixos/apps/vscode/default.nix b/modules/nixos/apps/vscode/default.nix index e8ad08d4..a475944c 100644 --- a/modules/nixos/apps/vscode/default.nix +++ b/modules/nixos/apps/vscode/default.nix @@ -7,13 +7,14 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.apps.vscode; -in { +in +{ options.${namespace}.apps.vscode = with types; { enable = mkBoolOpt false "Whether or not to enable vscode."; }; - config = - mkIf cfg.enable {environment.systemPackages = with pkgs; [vscode];}; + config = mkIf cfg.enable { environment.systemPackages = with pkgs; [ vscode ]; }; } diff --git a/modules/nixos/apps/winetricks/default.nix b/modules/nixos/apps/winetricks/default.nix index 88916b90..4a38689f 100644 --- a/modules/nixos/apps/winetricks/default.nix +++ b/modules/nixos/apps/winetricks/default.nix @@ -7,13 +7,14 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.apps.winetricks; -in { +in +{ options.${namespace}.apps.winetricks = with types; { enable = mkBoolOpt false "Whether or not to enable Winetricks."; }; - config = - mkIf cfg.enable {environment.systemPackages = with pkgs; [winetricks];}; + config = mkIf cfg.enable { environment.systemPackages = with pkgs; [ winetricks ]; }; } diff --git a/modules/nixos/apps/yt-music/default.nix b/modules/nixos/apps/yt-music/default.nix index 704ed214..42ca34bc 100644 --- a/modules/nixos/apps/yt-music/default.nix +++ b/modules/nixos/apps/yt-music/default.nix @@ -7,13 +7,14 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.apps.yt-music; -in { +in +{ options.${namespace}.apps.yt-music = with types; { enable = mkBoolOpt false "Whether or not to enable YouTube Music."; }; - config = - mkIf cfg.enable {environment.systemPackages = with pkgs.plusultra; [yt-music];}; + config = mkIf cfg.enable { environment.systemPackages = with pkgs.plusultra; [ yt-music ]; }; } diff --git a/modules/nixos/apps/yubikey/default.nix b/modules/nixos/apps/yubikey/default.nix index 409dee3d..d5c585f2 100644 --- a/modules/nixos/apps/yubikey/default.nix +++ b/modules/nixos/apps/yubikey/default.nix @@ -7,15 +7,17 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.apps.yubikey; -in { +in +{ options.${namespace}.apps.yubikey = with types; { enable = mkBoolOpt false "Whether or not to enable Yubikey."; }; config = mkIf cfg.enable { services.yubikey-agent.enable = true; - environment.systemPackages = with pkgs; [yubikey-manager-qt]; + environment.systemPackages = with pkgs; [ yubikey-manager-qt ]; }; } diff --git a/modules/nixos/apps/yuzu/default.nix b/modules/nixos/apps/yuzu/default.nix index f5dc4de0..1f25df46 100644 --- a/modules/nixos/apps/yuzu/default.nix +++ b/modules/nixos/apps/yuzu/default.nix @@ -7,14 +7,14 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.apps.yuzu; -in { +in +{ options.${namespace}.apps.yuzu = with types; { enable = mkBoolOpt false "Whether or not to enable Yuzu."; }; - config = mkIf cfg.enable { - environment.systemPackages = with pkgs; [yuzu-mainline]; - }; + config = mkIf cfg.enable { environment.systemPackages = with pkgs; [ yuzu-mainline ]; }; } diff --git a/modules/nixos/archetypes/gaming/default.nix b/modules/nixos/archetypes/gaming/default.nix index a8e581ad..4af574de 100644 --- a/modules/nixos/archetypes/gaming/default.nix +++ b/modules/nixos/archetypes/gaming/default.nix @@ -7,9 +7,11 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.archetypes.gaming; -in { +in +{ options.${namespace}.archetypes.gaming = with types; { enable = mkBoolOpt false "Whether or not to enable the gaming archetype."; }; diff --git a/modules/nixos/archetypes/server/default.nix b/modules/nixos/archetypes/server/default.nix index a13b52ad..c57f9d29 100644 --- a/modules/nixos/archetypes/server/default.nix +++ b/modules/nixos/archetypes/server/default.nix @@ -7,12 +7,13 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.archetypes.server; -in { +in +{ options.${namespace}.archetypes.server = with types; { - enable = - mkBoolOpt false "Whether or not to enable the server archetype."; + enable = mkBoolOpt false "Whether or not to enable the server archetype."; }; config = mkIf cfg.enable { diff --git a/modules/nixos/archetypes/workstation/default.nix b/modules/nixos/archetypes/workstation/default.nix index 833b6759..5e47dff9 100644 --- a/modules/nixos/archetypes/workstation/default.nix +++ b/modules/nixos/archetypes/workstation/default.nix @@ -7,12 +7,13 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.archetypes.workstation; -in { +in +{ options.${namespace}.archetypes.workstation = with types; { - enable = - mkBoolOpt false "Whether or not to enable the workstation archetype."; + enable = mkBoolOpt false "Whether or not to enable the workstation archetype."; }; config = mkIf cfg.enable { diff --git a/modules/nixos/cache/public/default.nix b/modules/nixos/cache/public/default.nix index 0ecd0d40..9b05dfd1 100644 --- a/modules/nixos/cache/public/default.nix +++ b/modules/nixos/cache/public/default.nix @@ -5,9 +5,11 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.cache.public; -in { +in +{ options.${namespace}.cache.public = { enable = mkEnableOption "Plus Ultra public cache"; }; diff --git a/modules/nixos/cli-apps/flake/default.nix b/modules/nixos/cli-apps/flake/default.nix index 132e0a53..1bf898a4 100644 --- a/modules/nixos/cli-apps/flake/default.nix +++ b/modules/nixos/cli-apps/flake/default.nix @@ -1,4 +1,4 @@ -inputs @ { +inputs@{ options, config, lib, @@ -7,16 +7,14 @@ inputs @ { ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.cli-apps.flake; -in { +in +{ options.${namespace}.cli-apps.flake = with types; { enable = mkBoolOpt false "Whether or not to enable flake."; }; - config = mkIf cfg.enable { - environment.systemPackages = with pkgs; [ - snowfallorg.flake - ]; - }; + config = mkIf cfg.enable { environment.systemPackages = with pkgs; [ snowfallorg.flake ]; }; } diff --git a/modules/nixos/cli-apps/mods/default.nix b/modules/nixos/cli-apps/mods/default.nix index aa1892f2..c9d4d6ba 100644 --- a/modules/nixos/cli-apps/mods/default.nix +++ b/modules/nixos/cli-apps/mods/default.nix @@ -7,9 +7,11 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.cli-apps.mods; -in { +in +{ options.${namespace}.cli-apps.mods = with types; { enable = mkBoolOpt false "Whether or not to enable mods."; }; @@ -21,9 +23,7 @@ in { OPENAI_API_BASE = "http://ruby:8080"; }; - environment.systemPackages = with pkgs; [ - mods - ]; + environment.systemPackages = with pkgs; [ mods ]; plusultra.home.configFile = { "mods/mods.yml".source = ./mods.yml; diff --git a/modules/nixos/cli-apps/neovim/default.nix b/modules/nixos/cli-apps/neovim/default.nix index 80499cb2..c87f4665 100644 --- a/modules/nixos/cli-apps/neovim/default.nix +++ b/modules/nixos/cli-apps/neovim/default.nix @@ -1,4 +1,4 @@ -inputs @ { +inputs@{ options, config, lib, @@ -7,9 +7,11 @@ inputs @ { ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.cli-apps.neovim; -in { +in +{ options.${namespace}.cli-apps.neovim = with types; { enable = mkBoolOpt false "Whether or not to enable neovim."; }; diff --git a/modules/nixos/cli-apps/prisma/default.nix b/modules/nixos/cli-apps/prisma/default.nix index 8e2103e4..7cf9e3fd 100644 --- a/modules/nixos/cli-apps/prisma/default.nix +++ b/modules/nixos/cli-apps/prisma/default.nix @@ -6,21 +6,21 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.cli-apps.prisma; -in { +in +{ options.${namespace}.cli-apps.prisma = with types; { enable = mkBoolOpt false "Whether or not to install Prisma"; pkgs = { npm = mkOpt package pkgs.nodePackages.prisma "The NPM package to install"; - engines = - mkOpt package pkgs.prisma-engines - "The package to get prisma engines from"; + engines = mkOpt package pkgs.prisma-engines "The package to get prisma engines from"; }; }; config = mkIf cfg.enable { - environment.systemPackages = [cfg.pkgs.npm]; + environment.systemPackages = [ cfg.pkgs.npm ]; plusultra.home.extraOptions = { programs.zsh.initExtra = '' diff --git a/modules/nixos/cli-apps/proton/default.nix b/modules/nixos/cli-apps/proton/default.nix index ffe9f87e..c255c0e8 100644 --- a/modules/nixos/cli-apps/proton/default.nix +++ b/modules/nixos/cli-apps/proton/default.nix @@ -7,14 +7,14 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.cli-apps.proton; -in { +in +{ options.${namespace}.cli-apps.proton = with types; { enable = mkBoolOpt false "Whether or not to enable Proton."; }; - config = mkIf cfg.enable { - environment.systemPackages = with pkgs; [proton-caller]; - }; + config = mkIf cfg.enable { environment.systemPackages = with pkgs; [ proton-caller ]; }; } diff --git a/modules/nixos/cli-apps/thaw/default.nix b/modules/nixos/cli-apps/thaw/default.nix index 4ecbb219..124071de 100644 --- a/modules/nixos/cli-apps/thaw/default.nix +++ b/modules/nixos/cli-apps/thaw/default.nix @@ -6,16 +6,14 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.cli-apps.thaw; -in { +in +{ options.${namespace}.cli-apps.thaw = with types; { enable = mkBoolOpt false "Whether or not to enable thaw."; }; - config = mkIf cfg.enable { - environment.systemPackages = with pkgs; [ - snowfallorg.thaw - ]; - }; + config = mkIf cfg.enable { environment.systemPackages = with pkgs; [ snowfallorg.thaw ]; }; } diff --git a/modules/nixos/cli-apps/tmux/default.nix b/modules/nixos/cli-apps/tmux/default.nix index 03de7b2f..62c789a9 100644 --- a/modules/nixos/cli-apps/tmux/default.nix +++ b/modules/nixos/cli-apps/tmux/default.nix @@ -6,16 +6,14 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.cli-apps.tmux; -in { +in +{ options.${namespace}.cli-apps.tmux = { enable = mkEnableOption "Tmux"; }; - config = mkIf cfg.enable { - environment.systemPackages = with pkgs; [ - plusultra.tmux - ]; - }; + config = mkIf cfg.enable { environment.systemPackages = with pkgs; [ plusultra.tmux ]; }; } diff --git a/modules/nixos/cli-apps/wine/default.nix b/modules/nixos/cli-apps/wine/default.nix index 47dd2d42..65b77957 100644 --- a/modules/nixos/cli-apps/wine/default.nix +++ b/modules/nixos/cli-apps/wine/default.nix @@ -7,9 +7,11 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.cli-apps.wine; -in { +in +{ options.${namespace}.cli-apps.wine = with types; { enable = mkBoolOpt false "Whether or not to enable Wine."; }; diff --git a/modules/nixos/cli-apps/wshowkeys/default.nix b/modules/nixos/cli-apps/wshowkeys/default.nix index e53d331b..e024c19b 100644 --- a/modules/nixos/cli-apps/wshowkeys/default.nix +++ b/modules/nixos/cli-apps/wshowkeys/default.nix @@ -7,15 +7,17 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.cli-apps.wshowkeys; -in { +in +{ options.${namespace}.cli-apps.wshowkeys = with types; { enable = mkBoolOpt false "Whether or not to enable wshowkeys."; }; config = mkIf cfg.enable { - plusultra.user.extraGroups = ["input"]; - environment.systemPackages = with pkgs; [wshowkeys]; + plusultra.user.extraGroups = [ "input" ]; + environment.systemPackages = with pkgs; [ wshowkeys ]; }; } diff --git a/modules/nixos/cli-apps/yubikey/default.nix b/modules/nixos/cli-apps/yubikey/default.nix index 1819196d..952b893c 100644 --- a/modules/nixos/cli-apps/yubikey/default.nix +++ b/modules/nixos/cli-apps/yubikey/default.nix @@ -7,15 +7,17 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.cli-apps.yubikey; -in { +in +{ options.${namespace}.cli-apps.yubikey = with types; { enable = mkBoolOpt false "Whether or not to enable Yubikey."; }; config = mkIf cfg.enable { services.yubikey-agent.enable = true; - environment.systemPackages = with pkgs; [yubikey-manager]; + environment.systemPackages = with pkgs; [ yubikey-manager ]; }; } diff --git a/modules/nixos/desktop/addons/ags/bar/default.nix b/modules/nixos/desktop/addons/ags/bar/default.nix index 7b817146..736000aa 100644 --- a/modules/nixos/desktop/addons/ags/bar/default.nix +++ b/modules/nixos/desktop/addons/ags/bar/default.nix @@ -4,12 +4,19 @@ pkgs, namespace, ... -}: let +}: +let cfg = config.${namespace}.desktop.addons.ags.bar; - inherit (lib) mkEnableOption mkOption mkIf types getExe; + inherit (lib) + mkEnableOption + mkOption + mkIf + types + getExe + ; - bar = pkgs.runCommandNoCC "plusultra-ags-bar" {} '' + bar = pkgs.runCommandNoCC "plusultra-ags-bar" { } '' mkdir -p $out cp -r ${./src}/* $out/ @@ -21,7 +28,8 @@ rm -rf $out/styles/sass ''; -in { +in +{ options.${namespace}.desktop.addons.ags.bar = { enable = mkEnableOption "AGS Bar"; @@ -35,7 +43,7 @@ in { config = mkIf cfg.enable { plusultra = { desktop.hyprland.settings = { - exec-once = ["${getExe cfg.package} --config ${bar}/config.js"]; + exec-once = [ "${getExe cfg.package} --config ${bar}/config.js" ]; }; }; }; diff --git a/modules/nixos/desktop/addons/clipboard/default.nix b/modules/nixos/desktop/addons/clipboard/default.nix index 6b317f49..0aec8df7 100644 --- a/modules/nixos/desktop/addons/clipboard/default.nix +++ b/modules/nixos/desktop/addons/clipboard/default.nix @@ -4,18 +4,16 @@ pkgs, namespace, ... -}: let +}: +let cfg = config.${namespace}.desktop.addons.clipboard; inherit (lib) mkIf mkEnableOption mkOption; -in { +in +{ options.${namespace}.desktop.addons.clipboard = { enable = mkEnableOption "Clipboard"; }; - config = mkIf cfg.enable { - environment.systemPackages = with pkgs; [ - wl-clipboard - ]; - }; + config = mkIf cfg.enable { environment.systemPackages = with pkgs; [ wl-clipboard ]; }; } diff --git a/modules/nixos/desktop/addons/electron-support/default.nix b/modules/nixos/desktop/addons/electron-support/default.nix index 1ef8a567..8cd46b2d 100644 --- a/modules/nixos/desktop/addons/electron-support/default.nix +++ b/modules/nixos/desktop/addons/electron-support/default.nix @@ -7,19 +7,20 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.desktop.addons.electron-support; -in { +in +{ options.${namespace}.desktop.addons.electron-support = with types; { - enable = - mkBoolOpt false - "Whether to enable electron support in the desktop environment."; + enable = mkBoolOpt false "Whether to enable electron support in the desktop environment."; }; config = mkIf cfg.enable { - plusultra.home.configFile."electron-flags.conf".source = - ./electron-flags.conf; + plusultra.home.configFile."electron-flags.conf".source = ./electron-flags.conf; - environment.sessionVariables = {NIXOS_OZONE_WL = "1";}; + environment.sessionVariables = { + NIXOS_OZONE_WL = "1"; + }; }; } diff --git a/modules/nixos/desktop/addons/firefox-nordic-theme/default.nix b/modules/nixos/desktop/addons/firefox-nordic-theme/default.nix index 12036b8b..d0a033e5 100644 --- a/modules/nixos/desktop/addons/firefox-nordic-theme/default.nix +++ b/modules/nixos/desktop/addons/firefox-nordic-theme/default.nix @@ -7,19 +7,19 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.desktop.addons.firefox-nordic-theme; profileDir = ".mozilla/firefox/${config.${namespace}.user.name}"; -in { +in +{ options.${namespace}.desktop.addons.firefox-nordic-theme = with types; { enable = mkBoolOpt false "Whether to enable the Nordic theme for firefox."; }; config = mkIf cfg.enable { plusultra.apps.firefox = { - extraConfig = - builtins.readFile - "${pkgs.plusultra.firefox-nordic-theme}/configuration/user.js"; + extraConfig = builtins.readFile "${pkgs.plusultra.firefox-nordic-theme}/configuration/user.js"; userChrome = '' @import "${pkgs.plusultra.firefox-nordic-theme}/userChrome.css"; ''; diff --git a/modules/nixos/desktop/addons/foot/default.nix b/modules/nixos/desktop/addons/foot/default.nix index 998d65c5..d14bdd6d 100644 --- a/modules/nixos/desktop/addons/foot/default.nix +++ b/modules/nixos/desktop/addons/foot/default.nix @@ -7,9 +7,11 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.desktop.addons.foot; -in { +in +{ options.${namespace}.desktop.addons.foot = with types; { enable = mkBoolOpt false "Whether to enable the gnome file manager."; }; diff --git a/modules/nixos/desktop/addons/gtk/default.nix b/modules/nixos/desktop/addons/gtk/default.nix index 48fbe004..bc0b13de 100644 --- a/modules/nixos/desktop/addons/gtk/default.nix +++ b/modules/nixos/desktop/addons/gtk/default.nix @@ -1,12 +1,14 @@ -{ options -, config -, lib -, pkgs -, namespace -, ... +{ + options, + config, + lib, + pkgs, + namespace, + ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.desktop.addons.gtk; gdmCfg = config.services.xserver.displayManager.gdm; in @@ -14,21 +16,15 @@ in options.${namespace}.desktop.addons.gtk = with types; { enable = mkBoolOpt false "Whether to customize GTK and apply themes."; theme = { - name = - mkOpt str "Nordic-darker" - "The name of the GTK theme to apply."; + name = mkOpt str "Nordic-darker" "The name of the GTK theme to apply."; pkg = mkOpt package pkgs.nordic "The package to use for the theme."; }; cursor = { - name = - mkOpt str "Bibata-Modern-Ice" - "The name of the cursor theme to apply."; + name = mkOpt str "Bibata-Modern-Ice" "The name of the cursor theme to apply."; pkg = mkOpt package pkgs.plusultra.bibata-cursors "The package to use for the cursor theme."; }; icon = { - name = - mkOpt str "Papirus" - "The name of the icon theme to apply."; + name = mkOpt str "Papirus" "The name of the icon theme to apply."; pkg = mkOpt package pkgs.papirus-icon-theme "The package to use for the icon theme."; }; }; diff --git a/modules/nixos/desktop/addons/kanshi/default.nix b/modules/nixos/desktop/addons/kanshi/default.nix index bb3b13ad..76b05af5 100644 --- a/modules/nixos/desktop/addons/kanshi/default.nix +++ b/modules/nixos/desktop/addons/kanshi/default.nix @@ -7,27 +7,30 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.desktop.addons.kanshi; user = config.${namespace}.user; home = config.users.users.${user.name}.home; -in { +in +{ options.${namespace}.desktop.addons.kanshi = with types; { - enable = - mkBoolOpt false "Whether to enable Kanshi in the desktop environment."; + enable = mkBoolOpt false "Whether to enable Kanshi in the desktop environment."; }; config = mkIf cfg.enable { plusultra.home.configFile."kanshi/config".source = ./config; - environment.systemPackages = with pkgs; [kanshi]; + environment.systemPackages = with pkgs; [ kanshi ]; # configuring kanshi systemd.user.services.kanshi = { description = "Kanshi output autoconfig "; - wantedBy = ["graphical-session.target"]; - partOf = ["graphical-session.target"]; - environment = {XDG_CONFIG_HOME = "${home}/.config";}; + wantedBy = [ "graphical-session.target" ]; + partOf = [ "graphical-session.target" ]; + environment = { + XDG_CONFIG_HOME = "${home}/.config"; + }; serviceConfig = { ExecCondition = '' ${pkgs.bash}/bin/bash -c '[ -n "$WAYLAND_DISPLAY" ]' diff --git a/modules/nixos/desktop/addons/keyring/default.nix b/modules/nixos/desktop/addons/keyring/default.nix index 38b86df1..097597ec 100644 --- a/modules/nixos/desktop/addons/keyring/default.nix +++ b/modules/nixos/desktop/addons/keyring/default.nix @@ -7,9 +7,11 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.desktop.addons.keyring; -in { +in +{ options.${namespace}.desktop.addons.keyring = with types; { enable = mkBoolOpt false "Whether to enable the gnome keyring."; }; @@ -17,6 +19,6 @@ in { config = mkIf cfg.enable { services.gnome.gnome-keyring.enable = true; - environment.systemPackages = with pkgs; [gnome.seahorse]; + environment.systemPackages = with pkgs; [ gnome.seahorse ]; }; } diff --git a/modules/nixos/desktop/addons/mako/default.nix b/modules/nixos/desktop/addons/mako/default.nix index 0e1cd42b..a08790cb 100644 --- a/modules/nixos/desktop/addons/mako/default.nix +++ b/modules/nixos/desktop/addons/mako/default.nix @@ -7,21 +7,26 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.desktop.addons.mako; -in { +in +{ options.${namespace}.desktop.addons.mako = with types; { enable = mkBoolOpt false "Whether to enable Mako in Sway."; }; config = mkIf cfg.enable { - environment.systemPackages = with pkgs; [mako libnotify]; + environment.systemPackages = with pkgs; [ + mako + libnotify + ]; systemd.user.services.mako = { description = "Mako notification daemon"; - wantedBy = ["graphical-session.target"]; - partOf = ["graphical-session.target"]; - after = ["graphical-session.target"]; + wantedBy = [ "graphical-session.target" ]; + partOf = [ "graphical-session.target" ]; + after = [ "graphical-session.target" ]; serviceConfig = { Type = "dbus"; BusName = "org.freedesktop.Notifications"; diff --git a/modules/nixos/desktop/addons/nautilus/default.nix b/modules/nixos/desktop/addons/nautilus/default.nix index 10d34d5e..ece471a7 100644 --- a/modules/nixos/desktop/addons/nautilus/default.nix +++ b/modules/nixos/desktop/addons/nautilus/default.nix @@ -7,9 +7,11 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.desktop.addons.nautilus; -in { +in +{ options.${namespace}.desktop.addons.nautilus = with types; { enable = mkBoolOpt false "Whether to enable the gnome file manager."; }; @@ -19,6 +21,6 @@ in { services.gvfs.enable = true; networking.firewall.extraCommands = "iptables -t raw -A OUTPUT -p udp -m udp --dport 137 -j CT --helper netbios-ns"; - environment.systemPackages = with pkgs; [nautilus]; + environment.systemPackages = with pkgs; [ nautilus ]; }; } diff --git a/modules/nixos/desktop/addons/rofi/default.nix b/modules/nixos/desktop/addons/rofi/default.nix index b6678e44..c0d2acd0 100644 --- a/modules/nixos/desktop/addons/rofi/default.nix +++ b/modules/nixos/desktop/addons/rofi/default.nix @@ -7,16 +7,17 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.desktop.addons.rofi; -in { +in +{ options.${namespace}.desktop.addons.rofi = with types; { - enable = - mkBoolOpt false "Whether to enable Rofi in the desktop environment."; + enable = mkBoolOpt false "Whether to enable Rofi in the desktop environment."; }; config = mkIf cfg.enable { - environment.systemPackages = with pkgs; [rofi]; + environment.systemPackages = with pkgs; [ rofi ]; plusultra.home.configFile."rofi/config.rasi".source = ./config.rasi; }; diff --git a/modules/nixos/desktop/addons/swappy/default.nix b/modules/nixos/desktop/addons/swappy/default.nix index 3bcc6838..6341239d 100644 --- a/modules/nixos/desktop/addons/swappy/default.nix +++ b/modules/nixos/desktop/addons/swappy/default.nix @@ -7,16 +7,17 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.desktop.addons.swappy; -in { +in +{ options.${namespace}.desktop.addons.swappy = with types; { - enable = - mkBoolOpt false "Whether to enable Swappy in the desktop environment."; + enable = mkBoolOpt false "Whether to enable Swappy in the desktop environment."; }; config = mkIf cfg.enable { - environment.systemPackages = with pkgs; [swappy]; + environment.systemPackages = with pkgs; [ swappy ]; plusultra.home.configFile."swappy/config".source = ./config; plusultra.home.file."Pictures/screenshots/.keep".text = ""; diff --git a/modules/nixos/desktop/addons/term/default.nix b/modules/nixos/desktop/addons/term/default.nix index 2d0165f9..1e7f9f1a 100644 --- a/modules/nixos/desktop/addons/term/default.nix +++ b/modules/nixos/desktop/addons/term/default.nix @@ -7,13 +7,15 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.desktop.addons.term; -in { +in +{ options.${namespace}.desktop.addons.term = with types; { enable = mkBoolOpt false "Whether to enable the gnome file manager."; pkg = mkOpt package pkgs.foot "The terminal to install."; }; - config = mkIf cfg.enable {environment.systemPackages = [cfg.pkg];}; + config = mkIf cfg.enable { environment.systemPackages = [ cfg.pkg ]; }; } diff --git a/modules/nixos/desktop/addons/wallpapers/default.nix b/modules/nixos/desktop/addons/wallpapers/default.nix index f6f4d519..4c3b6998 100644 --- a/modules/nixos/desktop/addons/wallpapers/default.nix +++ b/modules/nixos/desktop/addons/wallpapers/default.nix @@ -7,27 +7,23 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.desktop.addons.wallpapers; inherit (pkgs.plusultra) wallpapers; -in { +in +{ options.${namespace}.desktop.addons.wallpapers = with types; { - enable = - mkBoolOpt false - "Whether or not to add wallpapers to ~/Pictures/wallpapers."; + enable = mkBoolOpt false "Whether or not to add wallpapers to ~/Pictures/wallpapers."; }; config = { - plusultra.home.file = - lib.foldl - (acc: name: let + plusultra.home.file = lib.foldl ( + acc: name: + let wallpaper = wallpapers.${name}; in - acc - // { - "Pictures/wallpapers/${wallpaper.fileName}".source = wallpaper; - }) - {} - (wallpapers.names); + acc // { "Pictures/wallpapers/${wallpaper.fileName}".source = wallpaper; } + ) { } (wallpapers.names); }; } diff --git a/modules/nixos/desktop/addons/waybar/default.nix b/modules/nixos/desktop/addons/waybar/default.nix index 8a22f0de..47ab441f 100644 --- a/modules/nixos/desktop/addons/waybar/default.nix +++ b/modules/nixos/desktop/addons/waybar/default.nix @@ -7,16 +7,17 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.desktop.addons.waybar; -in { +in +{ options.${namespace}.desktop.addons.waybar = with types; { - enable = - mkBoolOpt false "Whether to enable Waybar in the desktop environment."; + enable = mkBoolOpt false "Whether to enable Waybar in the desktop environment."; }; config = mkIf cfg.enable { - environment.systemPackages = with pkgs; [waybar]; + environment.systemPackages = with pkgs; [ waybar ]; plusultra.home.configFile."waybar/config".source = ./config; plusultra.home.configFile."waybar/style.css".source = ./style.css; diff --git a/modules/nixos/desktop/addons/wofi/default.nix b/modules/nixos/desktop/addons/wofi/default.nix index 22d8b596..9cfec7a5 100644 --- a/modules/nixos/desktop/addons/wofi/default.nix +++ b/modules/nixos/desktop/addons/wofi/default.nix @@ -7,16 +7,20 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.desktop.addons.wofi; -in { +in +{ options.${namespace}.desktop.addons.wofi = with types; { - enable = - mkBoolOpt false "Whether to enable the Wofi in the desktop environment."; + enable = mkBoolOpt false "Whether to enable the Wofi in the desktop environment."; }; config = mkIf cfg.enable { - environment.systemPackages = with pkgs; [wofi wofi-emoji]; + environment.systemPackages = with pkgs; [ + wofi + wofi-emoji + ]; # config -> .config/wofi/config # css -> .config/wofi/style.css diff --git a/modules/nixos/desktop/addons/xdg-portal/default.nix b/modules/nixos/desktop/addons/xdg-portal/default.nix index 01e4a6d5..152258e0 100644 --- a/modules/nixos/desktop/addons/xdg-portal/default.nix +++ b/modules/nixos/desktop/addons/xdg-portal/default.nix @@ -7,9 +7,11 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.desktop.addons.xdg-portal; -in { +in +{ options.${namespace}.desktop.addons.xdg-portal = with types; { enable = mkBoolOpt false "Whether or not to add support for xdg portal."; }; diff --git a/modules/nixos/desktop/gnome/default.nix b/modules/nixos/desktop/gnome/default.nix index 330f5fda..13c476c9 100644 --- a/modules/nixos/desktop/gnome/default.nix +++ b/modules/nixos/desktop/gnome/default.nix @@ -1,12 +1,14 @@ -{ options -, config -, lib -, pkgs -, namespace -, ... +{ + options, + config, + lib, + pkgs, + namespace, + ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.desktop.gnome; gdmHome = config.users.users.gdm.home; @@ -38,16 +40,23 @@ with lib.${namespace}; let in { options.${namespace}.desktop.gnome = with types; { - enable = - mkBoolOpt false "Whether or not to use Gnome as the desktop environment."; + enable = mkBoolOpt false "Whether or not to use Gnome as the desktop environment."; wallpaper = { - light = mkOpt (oneOf [ str package ]) pkgs.plusultra.wallpapers.nord-rainbow-light-nix "The light wallpaper to use."; - dark = mkOpt (oneOf [ str package ]) pkgs.plusultra.wallpapers.nord-rainbow-dark-nix "The dark wallpaper to use."; + light = mkOpt (oneOf [ + str + package + ]) pkgs.plusultra.wallpapers.nord-rainbow-light-nix "The light wallpaper to use."; + dark = mkOpt (oneOf [ + str + package + ]) pkgs.plusultra.wallpapers.nord-rainbow-dark-nix "The dark wallpaper to use."; }; - color-scheme = mkOpt (enum [ "light" "dark" ]) "dark" "The color scheme to use."; + color-scheme = mkOpt (enum [ + "light" + "dark" + ]) "dark" "The color scheme to use."; wayland = mkBoolOpt true "Whether or not to use Wayland."; - suspend = - mkBoolOpt true "Whether or not to suspend the machine after inactivity."; + suspend = mkBoolOpt true "Whether or not to suspend the machine after inactivity."; monitors = mkOpt (nullOr path) null "The monitors.xml file to create."; extensions = mkOpt (listOf package) [ ] "Extra Gnome extensions to install."; }; @@ -61,7 +70,8 @@ in foot = enabled; }; - environment.systemPackages = with pkgs; + environment.systemPackages = + with pkgs; [ (hiPrio plusultra.xdg-open-with-portal) wl-clipboard @@ -81,9 +91,7 @@ in ]; systemd.tmpfiles.rules = - [ - "d ${gdmHome}/.config 0711 gdm gdm" - ] + [ "d ${gdmHome}/.config 0711 gdm gdm" ] ++ ( # "./monitors.xml" comes from ~/.config/monitors.xml when GNOME # display information is updated. @@ -102,7 +110,9 @@ in script = '' config_file=/var/lib/AccountsService/users/${config.${namespace}.user.name} - icon_file=/run/current-system/sw/share/plusultra-icons/user/${config.${namespace}.user.name}/${config.${namespace}.user.icon.fileName} + icon_file=/run/current-system/sw/share/plusultra-icons/user/${config.${namespace}.user.name}/${ + config.${namespace}.user.icon.fileName + } if ! [ -d "$(dirname "$config_file")"]; then mkdir -p "$(dirname "$config_file")" @@ -145,10 +155,8 @@ in dconf.settings = let user = config.users.users.${config.${namespace}.user.name}; - get-wallpaper = wallpaper: - if lib.isDerivation wallpaper - then builtins.toString wallpaper - else wallpaper; + get-wallpaper = + wallpaper: if lib.isDerivation wallpaper then builtins.toString wallpaper else wallpaper; in nested-default-attrs { "org/gnome/shell" = { @@ -180,10 +188,7 @@ in picture-uri-dark = get-wallpaper cfg.wallpaper.dark; }; "org/gnome/desktop/interface" = { - color-scheme = - if cfg.color-scheme == "light" - then "default" - else "prefer-dark"; + color-scheme = if cfg.color-scheme == "light" then "default" else "prefer-dark"; enable-hot-corners = false; }; "org/gnome/desktop/peripherals/mouse" = { @@ -267,9 +272,10 @@ in menu-button-icon-image = 23; menu-button-terminal = - if config.${namespace}.desktop.addons.term.enable - then lib.getExe config.${namespace}.desktop.addons.term.pkg - else lib.getExe pkgs.gnome.gnome-terminal; + if config.${namespace}.desktop.addons.term.enable then + lib.getExe config.${namespace}.desktop.addons.term.pkg + else + lib.getExe pkgs.gnome.gnome-terminal; }; "org/gnome/shell/extensions/aylurs-widgets" = { @@ -300,9 +306,7 @@ in "appMenu" ]; - center-box-order = [ - "Space Bar" - ]; + center-box-order = [ "Space Bar" ]; right-box-order = [ "keyboard" diff --git a/modules/nixos/desktop/hyprland/default.nix b/modules/nixos/desktop/hyprland/default.nix index d9092046..5a429262 100644 --- a/modules/nixos/desktop/hyprland/default.nix +++ b/modules/nixos/desktop/hyprland/default.nix @@ -1,14 +1,22 @@ -{ options -, config -, lib -, pkgs -, namespace -, ... +{ + options, + config, + lib, + pkgs, + namespace, + ... }: let cfg = config.${namespace}.desktop.hyprland; - inherit (lib) mkIf mkEnableOption mkOption mkMerge types optional; + inherit (lib) + mkIf + mkEnableOption + mkOption + mkMerge + types + optional + ; inherit (lib.${namespace}) enabled colors; pamixer = lib.getExe pkgs.pamixer; @@ -38,7 +46,11 @@ in }; wallpaper = mkOption { - type = types.oneOf [ types.package types.path types.str ]; + type = types.oneOf [ + types.package + types.path + types.str + ]; default = pkgs.plusultra.wallpapers.nord-rainbow-dark-nix; description = "The wallpaper to use."; }; @@ -267,12 +279,9 @@ in ", XF86AudioRaiseVolume, exec, volumectl up 5" ]; - windowrule = [ - ]; + windowrule = [ ]; - layerrule = [ - "noanim, ^avalanche-" - ]; + layerrule = [ "noanim, ^avalanche-" ]; # Programs to run on startup exec-once = diff --git a/modules/nixos/desktop/sway/default.nix b/modules/nixos/desktop/sway/default.nix index 507985fb..00423299 100644 --- a/modules/nixos/desktop/sway/default.nix +++ b/modules/nixos/desktop/sway/default.nix @@ -7,19 +7,20 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.desktop.sway; term = config.${namespace}.desktop.addons.term; substitutedConfig = pkgs.substituteAll { src = ./config; term = term.pkg.pname or term.pkg.name; }; -in { +in +{ options.${namespace}.desktop.sway = with types; { enable = mkBoolOpt false "Whether or not to enable Sway."; wallpaper = mkOpt (nullOr package) null "The wallpaper to display."; - extraConfig = - mkOpt str "" "Additional configuration for the Sway config file."; + extraConfig = mkOpt str "" "Additional configuration for the Sway config file."; }; config = mkIf cfg.enable { @@ -115,18 +116,18 @@ in { # configuring sway itself (assmung a display manager starts it) systemd.user.targets.sway-session = { description = "Sway compositor session"; - documentation = ["man:systemd.special(7)"]; - bindsTo = ["graphical-session.target"]; - wants = ["graphical-session-pre.target"]; - after = ["graphical-session-pre.target"]; + documentation = [ "man:systemd.special(7)" ]; + bindsTo = [ "graphical-session.target" ]; + wants = [ "graphical-session-pre.target" ]; + after = [ "graphical-session-pre.target" ]; }; systemd.user.services.sway = { description = "Sway - Wayland window manager"; - documentation = ["man:sway(5)"]; - bindsTo = ["graphical-session.target"]; - wants = ["graphical-session-pre.target"]; - after = ["graphical-session-pre.target"]; + documentation = [ "man:sway(5)" ]; + bindsTo = [ "graphical-session.target" ]; + wants = [ "graphical-session-pre.target" ]; + after = [ "graphical-session-pre.target" ]; # We explicitly unset PATH here, as we want it to be set by # systemctl --user import-environment in startsway environment.PATH = lib.mkForce null; diff --git a/modules/nixos/hardware/audio/default.nix b/modules/nixos/hardware/audio/default.nix index ab5406f3..951cf416 100644 --- a/modules/nixos/hardware/audio/default.nix +++ b/modules/nixos/hardware/audio/default.nix @@ -10,102 +10,115 @@ # broken my setup. I'll need to invest some time to figure out how to override Alsa things # again... with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.hardware.audio; lua-format = { - type = with lib.types; let - valueType = - nullOr - (oneOf [ - bool - int - float - str - path - (attrsOf valueType) - (listOf valueType) - ]) - // { - description = "Lua value"; - }; - in + type = + with lib.types; + let + valueType = + nullOr (oneOf [ + bool + int + float + str + path + (attrsOf valueType) + (listOf valueType) + ]) + // { + description = "Lua value"; + }; + in valueType; - generate = name: value: let - toLuaValue = value: - if value == null - then "null" - else if value == true - then "true" - else if value == false - then "false" - else if builtins.isInt value || builtins.isFloat value - then builtins.toString value - else if builtins.isString value - then toLuaString value - else if builtins.isAttrs value - then toLuaTable value - else if builtins.isList value - then toLuaList value - else builtins.abort "Unsupported value used with formats.lua.generate: ${value}"; - - toLuaString = value: "\"${builtins.toString value}\""; - - toLuaTable = value: let - pairs = - mapAttrsToList - (name: value: "[${toLuaString name}] = ${toLuaValue value}") - value; - content = concatStringsSep ", " pairs; - in "{ ${content} }"; - - toLuaList = value: let - parts = builtins.map toLuaValue value; - content = concatStringsSep ", " parts; - in "{ ${content} }"; - in + generate = + name: value: + let + toLuaValue = + value: + if value == null then + "null" + else if value == true then + "true" + else if value == false then + "false" + else if builtins.isInt value || builtins.isFloat value then + builtins.toString value + else if builtins.isString value then + toLuaString value + else if builtins.isAttrs value then + toLuaTable value + else if builtins.isList value then + toLuaList value + else + builtins.abort "Unsupported value used with formats.lua.generate: ${value}"; + + toLuaString = value: "\"${builtins.toString value}\""; + + toLuaTable = + value: + let + pairs = mapAttrsToList (name: value: "[${toLuaString name}] = ${toLuaValue value}") value; + content = concatStringsSep ", " pairs; + in + "{ ${content} }"; + + toLuaList = + value: + let + parts = builtins.map toLuaValue value; + content = concatStringsSep ", " parts; + in + "{ ${content} }"; + in toLuaValue value; }; pipewire-config = { - "context.objects" = cfg.nodes ++ []; - "context.modules" = - [ - { - name = "libpipewire-module-rtkit"; - args = {}; - flags = ["ifexists" "nofail"]; - } - {name = "libpipewire-module-protocol-native";} - {name = "libpipewire-module-profiler";} - # { - # name = "libpipewire-module-metadata"; - # flags = [ "ifexists" "nofail" ]; - # } - {name = "libpipewire-module-spa-device-factory";} - {name = "libpipewire-module-spa-node-factory";} - # { - # name = "libpipewire-module-client-node"; - # flags = [ "ifexists" "nofail" ]; - # } - # { - # name = "libpipewire-module-client-device"; - # flags = [ "ifexists" "nofail" ]; - # } - { - name = "libpipewire-module-portal"; - flags = ["ifexists" "nofail"]; - } - { - name = "libpipewire-module-access"; - args = {}; - } - {name = "libpipewire-module-adapter";} - {name = "libpipewire-module-link-factory";} - {name = "libpipewire-module-session-manager";} - ] - ++ cfg.modules; + "context.objects" = cfg.nodes ++ [ ]; + "context.modules" = [ + { + name = "libpipewire-module-rtkit"; + args = { }; + flags = [ + "ifexists" + "nofail" + ]; + } + { name = "libpipewire-module-protocol-native"; } + { name = "libpipewire-module-profiler"; } + # { + # name = "libpipewire-module-metadata"; + # flags = [ "ifexists" "nofail" ]; + # } + { name = "libpipewire-module-spa-device-factory"; } + { name = "libpipewire-module-spa-node-factory"; } + # { + # name = "libpipewire-module-client-node"; + # flags = [ "ifexists" "nofail" ]; + # } + # { + # name = "libpipewire-module-client-device"; + # flags = [ "ifexists" "nofail" ]; + # } + { + name = "libpipewire-module-portal"; + flags = [ + "ifexists" + "nofail" + ]; + } + { + name = "libpipewire-module-access"; + args = { }; + } + { name = "libpipewire-module-adapter"; } + { name = "libpipewire-module-link-factory"; } + { name = "libpipewire-module-session-manager"; } + ] ++ cfg.modules; "context.components" = [ { name = "libwireplumber-module-lua-scripting"; @@ -121,16 +134,13 @@ with lib.${namespace}; let alsa-config = { alsa_monitor = cfg.alsa-monitor; }; -in { +in +{ options.${namespace}.hardware.audio = with types; { enable = mkBoolOpt false "Whether or not to enable audio support."; - alsa-monitor = mkOpt attrs {} "Alsa configuration."; - nodes = - mkOpt (listOf attrs) [] - "Audio nodes to pass to Pipewire as `context.objects`."; - modules = - mkOpt (listOf attrs) [] - "Audio modules to pass to Pipewire as `context.modules`."; + alsa-monitor = mkOpt attrs { } "Alsa configuration."; + nodes = mkOpt (listOf attrs) [ ] "Audio nodes to pass to Pipewire as `context.objects`."; + modules = mkOpt (listOf attrs) [ ] "Audio modules to pass to Pipewire as `context.modules`."; extra-packages = mkOpt (listOf package) [ pkgs.qjackctl pkgs.easyeffects @@ -175,21 +185,25 @@ in { hardware.pulseaudio.enable = mkForce false; - environment.systemPackages = with pkgs; + environment.systemPackages = + with pkgs; [ pulsemixer pavucontrol ] ++ cfg.extra-packages; - plusultra.user.extraGroups = ["audio"]; + plusultra.user.extraGroups = [ "audio" ]; plusultra.home.extraOptions = { systemd.user.services.mpris-proxy = { Unit.Description = "Mpris proxy"; - Unit.After = ["network.target" "sound.target"]; + Unit.After = [ + "network.target" + "sound.target" + ]; Service.ExecStart = "${pkgs.bluez}/bin/mpris-proxy"; - Install.WantedBy = ["default.target"]; + Install.WantedBy = [ "default.target" ]; }; }; }; diff --git a/modules/nixos/hardware/fingerprint/default.nix b/modules/nixos/hardware/fingerprint/default.nix index 725b94e9..b9400b7b 100644 --- a/modules/nixos/hardware/fingerprint/default.nix +++ b/modules/nixos/hardware/fingerprint/default.nix @@ -7,12 +7,14 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.hardware.fingerprint; -in { +in +{ options.${namespace}.hardware.fingerprint = with types; { enable = mkBoolOpt false "Whether or not to enable fingerprint support."; }; - config = mkIf cfg.enable {services.fprintd.enable = true;}; + config = mkIf cfg.enable { services.fprintd.enable = true; }; } diff --git a/modules/nixos/hardware/networking/default.nix b/modules/nixos/hardware/networking/default.nix index 939272d3..a5933934 100644 --- a/modules/nixos/hardware/networking/default.nix +++ b/modules/nixos/hardware/networking/default.nix @@ -7,25 +7,23 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.hardware.networking; -in { +in +{ options.${namespace}.hardware.networking = with types; { enable = mkBoolOpt false "Whether or not to enable networking support"; - hosts = - mkOpt attrs {} - (mdDoc "An attribute set to merge with `networking.hosts`"); + hosts = mkOpt attrs { } (mdDoc "An attribute set to merge with `networking.hosts`"); }; config = mkIf cfg.enable { - plusultra.user.extraGroups = ["networkmanager"]; + plusultra.user.extraGroups = [ "networkmanager" ]; networking = { - hosts = - { - "127.0.0.1" = ["local.test"] ++ (cfg.hosts."127.0.0.1" or []); - } - // cfg.hosts; + hosts = { + "127.0.0.1" = [ "local.test" ] ++ (cfg.hosts."127.0.0.1" or [ ]); + } // cfg.hosts; networkmanager = { enable = true; diff --git a/modules/nixos/hardware/storage/default.nix b/modules/nixos/hardware/storage/default.nix index 1672ffff..8006d920 100644 --- a/modules/nixos/hardware/storage/default.nix +++ b/modules/nixos/hardware/storage/default.nix @@ -7,16 +7,19 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.hardware.storage; -in { +in +{ options.${namespace}.hardware.storage = with types; { - enable = - mkBoolOpt false - "Whether or not to enable support for extra storage devices."; + enable = mkBoolOpt false "Whether or not to enable support for extra storage devices."; }; config = mkIf cfg.enable { - environment.systemPackages = with pkgs; [ntfs3g fuseiso]; + environment.systemPackages = with pkgs; [ + ntfs3g + fuseiso + ]; }; } diff --git a/modules/nixos/home/default.nix b/modules/nixos/home/default.nix index a0fed69f..4d647c9b 100644 --- a/modules/nixos/home/default.nix +++ b/modules/nixos/home/default.nix @@ -8,17 +8,17 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.home; -in { +in +{ options.${namespace}.home = with types; { - file = - mkOpt attrs {} - (mdDoc "A set of files to be managed by home-manager's `home.file`."); - configFile = - mkOpt attrs {} - (mdDoc "A set of files to be managed by home-manager's `xdg.configFile`."); - extraOptions = mkOpt attrs {} "Options to pass directly to home-manager."; + file = mkOpt attrs { } (mdDoc "A set of files to be managed by home-manager's `home.file`."); + configFile = mkOpt attrs { } ( + mdDoc "A set of files to be managed by home-manager's `xdg.configFile`." + ); + extraOptions = mkOpt attrs { } "Options to pass directly to home-manager."; }; config = { @@ -29,7 +29,8 @@ in { xdg.configFile = mkAliasDefinitions options.${namespace}.home.configFile; }; - snowfallorg.users.${config.${namespace}.user.name}.home.config = config.${namespace}.home.extraOptions; + snowfallorg.users.${config.${namespace}.user.name}.home.config = + config.${namespace}.home.extraOptions; home-manager = { useUserPackages = true; diff --git a/modules/nixos/nix/default.nix b/modules/nixos/nix/default.nix index c7015b37..b87951a2 100644 --- a/modules/nixos/nix/default.nix +++ b/modules/nixos/nix/default.nix @@ -8,41 +8,43 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.nix; - substituters-submodule = types.submodule ({name, ...}: { - options = with types; { - key = mkOpt (nullOr str) null "The trusted public key for this substituter."; - }; - }); -in { + substituters-submodule = types.submodule ( + { name, ... }: + { + options = with types; { + key = mkOpt (nullOr str) null "The trusted public key for this substituter."; + }; + } + ); +in +{ options.${namespace}.nix = with types; { enable = mkBoolOpt true "Whether or not to manage nix configuration."; package = mkOpt package pkgs.nix "Which nix package to use."; default-substituter = { url = mkOpt str "https://cache.nixos.org" "The url for the substituter."; - key = mkOpt str "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" "The trusted public key for the substituter."; + key = + mkOpt str "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" + "The trusted public key for the substituter."; }; - extra-substituters = mkOpt (attrsOf substituters-submodule) {} "Extra substituters to configure."; + extra-substituters = mkOpt (attrsOf substituters-submodule) { } "Extra substituters to configure."; }; config = mkIf cfg.enable { - assertions = - mapAttrsToList - (name: value: { - assertion = value.key != null; - message = "plusultra.nix.extra-substituters.${name}.key must be set"; - }) - cfg.extra-substituters; + assertions = mapAttrsToList (name: value: { + assertion = value.key != null; + message = "plusultra.nix.extra-substituters.${name}.key must be set"; + }) cfg.extra-substituters; environment.systemPackages = with pkgs; [ plusultra.nixos-revision - (plusultra.nixos-hosts.override { - hosts = inputs.self.nixosConfigurations; - }) + (plusultra.nixos-hosts.override { hosts = inputs.self.nixosConfigurations; }) deploy-rs nixfmt-rfc-style nix-index @@ -52,46 +54,49 @@ in { snowfallorg.drift ]; - nix = let - users = - ["root" config.${namespace}.user.name] - ++ optional config.services.hydra.enable "hydra"; - in { - package = cfg.package; + nix = + let + users = [ + "root" + config.${namespace}.user.name + ] ++ optional config.services.hydra.enable "hydra"; + in + { + package = cfg.package; - settings = - { - experimental-features = "nix-command flakes"; - http-connections = 50; - warn-dirty = false; - log-lines = 50; - sandbox = "relaxed"; - auto-optimise-store = true; - trusted-users = users; - allowed-users = users; + settings = + { + experimental-features = "nix-command flakes"; + http-connections = 50; + warn-dirty = false; + log-lines = 50; + sandbox = "relaxed"; + auto-optimise-store = true; + trusted-users = users; + allowed-users = users; - substituters = - [cfg.default-substituter.url] - ++ (mapAttrsToList (name: value: name) cfg.extra-substituters); - trusted-public-keys = - [cfg.default-substituter.key] - ++ (mapAttrsToList (name: value: value.key) cfg.extra-substituters); - } - // (lib.optionalAttrs config.${namespace}.tools.direnv.enable { - keep-outputs = true; - keep-derivations = true; - }); + substituters = [ + cfg.default-substituter.url + ] ++ (mapAttrsToList (name: value: name) cfg.extra-substituters); + trusted-public-keys = [ + cfg.default-substituter.key + ] ++ (mapAttrsToList (name: value: value.key) cfg.extra-substituters); + } + // (lib.optionalAttrs config.${namespace}.tools.direnv.enable { + keep-outputs = true; + keep-derivations = true; + }); - gc = { - automatic = true; - dates = "weekly"; - options = "--delete-older-than 30d"; - }; + gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 30d"; + }; - # flake-utils-plus - generateRegistryFromInputs = true; - generateNixPathFromInputs = true; - linkInputs = true; - }; + # flake-utils-plus + generateRegistryFromInputs = true; + generateNixPathFromInputs = true; + linkInputs = true; + }; }; } diff --git a/modules/nixos/security/acme/default.nix b/modules/nixos/security/acme/default.nix index f10ee1db..bba4812f 100644 --- a/modules/nixos/security/acme/default.nix +++ b/modules/nixos/security/acme/default.nix @@ -5,12 +5,14 @@ virtual, namespace, ... -}: let +}: +let inherit (lib) mkIf mkEnableOption optional; inherit (lib.${namespace}) mkOpt; cfg = config.${namespace}.security.acme; -in { +in +{ options.${namespace}.security.acme = with lib.types; { enable = mkEnableOption "default ACME configuration"; email = mkOpt str config.${namespace}.user.email "The email to use."; diff --git a/modules/nixos/security/doas/default.nix b/modules/nixos/security/doas/default.nix index a24c34b3..97c1b5b9 100644 --- a/modules/nixos/security/doas/default.nix +++ b/modules/nixos/security/doas/default.nix @@ -7,9 +7,11 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.security.doas; -in { +in +{ options.${namespace}.security.doas = { enable = mkBoolOpt false "Whether or not to replace sudo with doas."; }; @@ -23,7 +25,7 @@ in { enable = true; extraRules = [ { - users = [config.${namespace}.user.name]; + users = [ config.${namespace}.user.name ]; noPass = true; keepEnv = true; } @@ -31,6 +33,8 @@ in { }; # Add an alias to the shell for backward-compat and convenience. - environment.shellAliases = {sudo = "doas";}; + environment.shellAliases = { + sudo = "doas"; + }; }; } diff --git a/modules/nixos/security/gpg/default.nix b/modules/nixos/security/gpg/default.nix index 3ae3c28b..22d32f42 100644 --- a/modules/nixos/security/gpg/default.nix +++ b/modules/nixos/security/gpg/default.nix @@ -8,7 +8,8 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.security.gpg; gpgConf = "${inputs.gpg-base-conf}/gpg.conf"; @@ -29,7 +30,7 @@ with lib.${namespace}; let sha256 = "1h48yqffpaz437f3c9hfryf23r95rr319lrb3y79kxpxbc9hihxb"; }; - guideHTML = pkgs.runCommand "yubikey-guide" {} '' + guideHTML = pkgs.runCommand "yubikey-guide" { } '' ${pkgs.pandoc}/bin/pandoc \ --standalone \ --metadata title="Yubikey Guide" \ @@ -49,13 +50,14 @@ with lib.${namespace}; let genericName = "View Yubikey Guide in a web browser"; exec = "${pkgs.xdg-utils}/bin/xdg-open ${guideHTML}"; icon = ./yubico-icon.svg; - categories = ["System"]; + categories = [ "System" ]; }; reload-yubikey = pkgs.writeShellScriptBin "reload-yubikey" '' ${pkgs.gnupg}/bin/gpg-connect-agent "scd serialno" "learn --force" /bye ''; -in { +in +{ options.${namespace}.security.gpg = with types; { enable = mkBoolOpt false "Whether or not to enable GPG."; agentTimeout = mkOpt int 5 "The amount of time to wait before continuing with shell init."; @@ -63,7 +65,7 @@ in { config = mkIf cfg.enable { services.pcscd.enable = true; - services.udev.packages = with pkgs; [yubikey-personalization]; + services.udev.packages = with pkgs; [ yubikey-personalization ]; # NOTE: This should already have been added by programs.gpg, but # keeping it here for now just in case. diff --git a/modules/nixos/security/keyring/default.nix b/modules/nixos/security/keyring/default.nix index 96b4c93e..d85b1923 100644 --- a/modules/nixos/security/keyring/default.nix +++ b/modules/nixos/security/keyring/default.nix @@ -7,9 +7,11 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.security.keyring; -in { +in +{ options.${namespace}.security.keyring = with types; { enable = mkBoolOpt false "Whether to enable gnome keyring."; }; diff --git a/modules/nixos/services/attic/default.nix b/modules/nixos/services/attic/default.nix index 5de85dfe..bdd70317 100644 --- a/modules/nixos/services/attic/default.nix +++ b/modules/nixos/services/attic/default.nix @@ -6,14 +6,15 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.services.attic; - toml-format = pkgs.formats.toml {}; + toml-format = pkgs.formats.toml { }; raw-server-toml = toml-format.generate "server.toml" cfg.settings; - server-toml = pkgs.runCommand "checked-server.toml" {config = raw-server-toml;} '' + server-toml = pkgs.runCommand "checked-server.toml" { config = raw-server-toml; } '' cat $config export ATTIC_SERVER_TOKEN_HS256_SECRET_BASE64="dGVzdCBzZWNyZXQ=" @@ -24,26 +25,32 @@ with lib.${namespace}; let cat < $config > $out ''; - is-local-postgres = let - url = cfg.settings.database.url or ""; - local-db-strings = ["localhost" "127.0.0.1" "/run/postgresql"]; - is-local-db-url = any (flip hasInfix url) local-db-strings; - in - config.services.postgresql.enable - && hasPrefix "postgresql://" url - && is-local-db-url; -in { + is-local-postgres = + let + url = cfg.settings.database.url or ""; + local-db-strings = [ + "localhost" + "127.0.0.1" + "/run/postgresql" + ]; + is-local-db-url = any (flip hasInfix url) local-db-strings; + in + config.services.postgresql.enable && hasPrefix "postgresql://" url && is-local-db-url; +in +{ options.${namespace}.services.attic = { enable = mkEnableOption "Attic"; package = mkOpt types.package pkgs.attic-server "The attic-server package to use."; - credentials = mkOpt (types.nullOr types.path) null "The path to an optional EnvironmentFile for the atticd service to use."; + credentials = + mkOpt (types.nullOr types.path) null + "The path to an optional EnvironmentFile for the atticd service to use."; user = mkOpt types.str "atticd" "The user under which attic runs."; group = mkOpt types.str "atticd" "The group under which attic runs."; - settings = mkOpt toml-format.type {} "Settings for the atticd config file."; + settings = mkOpt toml-format.type { } "Settings for the atticd config file."; }; config = mkIf cfg.enable { @@ -62,9 +69,7 @@ in { }; }; - groups = optionalAttrs (cfg.group == "atticd") { - atticd = {}; - }; + groups = optionalAttrs (cfg.group == "atticd") { atticd = { }; }; }; plusultra = { @@ -81,22 +86,21 @@ in { }; systemd.services.atticd = { - wantedBy = ["multi-user.target"]; + wantedBy = [ "multi-user.target" ]; after = - ["network.target"] - ++ optionals is-local-postgres ["postgresql.service" "nss-lookup.target"]; - - serviceConfig = - { - ExecStart = "${cfg.package}/bin/atticd -f ${server-toml}"; - StateDirectory = "atticd"; - User = cfg.user; - Group = cfg.group; - DynamicUser = true; - } - // optionalAttrs (cfg.credentials != null) { - EnvironmentFile = mkDefault cfg.credentials; - }; + [ "network.target" ] + ++ optionals is-local-postgres [ + "postgresql.service" + "nss-lookup.target" + ]; + + serviceConfig = { + ExecStart = "${cfg.package}/bin/atticd -f ${server-toml}"; + StateDirectory = "atticd"; + User = cfg.user; + Group = cfg.group; + DynamicUser = true; + } // optionalAttrs (cfg.credentials != null) { EnvironmentFile = mkDefault cfg.credentials; }; }; }; } diff --git a/modules/nixos/services/avahi/default.nix b/modules/nixos/services/avahi/default.nix index e47a5ecb..d5850df8 100644 --- a/modules/nixos/services/avahi/default.nix +++ b/modules/nixos/services/avahi/default.nix @@ -1,8 +1,9 @@ -{ lib -, config -, options -, namespace -, ... +{ + lib, + config, + options, + namespace, + ... }: let cfg = config.${namespace}.services.avahi; diff --git a/modules/nixos/services/cowsay-mastodon-poster/default.nix b/modules/nixos/services/cowsay-mastodon-poster/default.nix index 958d56a1..9be3097d 100644 --- a/modules/nixos/services/cowsay-mastodon-poster/default.nix +++ b/modules/nixos/services/cowsay-mastodon-poster/default.nix @@ -4,7 +4,8 @@ config, namespace, ... -}: let +}: +let inherit (lib) types mkIf; inherit (lib.${namespace}) mkBoolOpt mkOpt; inherit (pkgs) fortune toot; @@ -22,10 +23,8 @@ pushd $tmp_dir > /dev/null ${cow2img}/bin/cow2img --no-spinner ${ - if cfg.short - then "--message \"$(${fortune}/bin/fortune -s)\"" - else "" - } + if cfg.short then "--message \"$(${fortune}/bin/fortune -s)\"" else "" + } cow_name=$(cat ./cow/name) cow_message=$(cat ./cow/message) @@ -37,7 +36,8 @@ rm -rf $tmp_dir ''; -in { +in +{ options.${namespace}.services.cowsay-mastodon-poster = with types; { enable = mkBoolOpt false "Whether or not to enable cowsay posts."; short = mkBoolOpt false "Use short fortunes only."; @@ -48,7 +48,7 @@ in { config = mkIf cfg.enable { systemd = { timers.cowsay-mastodon-poster = { - wantedBy = ["timers.target"]; + wantedBy = [ "timers.target" ]; timerConfig = { # Run once a day at 10am. OnCalendar = "*-*-* 10:00:00"; @@ -57,7 +57,7 @@ in { }; services.cowsay-mastodon-poster = { - after = ["network-online.target"]; + after = [ "network-online.target" ]; description = "Post a cowsay image to Mastodon."; inherit script; diff --git a/modules/nixos/services/dex/default.nix b/modules/nixos/services/dex/default.nix index e941c8e3..b4d7e6f6 100644 --- a/modules/nixos/services/dex/default.nix +++ b/modules/nixos/services/dex/default.nix @@ -4,63 +4,52 @@ pkgs, namespace, ... -}: let +}: +let inherit (builtins) map removeAttrs; - inherit (lib) mapAttrs flatten concatMap concatMapStringsSep; + inherit (lib) + mapAttrs + flatten + concatMap + concatMapStringsSep + ; cfg = config.${namespace}.services.dex; - process-client-settings = client: - if client ? secretFile - then - (removeAttrs client ["secretFile"]) - // {secret = client.secretFile;} - else client; + process-client-settings = + client: + if client ? secretFile then + (removeAttrs client [ "secretFile" ]) // { secret = client.secretFile; } + else + client; settings = - mapAttrs - ( - name: value: - if name == "staticClients" - then map process-client-settings value - else value - ) - (cfg.settings - // { - storage = - (cfg.settings.storage or {}) - // { + mapAttrs (name: value: if name == "staticClients" then map process-client-settings value else value) + ( + cfg.settings + // { + storage = (cfg.settings.storage or { }) // { type = cfg.settings.storage.type or "sqlite3"; - config = - cfg.settings.storage.config - or { - file = "${cfg.stateDir}/dex.db"; - }; + config = cfg.settings.storage.config or { file = "${cfg.stateDir}/dex.db"; }; }; - }); + } + ); - secret-files = - concatMap - ( - client: - if client ? secretFile - then [client.secretFile] - else [] - ) - (settings.staticClients or []); + secret-files = concatMap (client: if client ? secretFile then [ client.secretFile ] else [ ]) ( + settings.staticClients or [ ] + ); - format = pkgs.formats.yaml {}; + format = pkgs.formats.yaml { }; configYaml = format.generate "config.yaml" settings; - replace-config-secrets = - pkgs.writeShellScript "replace-config-secrets" - ( - concatMapStringsSep "\n" - (file: "${pkgs.replace-secret}/bin/replace-secret '${file}' '${file}' ${cfg.stateDir}/config.yaml") - secret-files - ); -in { + replace-config-secrets = pkgs.writeShellScript "replace-config-secrets" ( + concatMapStringsSep "\n" ( + file: "${pkgs.replace-secret}/bin/replace-secret '${file}' '${file}' ${cfg.stateDir}/config.yaml" + ) secret-files + ); +in +{ options.${namespace}.services.dex = { enable = lib.mkEnableOption "Dex, the OpenID Connect and OAuth 2 identity provider"; @@ -84,7 +73,7 @@ in { settings = lib.mkOption { type = format.type; - default = {}; + default = { }; example = lib.literalExpression '' { # External url @@ -126,21 +115,17 @@ in { }; }; - groups = lib.optionalAttrs (cfg.group == "dex") { - dex = {}; - }; + groups = lib.optionalAttrs (cfg.group == "dex") { dex = { }; }; }; systemd = { - tmpfiles.rules = [ - "d '${cfg.stateDir}' 0750 ${cfg.user} ${cfg.group}" - ]; + tmpfiles.rules = [ "d '${cfg.stateDir}' 0750 ${cfg.user} ${cfg.group}" ]; services = { dex = { description = "dex identity provider"; - wantedBy = ["multi-user.target"]; - after = ["networking.target"]; + wantedBy = [ "multi-user.target" ]; + after = [ "networking.target" ]; preStart = '' cp --remove-destination ${configYaml} ${cfg.stateDir}/config.yaml @@ -166,7 +151,9 @@ in { "-/etc/localtime" "-/etc/dex" ]; - BindPaths = [cfg.stateDir] ++ lib.optional (settings.storage.type == "postgres") "/var/run/postgresql"; + BindPaths = [ + cfg.stateDir + ] ++ lib.optional (settings.storage.type == "postgres") "/var/run/postgresql"; CapabilityBoundingSet = "CAP_NET_BIND_SERVICE"; ## ProtectClock= adds DeviceAllow=char-rtc r #DeviceAllow = ""; diff --git a/modules/nixos/services/dex/default.orig.nix b/modules/nixos/services/dex/default.orig.nix index 3ec64ef7..a1290963 100644 --- a/modules/nixos/services/dex/default.orig.nix +++ b/modules/nixos/services/dex/default.orig.nix @@ -1,22 +1,40 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: with lib; let cfg = config.services.dex; - fixClient = client: if client ? secretFile then ((builtins.removeAttrs client [ "secretFile" ]) // { secret = client.secretFile; }) else client; - filteredSettings = mapAttrs (n: v: if n == "staticClients" then (builtins.map fixClient v) else v) cfg.settings; - secretFiles = flatten (builtins.map (c: if c ? secretFile then [ c.secretFile ] else [ ]) (cfg.settings.staticClients or [ ])); + fixClient = + client: + if client ? secretFile then + ((builtins.removeAttrs client [ "secretFile" ]) // { secret = client.secretFile; }) + else + client; + filteredSettings = mapAttrs ( + n: v: if n == "staticClients" then (builtins.map fixClient v) else v + ) cfg.settings; + secretFiles = flatten ( + builtins.map (c: if c ? secretFile then [ c.secretFile ] else [ ]) ( + cfg.settings.staticClients or [ ] + ) + ); settingsFormat = pkgs.formats.yaml { }; configFile = settingsFormat.generate "config.yaml" filteredSettings; - startPreScript = pkgs.writeShellScript "dex-start-pre" ('' - '' + (concatStringsSep "\n" (builtins.map - (file: '' - ${pkgs.replace-secret}/bin/replace-secret '${file}' '${file}' /run/dex/config.yaml - '') - secretFiles))); + startPreScript = pkgs.writeShellScript "dex-start-pre" ( + '''' + + (concatStringsSep "\n" ( + builtins.map (file: '' + ${pkgs.replace-secret}/bin/replace-secret '${file}' '${file}' /run/dex/config.yaml + '') secretFiles + )) + ); in { options.services.dex = { @@ -58,7 +76,9 @@ in systemd.services.dex = { description = "dex identity provider"; wantedBy = [ "multi-user.target" ]; - after = [ "networking.target" ] ++ (optional (cfg.settings.storage.type == "postgres") "postgresql.service"); + after = [ + "networking.target" + ] ++ (optional (cfg.settings.storage.type == "postgres") "postgresql.service"); serviceConfig = { ExecStart = "${pkgs.dex-oidc}/bin/dex serve /run/dex/config.yaml"; @@ -102,12 +122,19 @@ in ProtectKernelModules = true; ProtectKernelTunables = true; ProtectProc = "invisible"; - RestrictAddressFamilies = [ "AF_INET" "AF_INET6" "AF_UNIX" ]; + RestrictAddressFamilies = [ + "AF_INET" + "AF_INET6" + "AF_UNIX" + ]; RestrictNamespaces = true; RestrictRealtime = true; RestrictSUIDSGID = true; SystemCallArchitectures = "native"; - SystemCallFilter = [ "@system-service" "~@privileged @resources @setuid @keyring" ]; + SystemCallFilter = [ + "@system-service" + "~@privileged @resources @setuid @keyring" + ]; TemporaryFileSystem = "/:ro"; # Does not work well with the temporary root #UMask = "0066"; @@ -118,4 +145,3 @@ in # uses attributes of the linked package meta.buildDocsInSandbox = false; } - diff --git a/modules/nixos/services/homer/default.nix b/modules/nixos/services/homer/default.nix index bc53d393..ab1ade3d 100644 --- a/modules/nixos/services/homer/default.nix +++ b/modules/nixos/services/homer/default.nix @@ -6,24 +6,26 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.services.homer; - yaml-format = pkgs.formats.yaml {}; + yaml-format = pkgs.formats.yaml { }; settings-yaml = yaml-format.generate "config.yml" cfg.settings; settings-path = - if cfg.settings-path != null - then cfg.settings-path - else builtins.toString settings-yaml; -in { + if cfg.settings-path != null then cfg.settings-path else builtins.toString settings-yaml; +in +{ options.${namespace}.services.homer = { enable = mkEnableOption "Homer"; package = mkOpt types.package pkgs.plusultra.homer "The package of Homer assets to use."; - settings = mkOpt yaml-format.type {} "Configuration for Homer's config.yml file."; - settings-path = mkOpt (types.nullOr types.path) null "A replacement for the generated config.yml file."; + settings = mkOpt yaml-format.type { } "Configuration for Homer's config.yml file."; + settings-path = + mkOpt (types.nullOr types.path) null + "A replacement for the generated config.yml file."; host = mkOpt (types.nullOr types.str) null "The host to serve Homer on."; @@ -51,7 +53,7 @@ in { message = "plusultra.services.homer.host must be set."; } { - assertion = cfg.settings-path != null -> cfg.settings == {}; + assertion = cfg.settings-path != null -> cfg.settings == { }; message = "plusultra.services.homer.settings and plusultra.services.homer.settings-path are mutually exclusive."; } { diff --git a/modules/nixos/services/infrared/default.nix b/modules/nixos/services/infrared/default.nix index 0d122791..3005c59b 100644 --- a/modules/nixos/services/infrared/default.nix +++ b/modules/nixos/services/infrared/default.nix @@ -5,71 +5,76 @@ pkgs, namespace, ... -}: let +}: +let inherit (builtins) toString; inherit (lib) types; cfg = config.${namespace}.services.infrared; - format = pkgs.formats.json {}; - - serversType = types.submodule ({config, ...}: { - options = { - domain = lib.mkOption { - type = types.str; - default = ""; - description = '' - The domain to proxy. Should be fully qualified domain name. - Note: Every string is accepted. So localhost is also valid. - ''; - example = "minecraft.example.com"; - }; - - host = lib.mkOption { - type = types.str; - default = ""; - description = "The host where the Minecraft server is running. Defaults to local host."; - }; + format = pkgs.formats.json { }; + + serversType = types.submodule ( + { config, ... }: + { + options = { + domain = lib.mkOption { + type = types.str; + default = ""; + description = '' + The domain to proxy. Should be fully qualified domain name. + Note: Every string is accepted. So localhost is also valid. + ''; + example = "minecraft.example.com"; + }; - port = lib.mkOption { - type = types.port; - default = 25566; - description = "The port where the Minecraft server is running."; - }; + host = lib.mkOption { + type = types.str; + default = ""; + description = "The host where the Minecraft server is running. Defaults to local host."; + }; - settings = lib.mkOption { - default = {}; - description = '' - Infrared configuration (config.json). Refer to - - for details. - ''; - - type = types.submodule { - freeformType = format.type; - - options = { - domainName = lib.mkOption { - type = types.str; - default = config.domain; - defaultText = lib.literalExpression '' - "" - ''; - description = "The domain to proxy."; - }; + port = lib.mkOption { + type = types.port; + default = 25566; + description = "The port where the Minecraft server is running."; + }; - proxyTo = lib.mkOption { - type = types.str; - default = "${config.host}:${toString config.port}"; - defaultText = ":25565"; - description = "The address that the proxy should send incoming connections to."; + settings = lib.mkOption { + default = { }; + description = '' + Infrared configuration (config.json). Refer to + + for details. + ''; + + type = types.submodule { + freeformType = format.type; + + options = { + domainName = lib.mkOption { + type = types.str; + default = config.domain; + defaultText = lib.literalExpression '' + "" + ''; + description = "The domain to proxy."; + }; + + proxyTo = lib.mkOption { + type = types.str; + default = "${config.host}:${toString config.port}"; + defaultText = ":25565"; + description = "The address that the proxy should send incoming connections to."; + }; }; }; }; }; - }; - }); -in { + } + ); +in +{ options.${namespace}.services.infrared = { enable = lib.mkEnableOption "Infrared"; @@ -99,7 +104,7 @@ in { servers = lib.mkOption { type = types.listOf serversType; - default = []; + default = [ ]; description = "The servers to proxy."; example = lib.literalExpression '' [ @@ -113,8 +118,7 @@ in { }; config = lib.mkIf cfg.enable { - assertions = [ - ]; + assertions = [ ]; networking.firewall = lib.mkIf cfg.openFirewall { allowedUDPPorts = builtins.map (server: server.port) cfg.servers; @@ -122,18 +126,18 @@ in { }; systemd.tmpfiles.rules = - ["d '${cfg.stateDir}' 0750 ${cfg.user} ${cfg.group} - -"] - ++ builtins.map - ( - server: let + [ "d '${cfg.stateDir}' 0750 ${cfg.user} ${cfg.group} - -" ] + ++ builtins.map ( + server: + let config = format.generate "${server.domain}.json" server.settings; - in "L+ '${cfg.stateDir}/${server.domain}.json' - - - - ${config}" - ) - cfg.servers; + in + "L+ '${cfg.stateDir}/${server.domain}.json' - - - - ${config}" + ) cfg.servers; systemd.services.infrared = { - after = ["network.target"]; - wantedBy = ["multi-user.target"]; + after = [ "network.target" ]; + wantedBy = [ "multi-user.target" ]; serviceConfig = { Type = "simple"; @@ -153,9 +157,7 @@ in { }; }; - groups = lib.optionalAttrs (cfg.group == "infrared") { - infrared = {}; - }; + groups = lib.optionalAttrs (cfg.group == "infrared") { infrared = { }; }; }; }; } diff --git a/modules/nixos/services/local-ai/default.nix b/modules/nixos/services/local-ai/default.nix index 00b9c0d6..09fc312d 100644 --- a/modules/nixos/services/local-ai/default.nix +++ b/modules/nixos/services/local-ai/default.nix @@ -4,31 +4,40 @@ config, namespace, ... -}: let +}: +let cfg = config.${namespace}.services.local-ai; - inherit (lib) mkEnableOption mkIf types optionalAttrs optionalString; + inherit (lib) + mkEnableOption + mkIf + types + optionalAttrs + optionalString + ; inherit (lib.${namespace}) mkOpt; address = "${cfg.host}:${toString cfg.port}"; prepare-models-directory = - if cfg.models == null - then '' - if [[ -L '${cfg.stateDir}/models' ]]; then - rm -rf '${cfg.stateDir}/models' - fi - - mkdir -p '${cfg.stateDir}/models' - '' - else '' - if [[ -d '${cfg.stateDir}/models' ]]; then - rm -rf '${cfg.stateDir}/models' - fi - - ln -s '${cfg.models}' '${cfg.stateDir}/models' - ''; -in { + if cfg.models == null then + '' + if [[ -L '${cfg.stateDir}/models' ]]; then + rm -rf '${cfg.stateDir}/models' + fi + + mkdir -p '${cfg.stateDir}/models' + '' + else + '' + if [[ -d '${cfg.stateDir}/models' ]]; then + rm -rf '${cfg.stateDir}/models' + fi + + ln -s '${cfg.models}' '${cfg.stateDir}/models' + ''; +in +{ options.${namespace}.services.local-ai = { enable = mkEnableOption "LocalAI"; @@ -38,7 +47,9 @@ in { group = mkOpt types.str "localai" "Group under which LocalAI is ran."; - stateDir = mkOpt types.path "/var/lib/local-ai" "The state directory where keys and data are stored."; + stateDir = + mkOpt types.path "/var/lib/local-ai" + "The state directory where keys and data are stored."; # The models directory should contain models as well as templates and configuration. # For example, to fetch a model: @@ -57,7 +68,7 @@ in { cors = { enable = mkOpt types.bool false "Allow cross origin requests."; - allow = mkOpt (types.listOf types.str) ["*"] "The origin to allow."; + allow = mkOpt (types.listOf types.str) [ "*" ] "The origin to allow."; }; }; @@ -71,25 +82,21 @@ in { }; }; - groups = - optionalAttrs (cfg.group == "localai") {localai = {};}; + groups = optionalAttrs (cfg.group == "localai") { localai = { }; }; }; - systemd.tmpfiles.rules = [ - "d '${cfg.stateDir}' 0750 ${cfg.user} ${cfg.group} -" - ]; + systemd.tmpfiles.rules = [ "d '${cfg.stateDir}' 0750 ${cfg.user} ${cfg.group} -" ]; systemd.services.local-ai = { - after = ["network.target"]; - wantedBy = ["multi-user.target"]; + after = [ "network.target" ]; + wantedBy = [ "multi-user.target" ]; environment = - {ADDRESS = address;} + { + ADDRESS = address; + } // optionalAttrs cfg.cors.enable { - CORS = - if cfg.cors.enable - then "true" - else "false"; + CORS = if cfg.cors.enable then "true" else "false"; CORS_ALLOW_ORIGINS = builtins.toString cfg.cors.allow; }; diff --git a/modules/nixos/services/minecraft/default.nix b/modules/nixos/services/minecraft/default.nix index a7e69019..123f89d3 100644 --- a/modules/nixos/services/minecraft/default.nix +++ b/modules/nixos/services/minecraft/default.nix @@ -5,11 +5,13 @@ pkgs, namespace, ... -}: let +}: +let inherit (lib) types; cfg = config.${namespace}.services.minecraft; -in { +in +{ options.${namespace}.services.minecraft = { enable = lib.mkEnableOption "Minecraft server"; @@ -28,7 +30,7 @@ in { }; servers = lib.mkOption { - default = {}; + default = { }; description = "The Minecraft servers to run."; example = lib.literalExpression '' { @@ -63,142 +65,150 @@ in { } ''; - type = types.attrsOf (types.submodule ({ - config, - name, - ... - }: { - options = { - type = lib.mkOption { - type = types.enum ["vanilla" "forge"]; - default = "vanilla"; - description = "The kind of Minecraft server to create."; - }; + type = types.attrsOf ( + types.submodule ( + { config, name, ... }: + { + options = { + type = lib.mkOption { + type = types.enum [ + "vanilla" + "forge" + ]; + default = "vanilla"; + description = "The kind of Minecraft server to create."; + }; - package = lib.mkOption { - type = types.package; - default = - if config.type == "vanilla" - then pkgs.minecraft-server - else pkgs.plusultra.minecraft-forge; - defaultText = lib.literalExpression '' - pkgs.minecraft-server - ''; - }; + package = lib.mkOption { + type = types.package; + default = + if config.type == "vanilla" then pkgs.minecraft-server else pkgs.plusultra.minecraft-forge; + defaultText = lib.literalExpression '' + pkgs.minecraft-server + ''; + }; - dataDir = lib.mkOption { - type = types.path; - default = "/var/lib/minecraft/${name}"; - defaultText = "/var/lib/minecraft/"; - description = "The datrectory where data for the server is stored."; - }; + dataDir = lib.mkOption { + type = types.path; + default = "/var/lib/minecraft/${name}"; + defaultText = "/var/lib/minecraft/"; + description = "The datrectory where data for the server is stored."; + }; - port = lib.mkOption { - type = types.port; - default = 25565; - description = "The port for the server to listen on."; - }; + port = lib.mkOption { + type = types.port; + default = 25565; + description = "The port for the server to listen on."; + }; - domain = lib.mkOption { - type = types.str; - default = ""; - description = "The domain to pass to Infrared (if enabled)."; - }; + domain = lib.mkOption { + type = types.str; + default = ""; + description = "The domain to pass to Infrared (if enabled)."; + }; - jvmOpts = lib.mkOption { - type = types.separatedString " "; - default = "-Xmx2048M -Xms2048M"; - # Example options from https://minecraft.gamepedia.com/Tutorials/Server_startup_script - example = - "-Xms4092M -Xmx4092M -XX:+UseG1GC -XX:+CMSIncrementalPacing " - + "-XX:+CMSClassUnloadingEnabled -XX:ParallelGCThreads=2 " - + "-XX:MinHeapFreeRatio=5 -XX:MaxHeapFreeRatio=10"; - description = lib.mdDoc "JVM options for the Minecraft server."; - }; + jvmOpts = lib.mkOption { + type = types.separatedString " "; + default = "-Xmx2048M -Xms2048M"; + # Example options from https://minecraft.gamepedia.com/Tutorials/Server_startup_script + example = + "-Xms4092M -Xmx4092M -XX:+UseG1GC -XX:+CMSIncrementalPacing " + + "-XX:+CMSClassUnloadingEnabled -XX:ParallelGCThreads=2 " + + "-XX:MinHeapFreeRatio=5 -XX:MaxHeapFreeRatio=10"; + description = lib.mdDoc "JVM options for the Minecraft server."; + }; - serverProperties = lib.mkOption { - type = types.attrsOf (types.oneOf [types.bool types.int types.str]); - default = {}; - example = lib.literalExpression '' - { - server-port = 43000; - difficulty = 3; - gamemode = 1; - max-players = 5; - motd = "NixOS Minecraft server!"; - white-list = true; - enable-rcon = true; - "rcon.password" = "hunter2"; - } - ''; - description = lib.mdDoc '' - Minecraft server properties for the server.properties file. Only has - an effect when {option}`services.minecraft-server.declarative` - is set to `true`. See - - for documentation on these values. - ''; - }; + serverProperties = lib.mkOption { + type = types.attrsOf ( + types.oneOf [ + types.bool + types.int + types.str + ] + ); + default = { }; + example = lib.literalExpression '' + { + server-port = 43000; + difficulty = 3; + gamemode = 1; + max-players = 5; + motd = "NixOS Minecraft server!"; + white-list = true; + enable-rcon = true; + "rcon.password" = "hunter2"; + } + ''; + description = lib.mdDoc '' + Minecraft server properties for the server.properties file. Only has + an effect when {option}`services.minecraft-server.declarative` + is set to `true`. See + + for documentation on these values. + ''; + }; - whitelist = lib.mkOption { - type = let - minecraftUUID = - lib.types.strMatching - "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}" - // { - description = "Minecraft UUID"; - }; - in - lib.types.attrsOf minecraftUUID; - default = {}; - description = lib.mdDoc '' - Whitelisted players, only has an effect when - {option}`services.minecraft-server.declarative` is - `true` and the whitelist is enabled - via {option}`services.minecraft-server.serverProperties` by - setting `white-list` to `true`. - This is a mapping from Minecraft usernames to UUIDs. - You can use to get a - Minecraft UUID for a username. - ''; - example = lib.literalExpression '' - { - username1 = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"; - username2 = "yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy"; + whitelist = lib.mkOption { + type = + let + minecraftUUID = + lib.types.strMatching "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}" + // { + description = "Minecraft UUID"; + }; + in + lib.types.attrsOf minecraftUUID; + default = { }; + description = lib.mdDoc '' + Whitelisted players, only has an effect when + {option}`services.minecraft-server.declarative` is + `true` and the whitelist is enabled + via {option}`services.minecraft-server.serverProperties` by + setting `white-list` to `true`. + This is a mapping from Minecraft usernames to UUIDs. + You can use to get a + Minecraft UUID for a username. + ''; + example = lib.literalExpression '' + { + username1 = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"; + username2 = "yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy"; + }; + ''; }; - ''; - }; - openFirewall = lib.mkOption { - type = types.bool; - default = false; - description = lib.mdDoc '' - Whether to open ports in the firewall for the server. - ''; - }; + openFirewall = lib.mkOption { + type = types.bool; + default = false; + description = lib.mdDoc '' + Whether to open ports in the firewall for the server. + ''; + }; - declarative = lib.mkOption { - type = types.bool; - default = false; - description = lib.mdDoc '' - Whether to use a declarative Minecraft server configuration. - Only if set to `true`, the options - {option}`plusultra.services.minecraft.servers..whitelist` and - {option}`plusultra.services.minecraft.servers..serverProperties` will be - applied. - ''; - }; + declarative = lib.mkOption { + type = types.bool; + default = false; + description = lib.mdDoc '' + Whether to use a declarative Minecraft server configuration. + Only if set to `true`, the options + {option}`plusultra.services.minecraft.servers..whitelist` and + {option}`plusultra.services.minecraft.servers..serverProperties` will be + applied. + ''; + }; - extraInfraredOptions = lib.mkOption { - type = types.attrs; - default = {}; + extraInfraredOptions = lib.mkOption { + type = types.attrs; + default = { }; - description = lib.mdDoc '' - Extra options passed to Infrared (if enabled) when configuring this server. - ''; - }; - }; - })); + description = lib.mdDoc '' + Extra options passed to Infrared (if enabled) when configuring this server. + ''; + }; + }; + } + ) + ); }; }; } diff --git a/modules/nixos/services/openssh/default.nix b/modules/nixos/services/openssh/default.nix index 9c41e0ee..ab2d7afb 100644 --- a/modules/nixos/services/openssh/default.nix +++ b/modules/nixos/services/openssh/default.nix @@ -5,12 +5,13 @@ lib, host ? "", format ? "", - inputs ? {}, + inputs ? { }, namespace, ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.services.openssh; user = config.users.users.${config.${namespace}.user.name}; @@ -22,43 +23,41 @@ with lib.${namespace}; let default-key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCwaaCUq3Ooq1BaHbg5IwVxWj/xmNJY2dDthHKPZefrHXv/ksM/IREgm38J0CdoMpVS0Zp1C/vFrwGfaYZ2lCF5hBVdV3gf+mvj8Yb8Xpm6aM4L5ig+oBMp/3cz1+g/I4aLMJfCKCtdD6Q2o4vtkTpid6X+kL3UGZbX0HFn3pxoDinzOXQnVGSGw+pQhLASvQeVXWTJjVfIWhj9L2NRJau42cBRRlAH9kE3HUbcgLgyPUZ28aGXLLmiQ6CUjiIlce5ee16WNLHQHOzVfPJfF1e1F0HwGMMBe39ey3IEQz6ab1YqlIzjRx9fQ9hQK6Du+Duupby8JmBlbUAxhh8KJFCJB2cXW/K5Et4R8GHMS6MyIoKQwFUXGyrszVfiuNTGZIkPAYx9zlCq9M/J+x1xUZLHymL85WLPyxhlhN4ysM9ILYiyiJ3gYrPIn5FIZrW7MCQX4h8k0bEjWUwH5kF3dZpEvIT2ssyIu12fGzXkYaNQcJEb5D9gT1mNyi2dxQ62NPZ5orfYyIZ7fn22d1P/jegG+7LQeXPiy5NLE6b7MP5Rq2dL8Y9Oi8pOBtoY9BpLh7saSBbNFXTBtH/8OfAQacxDsZD/zTFtCzZjtTK6yiAaXCZTvMIOuoYGZvEk6zWXrjVsU8FlqF+4JOTfePqr/SSUXNJyKnrvQJ1BfHQiYsrckw=="; - other-hosts = - lib.filterAttrs - (key: host: - key != name && (host.config.${namespace}.user.name or null) != null) - ((inputs.self.nixosConfigurations or {}) // (inputs.self.darwinConfigurations or {})); + other-hosts = lib.filterAttrs ( + key: host: key != name && (host.config.${namespace}.user.name or null) != null + ) ((inputs.self.nixosConfigurations or { }) // (inputs.self.darwinConfigurations or { })); - other-hosts-config = - lib.concatMapStringsSep - "\n" - ( - name: let - remote = other-hosts.${name}; - remote-user-name = remote.config.${namespace}.user.name; - remote-user-id = builtins.toString remote.config.users.users.${remote-user-name}.uid; + other-hosts-config = lib.concatMapStringsSep "\n" ( + name: + let + remote = other-hosts.${name}; + remote-user-name = remote.config.${namespace}.user.name; + remote-user-id = builtins.toString remote.config.users.users.${remote-user-name}.uid; - forward-gpg = - optionalString (config.programs.gnupg.agent.enable && remote.config.programs.gnupg.agent.enable) + forward-gpg = + optionalString (config.programs.gnupg.agent.enable && remote.config.programs.gnupg.agent.enable) '' RemoteForward /run/user/${remote-user-id}/gnupg/S.gpg-agent /run/user/${user-id}/gnupg/S.gpg-agent.extra RemoteForward /run/user/${remote-user-id}/gnupg/S.gpg-agent.ssh /run/user/${user-id}/gnupg/S.gpg-agent.ssh ''; - in '' - Host ${name} - User ${remote-user-name} - ForwardAgent yes - Port ${builtins.toString cfg.port} - ${forward-gpg} - '' - ) - (builtins.attrNames other-hosts); -in { + in + '' + Host ${name} + User ${remote-user-name} + ForwardAgent yes + Port ${builtins.toString cfg.port} + ${forward-gpg} + '' + ) (builtins.attrNames other-hosts); +in +{ options.${namespace}.services.openssh = with types; { enable = mkBoolOpt false "Whether or not to configure OpenSSH support."; - authorizedKeys = - mkOpt (listOf str) [default-key] "The public keys to apply."; + authorizedKeys = mkOpt (listOf str) [ default-key ] "The public keys to apply."; port = mkOpt port 2222 "The port to listen on (in addition to 22)."; - manage-other-hosts = mkOpt bool true "Whether or not to add other host configurations to SSH config."; + manage-other-hosts = + mkOpt bool true + "Whether or not to add other host configurations to SSH config."; }; config = mkIf cfg.enable { @@ -66,10 +65,7 @@ in { enable = true; settings = { - PermitRootLogin = - if format == "install-iso" - then "yes" - else "no"; + PermitRootLogin = if format == "install-iso" then "yes" else "no"; PasswordAuthentication = false; }; @@ -90,19 +86,12 @@ in { ${optionalString cfg.manage-other-hosts other-hosts-config} ''; - plusultra.user.extraOptions.openssh.authorizedKeys.keys = - cfg.authorizedKeys; + plusultra.user.extraOptions.openssh.authorizedKeys.keys = cfg.authorizedKeys; plusultra.home.extraOptions = { - programs.zsh.shellAliases = - foldl - (aliases: system: - aliases - // { - "ssh-${system}" = "ssh ${system} -t tmux a"; - }) - {} - (builtins.attrNames other-hosts); + programs.zsh.shellAliases = foldl ( + aliases: system: aliases // { "ssh-${system}" = "ssh ${system} -t tmux a"; } + ) { } (builtins.attrNames other-hosts); }; }; } diff --git a/modules/nixos/services/palworld-container/default.nix b/modules/nixos/services/palworld-container/default.nix index 9f59d5b4..1839cba3 100644 --- a/modules/nixos/services/palworld-container/default.nix +++ b/modules/nixos/services/palworld-container/default.nix @@ -4,9 +4,11 @@ lib, namespace, ... -}: let +}: +let cfg = config.${namespace}.services.palworld-container; -in { +in +{ options.${namespace}.services.palworld-container = { enable = lib.mkEnableOption "Palworld (Docker)"; @@ -57,12 +59,10 @@ in { }; }; - groups = lib.optionalAttrs (cfg.group == "palworld") {palworld = {};}; + groups = lib.optionalAttrs (cfg.group == "palworld") { palworld = { }; }; }; - systemd.tmpfiles.rules = [ - "d ${cfg.stateDir} 0750 ${cfg.user} ${cfg.group} -" - ]; + systemd.tmpfiles.rules = [ "d ${cfg.stateDir} 0750 ${cfg.user} ${cfg.group} -" ]; virtualisation.oci-containers.containers.palworld = { image = "jammsen/palworld-dedicated-server:latest"; @@ -74,23 +74,16 @@ in { MAX_PLAYERS = builtins.toString cfg.players; MULTITHREAD_ENABLED = "true"; - ALWAYS_UPDATE_ON_START = - if cfg.update - then "true" - else "false"; + ALWAYS_UPDATE_ON_START = if cfg.update then "true" else "false"; COMMUNITY_SERVER = "false"; PUBLIC_IP = ""; PUBLIC_PORT = ""; }; - ports = [ - "${builtins.toString cfg.port}:${builtins.toString cfg.port}" - ]; + ports = [ "${builtins.toString cfg.port}:${builtins.toString cfg.port}" ]; - volumes = [ - "${cfg.stateDir}:/palworld" - ]; + volumes = [ "${cfg.stateDir}:/palworld" ]; }; }; } diff --git a/modules/nixos/services/palworld/default.nix b/modules/nixos/services/palworld/default.nix index 325f5511..e20f702a 100644 --- a/modules/nixos/services/palworld/default.nix +++ b/modules/nixos/services/palworld/default.nix @@ -6,7 +6,8 @@ namespace, lib, ... -}: let +}: +let cfg = config.${namespace}.services.palworld; steam-id = "2394010"; @@ -26,7 +27,8 @@ steamcmd-home = config.users.users.${cfg.steamcmd.name}.home; steamcmd-install-service = "steamcmd@${steam-id}.service"; -in { +in +{ options.${namespace}.services.palworld = { enable = lib.mkEnableOption "Palworld server"; @@ -74,13 +76,9 @@ in { config = lib.mkIf cfg.enable { plusultra.services.steam.enable = true; - networking.firewall.allowedTCPPorts = [ - cfg.port - ]; + networking.firewall.allowedTCPPorts = [ cfg.port ]; - networking.firewall.allowedUDPPorts = [ - cfg.port - ]; + networking.firewall.allowedUDPPorts = [ cfg.port ]; users = { users = lib.optionalAttrs (cfg.user.name == "palworld") { @@ -91,15 +89,11 @@ in { homeMode = "750"; group = cfg.user.group; - extraGroups = [ - cfg.steamcmd.group - ]; + extraGroups = [ cfg.steamcmd.group ]; }; }; - groups = lib.optionalAttrs (cfg.user.group == "palworld") { - palworld = {}; - }; + groups = lib.optionalAttrs (cfg.user.group == "palworld") { palworld = { }; }; }; systemd.tmpfiles.rules = [ @@ -108,14 +102,14 @@ in { ]; systemd.services.palworld = { - path = [pkgs.xdg-user-dirs]; + path = [ pkgs.xdg-user-dirs ]; # Manually start the server if needed, to save resources. wantedBy = lib.optional cfg.autostart "network-online.target"; # Install the game before launching. - wants = [steamcmd-install-service]; - after = [steamcmd-install-service]; + wants = [ steamcmd-install-service ]; + after = [ steamcmd-install-service ]; serviceConfig = { ExecStart = palworld-server; diff --git a/modules/nixos/services/printing/default.nix b/modules/nixos/services/printing/default.nix index 305620c3..5a9f3427 100644 --- a/modules/nixos/services/printing/default.nix +++ b/modules/nixos/services/printing/default.nix @@ -7,12 +7,14 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.services.printing; -in { +in +{ options.${namespace}.services.printing = with types; { enable = mkBoolOpt false "Whether or not to configure printing support."; }; - config = mkIf cfg.enable {services.printing.enable = true;}; + config = mkIf cfg.enable { services.printing.enable = true; }; } diff --git a/modules/nixos/services/samba/default.nix b/modules/nixos/services/samba/default.nix index 71949424..bf6abcce 100644 --- a/modules/nixos/services/samba/default.nix +++ b/modules/nixos/services/samba/default.nix @@ -3,11 +3,11 @@ config, namespace, ... -}: let +}: +let cfg = config.${namespace}.services.samba; - inherit - (lib) + inherit (lib) types mkEnableOption mkIf @@ -15,43 +15,41 @@ optionalAttrs ; - inherit - (lib.${namespace}) - mkOpt - mkBoolOpt - ; + inherit (lib.${namespace}) mkOpt mkBoolOpt; - bool-to-yes-no = value: - if value - then "yes" - else "no"; + bool-to-yes-no = value: if value then "yes" else "no"; - shares-submodule = with types; - submodule ({name, ...}: { - options = { - path = mkOpt str null "The path to serve."; - public = mkBoolOpt false "Whether the share is public."; - browseable = mkBoolOpt true "Whether the share is browseable."; - comment = mkOpt str name "An optional comment."; - read-only = mkBoolOpt false "Whether the share should be read only."; - only-owner-editable = mkBoolOpt false "Whether the share is only writable by the system owner (plusultra.user.name)."; + shares-submodule = + with types; + submodule ( + { name, ... }: + { + options = { + path = mkOpt str null "The path to serve."; + public = mkBoolOpt false "Whether the share is public."; + browseable = mkBoolOpt true "Whether the share is browseable."; + comment = mkOpt str name "An optional comment."; + read-only = mkBoolOpt false "Whether the share should be read only."; + only-owner-editable = mkBoolOpt false "Whether the share is only writable by the system owner (plusultra.user.name)."; - extra-config = mkOpt attrs {} "Extra configuration options for the share."; - }; - }); -in { + extra-config = mkOpt attrs { } "Extra configuration options for the share."; + }; + } + ); +in +{ options.${namespace}.services.samba = with types; { enable = mkEnableOption "Samba"; workgroup = mkOpt str "WORKGROUP" "The workgroup to use."; browseable = mkBoolOpt true "Whether the shares are browseable."; - shares = mkOpt (attrsOf shares-submodule) {} "The shares to serve."; + shares = mkOpt (attrsOf shares-submodule) { } "The shares to serve."; }; config = mkIf cfg.enable { networking.firewall = { - allowedTCPPorts = [5357]; - allowedUDPPorts = [3702]; + allowedTCPPorts = [ 5357 ]; + allowedUDPPorts = [ 3702 ]; }; services.samba-wsdd = { @@ -68,23 +66,22 @@ in { browseable = ${bool-to-yes-no cfg.browseable} ''; - shares = - mapAttrs - (name: value: - { - inherit (value) path comment; + shares = mapAttrs ( + name: value: + { + inherit (value) path comment; - public = bool-to-yes-no value.public; - browseable = bool-to-yes-no value.browseable; - "read only" = bool-to-yes-no value.read-only; - } - // (optionalAttrs value.only-owner-editable { - "write list" = config.${namespace}.user.name; - "read list" = "guest, nobody"; - "create mask" = "0755"; - }) - // value.extra-config) - cfg.shares; + public = bool-to-yes-no value.public; + browseable = bool-to-yes-no value.browseable; + "read only" = bool-to-yes-no value.read-only; + } + // (optionalAttrs value.only-owner-editable { + "write list" = config.${namespace}.user.name; + "read list" = "guest, nobody"; + "create mask" = "0755"; + }) + // value.extra-config + ) cfg.shares; }; }; } diff --git a/modules/nixos/services/steam/default.nix b/modules/nixos/services/steam/default.nix index 3ff3c299..782a044b 100644 --- a/modules/nixos/services/steam/default.nix +++ b/modules/nixos/services/steam/default.nix @@ -5,9 +5,11 @@ lib, namespace, ... -}: let +}: +let cfg = config.${namespace}.services.steam; -in { +in +{ options.${namespace}.services.steam = { enable = lib.mkEnableOption "Steam"; }; @@ -21,65 +23,67 @@ in { createHome = true; }; - users.groups.steamcmd = {}; + users.groups.steamcmd = { }; systemd.services."steamcmd@" = { - after = ["network-online.target"]; - wants = ["network-online.target"]; + after = [ "network-online.target" ]; + wants = [ "network-online.target" ]; serviceConfig = { Type = "oneshot"; RemainAfterExit = true; - ExecStart = "${pkgs.resholve.writeScript "steam" { - interpreter = "${pkgs.zsh}/bin/zsh"; - inputs = with pkgs; [ - patchelf - steamcmd - coreutils - ]; - execer = [ - "cannot:${pkgs.steamcmd}/bin/steamcmd" - ]; - } '' - set -eux + ExecStart = "${ + pkgs.resholve.writeScript "steam" + { + interpreter = "${pkgs.zsh}/bin/zsh"; + inputs = with pkgs; [ + patchelf + steamcmd + coreutils + ]; + execer = [ "cannot:${pkgs.steamcmd}/bin/steamcmd" ]; + } + '' + set -eux - instance=''${1:?Instance Missing} - eval 'args=(''${(@s:_:)instance})' - app=''${args[1]:?App ID missing} - beta=''${args[2]:-} - betapass=''${args[3]:-} + instance=''${1:?Instance Missing} + eval 'args=(''${(@s:_:)instance})' + app=''${args[1]:?App ID missing} + beta=''${args[2]:-} + betapass=''${args[3]:-} - dir=/var/lib/steamcmd/apps/$instance + dir=/var/lib/steamcmd/apps/$instance - cmds=( - +force_install_dir $dir - +login anonymous - +app_update $app validate - ) + cmds=( + +force_install_dir $dir + +login anonymous + +app_update $app validate + ) - if [[ $beta ]]; then - cmds+=(-beta $beta) - if [[ $betapass ]]; then - cmds+=(-betapassword $betapass) + if [[ $beta ]]; then + cmds+=(-beta $beta) + if [[ $betapass ]]; then + cmds+=(-betapassword $betapass) + fi fi - fi - cmds+=(+quit) + cmds+=(+quit) - steamcmd $cmds + steamcmd $cmds - for f in $dir/*; do - set +e - chmod -R ugo+rwx $f - set -e + for f in $dir/*; do + set +e + chmod -R ugo+rwx $f + set -e - if ! [[ -f $f && -x $f ]]; then - continue - fi + if ! [[ -f $f && -x $f ]]; then + continue + fi - # Update the interpreter to the path on NixOS. - patchelf --set-interpreter ${pkgs.glibc}/lib/ld-linux-x86-64.so.2 $f || true - done - ''} %i"; + # Update the interpreter to the path on NixOS. + patchelf --set-interpreter ${pkgs.glibc}/lib/ld-linux-x86-64.so.2 $f || true + done + '' + } %i"; PrivateTmp = true; Restart = "on-failure"; StateDirectory = "steamcmd/apps/%i"; @@ -91,9 +95,12 @@ in { # Some games might depend on the Steamworks SDK redistributable, so download it. systemd.services.steamworks-sdk = { - wantedBy = ["multi-user.target"]; - wants = ["steamcmd@1007.service" "steamworks-sdk.timer"]; - after = ["steamcmd@1007.service"]; + wantedBy = [ "multi-user.target" ]; + wants = [ + "steamcmd@1007.service" + "steamworks-sdk.timer" + ]; + after = [ "steamcmd@1007.service" ]; serviceConfig = { Type = "oneshot"; @@ -109,7 +116,7 @@ in { systemd.timers.steamworks-sdk = { description = "Updates Steamworks SDK daily."; - wantedBy = ["timers.target"]; + wantedBy = [ "timers.target" ]; timerConfig = { Unit = "steamworks-sdk.service"; OnCalendar = "*-*-* 04:00:00"; diff --git a/modules/nixos/services/tailscale/default.nix b/modules/nixos/services/tailscale/default.nix index 05ceaff0..6a582940 100644 --- a/modules/nixos/services/tailscale/default.nix +++ b/modules/nixos/services/tailscale/default.nix @@ -6,9 +6,11 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.services.tailscale; -in { +in +{ options.${namespace}.services.tailscale = with types; { enable = mkBoolOpt false "Whether or not to configure Tailscale"; autoconnect = { @@ -25,30 +27,36 @@ in { } ]; - environment.systemPackages = with pkgs; [tailscale]; + environment.systemPackages = with pkgs; [ tailscale ]; services.tailscale = enabled; networking = { firewall = { - trustedInterfaces = [config.services.tailscale.interfaceName]; + trustedInterfaces = [ config.services.tailscale.interfaceName ]; - allowedUDPPorts = [config.services.tailscale.port]; + allowedUDPPorts = [ config.services.tailscale.port ]; # Strict reverse path filtering breaks Tailscale exit node use and some subnet routing setups. checkReversePath = "loose"; }; - networkmanager.unmanaged = ["tailscale0"]; + networkmanager.unmanaged = [ "tailscale0" ]; }; systemd.services.tailscale-autoconnect = mkIf cfg.autoconnect.enable { description = "Automatic connection to Tailscale"; # Make sure tailscale is running before trying to connect to tailscale - after = ["network-pre.target" "tailscale.service"]; - wants = ["network-pre.target" "tailscale.service"]; - wantedBy = ["multi-user.target"]; + after = [ + "network-pre.target" + "tailscale.service" + ]; + wants = [ + "network-pre.target" + "tailscale.service" + ]; + wantedBy = [ "multi-user.target" ]; # Set this service as a oneshot job serviceConfig.Type = "oneshot"; diff --git a/modules/nixos/services/vault-agent/default.nix b/modules/nixos/services/vault-agent/default.nix index 385d8ec6..6a5c2839 100644 --- a/modules/nixos/services/vault-agent/default.nix +++ b/modules/nixos/services/vault-agent/default.nix @@ -7,7 +7,8 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.services.vault-agent; # nixos-vault-service places generated files here: @@ -15,80 +16,103 @@ with lib.${namespace}; let secret-files-root = "/tmp/detsys-vault"; environment-files-root = "/run/keys/environment"; - create-environment-files-submodule = service-name: - types.submodule ({name, ...}: { + create-environment-files-submodule = + service-name: + types.submodule ( + { name, ... }: + { + options = { + text = mkOpt (types.nullOr types.str) null "An inline template for Vault to template."; + source = + mkOpt (types.nullOr types.path) null + "The file with environment variables for Vault to template."; + path = mkOption { + readOnly = true; + type = types.str; + description = "The path to the environment file."; + default = "${environment-files-root}/${service-name}/${name}.EnvFile"; + defaultText = "${environment-files-root}//.EnvFile"; + }; + }; + } + ); + + secret-files-submodule = types.submodule ( + { name, ... }: + { options = { text = mkOpt (types.nullOr types.str) null "An inline template for Vault to template."; - source = mkOpt (types.nullOr types.path) null "The file with environment variables for Vault to template."; + source = mkOpt (types.nullOr types.path) null "The file for Vault to template."; + permissions = mkOpt types.str "0400" "The octal mode of this file."; + change-action = mkOpt (types.nullOr ( + types.enum [ + "restart" + "stop" + "none" + ] + )) null "The action to take when secrets change."; path = mkOption { readOnly = true; type = types.str; - description = "The path to the environment file."; - default = "${environment-files-root}/${service-name}/${name}.EnvFile"; - defaultText = "${environment-files-root}//.EnvFile"; + description = "The path to the secret file."; + default = "${secret-files-root}/${name}"; }; }; - }); - - secret-files-submodule = types.submodule ({name, ...}: { - options = { - text = mkOpt (types.nullOr types.str) null "An inline template for Vault to template."; - source = mkOpt (types.nullOr types.path) null "The file for Vault to template."; - permissions = mkOpt types.str "0400" "The octal mode of this file."; - change-action = mkOpt (types.nullOr (types.enum ["restart" "stop" "none"])) null "The action to take when secrets change."; - path = mkOption { - readOnly = true; - type = types.str; - description = "The path to the secret file."; - default = "${secret-files-root}/${name}"; - }; - }; - }); - - services-submodule = - types.submodule - ({ - name, - config, - ... - }: { + } + ); + + services-submodule = types.submodule ( + { name, config, ... }: + { options = { enable = mkBoolOpt true "Whether to enable Vault Agent for this service."; - settings = mkOpt types.attrs {} "Vault Agent configuration."; + settings = mkOpt types.attrs { } "Vault Agent configuration."; secrets = { environment = { - force = mkOpt types.bool false "Whether or not to force the use of Vault Agent's environment files."; - change-action = mkOpt (types.enum ["restart" "stop" "none"]) "restart" "The action to take when secrets change."; - templates = mkOpt (types.attrsOf (create-environment-files-submodule name)) {} "Environment variable files for Vault to template."; - template = mkOpt (types.nullOr (types.either types.path types.str)) null "An environment variable template."; + force = + mkOpt types.bool false + "Whether or not to force the use of Vault Agent's environment files."; + change-action = mkOpt (types.enum [ + "restart" + "stop" + "none" + ]) "restart" "The action to take when secrets change."; + templates = mkOpt (types.attrsOf ( + create-environment-files-submodule name + )) { } "Environment variable files for Vault to template."; + template = mkOpt (types.nullOr ( + types.either types.path types.str + )) null "An environment variable template."; paths = mkOption { readOnly = true; type = types.listOf types.str; description = "Paths to all of the environment files"; default = - if config.secrets.environment.template != null - then ["${environment-files-root}/${name}/EnvFile"] + if config.secrets.environment.template != null then + [ "${environment-files-root}/${name}/EnvFile" ] else - ( - mapAttrsToList - (template-name: value: value.path) - config.secrets.environment.templates - ); + (mapAttrsToList (template-name: value: value.path) config.secrets.environment.templates); }; }; file = { - change-action = mkOpt (types.enum ["restart" "stop" "none"]) "restart" "The action to take when secrets change."; + change-action = mkOpt (types.enum [ + "restart" + "stop" + "none" + ]) "restart" "The action to take when secrets change."; files = mkOption { description = "Secret files to template."; - default = {}; + default = { }; type = types.attrsOf secret-files-submodule; }; }; }; }; - }); -in { + } + ); +in +{ # imports = [ # inputs.vault-service.nixosModules.nixos-vault-service # ]; @@ -96,90 +120,80 @@ in { options.${namespace}.services.vault-agent = { enable = mkEnableOption "Vault Agent"; - settings = mkOpt types.attrs {} "Default Vault Agent configuration."; + settings = mkOpt types.attrs { } "Default Vault Agent configuration."; services = mkOption { description = "Services to install Vault Agent into."; - default = {}; + default = { }; type = types.attrsOf services-submodule; }; }; config = mkIf cfg.enable { - assertions = flatten (mapAttrsToList - ( + assertions = flatten ( + mapAttrsToList ( service-name: service: - (mapAttrsToList - ( - template-name: template: { - assertion = (template.source != null && template.text == null) || (template.source == null && template.text != null); - message = "plusultra.services.vault-agent.services.${service-name}.secrets.environment.templates.${template-name} must set either `source` or `text`."; - } - ) - service.secrets.environment.templates) - ++ (mapAttrsToList - ( - file-name: file: { - assertion = (file.source != null && file.text == null) || (file.source == null && file.text != null); - message = "plusultra.services.vault-agent.services.${service-name}.secrets.file.files.${file-name} must set either `source` or `text`."; - } - ) - service.secrets.file.files) - ) - cfg.services); - - systemd.services = - mapAttrs - (service-name: value: - mkIf value.secrets.environment.force { - serviceConfig.EnvironmentFile = mkForce value.secrets.environment.paths; - }) - cfg.services; + (mapAttrsToList (template-name: template: { + assertion = + (template.source != null && template.text == null) + || (template.source == null && template.text != null); + message = "plusultra.services.vault-agent.services.${service-name}.secrets.environment.templates.${template-name} must set either `source` or `text`."; + }) service.secrets.environment.templates) + ++ (mapAttrsToList (file-name: file: { + assertion = + (file.source != null && file.text == null) || (file.source == null && file.text != null); + message = "plusultra.services.vault-agent.services.${service-name}.secrets.file.files.${file-name} must set either `source` or `text`."; + }) service.secrets.file.files) + ) cfg.services + ); + + systemd.services = mapAttrs ( + service-name: value: + mkIf value.secrets.environment.force { + serviceConfig.EnvironmentFile = mkForce value.secrets.environment.paths; + } + ) cfg.services; detsys.vaultAgent = { defaultAgentConfig = cfg.settings; - systemd.services = - mapAttrs - (service-name: value: { - inherit (value) enable; - - agentConfig = value.settings; + systemd.services = mapAttrs (service-name: value: { + inherit (value) enable; + + agentConfig = value.settings; + + environment = { + changeAction = value.secrets.environment.change-action; + + templateFiles = mapAttrs (template-name: value: { + file = + if value.source != null then + value.source + else + pkgs.writeText "${service-name}-${template-name}-env-template" value.text; + }) value.secrets.environment.templates; + + template = + if + (builtins.isPath value.secrets.environment.template) + || (builtins.isNull value.secrets.environment.template) + then + value.secrets.environment.template + else + pkgs.writeText "${service-name}-env-template" value.secrets.environment.template; + }; - environment = { - changeAction = value.secrets.environment.change-action; - - templateFiles = - mapAttrs - (template-name: value: { - file = - if value.source != null - then value.source - else pkgs.writeText "${service-name}-${template-name}-env-template" value.text; - }) - value.secrets.environment.templates; - - template = - if (builtins.isPath value.secrets.environment.template) || (builtins.isNull value.secrets.environment.template) - then value.secrets.environment.template - else pkgs.writeText "${service-name}-env-template" value.secrets.environment.template; - }; + secretFiles = { + defaultChangeAction = value.secrets.file.change-action; - secretFiles = { - defaultChangeAction = value.secrets.file.change-action; - - files = - mapAttrs - (file-name: value: { - changeAction = value.change-action; - template = value.text; - templateFile = value.source; - perms = value.permissions; - }) - value.secrets.file.files; - }; - }) - cfg.services; + files = mapAttrs (file-name: value: { + changeAction = value.change-action; + template = value.text; + templateFile = value.source; + perms = value.permissions; + }) value.secrets.file.files; + }; + }) cfg.services; }; }; } diff --git a/modules/nixos/services/vault/default.nix b/modules/nixos/services/vault/default.nix index c381006d..1a8184dc 100644 --- a/modules/nixos/services/vault/default.nix +++ b/modules/nixos/services/vault/default.nix @@ -6,62 +6,59 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.services.vault; - package = - if cfg.ui - then pkgs.vault-bin - else pkgs.vault; + package = if cfg.ui then pkgs.vault-bin else pkgs.vault; has-policies = (builtins.length (builtins.attrNames cfg.policies)) != 0; - format-policy = name: file: - pkgs.runCommandNoCC - "formatted-vault-policy" - { - inherit file; - buildInputs = [package]; - } - '' - name="$(basename "$file")" - - cp "$file" "./$name" - - # Ensure that vault can overwrite the file. - chmod +w "./$name" - - # Create this variable here to avoid swallowing vault's exit code. - vault_output= - - set +e - vault_output=$(vault policy fmt "./$name" 2>&1) - vault_status=$? - set -e - - if [ "$vault_status" != 0 ]; then - echo 'Error formatting policy "${name}"' - echo "This is normally caused by a syntax error in the policy file." - echo "$file" - echo "" - echo "Vault Output:" - echo "$vault_output" - exit 1 - fi - - mv "./$name" $out - ''; - - policies = - mapAttrs - ( - name: value: - if builtins.isPath value - then format-policy name value - else format-policy name (pkgs.writeText "${name}.hcl" value) - ) - cfg.policies; -in { + format-policy = + name: file: + pkgs.runCommandNoCC "formatted-vault-policy" + { + inherit file; + buildInputs = [ package ]; + } + '' + name="$(basename "$file")" + + cp "$file" "./$name" + + # Ensure that vault can overwrite the file. + chmod +w "./$name" + + # Create this variable here to avoid swallowing vault's exit code. + vault_output= + + set +e + vault_output=$(vault policy fmt "./$name" 2>&1) + vault_status=$? + set -e + + if [ "$vault_status" != 0 ]; then + echo 'Error formatting policy "${name}"' + echo "This is normally caused by a syntax error in the policy file." + echo "$file" + echo "" + echo "Vault Output:" + echo "$vault_output" + exit 1 + fi + + mv "./$name" $out + ''; + + policies = mapAttrs ( + name: value: + if builtins.isPath value then + format-policy name value + else + format-policy name (pkgs.writeText "${name}.hcl" value) + ) cfg.policies; +in +{ options.${namespace}.services.vault = { enable = mkEnableOption "Vault"; @@ -75,7 +72,9 @@ in { mutable-policies = mkBoolOpt false "Whether policies not specified in Nix should be removed."; - policies = mkOpt (types.attrsOf (types.either types.str types.path)) {} "Policies to install when Vault runs."; + policies = mkOpt (types.attrsOf ( + types.either types.str types.path + )) { } "Policies to install when Vault runs."; policy-agent = { user = mkOpt types.str "vault" "The user to run the Vault Agent as."; @@ -83,7 +82,9 @@ in { auth = { roleIdFilePath = mkOpt types.str "/var/lib/vault/role-id" "The file to read the role-id from."; - secretIdFilePath = mkOpt types.str "/var/lib/vault/secret-id" "The file to read the secret-id from."; + secretIdFilePath = + mkOpt types.str "/var/lib/vault/secret-id" + "The file to read the secret-id from."; }; }; }; @@ -94,21 +95,17 @@ in { inherit package; extraConfig = '' - ui = ${ - if cfg.ui - then "true" - else "false" - } + ui = ${if cfg.ui then "true" else "false"} ${cfg.settings} ''; }; - systemd.services.vault = {}; + systemd.services.vault = { }; systemd.services.vault-policies = mkIf (has-policies || !cfg.mutable-policies) { - wantedBy = ["vault.service"]; - after = ["vault.service"]; + wantedBy = [ "vault.service" ]; + after = [ "vault.service" ]; serviceConfig = { Type = "oneshot"; @@ -131,82 +128,79 @@ in { VAULT_ADDR = "http://${config.services.vault.address}"; }; - script = let - write-policies-commands = - mapAttrsToList - ( - name: policy: '' - echo Writing policy '${name}': '${policy}' - vault policy write '${name}' '${policy}' - '' - ) - policies; - write-policies = concatStringsSep "\n" write-policies-commands; - - known-policies = mapAttrsToList (name: value: name) policies; - - remove-unknown-policies = '' - current_policies=$(vault policy list -format=json | jq -r '.[]') - known_policies=(${concatStringsSep " " (builtins.map (policy: "\"${policy}\"") known-policies)}) - - while read current_policy; do - is_known=false - - for known_policy in "''${known_policies[@]}"; do - if [ "$known_policy" = "$current_policy" ]; then - is_known=true - break + script = + let + write-policies-commands = mapAttrsToList (name: policy: '' + echo Writing policy '${name}': '${policy}' + vault policy write '${name}' '${policy}' + '') policies; + write-policies = concatStringsSep "\n" write-policies-commands; + + known-policies = mapAttrsToList (name: value: name) policies; + + remove-unknown-policies = '' + current_policies=$(vault policy list -format=json | jq -r '.[]') + known_policies=(${concatStringsSep " " (builtins.map (policy: "\"${policy}\"") known-policies)}) + + while read current_policy; do + is_known=false + + for known_policy in "''${known_policies[@]}"; do + if [ "$known_policy" = "$current_policy" ]; then + is_known=true + break + fi + done + + if [ "$is_known" = "false" ] && [ "$current_policy" != "default" ] && [ "$current_policy" != "root" ]; then + echo "Removing policy: $current_policy" + vault policy delete "$current_policy" + else + echo "Keeping policy: $current_policy" fi - done - - if [ "$is_known" = "false" ] && [ "$current_policy" != "default" ] && [ "$current_policy" != "root" ]; then - echo "Removing policy: $current_policy" - vault policy delete "$current_policy" - else - echo "Keeping policy: $current_policy" - fi - done <<< "$current_policies" - ''; - in '' - if ! [ -f '${cfg.policy-agent.auth.roleIdFilePath}' ]; then - echo 'role-id file not found: ${cfg.policy-agent.auth.roleIdFilePath}' - exit 1 - fi + done <<< "$current_policies" + ''; + in + '' + if ! [ -f '${cfg.policy-agent.auth.roleIdFilePath}' ]; then + echo 'role-id file not found: ${cfg.policy-agent.auth.roleIdFilePath}' + exit 1 + fi - if ! [ -f '${cfg.policy-agent.auth.secretIdFilePath}' ]; then - echo 'secret-id file not found: ${cfg.policy-agent.auth.secretIdFilePath}' - exit 1 - fi + if ! [ -f '${cfg.policy-agent.auth.secretIdFilePath}' ]; then + echo 'secret-id file not found: ${cfg.policy-agent.auth.secretIdFilePath}' + exit 1 + fi - role_id="$(cat '${cfg.policy-agent.auth.roleIdFilePath}')" - secret_id="$(cat '${cfg.policy-agent.auth.secretIdFilePath}')" + role_id="$(cat '${cfg.policy-agent.auth.roleIdFilePath}')" + secret_id="$(cat '${cfg.policy-agent.auth.secretIdFilePath}')" - seal_status=$(curl -s "$VAULT_ADDR/v1/sys/seal-status" | jq ".sealed") + seal_status=$(curl -s "$VAULT_ADDR/v1/sys/seal-status" | jq ".sealed") - echo "Seal Status: $seal_status" + echo "Seal Status: $seal_status" - if [ seal_status = "true" ]; then - echo "Vault is currently sealed, cannot install policies." - exit 1 - fi + if [ seal_status = "true" ]; then + echo "Vault is currently sealed, cannot install policies." + exit 1 + fi - echo "Getting token..." + echo "Getting token..." - token=$(vault write -field=token auth/approle/login \ - role_id="$role_id" \ - secret_id="$secret_id" \ - ) + token=$(vault write -field=token auth/approle/login \ + role_id="$role_id" \ + secret_id="$secret_id" \ + ) - echo "Logging in..." + echo "Logging in..." - export VAULT_TOKEN="$(vault login -method=token -token-only token="$token")" + export VAULT_TOKEN="$(vault login -method=token -token-only token="$token")" - echo "Writing policies..." + echo "Writing policies..." - ${write-policies} + ${write-policies} - ${optionalString (!cfg.mutable-policies) remove-unknown-policies} - ''; + ${optionalString (!cfg.mutable-policies) remove-unknown-policies} + ''; }; }; } diff --git a/modules/nixos/services/websites/aux/default.nix b/modules/nixos/services/websites/aux/default.nix index 894d83d6..b8322503 100644 --- a/modules/nixos/services/websites/aux/default.nix +++ b/modules/nixos/services/websites/aux/default.nix @@ -4,12 +4,14 @@ config, namespace, ... -}: let +}: +let inherit (lib) mkIf mkEnableOption fetchFromGitHub; inherit (lib.${namespace}) mkOpt; cfg = config.${namespace}.services.websites.aux; -in { +in +{ options.${namespace}.services.websites.aux = with lib.types; { enable = mkEnableOption "nixpkgs.news Website"; package = mkOpt package pkgs.auxolotl.website "The site package to use."; diff --git a/modules/nixos/services/websites/beyondthefringeoc/default.nix b/modules/nixos/services/websites/beyondthefringeoc/default.nix index 92965268..7d80bb97 100644 --- a/modules/nixos/services/websites/beyondthefringeoc/default.nix +++ b/modules/nixos/services/websites/beyondthefringeoc/default.nix @@ -4,16 +4,26 @@ config, namespace, ... -}: let - inherit (lib) mkIf mkEnableOption fetchFromGitHub foldl; +}: +let + inherit (lib) + mkIf + mkEnableOption + fetchFromGitHub + foldl + ; inherit (lib.${namespace}) mkOpt; cfg = config.${namespace}.services.websites.beyondthefringeoc; -in { +in +{ options.${namespace}.services.websites.beyondthefringeoc = with lib.types; { enable = mkEnableOption "Beyond The Fringe OC Website"; package = mkOpt package pkgs.plusultra.beyondthefringeoc-website "The site package to use."; - domains = mkOpt (listOf str) ["beyondthefringeoc.com" "hairbyjanine.com"] "The domain to serve the website site on."; + domains = mkOpt (listOf str) [ + "beyondthefringeoc.com" + "hairbyjanine.com" + ] "The domain to serve the website site on."; acme = { enable = mkOpt bool true "Whether or not to automatically fetch and configure SSL certs."; @@ -24,22 +34,20 @@ in { services.nginx = { enable = true; - virtualHosts = - foldl - (hosts: domain: - hosts - // { - "${domain}" = { - enableACME = cfg.acme.enable; - forceSSL = cfg.acme.enable; + virtualHosts = foldl ( + hosts: domain: + hosts + // { + "${domain}" = { + enableACME = cfg.acme.enable; + forceSSL = cfg.acme.enable; - locations."/" = { - root = cfg.package; - }; + locations."/" = { + root = cfg.package; }; - }) - {} - cfg.domains; + }; + } + ) { } cfg.domains; }; }; } diff --git a/modules/nixos/services/websites/dotbox/default.nix b/modules/nixos/services/websites/dotbox/default.nix index bbc871c5..64d4764e 100644 --- a/modules/nixos/services/websites/dotbox/default.nix +++ b/modules/nixos/services/websites/dotbox/default.nix @@ -4,12 +4,14 @@ config, namespace, ... -}: let +}: +let inherit (lib) mkIf mkEnableOption fetchFromGitHub; inherit (lib.${namespace}) mkOpt; cfg = config.${namespace}.services.websites.dotbox; -in { +in +{ options.${namespace}.services.websites.dotbox = with lib.types; { enable = mkEnableOption "DotBox Website"; package = mkOpt package pkgs.plusultra.dotbox-website "The site package to use."; diff --git a/modules/nixos/services/websites/jakehamilton/default.nix b/modules/nixos/services/websites/jakehamilton/default.nix index 42dfcc56..045406d7 100644 --- a/modules/nixos/services/websites/jakehamilton/default.nix +++ b/modules/nixos/services/websites/jakehamilton/default.nix @@ -4,16 +4,26 @@ config, namespace, ... -}: let - inherit (lib) mkIf mkEnableOption fetchFromGitHub foldl; +}: +let + inherit (lib) + mkIf + mkEnableOption + fetchFromGitHub + foldl + ; inherit (lib.${namespace}) mkOpt; cfg = config.${namespace}.services.websites.jakehamilton; -in { +in +{ options.${namespace}.services.websites.jakehamilton = with lib.types; { enable = mkEnableOption "Jake Hamilton Website"; package = mkOpt package pkgs.jakehamilton-website "The site package to use."; - domains = mkOpt (listOf str) ["jakehamilton.dev" "jakehamilton.website"] "The domain to serve the website site on."; + domains = mkOpt (listOf str) [ + "jakehamilton.dev" + "jakehamilton.website" + ] "The domain to serve the website site on."; acme = { enable = mkOpt bool true "Whether or not to automatically fetch and configure SSL certs."; @@ -29,22 +39,20 @@ in { } ''; - virtualHosts = - foldl - (hosts: domain: - hosts - // { - "${domain}" = { - enableACME = cfg.acme.enable; - forceSSL = cfg.acme.enable; + virtualHosts = foldl ( + hosts: domain: + hosts + // { + "${domain}" = { + enableACME = cfg.acme.enable; + forceSSL = cfg.acme.enable; - locations."/" = { - root = cfg.package; - }; + locations."/" = { + root = cfg.package; }; - }) - {} - cfg.domains; + }; + } + ) { } cfg.domains; }; }; } diff --git a/modules/nixos/services/websites/lasersandfeelings/default.nix b/modules/nixos/services/websites/lasersandfeelings/default.nix index 1138249f..59757530 100644 --- a/modules/nixos/services/websites/lasersandfeelings/default.nix +++ b/modules/nixos/services/websites/lasersandfeelings/default.nix @@ -4,9 +4,9 @@ config, namespace, ... -}: let - inherit - (lib) +}: +let + inherit (lib) mkIf mkEnableOption fetchFromGitHub @@ -16,7 +16,8 @@ inherit (lib.${namespace}) mkOpt; cfg = config.${namespace}.services.websites.lasersandfeelings; -in { +in +{ options.${namespace}.services.websites.lasersandfeelings = with lib.types; { enable = mkEnableOption "Lasers and Feelings"; package = mkOpt package pkgs.lasersandfeelings "The package to use."; @@ -41,14 +42,12 @@ in { }; }; - groups = optionalAttrs (cfg.group == "lasersandfeelings") { - lasersandfeelings = {}; - }; + groups = optionalAttrs (cfg.group == "lasersandfeelings") { lasersandfeelings = { }; }; }; systemd.services.lasersandfeelings = { - after = ["network.target"]; - wantedBy = ["multi-user.target"]; + after = [ "network.target" ]; + wantedBy = [ "multi-user.target" ]; serviceConfig = { Type = "simple"; @@ -58,8 +57,7 @@ in { RestartSec = 20; Environment = "NODE_PORT=${builtins.toString cfg.port}"; ExecStart = "${cfg.package}/bin/lasersandfeelings"; - AmbientCapabilities = - optionalString (cfg.port < 1024) "cap_net_bind_service"; + AmbientCapabilities = optionalString (cfg.port < 1024) "cap_net_bind_service"; }; }; diff --git a/modules/nixos/services/websites/nixpkgs-news/default.nix b/modules/nixos/services/websites/nixpkgs-news/default.nix index 6287d225..67aa6bf0 100644 --- a/modules/nixos/services/websites/nixpkgs-news/default.nix +++ b/modules/nixos/services/websites/nixpkgs-news/default.nix @@ -4,12 +4,14 @@ config, namespace, ... -}: let +}: +let inherit (lib) mkIf mkEnableOption fetchFromGitHub; inherit (lib.${namespace}) mkOpt; cfg = config.${namespace}.services.websites.nixpkgs-news; -in { +in +{ options.${namespace}.services.websites.nixpkgs-news = with lib.types; { enable = mkEnableOption "nixpkgs.news Website"; package = mkOpt package pkgs.plusultra.nixpkgs-news "The site package to use."; diff --git a/modules/nixos/services/websites/noopai/default.nix b/modules/nixos/services/websites/noopai/default.nix index 67f5e402..41e0be87 100644 --- a/modules/nixos/services/websites/noopai/default.nix +++ b/modules/nixos/services/websites/noopai/default.nix @@ -4,16 +4,23 @@ config, namespace, ... -}: let - inherit (lib) mkIf mkEnableOption fetchFromGitHub foldl; +}: +let + inherit (lib) + mkIf + mkEnableOption + fetchFromGitHub + foldl + ; inherit (lib.${namespace}) mkOpt; cfg = config.${namespace}.services.websites.noop-ai; -in { +in +{ options.${namespace}.services.websites.noop-ai = with lib.types; { enable = mkEnableOption "noop.ai Website"; package = mkOpt package pkgs.noop-ai-website "The site package to use."; - domains = mkOpt (listOf str) ["noop.ai"] "The domain to serve the website site on."; + domains = mkOpt (listOf str) [ "noop.ai" ] "The domain to serve the website site on."; acme = { enable = mkOpt bool true "Whether or not to automatically fetch and configure SSL certs."; @@ -29,22 +36,20 @@ in { } ''; - virtualHosts = - foldl - (hosts: domain: - hosts - // { - "${domain}" = { - enableACME = cfg.acme.enable; - forceSSL = cfg.acme.enable; + virtualHosts = foldl ( + hosts: domain: + hosts + // { + "${domain}" = { + enableACME = cfg.acme.enable; + forceSSL = cfg.acme.enable; - locations."/" = { - root = cfg.package; - }; + locations."/" = { + root = cfg.package; }; - }) - {} - cfg.domains; + }; + } + ) { } cfg.domains; }; }; } diff --git a/modules/nixos/services/websites/pungeonquest/default.nix b/modules/nixos/services/websites/pungeonquest/default.nix index dc906621..06235e8b 100644 --- a/modules/nixos/services/websites/pungeonquest/default.nix +++ b/modules/nixos/services/websites/pungeonquest/default.nix @@ -4,9 +4,9 @@ config, namespace, ... -}: let - inherit - (lib) +}: +let + inherit (lib) mkIf mkEnableOption fetchFromGitHub @@ -16,7 +16,8 @@ inherit (lib.${namespace}) mkOpt; cfg = config.${namespace}.services.websites.pungeonquest; -in { +in +{ options.${namespace}.services.websites.pungeonquest = with lib.types; { enable = mkEnableOption "Pungeonquest"; package = mkOpt package pkgs.pungeonquest "The package to use."; @@ -41,14 +42,12 @@ in { }; }; - groups = optionalAttrs (cfg.group == "pungeonquest") { - pungeonquest = {}; - }; + groups = optionalAttrs (cfg.group == "pungeonquest") { pungeonquest = { }; }; }; systemd.services.pungeonquest = { - after = ["network.target"]; - wantedBy = ["multi-user.target"]; + after = [ "network.target" ]; + wantedBy = [ "multi-user.target" ]; serviceConfig = { Type = "simple"; @@ -58,8 +57,7 @@ in { RestartSec = 20; Environment = "NODE_PORT=${builtins.toString cfg.port}"; ExecStart = "${cfg.package}/bin/pungeonquest"; - AmbientCapabilities = - optionalString (cfg.port < 1024) "cap_net_bind_service"; + AmbientCapabilities = optionalString (cfg.port < 1024) "cap_net_bind_service"; }; }; diff --git a/modules/nixos/services/websites/retrospectacle/default.nix b/modules/nixos/services/websites/retrospectacle/default.nix index 27121342..4a9cf5c2 100644 --- a/modules/nixos/services/websites/retrospectacle/default.nix +++ b/modules/nixos/services/websites/retrospectacle/default.nix @@ -4,9 +4,9 @@ config, namespace, ... -}: let - inherit - (lib) +}: +let + inherit (lib) mkIf mkEnableOption fetchFromGitHub @@ -16,7 +16,8 @@ inherit (lib.${namespace}) mkOpt; cfg = config.${namespace}.services.websites.retrospectacle; -in { +in +{ options.${namespace}.services.websites.retrospectacle = with lib.types; { enable = mkEnableOption "Retrospectacle"; package = mkOpt package pkgs.retrospectacle "The package to use."; @@ -41,14 +42,12 @@ in { }; }; - groups = optionalAttrs (cfg.group == "retrospectacle") { - retrospectacle = {}; - }; + groups = optionalAttrs (cfg.group == "retrospectacle") { retrospectacle = { }; }; }; systemd.services.retrospectacle = { - after = ["network.target"]; - wantedBy = ["multi-user.target"]; + after = [ "network.target" ]; + wantedBy = [ "multi-user.target" ]; serviceConfig = { Type = "simple"; @@ -58,8 +57,7 @@ in { RestartSec = 20; Environment = "NODE_PORT=${builtins.toString cfg.port}"; ExecStart = "${cfg.package}/bin/retrospectacle"; - AmbientCapabilities = - optionalString (cfg.port < 1024) "cap_net_bind_service"; + AmbientCapabilities = optionalString (cfg.port < 1024) "cap_net_bind_service"; }; }; diff --git a/modules/nixos/services/websites/scrumfish/default.nix b/modules/nixos/services/websites/scrumfish/default.nix index dc604b20..c6fd95bc 100644 --- a/modules/nixos/services/websites/scrumfish/default.nix +++ b/modules/nixos/services/websites/scrumfish/default.nix @@ -4,12 +4,20 @@ config, namespace, ... -}: let - inherit (lib) mkIf mkEnableOption fetchFromGitHub optionalString optionalAttrs; +}: +let + inherit (lib) + mkIf + mkEnableOption + fetchFromGitHub + optionalString + optionalAttrs + ; inherit (lib.${namespace}) mkOpt; cfg = config.${namespace}.services.websites.scrumfish; -in { +in +{ options.${namespace}.services.websites.scrumfish = with lib.types; { enable = mkEnableOption "Scrumfish"; package = mkOpt package pkgs.scrumfish "The package to use."; @@ -34,14 +42,12 @@ in { }; }; - groups = optionalAttrs (cfg.group == "scrumfish") { - scrumfish = {}; - }; + groups = optionalAttrs (cfg.group == "scrumfish") { scrumfish = { }; }; }; systemd.services.scrumfish = { - after = ["network.target"]; - wantedBy = ["multi-user.target"]; + after = [ "network.target" ]; + wantedBy = [ "multi-user.target" ]; serviceConfig = { Type = "simple"; @@ -51,8 +57,7 @@ in { RestartSec = 20; Environment = "NODE_PORT=${builtins.toString cfg.port}"; ExecStart = "${cfg.package}/bin/scrumfish"; - AmbientCapabilities = - optionalString (cfg.port < 1024) "cap_net_bind_service"; + AmbientCapabilities = optionalString (cfg.port < 1024) "cap_net_bind_service"; }; }; diff --git a/modules/nixos/services/websites/snowfall-docs/default.nix b/modules/nixos/services/websites/snowfall-docs/default.nix index f861c892..17ed9c50 100644 --- a/modules/nixos/services/websites/snowfall-docs/default.nix +++ b/modules/nixos/services/websites/snowfall-docs/default.nix @@ -4,12 +4,14 @@ config, namespace, ... -}: let +}: +let inherit (lib) mkIf mkEnableOption fetchFromGitHub; inherit (lib.${namespace}) mkOpt; cfg = config.${namespace}.services.websites.snowfall-docs; -in { +in +{ options.${namespace}.services.websites.snowfall-docs = with lib.types; { enable = mkEnableOption "docs.snowfall.org Website"; package = mkOpt package pkgs.snowfallorg.snowfall-docs "The site package to use."; diff --git a/modules/nixos/services/websites/sokoban/default.nix b/modules/nixos/services/websites/sokoban/default.nix index c478a8f4..4d084fad 100644 --- a/modules/nixos/services/websites/sokoban/default.nix +++ b/modules/nixos/services/websites/sokoban/default.nix @@ -4,12 +4,14 @@ config, namespace, ... -}: let +}: +let inherit (lib) mkIf mkEnableOption fetchFromGitHub; inherit (lib.${namespace}) mkOpt; cfg = config.${namespace}.services.websites.sokoban; -in { +in +{ options.${namespace}.services.websites.sokoban = with lib.types; { enable = mkEnableOption "Sokoban Website"; package = mkOpt package pkgs.plusultra.sokoban-website "The site package to use."; diff --git a/modules/nixos/services/websites/traek/default.nix b/modules/nixos/services/websites/traek/default.nix index 2dc8bbc1..367db5a0 100644 --- a/modules/nixos/services/websites/traek/default.nix +++ b/modules/nixos/services/websites/traek/default.nix @@ -4,12 +4,14 @@ config, namespace, ... -}: let +}: +let inherit (lib) mkIf mkEnableOption fetchFromGitHub; inherit (lib.${namespace}) mkOpt; cfg = config.${namespace}.services.websites.traek; -in { +in +{ options.${namespace}.services.websites.traek = with lib.types; { enable = mkEnableOption "traek.app Website"; package = mkOpt package pkgs.plusultra.traek-website "The site package to use."; diff --git a/modules/nixos/services/writefreely/default.nix b/modules/nixos/services/writefreely/default.nix index 0ad44154..c79d48f0 100644 --- a/modules/nixos/services/writefreely/default.nix +++ b/modules/nixos/services/writefreely/default.nix @@ -4,25 +4,37 @@ pkgs, namespace, ... -}: let +}: +let inherit (builtins) toString; - inherit (lib) types mkIf mkOption mkDefault; - inherit (lib) optional optionals optionalAttrs optionalString; + inherit (lib) + types + mkIf + mkOption + mkDefault + ; + inherit (lib) + optional + optionals + optionalAttrs + optionalString + ; inherit (pkgs) sqlite; format = pkgs.formats.ini { - mkKeyValue = key: value: let - value' = - if builtins.isNull value - then "" - else if builtins.isBool value - then - if value == true - then "true" - else "false" - else toString value; - in "${key} = ${value'}"; + mkKeyValue = + key: value: + let + value' = + if builtins.isNull value then + "" + else if builtins.isBool value then + if value == true then "true" else "false" + else + toString value; + in + "${key} = ${value'}"; }; cfg = config.${namespace}.services.writefreely; @@ -31,29 +43,22 @@ isMysql = cfg.database.type == "mysql"; isMysqlLocal = isMysql && cfg.database.createLocally == true; - hostProtocol = - if cfg.acme.enable - then "https" - else "http"; - - settings = - cfg.settings - // { - app = - cfg.settings.app - or {} - // { - host = cfg.settings.app.host or "${hostProtocol}://${cfg.host}"; - }; + hostProtocol = if cfg.acme.enable then "https" else "http"; + + settings = cfg.settings // { + app = cfg.settings.app or { } // { + host = cfg.settings.app.host or "${hostProtocol}://${cfg.host}"; + }; - database = - if cfg.database.type == "sqlite3" - then { + database = + if cfg.database.type == "sqlite3" then + { type = "sqlite3"; filename = cfg.settings.database.filename or "writefreely.db"; database = cfg.database.name; } - else { + else + { type = "mysql"; username = cfg.database.user; password = "#dbpass#"; @@ -63,21 +68,16 @@ tls = cfg.database.tls; }; - server = - cfg.settings.server - or {} - // { - bind = cfg.settings.server.bind or "localhost"; - gopher_port = cfg.settings.server.gopher_port or 0; - autocert = !cfg.nginx.enable && cfg.acme.enable; - templates_parent_dir = - cfg.settings.server.templates_parent_dir or cfg.package.src; - static_parent_dir = cfg.settings.server.static_parent_dir or assets; - pages_parent_dir = - cfg.settings.server.pages_parent_dir or cfg.package.src; - keys_parent_dir = cfg.settings.server.keys_parent_dir or cfg.stateDir; - }; + server = cfg.settings.server or { } // { + bind = cfg.settings.server.bind or "localhost"; + gopher_port = cfg.settings.server.gopher_port or 0; + autocert = !cfg.nginx.enable && cfg.acme.enable; + templates_parent_dir = cfg.settings.server.templates_parent_dir or cfg.package.src; + static_parent_dir = cfg.settings.server.static_parent_dir or assets; + pages_parent_dir = cfg.settings.server.pages_parent_dir or cfg.package.src; + keys_parent_dir = cfg.settings.server.keys_parent_dir or cfg.stateDir; }; + }; configFile = format.generate "config.ini" settings; @@ -86,7 +86,7 @@ inherit (cfg.package) version src; - nativeBuildInputs = with pkgs.nodePackages; [less]; + nativeBuildInputs = with pkgs.nodePackages; [ less ]; buildPhase = '' mkdir -p $out @@ -107,8 +107,7 @@ withConfigFile = text: '' db_pass=${ - optionalString (cfg.database.passwordFile != null) - "$(head -n1 ${cfg.database.passwordFile})" + optionalString (cfg.database.passwordFile != null) "$(head -n1 ${cfg.database.passwordFile})" } cp -f ${configFile} '${cfg.stateDir}/config.ini' @@ -118,7 +117,8 @@ ${text} ''; - withMysql = text: + withMysql = + text: withConfigFile '' query () { local result=$(${config.services.mysql.package}/bin/mysql \ @@ -137,7 +137,8 @@ ${text} ''; - withSqlite = text: + withSqlite = + text: withConfigFile '' query () { local result=$(${sqlite}/bin/sqlite3 \ @@ -150,10 +151,10 @@ ${text} ''; -in { +in +{ options.${namespace}.services.writefreely = { - enable = - lib.mkEnableOption (lib.mdDoc "Writefreely, build a digital writing community"); + enable = lib.mkEnableOption (lib.mdDoc "Writefreely, build a digital writing community"); package = lib.mkOption { type = lib.types.package; @@ -188,7 +189,7 @@ in { }; settings = mkOption { - default = {}; + default = { }; description = lib.mdDoc '' Writefreely configuration (`config.ini`). Refer to [writefreely.org/docs/latest/admin/config](https://writefreely.org/docs/latest/admin/config) @@ -210,10 +211,7 @@ in { server = { port = mkOption { type = types.port; - default = - if cfg.nginx.enable - then 18080 - else 80; + default = if cfg.nginx.enable then 18080 else 80; defaultText = "80"; description = "The port WriteFreely should listen on."; }; @@ -224,7 +222,10 @@ in { database = { type = mkOption { - type = types.enum ["sqlite3" "mysql"]; + type = types.enum [ + "sqlite3" + "mysql" + ]; default = "sqlite3"; description = "The database provider to use."; }; @@ -237,10 +238,7 @@ in { user = mkOption { type = types.nullOr types.str; - default = - if cfg.database.type == "mysql" - then "writefreely" - else null; + default = if cfg.database.type == "mysql" then "writefreely" else null; defaultText = "writefreely"; description = lib.mdDoc "The database user to connect as."; }; @@ -266,15 +264,13 @@ in { tls = mkOption { type = types.bool; default = false; - description = - lib.mdDoc "Whether or not TLS should be used for the database connection."; + description = lib.mdDoc "Whether or not TLS should be used for the database connection."; }; migrate = mkOption { type = types.bool; default = true; - description = - lib.mdDoc "Whether or not to automatically run migrations on startup."; + description = lib.mdDoc "Whether or not to automatically run migrations on startup."; }; createLocally = mkOption { @@ -353,19 +349,18 @@ in { }; }; - groups = - optionalAttrs (cfg.group == "writefreely") {writefreely = {};}; + groups = optionalAttrs (cfg.group == "writefreely") { writefreely = { }; }; }; - systemd.tmpfiles.rules = ["d '${cfg.stateDir}' 0750 ${cfg.user} ${cfg.group} - -"]; + systemd.tmpfiles.rules = [ "d '${cfg.stateDir}' 0750 ${cfg.user} ${cfg.group} - -" ]; systemd.services.writefreely = { after = - ["network.target"] + [ "network.target" ] ++ optional isSqlite "writefreely-sqlite-init.service" ++ optional isMysql "writefreely-mysql-init.service" ++ optional isMysqlLocal "mysql.service"; - wantedBy = ["multi-user.target"]; + wantedBy = [ "multi-user.target" ]; serviceConfig = { Type = "simple"; @@ -375,8 +370,7 @@ in { Restart = "always"; RestartSec = 20; ExecStart = "${cfg.package}/bin/writefreely -c '${cfg.stateDir}/config.ini' serve"; - AmbientCapabilities = - optionalString (settings.server.port < 1024) "cap_net_bind_service"; + AmbientCapabilities = optionalString (settings.server.port < 1024) "cap_net_bind_service"; }; preStart = '' @@ -393,31 +387,30 @@ in { }; systemd.services.writefreely-sqlite-init = mkIf isSqlite { - wantedBy = ["multi-user.target"]; + wantedBy = [ "multi-user.target" ]; serviceConfig = { Type = "oneshot"; User = cfg.user; Group = cfg.group; WorkingDirectory = cfg.stateDir; - ReadOnlyPaths = - optional (cfg.admin.initialPasswordFile != null) - cfg.admin.initialPasswordFile; + ReadOnlyPaths = optional (cfg.admin.initialPasswordFile != null) cfg.admin.initialPasswordFile; }; - script = let - migrateDatabase = optionalString cfg.database.migrate '' - ${cfg.package}/bin/writefreely -c '${cfg.stateDir}/config.ini' db migrate - ''; + script = + let + migrateDatabase = optionalString cfg.database.migrate '' + ${cfg.package}/bin/writefreely -c '${cfg.stateDir}/config.ini' db migrate + ''; - createAdmin = optionalString (cfg.admin.name != null) '' - if [[ $(query "SELECT COUNT(*) FROM users") == 0 ]]; then - admin_pass=$(head -n1 ${cfg.admin.initialPasswordFile}) + createAdmin = optionalString (cfg.admin.name != null) '' + if [[ $(query "SELECT COUNT(*) FROM users") == 0 ]]; then + admin_pass=$(head -n1 ${cfg.admin.initialPasswordFile}) - ${cfg.package}/bin/writefreely -c '${cfg.stateDir}/config.ini' --create-admin ${cfg.admin.name}:$admin_pass - fi - ''; - in + ${cfg.package}/bin/writefreely -c '${cfg.stateDir}/config.ini' --create-admin ${cfg.admin.name}:$admin_pass + fi + ''; + in withSqlite '' if ! test -f '${settings.database.filename}'; then ${cfg.package}/bin/writefreely -c '${cfg.stateDir}/config.ini' db init @@ -430,7 +423,7 @@ in { }; systemd.services.writefreely-mysql-init = mkIf isMysql { - wantedBy = ["multi-user.target"]; + wantedBy = [ "multi-user.target" ]; after = optional isMysqlLocal "mysql.service"; serviceConfig = { @@ -440,30 +433,30 @@ in { WorkingDirectory = cfg.stateDir; ReadOnlyPaths = optional isMysqlLocal cfg.database.passwordFile - ++ optional (cfg.admin.initialPasswordFile != null) - cfg.admin.initialPasswordFile; + ++ optional (cfg.admin.initialPasswordFile != null) cfg.admin.initialPasswordFile; }; - script = let - updateUser = optionalString isMysqlLocal '' - # WriteFreely currently *requires* a password for authentication, so we - # need to update the user in MySQL accordingly. By default MySQL users - # authenticate with auth_socket or unix_socket. - # See: https://github.com/writefreely/writefreely/issues/568 - ${config.services.mysql.package}/bin/mysql --skip-column-names --execute "ALTER USER '${cfg.database.user}'@'localhost' IDENTIFIED VIA unix_socket OR mysql_native_password USING PASSWORD('$db_pass'); FLUSH PRIVILEGES;" - ''; - - migrateDatabase = optionalString cfg.database.migrate '' - ${cfg.package}/bin/writefreely -c '${cfg.stateDir}/config.ini' db migrate - ''; - - createAdmin = optionalString (cfg.admin.name != null) '' - if [[ $(query 'SELECT COUNT(*) FROM users') == 0 ]]; then - admin_pass=$(head -n1 ${cfg.admin.initialPasswordFile}) - ${cfg.package}/bin/writefreely -c '${cfg.stateDir}/config.ini' --create-admin ${cfg.admin.name}:$admin_pass - fi - ''; - in + script = + let + updateUser = optionalString isMysqlLocal '' + # WriteFreely currently *requires* a password for authentication, so we + # need to update the user in MySQL accordingly. By default MySQL users + # authenticate with auth_socket or unix_socket. + # See: https://github.com/writefreely/writefreely/issues/568 + ${config.services.mysql.package}/bin/mysql --skip-column-names --execute "ALTER USER '${cfg.database.user}'@'localhost' IDENTIFIED VIA unix_socket OR mysql_native_password USING PASSWORD('$db_pass'); FLUSH PRIVILEGES;" + ''; + + migrateDatabase = optionalString cfg.database.migrate '' + ${cfg.package}/bin/writefreely -c '${cfg.stateDir}/config.ini' db migrate + ''; + + createAdmin = optionalString (cfg.admin.name != null) '' + if [[ $(query 'SELECT COUNT(*) FROM users') == 0 ]]; then + admin_pass=$(head -n1 ${cfg.admin.initialPasswordFile}) + ${cfg.package}/bin/writefreely -c '${cfg.stateDir}/config.ini' --create-admin ${cfg.admin.name}:$admin_pass + fi + ''; + in withMysql '' ${updateUser} @@ -480,7 +473,7 @@ in { services.mysql = mkIf isMysqlLocal { enable = true; package = mkDefault pkgs.mariadb; - ensureDatabases = [cfg.database.name]; + ensureDatabases = [ cfg.database.name ]; ensureUsers = [ { name = cfg.database.user; diff --git a/modules/nixos/suites/art/default.nix b/modules/nixos/suites/art/default.nix index e31ed32f..575241bb 100644 --- a/modules/nixos/suites/art/default.nix +++ b/modules/nixos/suites/art/default.nix @@ -7,9 +7,11 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.suites.art; -in { +in +{ options.${namespace}.suites.art = with types; { enable = mkBoolOpt false "Whether or not to enable art configuration."; }; @@ -22,9 +24,7 @@ in { blender = enabled; }; - system.fonts.fonts = with pkgs; [ - google-fonts - ]; + system.fonts.fonts = with pkgs; [ google-fonts ]; }; }; } diff --git a/modules/nixos/suites/business/default.nix b/modules/nixos/suites/business/default.nix index 8ada561f..3a85eb11 100644 --- a/modules/nixos/suites/business/default.nix +++ b/modules/nixos/suites/business/default.nix @@ -7,13 +7,20 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.suites.business; -in { +in +{ options.${namespace}.suites.business = with types; { enable = mkBoolOpt false "Whether or not to enable business configuration."; }; - config = - mkIf cfg.enable {plusultra = {apps = {frappe-books = enabled;};};}; + config = mkIf cfg.enable { + plusultra = { + apps = { + frappe-books = enabled; + }; + }; + }; } diff --git a/modules/nixos/suites/common-slim/default.nix b/modules/nixos/suites/common-slim/default.nix index 130085f7..1f9ac2ff 100644 --- a/modules/nixos/suites/common-slim/default.nix +++ b/modules/nixos/suites/common-slim/default.nix @@ -7,17 +7,17 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.suites.common-slim; -in { +in +{ options.${namespace}.suites.common-slim = with types; { enable = mkBoolOpt false "Whether or not to enable common-slim configuration."; }; config = mkIf cfg.enable { - environment.systemPackages = [ - pkgs.plusultra.list-iommu - ]; + environment.systemPackages = [ pkgs.plusultra.list-iommu ]; plusultra = { nix = enabled; diff --git a/modules/nixos/suites/common/default.nix b/modules/nixos/suites/common/default.nix index a89fff1f..d4662f1f 100644 --- a/modules/nixos/suites/common/default.nix +++ b/modules/nixos/suites/common/default.nix @@ -7,17 +7,17 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.suites.common; -in { +in +{ options.${namespace}.suites.common = with types; { enable = mkBoolOpt false "Whether or not to enable common configuration."; }; config = mkIf cfg.enable { - environment.systemPackages = [ - pkgs.plusultra.list-iommu - ]; + environment.systemPackages = [ pkgs.plusultra.list-iommu ]; plusultra = { nix = enabled; diff --git a/modules/nixos/suites/desktop/default.nix b/modules/nixos/suites/desktop/default.nix index 20d96d61..a2720146 100644 --- a/modules/nixos/suites/desktop/default.nix +++ b/modules/nixos/suites/desktop/default.nix @@ -7,12 +7,13 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.suites.desktop; -in { +in +{ options.${namespace}.suites.desktop = with types; { - enable = - mkBoolOpt false "Whether or not to enable common desktop configuration."; + enable = mkBoolOpt false "Whether or not to enable common desktop configuration."; }; config = mkIf cfg.enable { @@ -20,7 +21,9 @@ in { desktop = { gnome = enabled; - addons = {wallpapers = enabled;}; + addons = { + wallpapers = enabled; + }; }; apps = { diff --git a/modules/nixos/suites/development/default.nix b/modules/nixos/suites/development/default.nix index ff04d428..1a0bc6f0 100644 --- a/modules/nixos/suites/development/default.nix +++ b/modules/nixos/suites/development/default.nix @@ -7,7 +7,8 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.suites.development; apps = { vscode = enabled; @@ -20,11 +21,10 @@ with lib.${namespace}; let prisma = enabled; mods = enabled; }; -in { +in +{ options.${namespace}.suites.development = with types; { - enable = - mkBoolOpt false - "Whether or not to enable common development configuration."; + enable = mkBoolOpt false "Whether or not to enable common development configuration."; }; config = mkIf cfg.enable { @@ -51,7 +51,9 @@ in { qmk = enabled; }; - virtualisation = {podman = enabled;}; + virtualisation = { + podman = enabled; + }; }; }; } diff --git a/modules/nixos/suites/emulation/default.nix b/modules/nixos/suites/emulation/default.nix index 671781fe..35407fbf 100644 --- a/modules/nixos/suites/emulation/default.nix +++ b/modules/nixos/suites/emulation/default.nix @@ -7,12 +7,13 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.suites.emulation; -in { +in +{ options.${namespace}.suites.emulation = with types; { - enable = - mkBoolOpt false "Whether or not to enable emulation configuration."; + enable = mkBoolOpt false "Whether or not to enable emulation configuration."; }; config = mkIf cfg.enable { diff --git a/modules/nixos/suites/games/default.nix b/modules/nixos/suites/games/default.nix index 70a6a49a..85bfd764 100644 --- a/modules/nixos/suites/games/default.nix +++ b/modules/nixos/suites/games/default.nix @@ -7,7 +7,8 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.suites.games; apps = { steam = enabled; @@ -22,11 +23,15 @@ with lib.${namespace}; let wine = enabled; proton = enabled; }; -in { +in +{ options.${namespace}.suites.games = with types; { - enable = - mkBoolOpt false "Whether or not to enable common games configuration."; + enable = mkBoolOpt false "Whether or not to enable common games configuration."; }; - config = mkIf cfg.enable {plusultra = {inherit apps cli-apps;};}; + config = mkIf cfg.enable { + plusultra = { + inherit apps cli-apps; + }; + }; } diff --git a/modules/nixos/suites/media/default.nix b/modules/nixos/suites/media/default.nix index 28c6e473..cdcd46b2 100644 --- a/modules/nixos/suites/media/default.nix +++ b/modules/nixos/suites/media/default.nix @@ -7,12 +7,20 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.suites.media; -in { +in +{ options.${namespace}.suites.media = with types; { enable = mkBoolOpt false "Whether or not to enable media configuration."; }; - config = mkIf cfg.enable {plusultra = {apps = {freetube = enabled;};};}; + config = mkIf cfg.enable { + plusultra = { + apps = { + freetube = enabled; + }; + }; + }; } diff --git a/modules/nixos/suites/music/default.nix b/modules/nixos/suites/music/default.nix index 3dbfd184..5993934b 100644 --- a/modules/nixos/suites/music/default.nix +++ b/modules/nixos/suites/music/default.nix @@ -7,9 +7,11 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.suites.music; -in { +in +{ options.${namespace}.suites.music = with types; { enable = mkBoolOpt false "Whether or not to enable music configuration."; }; diff --git a/modules/nixos/suites/social/default.nix b/modules/nixos/suites/social/default.nix index 4e78234e..f8de39cd 100644 --- a/modules/nixos/suites/social/default.nix +++ b/modules/nixos/suites/social/default.nix @@ -7,9 +7,11 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.suites.social; -in { +in +{ options.${namespace}.suites.social = with types; { enable = mkBoolOpt false "Whether or not to enable social configuration."; }; diff --git a/modules/nixos/suites/video/default.nix b/modules/nixos/suites/video/default.nix index 32b26ecb..d06a32ac 100644 --- a/modules/nixos/suites/video/default.nix +++ b/modules/nixos/suites/video/default.nix @@ -7,9 +7,11 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.suites.video; -in { +in +{ options.${namespace}.suites.video = with types; { enable = mkBoolOpt false "Whether or not to enable video configuration."; }; diff --git a/modules/nixos/system/boot/default.nix b/modules/nixos/system/boot/default.nix index fb2a54a5..1f92c49d 100644 --- a/modules/nixos/system/boot/default.nix +++ b/modules/nixos/system/boot/default.nix @@ -7,9 +7,11 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.system.boot; -in { +in +{ options.${namespace}.system.boot = with types; { enable = mkBoolOpt false "Whether or not to enable booting."; }; diff --git a/modules/nixos/system/env/default.nix b/modules/nixos/system/env/default.nix index e14a7c09..7ab15757 100644 --- a/modules/nixos/system/env/default.nix +++ b/modules/nixos/system/env/default.nix @@ -7,17 +7,23 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.system.env; -in { - options.${namespace}.system.env = with types; +in +{ + options.${namespace}.system.env = + with types; mkOption { - type = attrsOf (oneOf [str path (listOf (either str path))]); - apply = mapAttrs (n: v: - if isList v - then concatMapStringsSep ":" (x: toString x) v - else (toString v)); - default = {}; + type = attrsOf (oneOf [ + str + path + (listOf (either str path)) + ]); + apply = mapAttrs ( + n: v: if isList v then concatMapStringsSep ":" (x: toString x) v else (toString v) + ); + default = { }; description = "A set of environment variables to set."; }; @@ -36,9 +42,7 @@ in { LESSHISTFILE = "$XDG_CACHE_HOME/less.history"; WGETRC = "$XDG_CONFIG_HOME/wgetrc"; }; - extraInit = - concatStringsSep "\n" - (mapAttrsToList (n: v: ''export ${n}="${v}"'') cfg); + extraInit = concatStringsSep "\n" (mapAttrsToList (n: v: ''export ${n}="${v}"'') cfg); }; }; } diff --git a/modules/nixos/system/fonts/default.nix b/modules/nixos/system/fonts/default.nix index 63a84f48..d7e063f2 100644 --- a/modules/nixos/system/fonts/default.nix +++ b/modules/nixos/system/fonts/default.nix @@ -7,12 +7,14 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.system.fonts; -in { +in +{ options.${namespace}.system.fonts = with types; { enable = mkBoolOpt false "Whether or not to manage fonts."; - fonts = mkOpt (listOf package) [] "Custom font packages to install."; + fonts = mkOpt (listOf package) [ ] "Custom font packages to install."; }; config = mkIf cfg.enable { @@ -21,16 +23,17 @@ in { LOG_ICONS = "true"; }; - environment.systemPackages = with pkgs; [font-manager]; + environment.systemPackages = with pkgs; [ font-manager ]; - fonts.packages = with pkgs; + fonts.packages = + with pkgs; [ noto-fonts noto-fonts-cjk-sans noto-fonts-cjk-serif noto-fonts-emoji pkgs.plusultra.rf - (nerdfonts.override {fonts = ["Hack"];}) + (nerdfonts.override { fonts = [ "Hack" ]; }) ] ++ cfg.fonts; }; diff --git a/modules/nixos/system/locale/default.nix b/modules/nixos/system/locale/default.nix index 52e8c9dd..4bbb513a 100644 --- a/modules/nixos/system/locale/default.nix +++ b/modules/nixos/system/locale/default.nix @@ -7,9 +7,11 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.system.locale; -in { +in +{ options.${namespace}.system.locale = with types; { enable = mkBoolOpt false "Whether or not to manage locale settings."; }; @@ -17,6 +19,8 @@ in { config = mkIf cfg.enable { i18n.defaultLocale = "en_US.UTF-8"; - console = {keyMap = mkForce "us";}; + console = { + keyMap = mkForce "us"; + }; }; } diff --git a/modules/nixos/system/time/default.nix b/modules/nixos/system/time/default.nix index db1f24af..1390098d 100644 --- a/modules/nixos/system/time/default.nix +++ b/modules/nixos/system/time/default.nix @@ -7,13 +7,14 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.system.time; -in { +in +{ options.${namespace}.system.time = with types; { - enable = - mkBoolOpt false "Whether or not to configure timezone information."; + enable = mkBoolOpt false "Whether or not to configure timezone information."; }; - config = mkIf cfg.enable {time.timeZone = "America/Los_Angeles";}; + config = mkIf cfg.enable { time.timeZone = "America/Los_Angeles"; }; } diff --git a/modules/nixos/system/xkb/default.nix b/modules/nixos/system/xkb/default.nix index e3d4d7ee..9d18c59f 100644 --- a/modules/nixos/system/xkb/default.nix +++ b/modules/nixos/system/xkb/default.nix @@ -6,9 +6,11 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.system.xkb; -in { +in +{ options.${namespace}.system.xkb = with types; { enable = mkBoolOpt false "Whether or not to configure xkb."; }; diff --git a/modules/nixos/system/zfs/default.nix b/modules/nixos/system/zfs/default.nix index abfa745c..a1761209 100644 --- a/modules/nixos/system/zfs/default.nix +++ b/modules/nixos/system/zfs/default.nix @@ -3,17 +3,19 @@ lib, namespace, ... -}: let +}: +let cfg = config.${namespace}.system.zfs; inherit (lib) mkEnableOption mkIf mkDefault; inherit (lib.${namespace}) mkOpt enabled; inherit (lib.types) listOf str; -in { +in +{ options.${namespace}.system.zfs = { enable = mkEnableOption "ZFS support"; - pools = mkOpt (listOf str) ["rpool"] "The ZFS pools to manage."; + pools = mkOpt (listOf str) [ "rpool" ] "The ZFS pools to manage."; auto-snapshot = { enable = mkEnableOption "ZFS auto snapshotting"; diff --git a/modules/nixos/tools/appimage-run/default.nix b/modules/nixos/tools/appimage-run/default.nix index 43c73e65..91bd3a98 100644 --- a/modules/nixos/tools/appimage-run/default.nix +++ b/modules/nixos/tools/appimage-run/default.nix @@ -7,9 +7,11 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.tools.appimage-run; -in { +in +{ options.${namespace}.tools.appimage-run = with types; { enable = mkBoolOpt false "Whether or not to enable appimage-run."; }; @@ -17,8 +19,6 @@ in { config = mkIf cfg.enable { plusultra.home.configFile."wgetrc".text = ""; - environment.systemPackages = with pkgs; [ - appimage-run - ]; + environment.systemPackages = with pkgs; [ appimage-run ]; }; } diff --git a/modules/nixos/tools/at/default.nix b/modules/nixos/tools/at/default.nix index 03719472..df20989c 100644 --- a/modules/nixos/tools/at/default.nix +++ b/modules/nixos/tools/at/default.nix @@ -7,17 +7,15 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.tools.at; -in { +in +{ options.${namespace}.tools.at = with types; { enable = mkBoolOpt false "Whether or not to install at."; pkg = mkOpt package pkgs.plusultra.at "The package to install as at."; }; - config = mkIf cfg.enable { - environment.systemPackages = [ - cfg.pkg - ]; - }; + config = mkIf cfg.enable { environment.systemPackages = [ cfg.pkg ]; }; } diff --git a/modules/nixos/tools/attic/default.nix b/modules/nixos/tools/attic/default.nix index b217a980..0c203c66 100644 --- a/modules/nixos/tools/attic/default.nix +++ b/modules/nixos/tools/attic/default.nix @@ -6,16 +6,14 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.tools.attic; -in { +in +{ options.${namespace}.tools.attic = { enable = mkEnableOption "Attic"; }; - config = mkIf cfg.enable { - environment.systemPackages = with pkgs; [ - attic - ]; - }; + config = mkIf cfg.enable { environment.systemPackages = with pkgs; [ attic ]; }; } diff --git a/modules/nixos/tools/bottom/default.nix b/modules/nixos/tools/bottom/default.nix index 35766f38..33e67b36 100644 --- a/modules/nixos/tools/bottom/default.nix +++ b/modules/nixos/tools/bottom/default.nix @@ -7,16 +7,14 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.tools.bottom; -in { +in +{ options.${namespace}.tools.bottom = with types; { enable = mkBoolOpt false "Whether or not to enable Bottom."; }; - config = mkIf cfg.enable { - environment.systemPackages = with pkgs; [ - bottom - ]; - }; + config = mkIf cfg.enable { environment.systemPackages = with pkgs; [ bottom ]; }; } diff --git a/modules/nixos/tools/comma/default.nix b/modules/nixos/tools/comma/default.nix index 5e35df3e..88731de3 100644 --- a/modules/nixos/tools/comma/default.nix +++ b/modules/nixos/tools/comma/default.nix @@ -7,9 +7,11 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.tools.comma; -in { +in +{ options.${namespace}.tools.comma = with types; { enable = mkBoolOpt false "Whether or not to enable comma."; }; diff --git a/modules/nixos/tools/direnv/default.nix b/modules/nixos/tools/direnv/default.nix index d5ffd22d..d9d2ae57 100644 --- a/modules/nixos/tools/direnv/default.nix +++ b/modules/nixos/tools/direnv/default.nix @@ -7,9 +7,11 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.tools.direnv; -in { +in +{ options.${namespace}.tools.direnv = with types; { enable = mkBoolOpt false "Whether or not to enable direnv."; }; diff --git a/modules/nixos/tools/fup-repl/default.nix b/modules/nixos/tools/fup-repl/default.nix index 686fa243..c079f35e 100644 --- a/modules/nixos/tools/fup-repl/default.nix +++ b/modules/nixos/tools/fup-repl/default.nix @@ -6,15 +6,17 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.tools.fup-repl; fup-repl = pkgs.writeShellScriptBin "fup-repl" '' ${pkgs.fup-repl}/bin/repl ''${@} ''; -in { +in +{ options.${namespace}.tools.fup-repl = with types; { enable = mkBoolOpt false "Whether to enable fup-repl or not"; }; - config = mkIf cfg.enable {environment.systemPackages = [fup-repl];}; + config = mkIf cfg.enable { environment.systemPackages = [ fup-repl ]; }; } diff --git a/modules/nixos/tools/git/default.nix b/modules/nixos/tools/git/default.nix index cea343d6..160d3c94 100644 --- a/modules/nixos/tools/git/default.nix +++ b/modules/nixos/tools/git/default.nix @@ -7,21 +7,22 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.tools.git; gpg = config.${namespace}.security.gpg; user = config.${namespace}.user; -in { +in +{ options.${namespace}.tools.git = with types; { enable = mkBoolOpt false "Whether or not to install and configure git."; userName = mkOpt types.str user.fullName "The name to configure git with."; userEmail = mkOpt types.str user.email "The email to configure git with."; - signingKey = - mkOpt types.str "9762169A1B35EA68" "The key ID to sign commits with."; + signingKey = mkOpt types.str "9762169A1B35EA68" "The key ID to sign commits with."; }; config = mkIf cfg.enable { - environment.systemPackages = with pkgs; [git]; + environment.systemPackages = with pkgs; [ git ]; plusultra.home.extraOptions = { programs.git = { @@ -33,10 +34,18 @@ in { signByDefault = mkIf gpg.enable true; }; extraConfig = { - init = {defaultBranch = "main";}; - pull = {rebase = true;}; - push = {autoSetupRemote = true;}; - core = {whitespace = "trailing-space,space-before-tab";}; + init = { + defaultBranch = "main"; + }; + pull = { + rebase = true; + }; + push = { + autoSetupRemote = true; + }; + core = { + whitespace = "trailing-space,space-before-tab"; + }; safe = { directory = "${config.users.users.${user.name}.home}/work/config"; }; diff --git a/modules/nixos/tools/go/default.nix b/modules/nixos/tools/go/default.nix index bcaa8a70..4e3485da 100644 --- a/modules/nixos/tools/go/default.nix +++ b/modules/nixos/tools/go/default.nix @@ -7,16 +7,21 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.tools.go; -in { +in +{ options.${namespace}.tools.go = with types; { enable = mkBoolOpt false "Whether or not to enable Go support."; }; config = mkIf cfg.enable { environment = { - systemPackages = with pkgs; [go gopls]; + systemPackages = with pkgs; [ + go + gopls + ]; sessionVariables = { GOPATH = "$HOME/work/go"; }; diff --git a/modules/nixos/tools/http/default.nix b/modules/nixos/tools/http/default.nix index 20efc3be..d038a304 100644 --- a/modules/nixos/tools/http/default.nix +++ b/modules/nixos/tools/http/default.nix @@ -7,13 +7,19 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.tools.http; -in { +in +{ options.${namespace}.tools.http = with types; { enable = mkBoolOpt false "Whether or not to enable common http utilities."; }; - config = - mkIf cfg.enable {environment.systemPackages = with pkgs; [wget curl];}; + config = mkIf cfg.enable { + environment.systemPackages = with pkgs; [ + wget + curl + ]; + }; } diff --git a/modules/nixos/tools/icehouse/default.nix b/modules/nixos/tools/icehouse/default.nix index 89806457..eaf3f9fa 100644 --- a/modules/nixos/tools/icehouse/default.nix +++ b/modules/nixos/tools/icehouse/default.nix @@ -4,16 +4,16 @@ pkgs, namespace, ... -}: let +}: +let cfg = config.${namespace}.tools.icehouse; inherit (lib) mkEnableOption mkIf; -in { +in +{ options.${namespace}.tools.icehouse = { enable = mkEnableOption "Icehouse"; }; - config = mkIf cfg.enable { - environment.systemPackages = [pkgs.snowfallorg.icehouse]; - }; + config = mkIf cfg.enable { environment.systemPackages = [ pkgs.snowfallorg.icehouse ]; }; } diff --git a/modules/nixos/tools/k8s/default.nix b/modules/nixos/tools/k8s/default.nix index 6c8e6c78..30c16bb3 100644 --- a/modules/nixos/tools/k8s/default.nix +++ b/modules/nixos/tools/k8s/default.nix @@ -7,12 +7,13 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.tools.k8s; -in { +in +{ options.${namespace}.tools.k8s = with types; { - enable = - mkBoolOpt false "Whether or not to enable common Kubernetes utilities."; + enable = mkBoolOpt false "Whether or not to enable common Kubernetes utilities."; }; config = mkIf cfg.enable { diff --git a/modules/nixos/tools/misc/default.nix b/modules/nixos/tools/misc/default.nix index e40e8067..1933bdcd 100644 --- a/modules/nixos/tools/misc/default.nix +++ b/modules/nixos/tools/misc/default.nix @@ -7,9 +7,11 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.tools.misc; -in { +in +{ options.${namespace}.tools.misc = with types; { enable = mkBoolOpt false "Whether or not to enable common utilities."; }; diff --git a/modules/nixos/tools/nix-ld/default.nix b/modules/nixos/tools/nix-ld/default.nix index 9786fa1b..d631b869 100644 --- a/modules/nixos/tools/nix-ld/default.nix +++ b/modules/nixos/tools/nix-ld/default.nix @@ -7,14 +7,14 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.tools.nix-ld; -in { +in +{ options.${namespace}.tools.nix-ld = with types; { enable = mkBoolOpt false "Whether or not to enable nix-ld."; }; - config = mkIf cfg.enable { - programs.nix-ld.enable = true; - }; + config = mkIf cfg.enable { programs.nix-ld.enable = true; }; } diff --git a/modules/nixos/tools/node/default.nix b/modules/nixos/tools/node/default.nix index 009d579d..773f0a83 100644 --- a/modules/nixos/tools/node/default.nix +++ b/modules/nixos/tools/node/default.nix @@ -7,16 +7,17 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.tools.node; -in { +in +{ options.${namespace}.tools.node = with types; { enable = mkBoolOpt false "Whether or not to install and configure git"; pkg = mkOpt package pkgs.nodejs "The NodeJS package to use"; prettier = { enable = mkBoolOpt true "Whether or not to install Prettier"; - pkg = - mkOpt package pkgs.nodePackages.prettier "The NodeJS package to use"; + pkg = mkOpt package pkgs.nodePackages.prettier "The NodeJS package to use"; }; yarn = { enable = mkBoolOpt true "Whether or not to install Yarn"; @@ -33,8 +34,9 @@ in { }; config = mkIf cfg.enable { - environment.systemPackages = with pkgs; - [cfg.pkg] + environment.systemPackages = + with pkgs; + [ cfg.pkg ] ++ (lib.optional cfg.prettier.enable cfg.prettier.pkg) ++ (lib.optional cfg.yarn.enable cfg.yarn.pkg) ++ (lib.optional cfg.pnpm.enable cfg.pnpm.pkg) diff --git a/modules/nixos/tools/qmk/default.nix b/modules/nixos/tools/qmk/default.nix index 004e7bb1..c7d4082f 100644 --- a/modules/nixos/tools/qmk/default.nix +++ b/modules/nixos/tools/qmk/default.nix @@ -7,9 +7,11 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.tools.qmk; -in { +in +{ options.${namespace}.tools.qmk = with types; { enable = mkBoolOpt false "Whether or not to enable QMK"; }; diff --git a/modules/nixos/tools/titan/default.nix b/modules/nixos/tools/titan/default.nix index 8d815d41..070e1358 100644 --- a/modules/nixos/tools/titan/default.nix +++ b/modules/nixos/tools/titan/default.nix @@ -7,9 +7,11 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.tools.titan; -in { +in +{ options.${namespace}.tools.titan = with types; { enable = mkBoolOpt false "Whether or not to install Titan."; pkg = mkOpt package pkgs.plusultra.titan "The package to install as Titan."; @@ -22,8 +24,6 @@ in { git = enabled; }; - environment.systemPackages = [ - cfg.pkg - ]; + environment.systemPackages = [ cfg.pkg ]; }; } diff --git a/modules/nixos/user/default.nix b/modules/nixos/user/default.nix index a4f6ccb1..2eb189d4 100644 --- a/modules/nixos/user/default.nix +++ b/modules/nixos/user/default.nix @@ -7,7 +7,8 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.user; defaultIconFileName = "profile.png"; defaultIcon = pkgs.stdenvNoCC.mkDerivation { @@ -20,33 +21,36 @@ with lib.${namespace}; let cp $src $out ''; - passthru = {fileName = defaultIconFileName;}; + passthru = { + fileName = defaultIconFileName; + }; }; propagatedIcon = pkgs.runCommandNoCC "propagated-icon" - {passthru = {fileName = cfg.icon.fileName;};} - '' - local target="$out/share/plusultra-icons/user/${cfg.name}" - mkdir -p "$target" + { + passthru = { + fileName = cfg.icon.fileName; + }; + } + '' + local target="$out/share/plusultra-icons/user/${cfg.name}" + mkdir -p "$target" - cp ${cfg.icon} "$target/${cfg.icon.fileName}" - ''; -in { + cp ${cfg.icon} "$target/${cfg.icon.fileName}" + ''; +in +{ options.${namespace}.user = with types; { name = mkOpt str "short" "The name to use for the user account."; fullName = mkOpt str "Jake Hamilton" "The full name of the user."; email = mkOpt str "jake.hamilton@hey.com" "The email of the user."; initialPassword = mkOpt str "password" - "The initial password to use when the user is first created."; - icon = - mkOpt (nullOr package) defaultIcon - "The profile picture to use for the user."; + "The initial password to use when the user is first created."; + icon = mkOpt (nullOr package) defaultIcon "The profile picture to use for the user."; prompt-init = mkBoolOpt true "Whether or not to show an initial message when opening a new shell."; - extraGroups = mkOpt (listOf str) [] "Groups for the user to be assigned."; - extraOptions = - mkOpt attrs {} - (mdDoc "Extra options passed to `users.users.`."); + extraGroups = mkOpt (listOf str) [ ] "Groups for the user to be assigned."; + extraOptions = mkOpt attrs { } (mdDoc "Extra options passed to `users.users.`."); }; config = { @@ -74,10 +78,7 @@ in { "Videos/.keep".text = ""; "work/.keep".text = ""; ".face".source = cfg.icon; - "Pictures/${ - cfg.icon.fileName or (builtins.baseNameOf cfg.icon) - }".source = - cfg.icon; + "Pictures/${cfg.icon.fileName or (builtins.baseNameOf cfg.icon)}".source = cfg.icon; }; extraOptions = { @@ -145,26 +146,24 @@ in { }; }; - users.users.${cfg.name} = - { - isNormalUser = true; + users.users.${cfg.name} = { + isNormalUser = true; - inherit (cfg) name initialPassword; + inherit (cfg) name initialPassword; - home = "/home/${cfg.name}"; - group = "users"; + home = "/home/${cfg.name}"; + group = "users"; - shell = pkgs.zsh; + shell = pkgs.zsh; - # Arbitrary user ID to use for the user. Since I only - # have a single user on my machines this won't ever collide. - # However, if you add multiple users you'll need to change this - # so each user has their own unique uid (or leave it out for the - # system to select). - uid = 1000; + # Arbitrary user ID to use for the user. Since I only + # have a single user on my machines this won't ever collide. + # However, if you add multiple users you'll need to change this + # so each user has their own unique uid (or leave it out for the + # system to select). + uid = 1000; - extraGroups = ["steamcmd"] ++ cfg.extraGroups; - } - // cfg.extraOptions; + extraGroups = [ "steamcmd" ] ++ cfg.extraGroups; + } // cfg.extraOptions; }; } diff --git a/modules/nixos/virtualisation/kvm/default.nix b/modules/nixos/virtualisation/kvm/default.nix index da434db1..fd98c4e5 100644 --- a/modules/nixos/virtualisation/kvm/default.nix +++ b/modules/nixos/virtualisation/kvm/default.nix @@ -6,23 +6,24 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.virtualisation.kvm; user = config.${namespace}.user; -in { +in +{ options.${namespace}.virtualisation.kvm = with types; { enable = mkBoolOpt false "Whether or not to enable KVM virtualisation."; - vfioIds = - mkOpt (listOf str) [] - "The hardware IDs to pass through to a virtual machine."; - platform = - mkOpt (enum ["amd" "intel"]) "amd" - "Which CPU platform the machine is using."; + vfioIds = mkOpt (listOf str) [ ] "The hardware IDs to pass through to a virtual machine."; + platform = mkOpt (enum [ + "amd" + "intel" + ]) "amd" "Which CPU platform the machine is using."; # Use `machinectl` and then `machinectl status ` to # get the unit "*.scope" of the virtual machine. machineUnits = - mkOpt (listOf str) [] - "The systemd *.scope units to wait for before starting Scream."; + mkOpt (listOf str) [ ] + "The systemd *.scope units to wait for before starting Scream."; }; config = mkIf cfg.enable { @@ -40,12 +41,10 @@ in { "kvm.ignore_msrs=1" # "vfio-pci.ids=${concatStringsSep "," cfg.vfioIds}" ]; - extraModprobeConfig = - optionalString (length cfg.vfioIds > 0) - '' - softdep amdgpu pre: vfio vfio-pci - options vfio-pci ids=${concatStringsSep "," cfg.vfioIds} - ''; + extraModprobeConfig = optionalString (length cfg.vfioIds > 0) '' + softdep amdgpu pre: vfio vfio-pci + options vfio-pci ids=${concatStringsSep "," cfg.vfioIds} + ''; }; systemd.tmpfiles.rules = [ @@ -53,9 +52,7 @@ in { "f /dev/shm/scream 0660 ${user.name} qemu-libvirtd -" ]; - environment.systemPackages = with pkgs; [ - virt-manager - ]; + environment.systemPackages = with pkgs; [ virt-manager ]; virtualisation = { libvirtd = { @@ -80,22 +77,28 @@ in { }; plusultra = { - user = {extraGroups = ["qemu-libvirtd" "libvirtd" "disk"];}; + user = { + extraGroups = [ + "qemu-libvirtd" + "libvirtd" + "disk" + ]; + }; - apps = {looking-glass-client = enabled;}; + apps = { + looking-glass-client = enabled; + }; home = { extraOptions = { systemd.user.services.scream = { Unit.Description = "Scream"; - Unit.After = - [ - "libvirtd.service" - "pipewire-pulse.service" - "pipewire.service" - "sound.target" - ] - ++ cfg.machineUnits; + Unit.After = [ + "libvirtd.service" + "pipewire-pulse.service" + "pipewire.service" + "sound.target" + ] ++ cfg.machineUnits; Service.ExecStart = "${pkgs.scream}/bin/scream -n scream -o pulse -m /dev/shm/scream"; Service.Restart = "always"; Service.StartLimitIntervalSec = "5"; diff --git a/modules/nixos/virtualisation/podman/default.nix b/modules/nixos/virtualisation/podman/default.nix index 30f8b7bd..0384fa52 100644 --- a/modules/nixos/virtualisation/podman/default.nix +++ b/modules/nixos/virtualisation/podman/default.nix @@ -7,18 +7,22 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let cfg = config.${namespace}.virtualisation.podman; -in { +in +{ options.${namespace}.virtualisation.podman = with types; { enable = mkBoolOpt false "Whether or not to enable Podman."; }; config = mkIf cfg.enable { - environment.systemPackages = with pkgs; [podman-compose]; + environment.systemPackages = with pkgs; [ podman-compose ]; plusultra.home.extraOptions = { - home.shellAliases = {"docker-compose" = "podman-compose";}; + home.shellAliases = { + "docker-compose" = "podman-compose"; + }; }; # NixOS 22.05 moved NixOS Containers to a new state directory and the old diff --git a/overlays/ags/default.nix b/overlays/ags/default.nix index 69221bc5..6b4ab29d 100644 --- a/overlays/ags/default.nix +++ b/overlays/ags/default.nix @@ -1,3 +1 @@ -{channels, ...}: final: prev: { - inherit (channels.unstable) ags; -} +{ channels, ... }: final: prev: { inherit (channels.unstable) ags; } diff --git a/overlays/attic/default.nix b/overlays/attic/default.nix index 4fd76aad..f0208111 100644 --- a/overlays/attic/default.nix +++ b/overlays/attic/default.nix @@ -1,7 +1,6 @@ { attic, ... }: -final: prev: -{ +final: prev: { # FIXME(jakehamilton): Attic currently requires a specific version of Rust that # is not on my stable channel. Replace this with the built-in overlay from the # Attic flake once stable has been upgraded to nixos-23.05. diff --git a/overlays/bibata-cursors/default.nix b/overlays/bibata-cursors/default.nix index b78b873f..fc972356 100644 --- a/overlays/bibata-cursors/default.nix +++ b/overlays/bibata-cursors/default.nix @@ -1,4 +1,5 @@ -{channels, ...}: final: prev: { +{ channels, ... }: +final: prev: { # FIXME: The latest version of bibata-cursors breaks Suchi's fork. # inherit (channels.unstable) bibata-cursors; } diff --git a/overlays/bun/default.nix b/overlays/bun/default.nix index 801fbf4e..5ee5b2f5 100644 --- a/overlays/bun/default.nix +++ b/overlays/bun/default.nix @@ -1,3 +1 @@ -{channels, ...}: final: prev: { - inherit (channels.unstable) bun; -} +{ channels, ... }: final: prev: { inherit (channels.unstable) bun; } diff --git a/overlays/comma/default.nix b/overlays/comma/default.nix index e2c62aae..e9c10e80 100644 --- a/overlays/comma/default.nix +++ b/overlays/comma/default.nix @@ -1,7 +1 @@ -{ - channels, - inputs, - ... -}: final: prev: { - inherit (inputs.comma.packages.${final.system}) comma; -} +{ channels, inputs, ... }: final: prev: { inherit (inputs.comma.packages.${final.system}) comma; } diff --git a/overlays/deploy-rs/default.nix b/overlays/deploy-rs/default.nix index 389b9484..47997e3c 100644 --- a/overlays/deploy-rs/default.nix +++ b/overlays/deploy-rs/default.nix @@ -2,6 +2,4 @@ final: prev: -{ - inherit (channels.unstable) deploy-rs; -} +{ inherit (channels.unstable) deploy-rs; } diff --git a/overlays/discord/default.nix b/overlays/discord/default.nix index fe056676..ea516a2e 100644 --- a/overlays/discord/default.nix +++ b/overlays/discord/default.nix @@ -2,30 +2,36 @@ final: prev: { plusultra = (prev.plusultra or { }) // { - discord-chromium = with prev; + discord-chromium = + with prev; makeDesktopItem { name = "Discord (chromium)"; desktopName = "Discord (chromium)"; genericName = "All-in-one cross-platform voice and text chat for gamers"; - exec = '' - ${chromium}/bin/chromium --app="https://discord.com/channels/@me" --enable-features=UseOzonePlatform,WebRTCPipeWireCapturer --ozone-platform=wayland''; + exec = ''${chromium}/bin/chromium --app="https://discord.com/channels/@me" --enable-features=UseOzonePlatform,WebRTCPipeWireCapturer --ozone-platform=wayland''; icon = "discord"; type = "Application"; - categories = [ "Network" "InstantMessaging" ]; + categories = [ + "Network" + "InstantMessaging" + ]; terminal = false; mimeTypes = [ "x-scheme-handler/discord" ]; }; - discord-firefox = with prev; + discord-firefox = + with prev; makeDesktopItem { name = "Discord (firefox)"; desktopName = "Discord (firefox)"; genericName = "All-in-one cross-platform voice and text chat for gamers"; - exec = '' - ${firefox}/bin/firefox "https://discord.com/channels/@me?plusultra.app=true"''; + exec = ''${firefox}/bin/firefox "https://discord.com/channels/@me?plusultra.app=true"''; icon = "discord"; type = "Application"; - categories = [ "Network" "InstantMessaging" ]; + categories = [ + "Network" + "InstantMessaging" + ]; terminal = false; mimeTypes = [ "x-scheme-handler/discord" ]; }; diff --git a/overlays/firefox/default.nix b/overlays/firefox/default.nix index 9dda5985..1bb83c1a 100644 --- a/overlays/firefox/default.nix +++ b/overlays/firefox/default.nix @@ -2,6 +2,4 @@ final: prev: -{ - inherit (channels.unstable) firefox-wayland; -} +{ inherit (channels.unstable) firefox-wayland; } diff --git a/overlays/flake-checker/default.nix b/overlays/flake-checker/default.nix index 59d2c705..d00028fb 100644 --- a/overlays/flake-checker/default.nix +++ b/overlays/flake-checker/default.nix @@ -1,6 +1,3 @@ { flake-checker, ... }: -final: prev: -{ - inherit (flake-checker.packages.${prev.system}) flake-checker; -} +final: prev: { inherit (flake-checker.packages.${prev.system}) flake-checker; } diff --git a/overlays/flyctl/default.nix b/overlays/flyctl/default.nix index bd14e64f..c601a67d 100644 --- a/overlays/flyctl/default.nix +++ b/overlays/flyctl/default.nix @@ -2,6 +2,4 @@ final: prev: -{ - inherit (channels.unstable) flyctl; -} +{ inherit (channels.unstable) flyctl; } diff --git a/overlays/freetube/default.nix b/overlays/freetube/default.nix index f8aee075..5e26df76 100644 --- a/overlays/freetube/default.nix +++ b/overlays/freetube/default.nix @@ -2,6 +2,4 @@ final: prev: -{ - inherit (channels.unstable) freetube; -} +{ inherit (channels.unstable) freetube; } diff --git a/overlays/gamescope/default.nix b/overlays/gamescope/default.nix index 8b8b5002..ced62d43 100644 --- a/overlays/gamescope/default.nix +++ b/overlays/gamescope/default.nix @@ -1,5 +1,3 @@ { channels, ... }: -final: prev: { - inherit (channels.unstable) gamescope; -} +final: prev: { inherit (channels.unstable) gamescope; } diff --git a/overlays/gnome/default.nix b/overlays/gnome/default.nix index 1bce91b2..36849b5f 100644 --- a/overlays/gnome/default.nix +++ b/overlays/gnome/default.nix @@ -1,9 +1,10 @@ -{channels, ...}: final: prev: let +{ channels, ... }: +final: prev: +let extensions = channels.unstable.gnomeExtensions; -in { - gnomeExtensions = - prev.gnomeExtensions - // { - # inherit (extensions) audio-output-switcher; - }; +in +{ + gnomeExtensions = prev.gnomeExtensions // { + # inherit (extensions) audio-output-switcher; + }; } diff --git a/overlays/gum/default.nix b/overlays/gum/default.nix index 17f77d31..e34c5a51 100644 --- a/overlays/gum/default.nix +++ b/overlays/gum/default.nix @@ -2,6 +2,4 @@ final: prev: -{ - inherit (channels.unstable) gum; -} +{ inherit (channels.unstable) gum; } diff --git a/overlays/jakehamilton-website/default.nix b/overlays/jakehamilton-website/default.nix index a2b8e117..ba15547b 100644 --- a/overlays/jakehamilton-website/default.nix +++ b/overlays/jakehamilton-website/default.nix @@ -1,5 +1,3 @@ { jakehamilton-website, ... }: -final: prev: { - jakehamilton-website = jakehamilton-website.packages.${prev.system}.website; -} +final: prev: { jakehamilton-website = jakehamilton-website.packages.${prev.system}.website; } diff --git a/overlays/kubecolor/default.nix b/overlays/kubecolor/default.nix index 00d7f6c1..fd3e85cc 100644 --- a/overlays/kubecolor/default.nix +++ b/overlays/kubecolor/default.nix @@ -2,6 +2,4 @@ final: prev: -{ - inherit (channels.unstable) kubecolor; -} +{ inherit (channels.unstable) kubecolor; } diff --git a/overlays/lasersandfeelings/default.nix b/overlays/lasersandfeelings/default.nix index e855d083..15c39f79 100644 --- a/overlays/lasersandfeelings/default.nix +++ b/overlays/lasersandfeelings/default.nix @@ -1,5 +1,3 @@ { lasersandfeelings, ... }: -final: prev: { - inherit (lasersandfeelings.packages.${prev.system}) lasersandfeelings; -} +final: prev: { inherit (lasersandfeelings.packages.${prev.system}) lasersandfeelings; } diff --git a/overlays/linux/default.nix b/overlays/linux/default.nix index 60259b8b..db273ebf 100644 --- a/overlays/linux/default.nix +++ b/overlays/linux/default.nix @@ -1,11 +1,8 @@ -{channels, ...}: final: prev: { +{ channels, ... }: +final: prev: { inherit (channels.unstable) linuxPackages_latest; # Fixes an issue with building Raspberry Pi kernels: # https://github.com/NixOS/nixpkgs/issues/154163 - makeModulesClosure = x: - prev.makeModulesClosure (x - // { - allowMissing = true; - }); + makeModulesClosure = x: prev.makeModulesClosure (x // { allowMissing = true; }); } diff --git a/overlays/logseq/default.nix b/overlays/logseq/default.nix index 789fd609..f791ab14 100644 --- a/overlays/logseq/default.nix +++ b/overlays/logseq/default.nix @@ -1,3 +1 @@ -{channels, ...}: final: prev: { - inherit (channels.unstable) logseq; -} +{ channels, ... }: final: prev: { inherit (channels.unstable) logseq; } diff --git a/overlays/lutris/default.nix b/overlays/lutris/default.nix index 230d59dd..8f9cb4e9 100644 --- a/overlays/lutris/default.nix +++ b/overlays/lutris/default.nix @@ -2,6 +2,4 @@ final: prev: -{ - inherit (channels.unstable) lutris; -} +{ inherit (channels.unstable) lutris; } diff --git a/overlays/nix/default.nix b/overlays/nix/default.nix index 1241acec..5af1bd0d 100644 --- a/overlays/nix/default.nix +++ b/overlays/nix/default.nix @@ -1,5 +1,3 @@ { channels, ... }: -final: prev: { - inherit (channels.unstable) nixUnstable; -} +final: prev: { inherit (channels.unstable) nixUnstable; } diff --git a/overlays/noopai-website/default.nix b/overlays/noopai-website/default.nix index 31066a2e..92a84c7e 100644 --- a/overlays/noopai-website/default.nix +++ b/overlays/noopai-website/default.nix @@ -1,5 +1,3 @@ { noop-ai-website, ... }: -final: prev: { - noop-ai-website = noop-ai-website.packages.${prev.system}.website; -} +final: prev: { noop-ai-website = noop-ai-website.packages.${prev.system}.website; } diff --git a/overlays/nordic/default.nix b/overlays/nordic/default.nix index a2ad39a0..498ddcec 100644 --- a/overlays/nordic/default.nix +++ b/overlays/nordic/default.nix @@ -2,6 +2,4 @@ final: prev: -{ - inherit (channels.unstable) nordic; -} +{ inherit (channels.unstable) nordic; } diff --git a/overlays/obs/default.nix b/overlays/obs/default.nix index 6837f38b..0d3989ab 100644 --- a/overlays/obs/default.nix +++ b/overlays/obs/default.nix @@ -2,6 +2,4 @@ final: prev: -{ - inherit (channels.unstable) wrapOBS obs-studio obs-studio-plugins; -} +{ inherit (channels.unstable) wrapOBS obs-studio obs-studio-plugins; } diff --git a/overlays/pocketcasts/default.nix b/overlays/pocketcasts/default.nix index 1468d3ef..48c79ad9 100644 --- a/overlays/pocketcasts/default.nix +++ b/overlays/pocketcasts/default.nix @@ -6,11 +6,16 @@ final: prev: { name = "Pocketcasts"; desktopName = "Pocketcasts"; genericName = "It’s smart listening, made simple."; - exec = '' - ${final.firefox}/bin/firefox "https://play.pocketcasts.com/podcasts?plusultra.app=true"''; + exec = ''${final.firefox}/bin/firefox "https://play.pocketcasts.com/podcasts?plusultra.app=true"''; icon = ./icon.svg; type = "Application"; - categories = [ "Network" "Feed" "AudioVideo" "Audio" "Player" ]; + categories = [ + "Network" + "Feed" + "AudioVideo" + "Audio" + "Player" + ]; terminal = false; }; }; diff --git a/overlays/prismlauncher/default.nix b/overlays/prismlauncher/default.nix index 61149058..08464550 100644 --- a/overlays/prismlauncher/default.nix +++ b/overlays/prismlauncher/default.nix @@ -2,6 +2,4 @@ final: prev: -{ - inherit (channels.unstable) prismlauncher; -} +{ inherit (channels.unstable) prismlauncher; } diff --git a/overlays/pungeonquest/default.nix b/overlays/pungeonquest/default.nix index 1a3c09cb..e984ddaa 100644 --- a/overlays/pungeonquest/default.nix +++ b/overlays/pungeonquest/default.nix @@ -1,3 +1 @@ -{pungeonquest, ...}: final: prev: { - inherit (pungeonquest.packages.${prev.system}) pungeonquest; -} +{ pungeonquest, ... }: final: prev: { inherit (pungeonquest.packages.${prev.system}) pungeonquest; } diff --git a/overlays/retrospectacle/default.nix b/overlays/retrospectacle/default.nix index 7ae7a836..7f27e8b1 100644 --- a/overlays/retrospectacle/default.nix +++ b/overlays/retrospectacle/default.nix @@ -1,5 +1,3 @@ { retrospectacle, ... }: -final: prev: { - retrospectacle = retrospectacle.packages.${prev.system}.retrospectacle-backend; -} +final: prev: { retrospectacle = retrospectacle.packages.${prev.system}.retrospectacle-backend; } diff --git a/overlays/scrumfish/default.nix b/overlays/scrumfish/default.nix index e879cdb1..f3cfc58a 100644 --- a/overlays/scrumfish/default.nix +++ b/overlays/scrumfish/default.nix @@ -1,5 +1,3 @@ { scrumfish, ... }: -final: prev: { - scrumfish = scrumfish.packages.${prev.system}.scrumfish-backend; -} +final: prev: { scrumfish = scrumfish.packages.${prev.system}.scrumfish-backend; } diff --git a/overlays/snowfall-docs-website/default.nix b/overlays/snowfall-docs-website/default.nix index cdbe4299..52939dd2 100644 --- a/overlays/snowfall-docs-website/default.nix +++ b/overlays/snowfall-docs-website/default.nix @@ -1,7 +1,6 @@ -{snowfall-docs, ...}: final: prev: { - snowfallorg = - (prev.snowfallorg or {}) - // { - inherit (snowfall-docs.packages.${prev.system}) snowfall-docs; - }; +{ snowfall-docs, ... }: +final: prev: { + snowfallorg = (prev.snowfallorg or { }) // { + inherit (snowfall-docs.packages.${prev.system}) snowfall-docs; + }; } diff --git a/overlays/yabai/default.nix b/overlays/yabai/default.nix index 379b8566..9956c5f4 100644 --- a/overlays/yabai/default.nix +++ b/overlays/yabai/default.nix @@ -1,3 +1 @@ -{channels, ...}: final: prev: { - inherit (channels.unstable) yabai; -} +{ channels, ... }: final: prev: { inherit (channels.unstable) yabai; } diff --git a/overlays/yt-music/default.nix b/overlays/yt-music/default.nix index 24e06eb2..dea08035 100644 --- a/overlays/yt-music/default.nix +++ b/overlays/yt-music/default.nix @@ -6,11 +6,14 @@ final: prev: { name = "YT Music"; desktopName = "YT Music"; genericName = "Music, from YouTube."; - exec = '' - ${final.firefox}/bin/firefox "https://music.youtube.com/?plusultra.app=true"''; + exec = ''${final.firefox}/bin/firefox "https://music.youtube.com/?plusultra.app=true"''; icon = ./icon.svg; type = "Application"; - categories = [ "AudioVideo" "Audio" "Player" ]; + categories = [ + "AudioVideo" + "Audio" + "Player" + ]; terminal = false; }; }; diff --git a/packages/at/create-node-packages.nix b/packages/at/create-node-packages.nix index b795f708..6cd396f2 100644 --- a/packages/at/create-node-packages.nix +++ b/packages/at/create-node-packages.nix @@ -1,17 +1,32 @@ # This file has been generated by node2nix 1.11.1. Do not edit! -{pkgs ? import { - inherit system; - }, system ? builtins.currentSystem, nodejs ? pkgs."nodejs_14"}: +{ + pkgs ? import { inherit system; }, + system ? builtins.currentSystem, + nodejs ? pkgs."nodejs_14", +}: let nodeEnv = import ./node-env.nix { - inherit (pkgs) stdenv lib python2 runCommand writeTextFile writeShellScript; + inherit (pkgs) + stdenv + lib + python2 + runCommand + writeTextFile + writeShellScript + ; inherit pkgs nodejs; libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null; }; in import ./node-packages.nix { - inherit (pkgs) fetchurl nix-gitignore stdenv lib fetchgit; + inherit (pkgs) + fetchurl + nix-gitignore + stdenv + lib + fetchgit + ; inherit nodeEnv; } diff --git a/packages/at/default.nix b/packages/at/default.nix index 582c8fc0..2312d259 100644 --- a/packages/at/default.nix +++ b/packages/at/default.nix @@ -5,26 +5,21 @@ nodejs, namespace, ... -}: let - raw-node-packages = pkgs.callPackage ./create-node-packages.nix { - inherit nodejs; - }; - node-packages = - lib.mapAttrs - (key: value: - value.override { - dontNpmInstall = true; - }) - raw-node-packages; +}: +let + raw-node-packages = pkgs.callPackage ./create-node-packages.nix { inherit nodejs; }; + node-packages = lib.mapAttrs ( + key: value: value.override { dontNpmInstall = true; } + ) raw-node-packages; in - runCommandNoCC "at" +runCommandNoCC "at" { src = node-packages."@suchipi/at-js"; meta = with lib; { mainProgram = "@"; description = "@ - JavaScript stdio transformation tool."; homepage = "https://github.com/suchipi/at-js#readme"; - maintainers = with maintainers; [jakehamilton]; + maintainers = with maintainers; [ jakehamilton ]; license = licenses.mit; }; } diff --git a/packages/at/node-env.nix b/packages/at/node-env.nix index bc1e3662..e942abfc 100644 --- a/packages/at/node-env.nix +++ b/packages/at/node-env.nix @@ -1,6 +1,16 @@ # This file originates from node2nix -{lib, stdenv, nodejs, python2, pkgs, libtool, runCommand, writeTextFile, writeShellScript}: +{ + lib, + stdenv, + nodejs, + python2, + pkgs, + libtool, + runCommand, + writeTextFile, + writeShellScript, +}: let # Workaround to cope with utillinux in Nixpkgs 20.09 and util-linux in Nixpkgs master @@ -9,7 +19,7 @@ let python = if nodejs ? python then nodejs.python else python2; # Create a tar wrapper that filters all the 'Ignoring unknown extended header keyword' noise - tarWrapper = runCommand "tarWrapper" {} '' + tarWrapper = runCommand "tarWrapper" { } '' mkdir -p $out/bin cat > $out/bin/tar < $out/bin/shell < $out/bin/shell < { - inherit system; - }, system ? builtins.currentSystem, nodejs ? pkgs."nodejs_14"}: +{ + pkgs ? import { inherit system; }, + system ? builtins.currentSystem, + nodejs ? pkgs."nodejs_14", +}: let nodeEnv = import ./node-env.nix { - inherit (pkgs) stdenv lib python2 runCommand writeTextFile writeShellScript; + inherit (pkgs) + stdenv + lib + python2 + runCommand + writeTextFile + writeShellScript + ; inherit pkgs nodejs; libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null; }; in import ./node-packages.nix { - inherit (pkgs) fetchurl nix-gitignore stdenv lib fetchgit; + inherit (pkgs) + fetchurl + nix-gitignore + stdenv + lib + fetchgit + ; inherit nodeEnv; } diff --git a/packages/titan/default.nix b/packages/titan/default.nix index 128d9cf2..2499d845 100644 --- a/packages/titan/default.nix +++ b/packages/titan/default.nix @@ -5,43 +5,35 @@ nodejs, namespace, ... -}: let +}: +let inherit (lib.${namespace}) override-meta; - raw-node-packages = pkgs.callPackage ./create-node-packages.nix { - inherit nodejs; - }; + raw-node-packages = pkgs.callPackage ./create-node-packages.nix { inherit nodejs; }; - node-packages = - lib.mapAttrs - (key: value: - value.override { - dontNpmInstall = true; - }) - raw-node-packages; + node-packages = lib.mapAttrs ( + key: value: value.override { dontNpmInstall = true; } + ) raw-node-packages; new-meta = with lib; { description = "A little tool for big (monorepo) projects."; homepage = "https://www.npmjs.com/package/@jakehamilton/titan"; license = licenses.asl20; - maintainers = with maintainers; [jakehamilton]; + maintainers = with maintainers; [ jakehamilton ]; }; - package = - runCommandNoCC "titan" - {src = node-packages."@jakehamilton/titan";} - '' - rstrip() { - # Usage: rstrip "string" "pattern" - printf '%s\n' "''${1%%$2}" - } + package = runCommandNoCC "titan" { src = node-packages."@jakehamilton/titan"; } '' + rstrip() { + # Usage: rstrip "string" "pattern" + printf '%s\n' "''${1%%$2}" + } - mkdir -p $out/bin + mkdir -p $out/bin - local bin=$src/lib/node_modules/@jakehamilton/titan/bin + local bin=$src/lib/node_modules/@jakehamilton/titan/bin - for f in $bin/*.js; do - ln -s $f $out/bin/$(rstrip "$(basename $f)" ".js") - done - ''; + for f in $bin/*.js; do + ln -s $f $out/bin/$(rstrip "$(basename $f)" ".js") + done + ''; in - override-meta new-meta package +override-meta new-meta package diff --git a/packages/titan/node-env.nix b/packages/titan/node-env.nix index bc1e3662..e942abfc 100644 --- a/packages/titan/node-env.nix +++ b/packages/titan/node-env.nix @@ -1,6 +1,16 @@ # This file originates from node2nix -{lib, stdenv, nodejs, python2, pkgs, libtool, runCommand, writeTextFile, writeShellScript}: +{ + lib, + stdenv, + nodejs, + python2, + pkgs, + libtool, + runCommand, + writeTextFile, + writeShellScript, +}: let # Workaround to cope with utillinux in Nixpkgs 20.09 and util-linux in Nixpkgs master @@ -9,7 +19,7 @@ let python = if nodejs ? python then nodejs.python else python2; # Create a tar wrapper that filters all the 'Ignoring unknown extended header keyword' noise - tarWrapper = runCommand "tarWrapper" {} '' + tarWrapper = runCommand "tarWrapper" { } '' mkdir -p $out/bin cat > $out/bin/tar < $out/bin/shell < $out/bin/shell < mywallpaper name = lib.snowfall.path.get-file-name-without-extension image; in - acc // {"${name}" = mkWallpaper name (./wallpapers + "/${image}");}) - {} - images; + acc // { "${name}" = mkWallpaper name (./wallpapers + "/${image}"); } + ) { } images; installTarget = "$out/share/wallpapers"; - installWallpapers = - builtins.mapAttrs - (name: wallpaper: '' - cp ${wallpaper} ${installTarget}/${wallpaper.fileName} - '') - wallpapers; + installWallpapers = builtins.mapAttrs (name: wallpaper: '' + cp ${wallpaper} ${installTarget}/${wallpaper.fileName} + '') wallpapers; in - pkgs.stdenvNoCC.mkDerivation { - name = "plusultra-wallpapers"; - src = ./wallpapers; +pkgs.stdenvNoCC.mkDerivation { + name = "plusultra-wallpapers"; + src = ./wallpapers; - installPhase = '' - mkdir -p ${installTarget} + installPhase = '' + mkdir -p ${installTarget} - find * -type f -mindepth 0 -maxdepth 0 -exec cp ./{} ${installTarget}/{} ';' - ''; + find * -type f -mindepth 0 -maxdepth 0 -exec cp ./{} ${installTarget}/{} ';' + ''; - passthru = {inherit names;} // wallpapers; + passthru = { + inherit names; + } // wallpapers; - meta = with lib; { - description = "Some good wallpapers!"; - license = licenses.asl20; - maintainers = with maintainers; [jakehamilton]; - }; - } + meta = with lib; { + description = "Some good wallpapers!"; + license = licenses.asl20; + maintainers = with maintainers; [ jakehamilton ]; + }; +} diff --git a/packages/xdg-open-with-portal/default.nix b/packages/xdg-open-with-portal/default.nix index 4e6dfed8..afec2d9c 100644 --- a/packages/xdg-open-with-portal/default.nix +++ b/packages/xdg-open-with-portal/default.nix @@ -6,13 +6,14 @@ glib, namespace, ... -}: let +}: +let inherit (lib.${namespace}) override-meta; new-meta = with lib; { description = "A replacement for the default xdg-open program which correctly handles portals."; license = licenses.asl20; - maintainers = with maintainers; [jakehamilton]; + maintainers = with maintainers; [ jakehamilton ]; }; # TODO can this maybe suck less @@ -54,4 +55,4 @@ fi ''; in - override-meta new-meta package +override-meta new-meta package diff --git a/systems/aarch64-darwin/halite/default.nix b/systems/aarch64-darwin/halite/default.nix index fa6aac6e..89d0f6bf 100644 --- a/systems/aarch64-darwin/halite/default.nix +++ b/systems/aarch64-darwin/halite/default.nix @@ -4,7 +4,8 @@ namespace, ... }: -with lib.${namespace}; { +with lib.${namespace}; +{ plusultra = { suites = { common = enabled; @@ -14,9 +15,7 @@ with lib.${namespace}; { desktop.yabai = enabled; }; - environment.systemPath = [ - "/opt/homebrew/bin" - ]; + environment.systemPath = [ "/opt/homebrew/bin" ]; system.stateVersion = 4; } diff --git a/systems/aarch64-linux/vesuvianite/default.nix b/systems/aarch64-linux/vesuvianite/default.nix index 769a1196..77084ab2 100644 --- a/systems/aarch64-linux/vesuvianite/default.nix +++ b/systems/aarch64-linux/vesuvianite/default.nix @@ -8,7 +8,8 @@ ... }: with lib; -with lib.${namespace}; { +with lib.${namespace}; +{ imports = with inputs.nixos-hardware.nixosModules; [ (modulesPath + "/installer/scan/not-detected.nix") (modulesPath + "/installer/sd-card/sd-image-aarch64.nix") diff --git a/systems/aarch64-linux/violane/default.nix b/systems/aarch64-linux/violane/default.nix index 769a1196..77084ab2 100644 --- a/systems/aarch64-linux/violane/default.nix +++ b/systems/aarch64-linux/violane/default.nix @@ -8,7 +8,8 @@ ... }: with lib; -with lib.${namespace}; { +with lib.${namespace}; +{ imports = with inputs.nixos-hardware.nixosModules; [ (modulesPath + "/installer/scan/not-detected.nix") (modulesPath + "/installer/sd-card/sd-image-aarch64.nix") diff --git a/systems/aarch64-linux/vivianite/default.nix b/systems/aarch64-linux/vivianite/default.nix index e0bc8e8b..afadf0c2 100644 --- a/systems/aarch64-linux/vivianite/default.nix +++ b/systems/aarch64-linux/vivianite/default.nix @@ -8,7 +8,8 @@ ... }: with lib; -with lib.${namespace}; { +with lib.${namespace}; +{ imports = with inputs.nixos-hardware.nixosModules; [ (modulesPath + "/installer/scan/not-detected.nix") (modulesPath + "/installer/sd-card/sd-image-aarch64.nix") diff --git a/systems/aarch64-linux/wavellite/default.nix b/systems/aarch64-linux/wavellite/default.nix index e0bc8e8b..afadf0c2 100644 --- a/systems/aarch64-linux/wavellite/default.nix +++ b/systems/aarch64-linux/wavellite/default.nix @@ -8,7 +8,8 @@ ... }: with lib; -with lib.${namespace}; { +with lib.${namespace}; +{ imports = with inputs.nixos-hardware.nixosModules; [ (modulesPath + "/installer/scan/not-detected.nix") (modulesPath + "/installer/sd-card/sd-image-aarch64.nix") diff --git a/systems/aarch64-linux/wulfenite/default.nix b/systems/aarch64-linux/wulfenite/default.nix index e0bc8e8b..afadf0c2 100644 --- a/systems/aarch64-linux/wulfenite/default.nix +++ b/systems/aarch64-linux/wulfenite/default.nix @@ -8,7 +8,8 @@ ... }: with lib; -with lib.${namespace}; { +with lib.${namespace}; +{ imports = with inputs.nixos-hardware.nixosModules; [ (modulesPath + "/installer/scan/not-detected.nix") (modulesPath + "/installer/sd-card/sd-image-aarch64.nix") diff --git a/systems/aarch64-linux/zoisite/default.nix b/systems/aarch64-linux/zoisite/default.nix index e0bc8e8b..afadf0c2 100644 --- a/systems/aarch64-linux/zoisite/default.nix +++ b/systems/aarch64-linux/zoisite/default.nix @@ -8,7 +8,8 @@ ... }: with lib; -with lib.${namespace}; { +with lib.${namespace}; +{ imports = with inputs.nixos-hardware.nixosModules; [ (modulesPath + "/installer/scan/not-detected.nix") (modulesPath + "/installer/sd-card/sd-image-aarch64.nix") diff --git a/systems/aarch64-sd-aarch64/server-pi-3/default.nix b/systems/aarch64-sd-aarch64/server-pi-3/default.nix index b8c5137a..9b58e892 100644 --- a/systems/aarch64-sd-aarch64/server-pi-3/default.nix +++ b/systems/aarch64-sd-aarch64/server-pi-3/default.nix @@ -8,7 +8,8 @@ ... }: with lib; -with lib.${namespace}; { +with lib.${namespace}; +{ imports = with inputs.nixos-hardware.nixosModules; [ (modulesPath + "/installer/scan/not-detected.nix") ]; diff --git a/systems/aarch64-sd-aarch64/server-pi-4/default.nix b/systems/aarch64-sd-aarch64/server-pi-4/default.nix index 0e972cfd..88e424ef 100644 --- a/systems/aarch64-sd-aarch64/server-pi-4/default.nix +++ b/systems/aarch64-sd-aarch64/server-pi-4/default.nix @@ -8,7 +8,8 @@ ... }: with lib; -with lib.${namespace}; { +with lib.${namespace}; +{ imports = with inputs.nixos-hardware.nixosModules; [ (modulesPath + "/installer/scan/not-detected.nix") raspberry-pi-4 diff --git a/systems/aarch64-sd-aarch64/steam-pi-4/default.nix b/systems/aarch64-sd-aarch64/steam-pi-4/default.nix index 6dde05ed..e1ceacfa 100644 --- a/systems/aarch64-sd-aarch64/steam-pi-4/default.nix +++ b/systems/aarch64-sd-aarch64/steam-pi-4/default.nix @@ -8,11 +8,12 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let steam-pi-setup = pkgs.writeShellApplication { name = "steam-pi-setup"; checkPhase = ""; - runtimeInputs = with pkgs; [slides]; + runtimeInputs = with pkgs; [ slides ]; text = '' slides ${./slides.md} ''; @@ -31,7 +32,8 @@ with lib.${namespace}; let # gamescope -f -- steam -gamepadui ''; }; -in { +in +{ imports = with inputs.nixos-hardware.nixosModules; [ (modulesPath + "/installer/scan/not-detected.nix") raspberry-pi-4 @@ -79,7 +81,7 @@ in { }; hardware = { - audio.extra-packages = []; + audio.extra-packages = [ ]; }; services = { diff --git a/systems/x86_64-do/base/default.nix b/systems/x86_64-do/base/default.nix index bbfd049b..78fb11d8 100644 --- a/systems/x86_64-do/base/default.nix +++ b/systems/x86_64-do/base/default.nix @@ -3,54 +3,54 @@ pkgs, namespace, ... -}: let +}: +let tailscale-key = builtins.getEnv "TAILSCALE_AUTH_KEY"; in - with lib; - with lib.${namespace}; { - virtualisation.digitalOcean = { - rebuildFromUserData = false; - }; +with lib; +with lib.${namespace}; +{ + virtualisation.digitalOcean = { + rebuildFromUserData = false; + }; - boot.loader.grub = enabled; + boot.loader.grub = enabled; - environment.systemPackages = with pkgs; [ - neovim - ]; + environment.systemPackages = with pkgs; [ neovim ]; - plusultra = { - nix = enabled; + plusultra = { + nix = enabled; - cli-apps = { - tmux = enabled; - }; + cli-apps = { + tmux = enabled; + }; - tools = { - git = enabled; - }; + tools = { + git = enabled; + }; - security = { - doas = enabled; - }; + security = { + doas = enabled; + }; - services = { - openssh = enabled; - tailscale = { - enable = true; - autoconnect = { - enable = tailscale-key != ""; - key = tailscale-key; - }; + services = { + openssh = enabled; + tailscale = { + enable = true; + autoconnect = { + enable = tailscale-key != ""; + key = tailscale-key; }; }; + }; - system = { - fonts = enabled; - locale = enabled; - time = enabled; - xkb = enabled; - }; + system = { + fonts = enabled; + locale = enabled; + time = enabled; + xkb = enabled; }; + }; - system.stateVersion = "21.11"; - } + system.stateVersion = "21.11"; +} diff --git a/systems/x86_64-install-iso/graphical/default.nix b/systems/x86_64-install-iso/graphical/default.nix index d6e4a628..ab913956 100644 --- a/systems/x86_64-install-iso/graphical/default.nix +++ b/systems/x86_64-install-iso/graphical/default.nix @@ -3,88 +3,90 @@ lib, namespace, ... -}: let +}: +let tailscale-key = builtins.getEnv "TAILSCALE_AUTH_KEY"; in - with lib; - with lib.${namespace}; { - # `install-iso` adds wireless support that - # is incompatible with networkmanager. - networking.wireless.enable = mkForce false; - - plusultra = { - nix = enabled; +with lib; +with lib.${namespace}; +{ + # `install-iso` adds wireless support that + # is incompatible with networkmanager. + networking.wireless.enable = mkForce false; - apps = { - _1password = enabled; - firefox = enabled; - vscode = enabled; - gparted = enabled; - }; + plusultra = { + nix = enabled; - cli-apps = { - neovim = enabled; - tmux = enabled; - }; + apps = { + _1password = enabled; + firefox = enabled; + vscode = enabled; + gparted = enabled; + }; - desktop = { - gnome = { - enable = true; - }; + cli-apps = { + neovim = enabled; + tmux = enabled; + }; - addons = { - # I like to have a convenient place to share wallpapers from - # even if they're not currently being used. - wallpapers = enabled; - }; + desktop = { + gnome = { + enable = true; }; - tools = { - k8s = enabled; - git = enabled; - node = enabled; - http = enabled; - misc = enabled; - titan = enabled; + addons = { + # I like to have a convenient place to share wallpapers from + # even if they're not currently being used. + wallpapers = enabled; }; + }; - hardware = { - audio = enabled; - networking = enabled; - }; + tools = { + k8s = enabled; + git = enabled; + node = enabled; + http = enabled; + misc = enabled; + titan = enabled; + }; + + hardware = { + audio = enabled; + networking = enabled; + }; - services = { - openssh = enabled; - printing = enabled; + services = { + openssh = enabled; + printing = enabled; - tailscale = { - enable = true; - autoconnect = { - enable = tailscale-key != ""; - key = tailscale-key; - }; + tailscale = { + enable = true; + autoconnect = { + enable = tailscale-key != ""; + key = tailscale-key; }; }; + }; - security = { - doas = enabled; - keyring = enabled; - }; + security = { + doas = enabled; + keyring = enabled; + }; - system = { - boot = enabled; - fonts = enabled; - locale = enabled; - time = enabled; - xkb = enabled; - }; + system = { + boot = enabled; + fonts = enabled; + locale = enabled; + time = enabled; + xkb = enabled; }; + }; - # This value determines the NixOS release from which the default - # settings for stateful data, like file locations and database versions - # on your system were taken. It‘s perfectly fine and recommended to leave - # this value at the release version of the first install of this system. - # Before changing this value read the documentation for this option - # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). - system.stateVersion = "23.11"; # Did you read the comment? - } + # This value determines the NixOS release from which the default + # settings for stateful data, like file locations and database versions + # on your system were taken. It‘s perfectly fine and recommended to leave + # this value at the release version of the first install of this system. + # Before changing this value read the documentation for this option + # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + system.stateVersion = "23.11"; # Did you read the comment? +} diff --git a/systems/x86_64-install-iso/minimal/default.nix b/systems/x86_64-install-iso/minimal/default.nix index 797caaf6..fe4903ba 100644 --- a/systems/x86_64-install-iso/minimal/default.nix +++ b/systems/x86_64-install-iso/minimal/default.nix @@ -5,7 +5,8 @@ ... }: with lib; -with lib.${namespace}; { +with lib.${namespace}; +{ # `install-iso` adds wireless support that # is incompatible with networkmanager. networking.wireless.enable = mkForce false; diff --git a/systems/x86_64-iso/isolated/default.nix b/systems/x86_64-iso/isolated/default.nix index a1b77836..214ca2c4 100644 --- a/systems/x86_64-iso/isolated/default.nix +++ b/systems/x86_64-iso/isolated/default.nix @@ -6,7 +6,8 @@ ... }: with lib; -with lib.${namespace}; let +with lib.${namespace}; +let gpgConf = "${inputs.gpg-base-conf}/gpg.conf"; gpgAgentConf = '' @@ -22,7 +23,7 @@ with lib.${namespace}; let sha256 = "1h48yqffpaz437f3c9hfryf23r95rr319lrb3y79kxpxbc9hihxb"; }; - guideHTML = pkgs.runCommand "yubikey-guide" {} '' + guideHTML = pkgs.runCommand "yubikey-guide" { } '' ${pkgs.pandoc}/bin/pandoc \ --standalone \ --metadata title="Yubikey Guide" \ @@ -42,15 +43,16 @@ with lib.${namespace}; let genericName = "View Yubikey Guide in a web browser"; exec = "${pkgs.xdg-utils}/bin/xdg-open ${guideHTML}"; icon = lib.snowfall.fs.get-file "modules/security/gpg/yubico-icon.svg"; - categories = ["System"]; + categories = [ "System" ]; }; reload-yubikey = pkgs.writeShellScriptBin "reload-yubikey" '' ${pkgs.gnupg}/bin/gpg-connect-agent "scd serialno" "learn --force" /bye ''; -in { +in +{ services.pcscd.enable = true; - services.udev.packages = with pkgs; [yubikey-personalization]; + services.udev.packages = with pkgs; [ yubikey-personalization ]; environment.systemPackages = with pkgs; [ cryptsetup @@ -111,7 +113,9 @@ in { }; }; - security = {doas = enabled;}; + security = { + doas = enabled; + }; system = { fonts = enabled; diff --git a/systems/x86_64-iso/rescue/default.nix b/systems/x86_64-iso/rescue/default.nix index 3889fe68..05063e5b 100644 --- a/systems/x86_64-iso/rescue/default.nix +++ b/systems/x86_64-iso/rescue/default.nix @@ -5,11 +5,14 @@ ... }: with lib; -with lib.${namespace}; { +with lib.${namespace}; +{ plusultra = { nix = enabled; - cli-apps = {neovim = enabled;}; + cli-apps = { + neovim = enabled; + }; tools = { misc = enabled; @@ -17,9 +20,13 @@ with lib.${namespace}; { http = enabled; }; - hardware = {networking = enabled;}; + hardware = { + networking = enabled; + }; - security = {doas = enabled;}; + security = { + doas = enabled; + }; system = { fonts = enabled; diff --git a/systems/x86_64-linux/adamite/default.nix b/systems/x86_64-linux/adamite/default.nix index 921f402b..5ee4e9ad 100644 --- a/systems/x86_64-linux/adamite/default.nix +++ b/systems/x86_64-linux/adamite/default.nix @@ -1,14 +1,14 @@ -{ lib -, pkgs -, modulesPath -, namespace -, ... +{ + lib, + pkgs, + modulesPath, + namespace, + ... }: with lib; -with lib.${namespace}; { - imports = [ - (modulesPath + "/virtualisation/digital-ocean-config.nix") - ]; +with lib.${namespace}; +{ + imports = [ (modulesPath + "/virtualisation/digital-ocean-config.nix") ]; virtualisation.digitalOcean = { rebuildFromUserData = false; @@ -21,9 +21,7 @@ with lib.${namespace}; { 443 ]; - environment.systemPackages = with pkgs; [ - neovim - ]; + environment.systemPackages = with pkgs; [ neovim ]; plusultra = { nix = enabled; diff --git a/systems/x86_64-linux/agate/default.nix b/systems/x86_64-linux/agate/default.nix index 3b082dac..c1d65efc 100644 --- a/systems/x86_64-linux/agate/default.nix +++ b/systems/x86_64-linux/agate/default.nix @@ -1,14 +1,14 @@ -{ lib -, pkgs -, modulesPath -, namespace -, ... +{ + lib, + pkgs, + modulesPath, + namespace, + ... }: with lib; -with lib.${namespace}; { - imports = [ - (modulesPath + "/virtualisation/digital-ocean-config.nix") - ]; +with lib.${namespace}; +{ + imports = [ (modulesPath + "/virtualisation/digital-ocean-config.nix") ]; virtualisation.digitalOcean = { rebuildFromUserData = false; @@ -21,9 +21,7 @@ with lib.${namespace}; { 443 ]; - environment.systemPackages = with pkgs; [ - neovim - ]; + environment.systemPackages = with pkgs; [ neovim ]; plusultra = { nix = enabled; diff --git a/systems/x86_64-linux/albite/default.nix b/systems/x86_64-linux/albite/default.nix index 3205fee6..a6e1c183 100644 --- a/systems/x86_64-linux/albite/default.nix +++ b/systems/x86_64-linux/albite/default.nix @@ -1,14 +1,14 @@ -{ lib -, pkgs -, modulesPath -, namespace -, ... +{ + lib, + pkgs, + modulesPath, + namespace, + ... }: with lib; -with lib.${namespace}; { - imports = [ - (modulesPath + "/virtualisation/digital-ocean-config.nix") - ]; +with lib.${namespace}; +{ + imports = [ (modulesPath + "/virtualisation/digital-ocean-config.nix") ]; virtualisation.digitalOcean = { rebuildFromUserData = false; @@ -21,9 +21,7 @@ with lib.${namespace}; { 443 ]; - environment.systemPackages = with pkgs; [ - neovim - ]; + environment.systemPackages = with pkgs; [ neovim ]; plusultra = { nix = enabled; diff --git a/systems/x86_64-linux/ametrine/default.nix b/systems/x86_64-linux/ametrine/default.nix index 45f69718..67225700 100644 --- a/systems/x86_64-linux/ametrine/default.nix +++ b/systems/x86_64-linux/ametrine/default.nix @@ -1,15 +1,15 @@ -{ lib -, pkgs -, config -, modulesPath -, namespace -, ... +{ + lib, + pkgs, + config, + modulesPath, + namespace, + ... }: with lib; -with lib.${namespace}; { - imports = [ - (modulesPath + "/virtualisation/digital-ocean-config.nix") - ]; +with lib.${namespace}; +{ + imports = [ (modulesPath + "/virtualisation/digital-ocean-config.nix") ]; virtualisation.digitalOcean = { rebuildFromUserData = false; @@ -22,9 +22,7 @@ with lib.${namespace}; { 443 ]; - environment.systemPackages = with pkgs; [ - neovim - ]; + environment.systemPackages = with pkgs; [ neovim ]; services = { discourse = { diff --git a/systems/x86_64-linux/bismuth/default.nix b/systems/x86_64-linux/bismuth/default.nix index e2188d8b..67d84628 100644 --- a/systems/x86_64-linux/bismuth/default.nix +++ b/systems/x86_64-linux/bismuth/default.nix @@ -7,8 +7,9 @@ ... }: with lib; -with lib.${namespace}; { - imports = [./hardware.nix]; +with lib.${namespace}; +{ + imports = [ ./hardware.nix ]; # Resolve an issue with Bismuth's wired connections failing sometimes due to weird # DHCP issues. I'm not quite sure why this is the case, but I have found that the @@ -17,11 +18,11 @@ with lib.${namespace}; { # condition when the system is coming up that causes this. # networking.dhcpcd.enable = false; - boot.binfmt.emulatedSystems = ["aarch64-linux"]; + boot.binfmt.emulatedSystems = [ "aarch64-linux" ]; # NOTE: This _may_ be required for openvpn to work. However, I have # not confirmed that... - boot.kernelModules = ["tun"]; + boot.kernelModules = [ "tun" ]; # Bismuth has had issues with FS corruption in the past and has now experienced # extremely strange errors when attempting to install NixOS. There may be some @@ -29,8 +30,8 @@ with lib.${namespace}; { boot.loader.systemd-boot.memtest86.enable = true; networking.firewall = { - allowedUDPPorts = [28000]; - allowedTCPPorts = [28000]; + allowedUDPPorts = [ 28000 ]; + allowedTCPPorts = [ 28000 ]; }; environment.systemPackages = with pkgs; [ @@ -113,8 +114,11 @@ with lib.${namespace}; { # RX480 when in the bottom slot: # IOMMU Group 23 23:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Ellesmere [Radeon RX 470/480/570/570X/580/580X/590] [1002:67df] (rev c7) # IOMMU Group 23 23:00.1 Audio device [0403]: Advanced Micro Devices, Inc. [AMD/ATI] Ellesmere HDMI Audio [Radeon RX 470/480 / 570/580/590] [1002:aaf0] - vfioIds = ["1002:67df" "1002:aaf0"]; - machineUnits = ["machine-qemu\\x2d1\\x2dwin10.scope"]; + vfioIds = [ + "1002:67df" + "1002:aaf0" + ]; + machineUnits = [ "machine-qemu\\x2d1\\x2dwin10.scope" ]; }; }; diff --git a/systems/x86_64-linux/bismuth/hardware.nix b/systems/x86_64-linux/bismuth/hardware.nix index 206d7720..83a93948 100644 --- a/systems/x86_64-linux/bismuth/hardware.nix +++ b/systems/x86_64-linux/bismuth/hardware.nix @@ -5,9 +5,11 @@ modulesPath, inputs, ... -}: let +}: +let inherit (inputs) nixos-hardware; -in { +in +{ imports = with nixos-hardware.nixosModules; [ (modulesPath + "/installer/scan/not-detected.nix") common-cpu-amd @@ -20,10 +22,17 @@ in { kernelPackages = pkgs.linuxPackages_latest; initrd = { - availableKernelModules = ["nvme" "ahci" "xhci_pci" "usbhid" "usb_storage" "sd_mod"]; + availableKernelModules = [ + "nvme" + "ahci" + "xhci_pci" + "usbhid" + "usb_storage" + "sd_mod" + ]; }; - extraModulePackages = []; + extraModulePackages = [ ]; }; fileSystems."/" = { @@ -39,10 +48,10 @@ in { fileSystems."/mnt/data" = { device = "/dev/sda1"; fsType = "auto"; - options = ["rw"]; + options = [ "rw" ]; }; - swapDevices = [{device = "/dev/disk/by-label/swap";}]; + swapDevices = [ { device = "/dev/disk/by-label/swap"; } ]; # NOTE: NetworkManager will handle DHCP. networking.interfaces.enp39s0.useDHCP = false; @@ -50,8 +59,7 @@ in { hardware.enableRedistributableFirmware = true; - hardware.cpu.amd.updateMicrocode = - lib.mkDefault config.hardware.enableRedistributableFirmware; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; hardware.bluetooth.enable = true; } diff --git a/systems/x86_64-linux/jasper/default.nix b/systems/x86_64-linux/jasper/default.nix index 0b72d849..23937a5f 100644 --- a/systems/x86_64-linux/jasper/default.nix +++ b/systems/x86_64-linux/jasper/default.nix @@ -5,10 +5,11 @@ ... }: with lib; -with lib.${namespace}; { - imports = [./hardware.nix]; +with lib.${namespace}; +{ + imports = [ ./hardware.nix ]; - boot.binfmt.emulatedSystems = ["aarch64-linux"]; + boot.binfmt.emulatedSystems = [ "aarch64-linux" ]; snowfallorg = { avalanche.desktop = { @@ -32,8 +33,7 @@ with lib.${namespace}; { desktop.hyprland = enabled; desktop.gnome = { - enable = - mkForce false; + enable = mkForce false; monitors = ./monitors.xml; }; diff --git a/systems/x86_64-linux/jasper/hardware.nix b/systems/x86_64-linux/jasper/hardware.nix index 62e9740a..1328b1e4 100644 --- a/systems/x86_64-linux/jasper/hardware.nix +++ b/systems/x86_64-linux/jasper/hardware.nix @@ -9,19 +9,24 @@ # TODO(jakehamilton): Phase most of this out when nixos-hardware # is updated with Framework support. { - imports = [ - (modulesPath + "/installer/scan/not-detected.nix") - ]; + imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; boot = { - kernelModules = ["kvm-intel"]; + kernelModules = [ "kvm-intel" ]; initrd = { - availableKernelModules = ["xhci_pci" "thunderbolt" "nvme" "usb_storage" "usbhid" "sd_mod"]; - kernelModules = []; + availableKernelModules = [ + "xhci_pci" + "thunderbolt" + "nvme" + "usb_storage" + "usbhid" + "sd_mod" + ]; + kernelModules = [ ]; }; - extraModulePackages = []; + extraModulePackages = [ ]; }; fileSystems = { @@ -51,13 +56,12 @@ }; }; - swapDevices = [{device = "/dev/disk/by-label/swap";}]; + swapDevices = [ { device = "/dev/disk/by-label/swap"; } ]; # nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; - hardware.cpu.intel.updateMicrocode = - lib.mkDefault config.hardware.enableRedistributableFirmware; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; hardware.opengl.enable = true; diff --git a/systems/x86_64-linux/quartz/default.nix b/systems/x86_64-linux/quartz/default.nix index 50f142f7..369e5fdd 100644 --- a/systems/x86_64-linux/quartz/default.nix +++ b/systems/x86_64-linux/quartz/default.nix @@ -6,15 +6,16 @@ ... }: with lib; -with lib.${namespace}; { - imports = [./hardware.nix]; +with lib.${namespace}; +{ + imports = [ ./hardware.nix ]; services.minio = { enable = true; region = "us-west-1"; - dataDir = ["/persist/apps/minio/data"]; + dataDir = [ "/persist/apps/minio/data" ]; configDir = "/persist/apps/minio/config"; rootCredentialsFile = "/persist/apps/minio/credentials"; @@ -82,20 +83,15 @@ with lib.${namespace}; { policies = builtins.foldl' - (policies: file: - policies - // { - "${snowfall.path.get-file-name-without-extension file}" = file; - }) - {} - (builtins.filter (snowfall.path.has-file-extension "hcl") - (builtins.map - ( - path: - ./vault/policies - + "/${builtins.baseNameOf (builtins.unsafeDiscardStringContext path)}" + (policies: file: policies // { "${snowfall.path.get-file-name-without-extension file}" = file; }) + { } + ( + builtins.filter (snowfall.path.has-file-extension "hcl") ( + builtins.map ( + path: ./vault/policies + "/${builtins.baseNameOf (builtins.unsafeDiscardStringContext path)}" + ) (snowfall.fs.get-files ./vault/policies) ) - (snowfall.fs.get-files ./vault/policies))); + ); }; samba = { @@ -152,7 +148,7 @@ with lib.${namespace}; { enable = true; host = "hamho.me"; - package = pkgs.plusultra.homer-catppuccin.override {favicon = "light";}; + package = pkgs.plusultra.homer-catppuccin.override { favicon = "light"; }; settings = { title = "Dashboard"; @@ -302,48 +298,52 @@ with lib.${namespace}; { enable = true; recommendedProxySettings = true; - virtualHosts = let - shared-config = { - extra-config = { - forceSSL = true; + virtualHosts = + let + shared-config = { + extra-config = { + forceSSL = true; - sslCertificate = "${config.security.acme.certs."quartz.hamho.me".directory}/fullchain.pem"; - sslCertificateKey = "${config.security.acme.certs."quartz.hamho.me".directory}/key.pem"; + sslCertificate = "${config.security.acme.certs."quartz.hamho.me".directory}/fullchain.pem"; + sslCertificateKey = "${config.security.acme.certs."quartz.hamho.me".directory}/key.pem"; + }; }; - }; - in { - "hamho.me" = { - forceSSL = mkForce true; + in + { + "hamho.me" = { + forceSSL = mkForce true; - sslCertificate = "${config.security.acme.certs."hamho.me".directory}/fullchain.pem"; - sslCertificateKey = "${config.security.acme.certs."hamho.me".directory}/key.pem"; - }; + sslCertificate = "${config.security.acme.certs."hamho.me".directory}/fullchain.pem"; + sslCertificateKey = "${config.security.acme.certs."hamho.me".directory}/key.pem"; + }; - "minio.quartz.hamho.me" = - network.create-proxy - ((network.get-address-parts config.services.minio.consoleAddress) - // shared-config); - - "jellyfin.quartz.hamho.me" = network.create-proxy ({ - # https://jellyfin.org/docs/general/networking/index.html#static-ports - port = 8096; - - # This is required to support sync play. - proxy-web-sockets = true; - } - // shared-config); - - "navidrome.quartz.hamho.me" = network.create-proxy ({ - # https://www.navidrome.org/docs/usage/configuration-options/#available-options - port = 4533; - } - // shared-config); - - "vault.quartz.hamho.me" = - network.create-proxy - ((network.get-address-parts config.services.vault.address) - // shared-config); - }; + "minio.quartz.hamho.me" = network.create-proxy ( + (network.get-address-parts config.services.minio.consoleAddress) // shared-config + ); + + "jellyfin.quartz.hamho.me" = network.create-proxy ( + { + # https://jellyfin.org/docs/general/networking/index.html#static-ports + port = 8096; + + # This is required to support sync play. + proxy-web-sockets = true; + } + // shared-config + ); + + "navidrome.quartz.hamho.me" = network.create-proxy ( + { + # https://www.navidrome.org/docs/usage/configuration-options/#available-options + port = 4533; + } + // shared-config + ); + + "vault.quartz.hamho.me" = network.create-proxy ( + (network.get-address-parts config.services.vault.address) // shared-config + ); + }; }; system.stateVersion = "21.11"; diff --git a/systems/x86_64-linux/quartz/hardware.nix b/systems/x86_64-linux/quartz/hardware.nix index a08fad4f..b2aec4a8 100644 --- a/systems/x86_64-linux/quartz/hardware.nix +++ b/systems/x86_64-linux/quartz/hardware.nix @@ -1,13 +1,22 @@ -{ config, lib, pkgs, modulesPath, ... }: +{ + config, + lib, + pkgs, + modulesPath, + ... +}: { - imports = [ - (modulesPath + "/installer/scan/not-detected.nix") - ]; + imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; boot = { initrd = { - availableKernelModules = [ "ahci" "xhci_pci" "usb_storage" "sd_mod" ]; + availableKernelModules = [ + "ahci" + "xhci_pci" + "usb_storage" + "sd_mod" + ]; kernelModules = [ ]; }; diff --git a/systems/x86_64-linux/ruby/default.nix b/systems/x86_64-linux/ruby/default.nix index c524ff29..fea9d672 100644 --- a/systems/x86_64-linux/ruby/default.nix +++ b/systems/x86_64-linux/ruby/default.nix @@ -6,8 +6,9 @@ ... }: with lib; -with lib.${namespace}; { - imports = [./hardware.nix]; +with lib.${namespace}; +{ + imports = [ ./hardware.nix ]; plusultra = { nix = enabled; @@ -81,17 +82,18 @@ with lib.${namespace}; { clientMaxBodySize = "256m"; - virtualHosts = let - shared-config = { - extra-config = { - forceSSL = true; + virtualHosts = + let + shared-config = { + extra-config = { + forceSSL = true; - sslCertificate = "${config.security.acme.certs."ruby.hamho.me".directory}/fullchain.pem"; - sslCertificateKey = "${config.security.acme.certs."ruby.hamho.me".directory}/key.pem"; + sslCertificate = "${config.security.acme.certs."ruby.hamho.me".directory}/fullchain.pem"; + sslCertificateKey = "${config.security.acme.certs."ruby.hamho.me".directory}/key.pem"; + }; }; - }; - in { - }; + in + { }; }; system.stateVersion = "22.05"; diff --git a/systems/x86_64-linux/ruby/hardware.nix b/systems/x86_64-linux/ruby/hardware.nix index 436e6352..50004ce3 100644 --- a/systems/x86_64-linux/ruby/hardware.nix +++ b/systems/x86_64-linux/ruby/hardware.nix @@ -7,15 +7,22 @@ pkgs, modulesPath, ... -}: { - imports = [ - (modulesPath + "/installer/scan/not-detected.nix") - ]; +}: +{ + imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; - boot.initrd.availableKernelModules = ["xhci_pci" "ahci" "usb_storage" "sd_mod"]; - boot.initrd.kernelModules = []; - boot.kernelModules = ["kvm-intel" "wl"]; - boot.extraModulePackages = [config.boot.kernelPackages.broadcom_sta]; + boot.initrd.availableKernelModules = [ + "xhci_pci" + "ahci" + "usb_storage" + "sd_mod" + ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ + "kvm-intel" + "wl" + ]; + boot.extraModulePackages = [ config.boot.kernelPackages.broadcom_sta ]; fileSystems."/" = { device = "/dev/disk/by-uuid/ba386419-9eb0-4dc3-8e30-7bb2584e51b8"; @@ -27,7 +34,7 @@ fsType = "vfat"; }; - swapDevices = []; + swapDevices = [ ]; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking # (the default) this is the recommended approach. When using systemd-networkd it's diff --git a/systems/x86_64-virtualbox/virt/default.nix b/systems/x86_64-virtualbox/virt/default.nix index 2d1ac50d..6b0b1444 100644 --- a/systems/x86_64-virtualbox/virt/default.nix +++ b/systems/x86_64-virtualbox/virt/default.nix @@ -5,7 +5,8 @@ ... }: with lib; -with lib.${namespace}; { +with lib.${namespace}; +{ virtualisation.virtualbox.guest.enable = true; boot.loader.grub.enable = true; @@ -24,7 +25,9 @@ with lib.${namespace}; { vscode = enabled; }; - cli-apps = {neovim = enabled;}; + cli-apps = { + neovim = enabled; + }; desktop = { gnome = { @@ -52,7 +55,9 @@ with lib.${namespace}; { networking = enabled; }; - services = {printing = enabled;}; + services = { + printing = enabled; + }; security = { doas = enabled;