From ce87422de41707a5205ef4f20ba868701eab52e5 Mon Sep 17 00:00:00 2001 From: iosmanthus Date: Sat, 14 Sep 2024 14:04:07 +0800 Subject: [PATCH] migrate nixpkgs-fmt to nixfmt Signed-off-by: iosmanthus --- Makefile | 2 +- flake.nix | 156 ++++---- modules/admin/default.nix | 10 +- modules/admin/options.nix | 46 +-- modules/atuin/default.nix | 14 +- modules/base16/default.nix | 5 +- modules/chinadns/default.nix | 26 +- modules/cloud/aws-lightsail/default.nix | 9 +- modules/cloud/base/default.nix | 18 +- modules/cloud/firewall/default.nix | 5 +- modules/cloud/gce/default.nix | 9 +- modules/cloud/sing-box/default.nix | 105 +++--- modules/default.nix | 40 +- modules/gemini-openai-proxy/default.nix | 14 +- modules/gtk-theme/default.nix | 8 +- modules/gtk-theme/theme.nix | 12 +- modules/immutable-file.nix | 40 +- modules/monitors.nix | 40 +- modules/mutable-vscode-ext.nix | 32 +- modules/nixbuild/default.nix | 9 +- modules/o11y/default.nix | 43 ++- modules/sing-box/default.nix | 36 +- modules/subgen/default.nix | 14 +- modules/unguarded/default.nix | 14 +- modules/wallpaper/default.nix | 8 +- modules/wallpaper/options.nix | 8 +- nixos/aws-lightsail-0/atuin/default.nix | 8 +- nixos/aws-lightsail-0/caddy/default.nix | 19 +- nixos/aws-lightsail-0/default.nix | 7 +- nixos/aws-lightsail-0/users.nix | 9 +- nixos/aws-lightsail-0/vaultwarden/default.nix | 5 +- nixos/gcp-instance-0/caddy/default.nix | 19 +- nixos/gcp-instance-0/chinadns/default.nix | 3 +- nixos/gcp-instance-0/default.nix | 3 +- nixos/gcp-instance-0/subgen/default.nix | 4 +- nixos/gcp-instance-1/default.nix | 3 +- nixos/gcp-instance-2/default.nix | 40 +- nixos/iosmanthus-legion/default.nix | 9 +- .../hardware-configuration.nix | 24 +- nixos/iosmanthus-legion/monitors.nix | 8 +- nixos/iosmanthus-xps/default.nix | 3 +- .../iosmanthus-xps/hardware-configuration.nix | 82 ++--- nixos/iosmanthus-xps/monitors.nix | 11 +- nixos/lego-router/default.nix | 8 +- nixos/lego-router/hardware-configuration.nix | 62 ++-- nixos/workstation/default.nix | 47 ++- nixos/workstation/desktop/default.nix | 22 +- nixos/workstation/desktop/fcitx5.nix | 9 +- nixos/workstation/desktop/fonts.nix | 9 +- nixos/workstation/desktop/monitors.nix | 36 +- nixos/workstation/home/default.nix | 246 +++++++------ nixos/workstation/home/desktop/default.nix | 10 +- nixos/workstation/home/desktop/dunst.nix | 5 +- nixos/workstation/home/desktop/i3.nix | 345 +++++++++--------- nixos/workstation/home/fcitx5/default.nix | 15 +- nixos/workstation/home/firefox/default.nix | 12 +- nixos/workstation/home/gpg/default.nix | 15 +- nixos/workstation/home/polybar/default.nix | 5 +- nixos/workstation/home/shell/alias.nix | 9 +- nixos/workstation/home/shell/default.nix | 16 +- nixos/workstation/home/shell/starship.nix | 14 +- nixos/workstation/home/tmux.nix | 10 +- nixos/workstation/home/vscode/default.nix | 72 ++-- nixos/workstation/network.nix | 12 +- nixos/workstation/o11y/default.nix | 11 +- nixos/workstation/users.nix | 36 +- packages/base16-rofi/default.nix | 5 +- packages/chinadns/default.nix | 3 +- packages/default.nix | 186 +++++----- packages/fcitx5-adwaita-dark/default.nix | 5 +- packages/fcitx5-material-color/default.nix | 7 +- packages/follow/default.nix | 20 +- packages/gemini-openai-proxy/default.nix | 4 +- packages/jetbrains-nerd-font/default.nix | 4 +- packages/kitty-themes/default.nix | 37 +- packages/leaf/default.nix | 7 +- packages/lib/default.nix | 5 +- packages/lib/nix-background.nix | 14 +- packages/logseq/default.nix | 4 +- packages/minimal-tmux-status/default.nix | 5 +- packages/monaspace/default.nix | 8 +- packages/r3playx/default.nix | 10 +- packages/rime-data-cantonia/default.nix | 4 +- packages/sing-box/default.nix | 41 ++- packages/subgen/default.nix | 3 +- packages/tmux-yank/default.nix | 5 +- packages/unguarded/default.nix | 3 +- packages/vscode-launcher/default.nix | 5 +- packages/warp-terminal/default.nix | 47 +-- packages/yesplaymusic/default.nix | 10 +- secrets/aws-lightsail-0/default.nix | 3 +- secrets/cloud/cloudflare/default.nix | 4 +- secrets/cloud/endpoints/default.nix | 12 +- secrets/cloud/grafana/default.nix | 8 +- secrets/cloud/sing-box/default.nix | 28 +- secrets/cloud/subgen/default.nix | 8 +- secrets/gcp-instance-0/default.nix | 3 +- secrets/gcp-instance-1/default.nix | 3 +- secrets/gcp-instance-2/default.nix | 3 +- secrets/iosmanthus/default.nix | 4 +- secrets/workstation/default.nix | 4 +- secrets/workstation/update.py | 2 +- 102 files changed, 1266 insertions(+), 1264 deletions(-) diff --git a/Makefile b/Makefile index e01cbbc..eb7eb3e 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ switch: @nixos-rebuild switch --use-remote-sudo |& nom format: - @fd --glob "*.nix" --exec-batch "nixpkgs-fmt" + @fd --glob "*.nix" --exec-batch "nixfmt" @fd --glob "*.py" --exec-batch "yapf" "-i" update: diff --git a/flake.nix b/flake.nix index cd5b3d8..b428a8b 100644 --- a/flake.nix +++ b/flake.nix @@ -46,43 +46,47 @@ vaultwarden.url = "github:iosmanthus/nixpkgs/bump-vaultwarden-20240912141923"; }; outputs = - { self - , nixpkgs - , master - , flake-utils - , home-manager - , sops-nix - , berberman - , base16 - , code-insiders - , nixos-generators - , nur - , nixos-hardware - , ... + { + self, + nixpkgs, + master, + flake-utils, + home-manager, + sops-nix, + berberman, + base16, + code-insiders, + nixos-generators, + nur, + nixos-hardware, + ... }@inputs: let this = import ./packages; - mkWorkstationModules = - system: [ - ./nixos/workstation - ./secrets/workstation + mkWorkstationModules = system: [ + ./nixos/workstation + ./secrets/workstation - self.nixosModules.workstation - self.nixosModules.admin.iosmanthus + self.nixosModules.workstation + self.nixosModules.admin.iosmanthus - sops-nix.nixosModules.sops - home-manager.nixosModules.home-manager - base16.nixosModule + sops-nix.nixosModules.sops + home-manager.nixosModules.home-manager + base16.nixosModule - ({ config, ... }: { + ( + { config, ... }: + { home-manager = { - users.${config.admin.name} = { ... }: { - imports = [ - (./secrets + "/${config.admin.name}") - ./nixos/workstation/home - ]; - }; + users.${config.admin.name} = + { ... }: + { + imports = [ + (./secrets + "/${config.admin.name}") + ./nixos/workstation/home + ]; + }; sharedModules = [ sops-nix.homeManagerModule base16.nixosModule @@ -95,40 +99,41 @@ useGlobalPkgs = true; verbose = true; }; - }) - { - nixpkgs.overlays = - [ - self.overlays.unstable - self.overlays.jetbrains - self.overlays.default - - berberman.overlays.default - code-insiders.overlays.default - nur.overlay - ]; } - ]; + ) + { + nixpkgs.overlays = [ + self.overlays.unstable + self.overlays.jetbrains + self.overlays.default + + berberman.overlays.default + code-insiders.overlays.default + nur.overlay + ]; + } + ]; in { - packages.x86_64-linux = this.packages - (import nixpkgs { - config = { - allowUnfree = true; - }; - system = "x86_64-linux"; - }) // { - nixos-gce-image = nixos-generators.nixosGenerate { - system = "x86_64-linux"; - format = "gce"; - specialArgs = { - inherit self; + packages.x86_64-linux = + this.packages ( + import nixpkgs { + config = { + allowUnfree = true; + }; + system = "x86_64-linux"; + } + ) + // { + nixos-gce-image = nixos-generators.nixosGenerate { + system = "x86_64-linux"; + format = "gce"; + specialArgs = { + inherit self; + }; + modules = [ self.nixosModules.cloud.gce ]; }; - modules = [ - self.nixosModules.cloud.gce - ]; }; - }; overlays = { default = this.overlay; unstable = this.branchOverlay { @@ -136,9 +141,7 @@ system = "x86_64-linux"; config = { allowUnfree = true; - permittedInsecurePackages = [ - "openssl-1.1.1w" - ]; + permittedInsecurePackages = [ "openssl-1.1.1w" ]; }; packages = [ "bat" @@ -172,20 +175,26 @@ jetbrains = this.branchOverlay { branch = inputs.jetbrains; system = "x86_64-linux"; - config = { allowUnfree = true; }; + config = { + allowUnfree = true; + }; packages = [ "jetbrains" ]; }; vaultwarden = this.branchOverlay { branch = inputs.vaultwarden; system = "x86_64-linux"; - config = { allowUnfree = true; }; + config = { + allowUnfree = true; + }; packages = [ "vaultwarden" ]; }; }; nixosModules = import ./modules; nixosConfigurations = { iosmanthus-xps = nixpkgs.lib.nixosSystem rec { - specialArgs = { inherit self; }; + specialArgs = { + inherit self; + }; system = "x86_64-linux"; modules = [ ./nixos/iosmanthus-xps @@ -195,9 +204,7 @@ iosmanthus-legion = nixpkgs.lib.nixosSystem rec { system = "x86_64-linux"; - modules = [ - ./nixos/iosmanthus-legion - ] ++ (mkWorkstationModules system); + modules = [ ./nixos/iosmanthus-legion ] ++ (mkWorkstationModules system); }; aws-lightsail-0 = nixpkgs.lib.nixosSystem { @@ -346,13 +353,15 @@ ]; }; }; - } // flake-utils.lib.eachSystem - [ "x86_64-linux" ] - (system: + } + // flake-utils.lib.eachSystem [ "x86_64-linux" ] ( + system: let pkgs = import nixpkgs { inherit system; - config = { allowUnfree = true; }; + config = { + allowUnfree = true; + }; }; in { @@ -365,7 +374,7 @@ google-cloud-sdk gotools nix-output-monitor - nixpkgs-fmt + nixfmt-rfc-style nodejs sops statix @@ -373,5 +382,6 @@ yapf ]; }; - }); + } + ); } diff --git a/modules/admin/default.nix b/modules/admin/default.nix index c42a6d1..8a3d47b 100644 --- a/modules/admin/default.nix +++ b/modules/admin/default.nix @@ -1,12 +1,8 @@ { iosmanthus = - { pkgs - , config - , ... - }: { - imports = [ - ./options.nix - ]; + { pkgs, config, ... }: + { + imports = [ ./options.nix ]; admin = rec { name = "iosmanthus"; diff --git a/modules/admin/options.nix b/modules/admin/options.nix index 53f86e5..2fb2bca 100644 --- a/modules/admin/options.nix +++ b/modules/admin/options.nix @@ -1,37 +1,23 @@ -{ lib -, ... -}: +{ lib, ... }: with lib; let - adminOpts = { ... }: { - options = { - name = mkOption { - type = types.str; - }; - email = mkOption { - type = types.str; - }; - home = mkOption { - type = types.str; - }; - shell = mkOption { - type = types.package; - }; - hashedPasswordFile = mkOption { - type = types.path; - }; - sshPubKey = mkOption { - type = types.str; - }; - gpgPubKey = mkOption { - type = types.str; - default = ""; + adminOpts = + { ... }: + { + options = { + name = mkOption { type = types.str; }; + email = mkOption { type = types.str; }; + home = mkOption { type = types.str; }; + shell = mkOption { type = types.package; }; + hashedPasswordFile = mkOption { type = types.path; }; + sshPubKey = mkOption { type = types.str; }; + gpgPubKey = mkOption { + type = types.str; + default = ""; + }; }; }; - }; in { - options.admin = mkOption { - type = types.submodule adminOpts; - }; + options.admin = mkOption { type = types.submodule adminOpts; }; } diff --git a/modules/atuin/default.nix b/modules/atuin/default.nix index 6c28f91..943375c 100644 --- a/modules/atuin/default.nix +++ b/modules/atuin/default.nix @@ -1,6 +1,16 @@ -{ config, pkgs, lib, ... }: +{ + config, + pkgs, + lib, + ... +}: let - inherit (lib) mkOption types mdDoc mkIf; + inherit (lib) + mkOption + types + mdDoc + mkIf + ; cfg = config.services.self-hosted.atuin; in { diff --git a/modules/base16/default.nix b/modules/base16/default.nix index cfb503d..ea5a2bb 100644 --- a/modules/base16/default.nix +++ b/modules/base16/default.nix @@ -1,6 +1,5 @@ -{ self -, ... -}: { +{ self, ... }: +{ # system: "base16" # name: "Material Darker" # author: "Nate Peterson" diff --git a/modules/chinadns/default.nix b/modules/chinadns/default.nix index a41f83d..539a035 100644 --- a/modules/chinadns/default.nix +++ b/modules/chinadns/default.nix @@ -1,12 +1,14 @@ -{ config -, pkgs -, lib -, ... +{ + config, + pkgs, + lib, + ... }: with lib; let cfg = config.services.self-hosted.chinadns; - writeShScript = name: text: + writeShScript = + name: text: let dir = pkgs.writeScriptBin name '' #! ${pkgs.runtimeShell} -e @@ -41,15 +43,9 @@ in type = types.str; default = "127.0.0.1:10888"; }; - geoipCN = mkOption { - type = types.path; - }; - geositeCN = mkOption { - type = types.path; - }; - geositeNotCN = mkOption { - type = types.path; - }; + geoipCN = mkOption { type = types.path; }; + geositeCN = mkOption { type = types.path; }; + geositeNotCN = mkOption { type = types.path; }; statePath = mkOption { type = types.path; default = "/var/lib/chinadns/data"; @@ -110,5 +106,3 @@ in }; }; } - - diff --git a/modules/cloud/aws-lightsail/default.nix b/modules/cloud/aws-lightsail/default.nix index 6497688..5d73c69 100644 --- a/modules/cloud/aws-lightsail/default.nix +++ b/modules/cloud/aws-lightsail/default.nix @@ -1,7 +1,8 @@ -{ self -, modulesPath -, lib -, ... +{ + self, + modulesPath, + lib, + ... }: { imports = [ diff --git a/modules/cloud/base/default.nix b/modules/cloud/base/default.nix index 986531e..a808a0b 100644 --- a/modules/cloud/base/default.nix +++ b/modules/cloud/base/default.nix @@ -1,6 +1,4 @@ -{ pkgs -, ... -}: +{ pkgs, ... }: { nix = { package = pkgs.nixVersions.nix_2_22; @@ -27,10 +25,12 @@ "net.core.default_qdisc" = "fq"; }; - swapDevices = [{ - device = "/swapfile"; - size = 2 * 1024; # 2 GiB - }]; + swapDevices = [ + { + device = "/swapfile"; + size = 2 * 1024; # 2 GiB + } + ]; services.openssh = { enable = true; @@ -64,7 +64,9 @@ i18n.defaultLocale = "en_US.UTF-8"; - console = { keyMap = "us"; }; + console = { + keyMap = "us"; + }; time.timeZone = "Asia/Shanghai"; } diff --git a/modules/cloud/firewall/default.nix b/modules/cloud/firewall/default.nix index b3d9a91..cca753c 100644 --- a/modules/cloud/firewall/default.nix +++ b/modules/cloud/firewall/default.nix @@ -1,6 +1,5 @@ -{ lib -, ... -}: { +{ lib, ... }: +{ services.fail2ban = { enable = true; daemonSettings = { diff --git a/modules/cloud/gce/default.nix b/modules/cloud/gce/default.nix index c97744c..cca41f4 100644 --- a/modules/cloud/gce/default.nix +++ b/modules/cloud/gce/default.nix @@ -1,7 +1,8 @@ -{ self -, lib -, modulesPath -, ... +{ + self, + lib, + modulesPath, + ... }: { imports = [ diff --git a/modules/cloud/sing-box/default.nix b/modules/cloud/sing-box/default.nix index 6665e8c..3ddda86 100644 --- a/modules/cloud/sing-box/default.nix +++ b/modules/cloud/sing-box/default.nix @@ -1,8 +1,9 @@ -{ self -, lib -, pkgs -, config -, ... +{ + self, + lib, + pkgs, + config, + ... }: with lib; let @@ -17,21 +18,19 @@ let mkGeositeUrl = geosite: "${ruleBaseUrl}/rule-set-geosite/${geosite}.srs"; - defaultUnlockSites = builtins.map - (geosite: "geosite-${geosite}") - [ - "category-porn" - "cloudflare" - "disney" - "hbo" - "hulu" - "netflix" - "openai" - "stripe" - "tiktok" - "microsoft" - # "youtube" - ]; + defaultUnlockSites = builtins.map (geosite: "geosite-${geosite}") [ + "category-porn" + "cloudflare" + "disney" + "hbo" + "hulu" + "netflix" + "openai" + "stripe" + "tiktok" + "microsoft" + # "youtube" + ]; defaultUnlockServer = { type = "wireguard"; @@ -48,10 +47,12 @@ let }; unlockSettings = - if cfg.unlockSettings == null then { - server = defaultUnlockServer; - sites = defaultUnlockSites; - } else + if cfg.unlockSettings == null then + { + server = defaultUnlockServer; + sites = defaultUnlockSites; + } + else cfg.unlockSettings; shadowtls = { @@ -132,15 +133,13 @@ let }; route = { final = "direct"; - rule_set = builtins.map - (geosite: { - type = "remote"; - tag = geosite; - format = "binary"; - url = mkGeositeUrl geosite; - download_detour = "direct"; - }) - unlockSettings.sites; + rule_set = builtins.map (geosite: { + type = "remote"; + tag = geosite; + format = "binary"; + url = mkGeositeUrl geosite; + download_detour = "direct"; + }) unlockSettings.sites; rules = [ { protocol = "bittorrent"; @@ -153,7 +152,10 @@ let ]; }; - inbounds = [ shadowtls shadowsocks ]; + inbounds = [ + shadowtls + shadowsocks + ]; outbounds = [ { type = "direct"; @@ -168,28 +170,27 @@ let }; # nested JSON objects should be unquoted - settingsJSON = builtins.replaceStrings - [ ''"${config.sops.placeholder."sing-box/shadowsocks/users"}"'' ] - [ config.sops.placeholder."sing-box/shadowsocks/users" ] - (builtins.toJSON settings); - - unlockSettingsOpts = { ... }: { - options = { - server = mkOption { - inherit (pkgs.formats.json { }) type; - description = "The unlock server"; - }; - sites = mkOption { - type = types.listOf types.str; - description = "The sites to unlock"; + settingsJSON = builtins.replaceStrings [ + ''"${config.sops.placeholder."sing-box/shadowsocks/users"}"'' + ] [ config.sops.placeholder."sing-box/shadowsocks/users" ] (builtins.toJSON settings); + + unlockSettingsOpts = + { ... }: + { + options = { + server = mkOption { + inherit (pkgs.formats.json { }) type; + description = "The unlock server"; + }; + sites = mkOption { + type = types.listOf types.str; + description = "The sites to unlock"; + }; }; }; - }; in { - imports = [ - self.nixosModules.sing-box - ]; + imports = [ self.nixosModules.sing-box ]; options.services.self-hosted.cloud.sing-box = { enable = mkEnableOption "sing-box service in the cloud"; diff --git a/modules/default.nix b/modules/default.nix index f397f04..ce3d859 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -1,24 +1,28 @@ { - workstation = { ... }: { - imports = [ - ./monitors.nix + workstation = + { ... }: + { + imports = [ + ./monitors.nix - ./base16 - ./gtk-theme - ./sing-box - ./wallpaper - ]; - }; - home-manager = { ... }: { - imports = [ - ./immutable-file.nix - ./mutable-vscode-ext.nix + ./base16 + ./gtk-theme + ./sing-box + ./wallpaper + ]; + }; + home-manager = + { ... }: + { + imports = [ + ./immutable-file.nix + ./mutable-vscode-ext.nix - ./base16 - ./gtk-theme - ./wallpaper - ]; - }; + ./base16 + ./gtk-theme + ./wallpaper + ]; + }; admin = import ./admin; atuin = import ./atuin; cloud = import ./cloud; diff --git a/modules/gemini-openai-proxy/default.nix b/modules/gemini-openai-proxy/default.nix index 7b4afa4..5e3afe6 100644 --- a/modules/gemini-openai-proxy/default.nix +++ b/modules/gemini-openai-proxy/default.nix @@ -1,7 +1,8 @@ -{ pkgs -, config -, lib -, ... +{ + pkgs, + config, + lib, + ... }: with lib; let @@ -31,7 +32,10 @@ in ExecStart = "${cfg.package}/bin/gemini-openai-proxy -port ${toString cfg.port}"; }; wantedBy = [ "multi-user.target" ]; - after = [ "network.target" "network-online.target" ]; + after = [ + "network.target" + "network-online.target" + ]; requires = [ "network-online.target" ]; }; }; diff --git a/modules/gtk-theme/default.nix b/modules/gtk-theme/default.nix index db6d77d..97d14e6 100644 --- a/modules/gtk-theme/default.nix +++ b/modules/gtk-theme/default.nix @@ -1,10 +1,6 @@ -{ pkgs -, ... -}: +{ pkgs, ... }: { - imports = [ - ./theme.nix - ]; + imports = [ ./theme.nix ]; gtk.globalTheme = { package = pkgs.fluent-gtk-theme; diff --git a/modules/gtk-theme/theme.nix b/modules/gtk-theme/theme.nix index f9904b7..7090797 100644 --- a/modules/gtk-theme/theme.nix +++ b/modules/gtk-theme/theme.nix @@ -1,14 +1,8 @@ -{ lib -, ... -}: +{ lib, ... }: with lib; { options.gtk.globalTheme = { - package = mkOption { - type = types.package; - }; - name = mkOption { - type = types.str; - }; + package = mkOption { type = types.package; }; + name = mkOption { type = types.str; }; }; } diff --git a/modules/immutable-file.nix b/modules/immutable-file.nix index 6d526c0..21748a8 100644 --- a/modules/immutable-file.nix +++ b/modules/immutable-file.nix @@ -1,21 +1,20 @@ -{ config -, lib -, pkgs -, ... +{ + config, + lib, + pkgs, + ... }: with lib; let cfg = config.home.immutable-file; - immutableFileOpts = { ... }: { - options = { - src = mkOption { - type = types.path; - }; - dst = mkOption { - type = types.path; + immutableFileOpts = + { ... }: + { + options = { + src = mkOption { type = types.path; }; + dst = mkOption { type = types.path; }; }; }; - }; mkImmutableFile = pkgs.writeScript "make_immutable_file" '' # $1: dst # $2: src @@ -38,13 +37,14 @@ in }; config = mkIf (cfg != { }) { - home.activation = mapAttrs' - (name: { src, dst }: - nameValuePair - "make-immutable-${name}" - (lib.hm.dag.entryAfter [ "writeBoundary" ] '' - ${mkImmutableFile} ${dst} ${src} - '')) - cfg; + home.activation = mapAttrs' ( + name: + { src, dst }: + nameValuePair "make-immutable-${name}" ( + lib.hm.dag.entryAfter [ "writeBoundary" ] '' + ${mkImmutableFile} ${dst} ${src} + '' + ) + ) cfg; }; } diff --git a/modules/monitors.nix b/modules/monitors.nix index c2d9f04..5447292 100644 --- a/modules/monitors.nix +++ b/modules/monitors.nix @@ -1,36 +1,26 @@ -{ lib -, ... -}: +{ lib, ... }: with lib; let - externalMonitorOpts = { ... }: { - options = { - fingerprint = mkOption { - type = types.str; + externalMonitorOpts = + { ... }: + { + options = { + fingerprint = mkOption { type = types.str; }; }; }; - }; - builtinMonitorOpts = { ... }: { - options = { - name = mkOption { - type = types.str; - }; - fingerprint = mkOption { - type = types.str; - }; - ports = mkOption { - type = with types; listOf str; + builtinMonitorOpts = + { ... }: + { + options = { + name = mkOption { type = types.str; }; + fingerprint = mkOption { type = types.str; }; + ports = mkOption { type = with types; listOf str; }; }; }; - }; in { options.monitors = { - builtin = mkOption { - type = types.submodule builtinMonitorOpts; - }; - external = mkOption { - type = with types; attrsOf (submodule externalMonitorOpts); - }; + builtin = mkOption { type = types.submodule builtinMonitorOpts; }; + external = mkOption { type = with types; attrsOf (submodule externalMonitorOpts); }; }; } diff --git a/modules/mutable-vscode-ext.nix b/modules/mutable-vscode-ext.nix index c9245aa..5cd7b57 100644 --- a/modules/mutable-vscode-ext.nix +++ b/modules/mutable-vscode-ext.nix @@ -1,21 +1,12 @@ -{ config -, lib -, ... -}: +{ config, lib, ... }: with lib; let cfg = config.programs.vscode.mutableExtensions; extensions = { options = { - name = mkOption { - type = types.str; - }; - publisher = mkOption { - type = types.str; - }; - version = mkOption { - type = types.str; - }; + name = mkOption { type = types.str; }; + publisher = mkOption { type = types.str; }; + version = mkOption { type = types.str; }; }; }; in @@ -26,9 +17,18 @@ in config = mkIf (config.programs.vscode.enable && config.programs.vscode.mutableExtensionsDir) { home.activation = { installMutableExtensions = hm.dag.entryAfter [ "writeBoundary" ] '' - exts=(${toString (builtins.map ( - {publisher, name, version}: "${publisher}.${name}@${version}") - cfg)}) + exts=(${ + toString ( + builtins.map ( + { + publisher, + name, + version, + }: + "${publisher}.${name}@${version}" + ) cfg + ) + }) CODE=$(command -v code || command -v codium || command -v code-insiders) for ext in $(echo $exts | sed 's/ /\n/g'); do $CODE --install-extension $ext diff --git a/modules/nixbuild/default.nix b/modules/nixbuild/default.nix index 0658649..73be3dc 100644 --- a/modules/nixbuild/default.nix +++ b/modules/nixbuild/default.nix @@ -1,6 +1,5 @@ -{ config -, ... -}: { +{ config, ... }: +{ security.sudo.wheelNeedsPassword = false; users.users.nixbuild = { @@ -12,9 +11,7 @@ description = "nixbuild"; - extraGroups = [ - "wheel" - ] ++ (if config.virtualisation.docker.enable then [ "docker" ] else [ ]); + extraGroups = [ "wheel" ] ++ (if config.virtualisation.docker.enable then [ "docker" ] else [ ]); openssh.authorizedKeys.keys = [ (builtins.readFile ../../secrets/iosmanthus/id_ecdsa_iosmanthus.pub) diff --git a/modules/o11y/default.nix b/modules/o11y/default.nix index 3aa1210..d4f5775 100644 --- a/modules/o11y/default.nix +++ b/modules/o11y/default.nix @@ -1,7 +1,4 @@ -{ config -, lib -, ... -}: +{ config, lib, ... }: with lib; let cfg = config.services.self-hosted.o11y; @@ -38,9 +35,11 @@ let http_listen_port = 0; grpc_listen_port = 0; }; - clients = [{ - url = "http://127.0.0.1:${cfg.grafanaCloudGateway}/promtail/loki/api/v1/push"; - }]; + clients = [ + { + url = "http://127.0.0.1:${cfg.grafanaCloudGateway}/promtail/loki/api/v1/push"; + } + ]; scrape_configs = [ { job_name = "journal"; @@ -54,16 +53,12 @@ let }; relabel_configs = [ { - source_labels = [ - "__journal__hostname" - ]; + source_labels = [ "__journal__hostname" ]; target_label = "host"; replacement = cfg.hostName; } { - source_labels = [ - "__journal__systemd_unit" - ]; + source_labels = [ "__journal__systemd_unit" ]; target_label = "unit"; } ]; @@ -83,9 +78,13 @@ let scrapeConfigs = [ { job_name = "systemd"; - static_configs = [{ - targets = [ "127.0.0.1:${toString config.services.prometheus.exporters.node.port}" ]; - }]; + static_configs = [ + { + targets = [ + "127.0.0.1:${toString config.services.prometheus.exporters.node.port}" + ]; + } + ]; relabel_configs = [ { source_labels = [ "__address__" ]; @@ -96,9 +95,11 @@ let } ]; - remoteWrite = [{ - url = "http://127.0.0.1:${cfg.grafanaCloudGateway}/prometheus/api/prom/push"; - }]; + remoteWrite = [ + { + url = "http://127.0.0.1:${cfg.grafanaCloudGateway}/prometheus/api/prom/push"; + } + ]; in { options.services.self-hosted.o11y = { @@ -122,9 +123,7 @@ in }; systemd.services.caddy = { - restartTriggers = [ - config.sops.templates."caddy.env".content - ]; + restartTriggers = [ config.sops.templates."caddy.env".content ]; serviceConfig = { EnvironmentFile = [ config.sops.templates."caddy.env".path ]; diff --git a/modules/sing-box/default.nix b/modules/sing-box/default.nix index f15f828..0639d22 100644 --- a/modules/sing-box/default.nix +++ b/modules/sing-box/default.nix @@ -1,28 +1,30 @@ -{ pkgs -, config -, lib -, ... +{ + pkgs, + config, + lib, + ... }: with lib; let cfg = config.services.self-hosted.sing-box; - singboxOpts = { ... }: { - options = { - enable = mkEnableOption "sing-box"; + singboxOpts = + { ... }: + { + options = { + enable = mkEnableOption "sing-box"; - package = mkOption { - type = types.package; - default = pkgs.sing-box; - }; + package = mkOption { + type = types.package; + default = pkgs.sing-box; + }; - configFile = mkOption { - type = types.path; + configFile = mkOption { type = types.path; }; }; }; - }; - writeShScript = name: text: + writeShScript = + name: text: let dir = pkgs.writeScriptBin name '' #! ${pkgs.runtimeShell} -e @@ -40,9 +42,7 @@ let ''; in { - options.services.self-hosted.sing-box = mkOption { - type = with types; (submodule singboxOpts); - }; + options.services.self-hosted.sing-box = mkOption { type = with types; (submodule singboxOpts); }; config = mkIf cfg.enable { systemd.services.sing-box = { diff --git a/modules/subgen/default.nix b/modules/subgen/default.nix index c9087ef..89d3174 100644 --- a/modules/subgen/default.nix +++ b/modules/subgen/default.nix @@ -1,7 +1,8 @@ -{ pkgs -, config -, lib -, ... +{ + pkgs, + config, + lib, + ... }: with lib; let @@ -41,7 +42,10 @@ in ExecStart = "${cfg.package}/bin/subgen -config ${cfg.configFile} -expr ${cfg.exprPath} -addr ${cfg.address}"; }; wantedBy = [ "multi-user.target" ]; - after = [ "network.target" "network-online.target" ]; + after = [ + "network.target" + "network-online.target" + ]; requires = [ "network-online.target" ]; }; }; diff --git a/modules/unguarded/default.nix b/modules/unguarded/default.nix index d6ecd27..8867974 100644 --- a/modules/unguarded/default.nix +++ b/modules/unguarded/default.nix @@ -1,7 +1,8 @@ -{ pkgs -, config -, lib -, ... +{ + pkgs, + config, + lib, + ... }: with lib; let @@ -31,7 +32,10 @@ in ExecStart = "${cfg.package}/bin/unguarded -addr ${cfg.address}"; }; wantedBy = [ "multi-user.target" ]; - after = [ "network.target" "network-online.target" ]; + after = [ + "network.target" + "network-online.target" + ]; requires = [ "network-online.target" ]; }; }; diff --git a/modules/wallpaper/default.nix b/modules/wallpaper/default.nix index 413c8d1..57a6815 100644 --- a/modules/wallpaper/default.nix +++ b/modules/wallpaper/default.nix @@ -1,10 +1,6 @@ -{ pkgs -, ... -}: +{ pkgs, ... }: { - imports = [ - ./options.nix - ]; + imports = [ ./options.nix ]; wallpaper = { package = pkgs.lib.mkNixBackground { diff --git a/modules/wallpaper/options.nix b/modules/wallpaper/options.nix index 8e57b11..b2820f0 100644 --- a/modules/wallpaper/options.nix +++ b/modules/wallpaper/options.nix @@ -1,11 +1,7 @@ -{ lib -, ... -}: +{ lib, ... }: with lib; { options.wallpaper = { - package = mkOption { - type = types.package; - }; + package = mkOption { type = types.package; }; }; } diff --git a/nixos/aws-lightsail-0/atuin/default.nix b/nixos/aws-lightsail-0/atuin/default.nix index fb88c43..ca2321f 100644 --- a/nixos/aws-lightsail-0/atuin/default.nix +++ b/nixos/aws-lightsail-0/atuin/default.nix @@ -1,6 +1,4 @@ -{ config -, ... -}: +{ config, ... }: { sops.templates."atuin.env".content = '' ATUIN_HOST="127.0.0.1" @@ -13,9 +11,7 @@ ATUIN_DB_URI="${config.sops.placeholder."atuin/db-uri"}" ''; - systemd.services.atuin.restartTriggers = [ - config.sops.templates."atuin.env".content - ]; + systemd.services.atuin.restartTriggers = [ config.sops.templates."atuin.env".content ]; services.self-hosted.atuin = { enable = true; diff --git a/nixos/aws-lightsail-0/caddy/default.nix b/nixos/aws-lightsail-0/caddy/default.nix index 6aa4e12..f89eab5 100644 --- a/nixos/aws-lightsail-0/caddy/default.nix +++ b/nixos/aws-lightsail-0/caddy/default.nix @@ -1,13 +1,12 @@ -{ config -, lib -, ... -}: +{ config, lib, ... }: let mkReverseProxy = - { backend - , logLevel - , basicauth ? null - }: { + { + backend, + logLevel, + basicauth ? null, + }: + { extraConfig = '' tls { dns cloudflare {env.CLOUDFLARE_API_TOKEN} @@ -46,9 +45,7 @@ in }; systemd.services.caddy = { - restartTriggers = [ - config.sops.templates."caddy.env".content - ]; + restartTriggers = [ config.sops.templates."caddy.env".content ]; serviceConfig = { EnvironmentFile = [ config.sops.templates."caddy.env".path ]; }; diff --git a/nixos/aws-lightsail-0/default.nix b/nixos/aws-lightsail-0/default.nix index 227755b..3972359 100644 --- a/nixos/aws-lightsail-0/default.nix +++ b/nixos/aws-lightsail-0/default.nix @@ -1,5 +1,4 @@ -{ ... -}: +{ ... }: { imports = [ ./atuin @@ -7,9 +6,7 @@ ./vaultwarden ]; - networking.timeServers = [ - "time.aws.com" - ]; + networking.timeServers = [ "time.aws.com" ]; services.timesyncd = { enable = true; diff --git a/nixos/aws-lightsail-0/users.nix b/nixos/aws-lightsail-0/users.nix index e4db309..85cbe4a 100644 --- a/nixos/aws-lightsail-0/users.nix +++ b/nixos/aws-lightsail-0/users.nix @@ -1,6 +1,5 @@ -{ config -, ... -}: { +{ config, ... }: +{ users = { mutableUsers = false; users.${config.admin.name} = { @@ -16,9 +15,7 @@ "wheel" ]; - openssh.authorizedKeys.keys = [ - config.admin.sshPubKey - ]; + openssh.authorizedKeys.keys = [ config.admin.sshPubKey ]; }; }; } diff --git a/nixos/aws-lightsail-0/vaultwarden/default.nix b/nixos/aws-lightsail-0/vaultwarden/default.nix index 4f2a084..abf067c 100644 --- a/nixos/aws-lightsail-0/vaultwarden/default.nix +++ b/nixos/aws-lightsail-0/vaultwarden/default.nix @@ -1,6 +1,5 @@ -{ config -, ... -}: { +{ config, ... }: +{ services.vaultwarden = { enable = true; dbBackend = "postgresql"; diff --git a/nixos/gcp-instance-0/caddy/default.nix b/nixos/gcp-instance-0/caddy/default.nix index 6b2e114..29e1b12 100644 --- a/nixos/gcp-instance-0/caddy/default.nix +++ b/nixos/gcp-instance-0/caddy/default.nix @@ -1,13 +1,12 @@ -{ config -, lib -, ... -}: +{ config, lib, ... }: let mkReverseProxy = - { backend - , logLevel - , basicauth ? null - }: { + { + backend, + logLevel, + basicauth ? null, + }: + { extraConfig = '' tls { dns cloudflare {env.CLOUDFLARE_API_TOKEN} @@ -46,9 +45,7 @@ in }; systemd.services.caddy = { - restartTriggers = [ - config.sops.templates."caddy.env".content - ]; + restartTriggers = [ config.sops.templates."caddy.env".content ]; serviceConfig = { EnvironmentFile = [ config.sops.templates."caddy.env".path ]; }; diff --git a/nixos/gcp-instance-0/chinadns/default.nix b/nixos/gcp-instance-0/chinadns/default.nix index 3978434..7a14727 100644 --- a/nixos/gcp-instance-0/chinadns/default.nix +++ b/nixos/gcp-instance-0/chinadns/default.nix @@ -1,4 +1,5 @@ -{ ... }: { +{ ... }: +{ services.self-hosted.chinadns = { enable = true; geoipCN = ./geoip-cn.srs; diff --git a/nixos/gcp-instance-0/default.nix b/nixos/gcp-instance-0/default.nix index 1c91f17..aab8fd0 100644 --- a/nixos/gcp-instance-0/default.nix +++ b/nixos/gcp-instance-0/default.nix @@ -1,4 +1,5 @@ -{ ... }: { +{ ... }: +{ imports = [ ./caddy ./subgen diff --git a/nixos/gcp-instance-0/subgen/default.nix b/nixos/gcp-instance-0/subgen/default.nix index b3f4e91..11ecd22 100644 --- a/nixos/gcp-instance-0/subgen/default.nix +++ b/nixos/gcp-instance-0/subgen/default.nix @@ -1,6 +1,4 @@ -{ config -, ... -}: +{ config, ... }: let outboundTemplates = { shadowtls = { diff --git a/nixos/gcp-instance-1/default.nix b/nixos/gcp-instance-1/default.nix index d01977f..4d99eb9 100644 --- a/nixos/gcp-instance-1/default.nix +++ b/nixos/gcp-instance-1/default.nix @@ -1,4 +1,5 @@ -{ ... }: { +{ ... }: +{ virtualisation.docker.enable = true; services.self-hosted.o11y = { diff --git a/nixos/gcp-instance-2/default.nix b/nixos/gcp-instance-2/default.nix index f64547c..e06ad2c 100644 --- a/nixos/gcp-instance-2/default.nix +++ b/nixos/gcp-instance-2/default.nix @@ -1,6 +1,5 @@ -{ config -, ... -}: { +{ config, ... }: +{ virtualisation.docker.enable = true; services.self-hosted.o11y = { @@ -17,29 +16,28 @@ server = config.sops.placeholder."gcp-instance-0/external-address-v4"; server_port = 18080; method = config.sops.placeholder."sing-box/shadowsocks/method"; - password = - "${config.sops.placeholder."sing-box/shadowsocks/server-password"}:${config.sops.placeholder."sing-box/shadowsocks/default-user"}"; + password = "${config.sops.placeholder."sing-box/shadowsocks/server-password"}:${ + config.sops.placeholder."sing-box/shadowsocks/default-user" + }"; multiplex = { enabled = true; padding = true; }; }; - sites = builtins.map - (geosite: "geosite-${geosite}") - [ - "category-porn" - "cloudflare" - "disney" - "google" - "hbo" - "hulu" - "microsoft" - "netflix" - "openai" - "stripe" - "tiktok" - "youtube" - ]; + sites = builtins.map (geosite: "geosite-${geosite}") [ + "category-porn" + "cloudflare" + "disney" + "google" + "hbo" + "hulu" + "microsoft" + "netflix" + "openai" + "stripe" + "tiktok" + "youtube" + ]; }; }; } diff --git a/nixos/iosmanthus-legion/default.nix b/nixos/iosmanthus-legion/default.nix index 470179a..8018ebb 100644 --- a/nixos/iosmanthus-legion/default.nix +++ b/nixos/iosmanthus-legion/default.nix @@ -1,13 +1,14 @@ -{ pkgs -, ... -}: { +{ pkgs, ... }: +{ imports = [ ./hardware-configuration.nix ./monitors.nix ]; networking.hostName = "iosmanthus-legion"; - services.throttled = { enable = true; }; + services.throttled = { + enable = true; + }; hardware.firmware = [ pkgs.firmwareLinuxNonfree ]; # video driver hardware.opengl.extraPackages = with pkgs; [ diff --git a/nixos/iosmanthus-legion/hardware-configuration.nix b/nixos/iosmanthus-legion/hardware-configuration.nix index e379d5d..bf2adcc 100644 --- a/nixos/iosmanthus-legion/hardware-configuration.nix +++ b/nixos/iosmanthus-legion/hardware-configuration.nix @@ -1,15 +1,22 @@ -{ lib -, modulesPath -, ... -}: +{ lib, modulesPath, ... }: { imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; - boot.initrd.availableKernelModules = - [ "xhci_pci" "nvme" "usbhid" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ]; + boot.initrd.availableKernelModules = [ + "xhci_pci" + "nvme" + "usbhid" + "usb_storage" + "sd_mod" + "rtsx_pci_sdmmc" + ]; boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-intel" "coretemp" "cpuid" ]; + boot.kernelModules = [ + "kvm-intel" + "coretemp" + "cpuid" + ]; boot.extraModulePackages = [ ]; fileSystems."/" = { @@ -36,8 +43,7 @@ fsType = "vfat"; }; - swapDevices = - [{ device = "/dev/disk/by-uuid/9f505500-071c-48b1-9561-467ee3657124"; }]; + swapDevices = [ { device = "/dev/disk/by-uuid/9f505500-071c-48b1-9561-467ee3657124"; } ]; powerManagement.cpuFreqGovernor = lib.mkDefault "performance"; } diff --git a/nixos/iosmanthus-legion/monitors.nix b/nixos/iosmanthus-legion/monitors.nix index 2939da3..eda4276 100644 --- a/nixos/iosmanthus-legion/monitors.nix +++ b/nixos/iosmanthus-legion/monitors.nix @@ -1,14 +1,16 @@ { ... }: let name = "eDP-1"; - fingerprint = - "00ffffffffffff0009e59c0800000000161d0104b523137802df50a35435b5260f50540000000101010101010101010101010101010150d000a0f0703e803020350058c21000001a00000000000000000000000000000000001a000000fe00424f452048460a202020202020000000fe004e4531353651554d2d4e36360a01bf02030f00e3058000e606050160602800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000aa"; + fingerprint = "00ffffffffffff0009e59c0800000000161d0104b523137802df50a35435b5260f50540000000101010101010101010101010101010150d000a0f0703e803020350058c21000001a00000000000000000000000000000000001a000000fe00424f452048460a202020202020000000fe004e4531353651554d2d4e36360a01bf02030f00e3058000e606050160602800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000aa"; in { monitors = { builtin = { inherit name fingerprint; - ports = builtins.map (p: "DP-" + (builtins.toString p)) [ 1 2 ]; + ports = builtins.map (p: "DP-" + (builtins.toString p)) [ + 1 + 2 + ]; }; }; services.autorandr = { diff --git a/nixos/iosmanthus-xps/default.nix b/nixos/iosmanthus-xps/default.nix index 0efb2ec..87924df 100644 --- a/nixos/iosmanthus-xps/default.nix +++ b/nixos/iosmanthus-xps/default.nix @@ -1,4 +1,5 @@ -{ ... }: { +{ ... }: +{ imports = [ ./hardware-configuration.nix diff --git a/nixos/iosmanthus-xps/hardware-configuration.nix b/nixos/iosmanthus-xps/hardware-configuration.nix index ee02798..4c6561c 100644 --- a/nixos/iosmanthus-xps/hardware-configuration.nix +++ b/nixos/iosmanthus-xps/hardware-configuration.nix @@ -1,54 +1,54 @@ # Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. -{ config -, lib -, modulesPath -, ... +{ + config, + lib, + modulesPath, + ... }: { - imports = - [ - (modulesPath + "/installer/scan/not-detected.nix") - ]; - - boot.initrd.availableKernelModules = [ "xhci_pci" "thunderbolt" "vmd" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ]; + imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; + + boot.initrd.availableKernelModules = [ + "xhci_pci" + "thunderbolt" + "vmd" + "nvme" + "usb_storage" + "sd_mod" + "rtsx_pci_sdmmc" + ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-intel" ]; boot.extraModulePackages = [ ]; - fileSystems."/" = - { - device = "/dev/disk/by-uuid/9fc68b4a-c446-4498-b9ae-6075ef52694f"; - fsType = "btrfs"; - options = [ "subvol=root" ]; - }; - - fileSystems."/home" = - { - neededForBoot = true; - device = "/dev/disk/by-uuid/9fc68b4a-c446-4498-b9ae-6075ef52694f"; - fsType = "btrfs"; - options = [ "subvol=home" ]; - }; - - fileSystems."/vm" = - { - device = "/dev/disk/by-uuid/9fc68b4a-c446-4498-b9ae-6075ef52694f"; - fsType = "btrfs"; - options = [ "subvol=vm" ]; - }; - - fileSystems."/boot" = - { - device = "/dev/disk/by-uuid/17E6-15D0"; - fsType = "vfat"; - }; - - swapDevices = - [{ device = "/dev/disk/by-uuid/727fdb7a-2c32-4626-9cd7-48f3515d02c8"; }]; - + fileSystems."/" = { + device = "/dev/disk/by-uuid/9fc68b4a-c446-4498-b9ae-6075ef52694f"; + fsType = "btrfs"; + options = [ "subvol=root" ]; + }; + + fileSystems."/home" = { + neededForBoot = true; + device = "/dev/disk/by-uuid/9fc68b4a-c446-4498-b9ae-6075ef52694f"; + fsType = "btrfs"; + options = [ "subvol=home" ]; + }; + + fileSystems."/vm" = { + device = "/dev/disk/by-uuid/9fc68b4a-c446-4498-b9ae-6075ef52694f"; + fsType = "btrfs"; + options = [ "subvol=vm" ]; + }; + + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/17E6-15D0"; + fsType = "vfat"; + }; + + swapDevices = [ { device = "/dev/disk/by-uuid/727fdb7a-2c32-4626-9cd7-48f3515d02c8"; } ]; powerManagement.cpuFreqGovernor = lib.mkDefault "performance"; hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; diff --git a/nixos/iosmanthus-xps/monitors.nix b/nixos/iosmanthus-xps/monitors.nix index d5ec1c6..195148c 100644 --- a/nixos/iosmanthus-xps/monitors.nix +++ b/nixos/iosmanthus-xps/monitors.nix @@ -1,6 +1,4 @@ -{ config -, ... -}: +{ config, ... }: let name = "eDP-1-1"; fingerprint = "00ffffffffffff004d10d61400000000051e0104b52517780a0dc2a95533ba240d50570000000101010101010101010101010101010172e700a0f0604590302036006ee51000001828b900a0f0604590302036006ee510000018000000fe00374a584b38814c513137305231000000000002410332011200000b010a2020014702030f00e3058000e606050160602800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000aa"; @@ -9,7 +7,12 @@ in monitors = { builtin = { inherit name fingerprint; - ports = builtins.map (p: "DP-1-" + (builtins.toString p)) [ 1 2 3 4 ]; + ports = builtins.map (p: "DP-1-" + (builtins.toString p)) [ + 1 + 2 + 3 + 4 + ]; }; }; services.autorandr = { diff --git a/nixos/lego-router/default.nix b/nixos/lego-router/default.nix index acdd204..df620f7 100644 --- a/nixos/lego-router/default.nix +++ b/nixos/lego-router/default.nix @@ -1,11 +1,7 @@ -{ config -, ... -}: +{ config, ... }: { - imports = [ - ./hardware-configuration.nix - ]; + imports = [ ./hardware-configuration.nix ]; networking.hostName = "lego-router"; diff --git a/nixos/lego-router/hardware-configuration.nix b/nixos/lego-router/hardware-configuration.nix index d84aaeb..00d5a37 100644 --- a/nixos/lego-router/hardware-configuration.nix +++ b/nixos/lego-router/hardware-configuration.nix @@ -1,39 +1,45 @@ -{ config -, lib -, modulesPath -, ... +{ + config, + lib, + modulesPath, + ... }: { - imports = [ - (modulesPath + "/installer/scan/not-detected.nix") + imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; + + boot.initrd.availableKernelModules = [ + "xhci_pci" + "ahci" + "nvme" + "usb_storage" + "sd_mod" + "rtsx_pci_sdmmc" ]; - - boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-intel" ]; boot.extraModulePackages = [ ]; - fileSystems."/" = - { - device = "/dev/disk/by-uuid/308ed692-dc26-4c8b-975a-9339b767cf90"; - fsType = "btrfs"; - options = [ "subvol=root" ]; - }; - - fileSystems."/boot" = - { - device = "/dev/disk/by-uuid/17CD-8ECE"; - fsType = "vfat"; - options = [ "fmask=0022" "dmask=0022" ]; - }; - - fileSystems."/home" = - { - device = "/dev/disk/by-uuid/308ed692-dc26-4c8b-975a-9339b767cf90"; - fsType = "btrfs"; - options = [ "subvol=home" ]; - }; + fileSystems."/" = { + device = "/dev/disk/by-uuid/308ed692-dc26-4c8b-975a-9339b767cf90"; + fsType = "btrfs"; + options = [ "subvol=root" ]; + }; + + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/17CD-8ECE"; + fsType = "vfat"; + options = [ + "fmask=0022" + "dmask=0022" + ]; + }; + + fileSystems."/home" = { + device = "/dev/disk/by-uuid/308ed692-dc26-4c8b-975a-9339b767cf90"; + fsType = "btrfs"; + options = [ "subvol=home" ]; + }; swapDevices = [ ]; diff --git a/nixos/workstation/default.nix b/nixos/workstation/default.nix index 4e2be57..1fc7bd2 100644 --- a/nixos/workstation/default.nix +++ b/nixos/workstation/default.nix @@ -1,8 +1,10 @@ -{ config -, pkgs -, lib -, ... -}: { +{ + config, + pkgs, + lib, + ... +}: +{ imports = [ ./desktop ./o11y @@ -43,12 +45,13 @@ }; }; - console = { keyMap = "us"; }; + console = { + keyMap = "us"; + }; time.timeZone = "Asia/Shanghai"; - sops.age.keyFile = - "${config.admin.home}/.config/sops/age/keys.txt"; + sops.age.keyFile = "${config.admin.home}/.config/sops/age/keys.txt"; environment.systemPackages = with pkgs; [ alsa-utils @@ -108,9 +111,7 @@ services.gvfs.enable = true; services.upower.enable = true; services.udev = { - packages = with pkgs; [ - via - ]; + packages = with pkgs; [ via ]; extraRules = '' RUN+="${pkgs.coreutils}/bin/chgrp video /sys/class/backlight/intel_backlight/brightness" RUN+="${pkgs.coreutils}/bin/chmod g+w /sys/class/backlight/intel_backlight/brightness" @@ -124,13 +125,17 @@ security = { polkit.enable = true; rtkit.enable = true; - sudo.extraRules = [{ - users = [ "${config.admin.name}" ]; - commands = [{ - command = "ALL"; - options = [ "NOPASSWD" ]; - }]; - }]; + sudo.extraRules = [ + { + users = [ "${config.admin.name}" ]; + commands = [ + { + command = "ALL"; + options = [ "NOPASSWD" ]; + } + ]; + } + ]; pam = { services = { ${config.admin.name}.gnupg.enable = true; @@ -159,13 +164,15 @@ default-ulimit = "nofile=1048576:1048576"; }; }; - libvirtd = { enable = true; }; + libvirtd = { + enable = true; + }; spiceUSBRedirection.enable = true; }; programs.nix-ld = { enable = true; - libraries = with pkgs; [ + libraries = with pkgs; [ acl attr bzip2 diff --git a/nixos/workstation/desktop/default.nix b/nixos/workstation/desktop/default.nix index 7209537..773e4f6 100644 --- a/nixos/workstation/desktop/default.nix +++ b/nixos/workstation/desktop/default.nix @@ -1,7 +1,5 @@ -{ config -, pkgs -, ... -}: { +{ config, pkgs, ... }: +{ imports = [ ./fonts.nix ./monitors.nix @@ -49,20 +47,28 @@ size = 48; }; theme = config.gtk.globalTheme; - indicators = - [ "~host" "~spacer" "~clock" "~spacer" "~session" "~power" ]; + indicators = [ + "~host" + "~spacer" + "~clock" + "~spacer" + "~session" + "~power" + ]; extraConfig = '' xft-dpi=192 font-name=sans-serif ''; }; }; - windowManager.i3 = { enable = true; }; + windowManager.i3 = { + enable = true; + }; }; programs.thunar = { enable = true; - plugins = with pkgs.xfce;[ + plugins = with pkgs.xfce; [ thunar-archive-plugin thunar-volman ]; diff --git a/nixos/workstation/desktop/fcitx5.nix b/nixos/workstation/desktop/fcitx5.nix index 9517907..d99b418 100644 --- a/nixos/workstation/desktop/fcitx5.nix +++ b/nixos/workstation/desktop/fcitx5.nix @@ -1,6 +1,5 @@ -{ pkgs -, ... -}: { +{ pkgs, ... }: +{ i18n = { defaultLocale = "en_US.UTF-8"; inputMethod = { @@ -9,9 +8,7 @@ fcitx5 = { addons = with pkgs; [ fcitx5-adwaita-dark - (fcitx5-rime.override { - rimeDataPkgs = pkgs.rime-data-cantonia; - }) + (fcitx5-rime.override { rimeDataPkgs = pkgs.rime-data-cantonia; }) ]; settings = { diff --git a/nixos/workstation/desktop/fonts.nix b/nixos/workstation/desktop/fonts.nix index 3fd8114..e16048b 100644 --- a/nixos/workstation/desktop/fonts.nix +++ b/nixos/workstation/desktop/fonts.nix @@ -37,7 +37,14 @@ vistafonts-chs (nerdfonts.override { - fonts = [ "DroidSansMono" "LiberationMono" "Iosevka" "Hasklig" "JetBrainsMono" "FiraCode" ]; + fonts = [ + "DroidSansMono" + "LiberationMono" + "Iosevka" + "Hasklig" + "JetBrainsMono" + "FiraCode" + ]; }) ]; diff --git a/nixos/workstation/desktop/monitors.nix b/nixos/workstation/desktop/monitors.nix index 49b6e63..d594d97 100644 --- a/nixos/workstation/desktop/monitors.nix +++ b/nixos/workstation/desktop/monitors.nix @@ -1,7 +1,4 @@ -{ config -, pkgs -, ... -}: +{ config, pkgs, ... }: let builtin = config.monitors.builtin.name; builtinFp = config.monitors.builtin.fingerprint; @@ -28,12 +25,16 @@ let }; }; mkProfile = - { name - , fingerprint - , mkConfig - , ports - }: builtins.foldl' - (profile: port: profile // { + { + name, + fingerprint, + mkConfig, + ports, + }: + builtins.foldl' ( + profile: port: + profile + // { "${name}-${port}" = { fingerprint = { "${builtin}" = builtinFp; @@ -42,9 +43,8 @@ let config = mkConfig port; inherit hooks; }; - }) - { } - ports; + } + ) { } ports; in { monitors = { @@ -58,22 +58,20 @@ in services.autorandr = { enable = true; inherit hooks; - profiles = mkProfile - { + profiles = + mkProfile { name = "aoc-only"; inherit (externalMonitors.home-aoc) fingerprint; inherit ports; mkConfig = mk4k; } - // mkProfile - { + // mkProfile { name = "lg-only"; inherit (externalMonitors.home-lg) fingerprint; inherit ports; mkConfig = mk4k; } - // mkProfile - { + // mkProfile { name = "office"; inherit (externalMonitors.office-lg) fingerprint; inherit ports; diff --git a/nixos/workstation/home/default.nix b/nixos/workstation/home/default.nix index 18e726d..db81084 100644 --- a/nixos/workstation/home/default.nix +++ b/nixos/workstation/home/default.nix @@ -1,8 +1,10 @@ -{ lib -, config -, pkgs -, ... -}: { +{ + lib, + config, + pkgs, + ... +}: +{ imports = [ ./tmux.nix @@ -20,109 +22,112 @@ home.stateVersion = "18.09"; - home.packages = with pkgs; [ - ascii - awscli2 - brave - btop - code-cursor - delta - delve - discord - fast-cli - fd - feishu - flameshot - flyctl - fzf - gedit - geoipWithDatabase - gh - gnome-font-viewer - gnome-clocks - go-musicfox - go-tools - google-cloud-sdk - graphviz - htop - httpie - imagemagick - iperf3 - jq - k9s - kubectl - kubectx - kubernetes-helm - libnotify - logseq - mariadb - minikube - mycli - networkmanagerapplet - nix-output-monitor - nnn - pavucontrol - peek - pgcli - quickemu - r3playx - regctl - ripgrep - seahorse - slack - solaar - sops - speedtest-cli - spotify-unwrapped - ssm-session-manager-plugin - tdesktop - thunderbird - tldr - tokei - tor - tree - unzip - via - vlc - warp-terminal - wireguard-tools - wmfocus - xfce.xfce4-taskmanager - xxd - yesplaymusic - zoom-us - nur.repos.linyinfeng.wemeet - follow - (wechat-uos.override { - uosLicense = builtins.fetchurl { - url = "https://github.com/archlinux/aur/raw/6e9a4ad47ff090ecd98170e26bd55219e55109fc/license.tar.gz"; - sha256 = "0sdx5mdybx4y489dhhc8505mjfajscggxvymlcpqzdd5q5wh0xjk"; - }; - }) - (retroarch.override { - cores = with pkgs.libretro; [ - mgba - melonds - ]; - }) - ] ++ - ( - let - commonPlugins = [ - "github-copilot" - "ideavim" - ]; - in - # https://github.com/NixOS/nixpkgs/pull/223593 - with pkgs.jetbrains; [ - (plugins.addPlugins clion commonPlugins) - (plugins.addPlugins goland commonPlugins) - (plugins.addPlugins idea-ultimate commonPlugins) - (plugins.addPlugins pycharm-professional commonPlugins) - (plugins.addPlugins rust-rover commonPlugins) - (plugins.addPlugins webstorm commonPlugins) + home.packages = + with pkgs; + [ + ascii + awscli2 + brave + btop + code-cursor + delta + delve + discord + fast-cli + fd + feishu + flameshot + flyctl + fzf + gedit + geoipWithDatabase + gh + gnome-font-viewer + gnome-clocks + go-musicfox + go-tools + google-cloud-sdk + graphviz + htop + httpie + imagemagick + iperf3 + jq + k9s + kubectl + kubectx + kubernetes-helm + libnotify + logseq + mariadb + minikube + mycli + networkmanagerapplet + nix-output-monitor + nnn + pavucontrol + peek + pgcli + quickemu + r3playx + regctl + ripgrep + seahorse + slack + solaar + sops + speedtest-cli + spotify-unwrapped + ssm-session-manager-plugin + tdesktop + thunderbird + tldr + tokei + tor + tree + unzip + via + vlc + warp-terminal + wireguard-tools + wmfocus + xfce.xfce4-taskmanager + xxd + yesplaymusic + zoom-us + nur.repos.linyinfeng.wemeet + follow + (wechat-uos.override { + uosLicense = builtins.fetchurl { + url = "https://github.com/archlinux/aur/raw/6e9a4ad47ff090ecd98170e26bd55219e55109fc/license.tar.gz"; + sha256 = "0sdx5mdybx4y489dhhc8505mjfajscggxvymlcpqzdd5q5wh0xjk"; + }; + }) + (retroarch.override { + cores = with pkgs.libretro; [ + mgba + melonds + ]; + }) ] - ); + ++ ( + let + commonPlugins = [ + "github-copilot" + "ideavim" + ]; + in + # https://github.com/NixOS/nixpkgs/pull/223593 + with pkgs.jetbrains; + [ + (plugins.addPlugins clion commonPlugins) + (plugins.addPlugins goland commonPlugins) + (plugins.addPlugins idea-ultimate commonPlugins) + (plugins.addPlugins pycharm-professional commonPlugins) + (plugins.addPlugins rust-rover commonPlugins) + (plugins.addPlugins webstorm commonPlugins) + ] + ); home.sessionVariables = { "TERMINAL" = "${pkgs.kitty}/bin/kitty"; @@ -133,12 +138,13 @@ $DRY_RUN_CMD mkdir -p $VERBOSE_ARG $HOME/.go ''; - restartSopsNix = lib.hm.dag.entryAfter [ "reloadSystemd" ] ''( - if ${pkgs.systemd}/bin/systemctl --user list-unit-files | grep -q sops-nix.service; then - echo "restart sops-nix.service" - $DRY_RUN_CMD ${pkgs.systemd}/bin/systemctl --user restart sops-nix.service - fi - )''; + restartSopsNix = lib.hm.dag.entryAfter [ "reloadSystemd" ] '' + ( + if ${pkgs.systemd}/bin/systemctl --user list-unit-files | grep -q sops-nix.service; then + echo "restart sops-nix.service" + $DRY_RUN_CMD ${pkgs.systemd}/bin/systemctl --user restart sops-nix.service + fi + )''; }; home.keyboard.options = [ "caps:escape" ]; @@ -184,7 +190,9 @@ }; }; - programs.gpg = { enable = true; }; + programs.gpg = { + enable = true; + }; services.gpg-agent = { enable = true; @@ -255,9 +263,7 @@ programs.atuin = { enable = true; - flags = [ - "--disable-up-arrow" - ]; + flags = [ "--disable-up-arrow" ]; settings = { auto_sync = true; keymap_mode = "vim-normal"; @@ -274,7 +280,11 @@ services.gnome-keyring = { enable = true; - components = [ "pkcs11" "secrets" "ssh" ]; + components = [ + "pkcs11" + "secrets" + "ssh" + ]; }; services.flameshot = { diff --git a/nixos/workstation/home/desktop/default.nix b/nixos/workstation/home/desktop/default.nix index a77b460..031f7d1 100644 --- a/nixos/workstation/home/desktop/default.nix +++ b/nixos/workstation/home/desktop/default.nix @@ -1,7 +1,5 @@ -{ config -, pkgs -, ... -}: { +{ config, pkgs, ... }: +{ imports = [ ./i3.nix ./dunst.nix @@ -48,7 +46,9 @@ # }; }; - services.clipmenu = { enable = true; }; + services.clipmenu = { + enable = true; + }; home.file = { wallpaper = { diff --git a/nixos/workstation/home/desktop/dunst.nix b/nixos/workstation/home/desktop/dunst.nix index bc03ba8..3e2da6f 100644 --- a/nixos/workstation/home/desktop/dunst.nix +++ b/nixos/workstation/home/desktop/dunst.nix @@ -1,7 +1,4 @@ -{ config -, pkgs -, ... -}: +{ config, pkgs, ... }: let playNotificationSound = pkgs.writeShellScript "play-notification-sound" '' ${pkgs.mpv}/bin/mpv ${pkgs.yaru-theme}/share/sounds/Yaru/stereo/message.oga diff --git a/nixos/workstation/home/desktop/i3.nix b/nixos/workstation/home/desktop/i3.nix index 9c7c87c..425aed8 100644 --- a/nixos/workstation/home/desktop/i3.nix +++ b/nixos/workstation/home/desktop/i3.nix @@ -1,7 +1,8 @@ -{ config -, pkgs -, lib -, ... +{ + config, + pkgs, + lib, + ... }: let modifier0 = "Mod4"; @@ -11,193 +12,181 @@ let i3 = { enable = true; package = pkgs.i3; - config = - { - fonts = - { - names = [ "monospace" ]; - size = 12.0; - }; - modifier = modifier0; - focus = { - newWindow = "focus"; - }; - window = { - border = 0; - titlebar = true; - commands = [ - { - command = "title_window_icon on"; - criteria = { - all = true; - }; - } - { - command = "resize set 640 480"; - criteria = { - window_role = "pop_up"; - }; - } - { - command = "resize set 640 480"; - criteria = { - window_role = "task_dialog"; - }; - } - { - command = "floating enable"; - criteria = { - window_role = "pop_up"; - }; - } - { - command = "floating enable"; - criteria = { - window_role = "task_dialog"; - }; - } - ]; - }; - terminal = "kitty tmux"; - keybindings = lib.mkOptionDefault { - "${modifier0}+Shift+c" = "kill"; - - "${modifier1}+e" = "layout toggle split"; - "${modifier1}+h" = "split h"; - "${modifier1}+v" = "split v"; - "${modifier1}+s" = "layout stacking"; - "${modifier1}+w" = "layout tabbed"; - - "${modifier0}+1" = "workspace 1: main"; - "${modifier0}+2" = "workspace 2: chat"; - "${modifier0}+3" = "workspace 3: mail"; - "${modifier0}+4" = "workspace 4: music"; - "${modifier0}+5" = "workspace 5: vm"; - - "${modifier0}+Shift+1" = "move container to workspace 1: main"; - "${modifier0}+Shift+2" = "move container to workspace 2: chat"; - "${modifier0}+Shift+3" = "move container to workspace 3: mail"; - "${modifier0}+Shift+4" = "move container to workspace 4: music"; - "${modifier0}+Shift+5" = "move container to workspace 5: vm"; - - "${modifier0}+j" = "focus down"; - "${modifier0}+h" = "focus left"; - "${modifier0}+l" = "focus right"; - "${modifier0}+k" = "focus up"; - "${modifier0}+x" = "[urgent=latest] focus"; - - "${modifier0}+Tab" = "workspace next"; - "${modifier0}+Shift+Tab" = "workspace prev"; - - "${modifier0}+Shift+j" = "move down"; - "${modifier0}+Shift+h" = "move left"; - "${modifier0}+Shift+l" = "move right"; - "${modifier0}+Shift+k" = "move up"; - - "${modifier0}+Shift+q" = "exec i3-msg restart"; - "${modifier0}+Shift+x" = '' - exec ${betterlockscreen} -l dim - ''; - "${modifier0}+c" = "exec env CM_LAUNCHER=rofi clipmenu"; - "${modifier0}+m" = "exec autorandr --change"; - "${modifier0}+w" = "exec brave"; - "${modifier0}+p" = "exec rofi -show combi"; - "${modifier0}+d" = "exec Discord"; - "${modifier0}+t" = "exec telegram-desktop"; - "${modifier0}+s" = "exec flameshot gui"; - "${modifier0}+n" = "exec dunstctl history-pop"; - "${modifier0}+Shift+n" = "exec dunstctl close-all"; - "${modifier0}+g" = "exec gedit"; - "${modifier0}+space" = "exec wmfocus"; - "${modifier0}+b" = "exec polybar-msg cmd toggle"; - - # Disable tiling_drag before there is a threshold for it. - "button1" = "focus"; - }; - modes = lib.mkOptionDefault { - resize = { - j = "resize shrink height 10 px or 10 ppt"; - h = "resize shrink width 10 px or 10 ppt"; - l = "resize grow width 10 px or 10 ppt"; - k = "resize grow height 10 px or 10 ppt"; - }; - }; - workspaceAutoBackAndForth = true; - workspaceLayout = "tabbed"; - workspaceOutputAssign = [ - { - workspace = "1: main"; - output = "primary"; + config = { + fonts = { + names = [ "monospace" ]; + size = 12.0; + }; + modifier = modifier0; + focus = { + newWindow = "focus"; + }; + window = { + border = 0; + titlebar = true; + commands = [ + { + command = "title_window_icon on"; + criteria = { + all = true; + }; } { - workspace = "2: chat"; - output = "primary"; + command = "resize set 640 480"; + criteria = { + window_role = "pop_up"; + }; } { - workspace = "3: mail"; - output = "primary"; + command = "resize set 640 480"; + criteria = { + window_role = "task_dialog"; + }; } { - workspace = "4: music"; - output = "primary"; + command = "floating enable"; + criteria = { + window_role = "pop_up"; + }; } { - workspace = "5: vm"; - output = "primary"; + command = "floating enable"; + criteria = { + window_role = "task_dialog"; + }; } ]; - assigns = { - "1: main" = [ - { class = "^firefox-nightly$"; } - { class = "^logseq$"; } - ]; - "2: chat" = [ - { class = "^Discord$"; } - { class = "^TelegramDesktop$"; } - ]; - "3: mail" = [{ class = "^thunderbird$"; }]; - "4: music" = [{ class = "^Spotify$"; }]; - "5: vm" = [{ class = "^Remote-viewer$"; }]; + }; + terminal = "kitty tmux"; + keybindings = lib.mkOptionDefault { + "${modifier0}+Shift+c" = "kill"; + + "${modifier1}+e" = "layout toggle split"; + "${modifier1}+h" = "split h"; + "${modifier1}+v" = "split v"; + "${modifier1}+s" = "layout stacking"; + "${modifier1}+w" = "layout tabbed"; + + "${modifier0}+1" = "workspace 1: main"; + "${modifier0}+2" = "workspace 2: chat"; + "${modifier0}+3" = "workspace 3: mail"; + "${modifier0}+4" = "workspace 4: music"; + "${modifier0}+5" = "workspace 5: vm"; + + "${modifier0}+Shift+1" = "move container to workspace 1: main"; + "${modifier0}+Shift+2" = "move container to workspace 2: chat"; + "${modifier0}+Shift+3" = "move container to workspace 3: mail"; + "${modifier0}+Shift+4" = "move container to workspace 4: music"; + "${modifier0}+Shift+5" = "move container to workspace 5: vm"; + + "${modifier0}+j" = "focus down"; + "${modifier0}+h" = "focus left"; + "${modifier0}+l" = "focus right"; + "${modifier0}+k" = "focus up"; + "${modifier0}+x" = "[urgent=latest] focus"; + + "${modifier0}+Tab" = "workspace next"; + "${modifier0}+Shift+Tab" = "workspace prev"; + + "${modifier0}+Shift+j" = "move down"; + "${modifier0}+Shift+h" = "move left"; + "${modifier0}+Shift+l" = "move right"; + "${modifier0}+Shift+k" = "move up"; + + "${modifier0}+Shift+q" = "exec i3-msg restart"; + "${modifier0}+Shift+x" = '' + exec ${betterlockscreen} -l dim + ''; + "${modifier0}+c" = "exec env CM_LAUNCHER=rofi clipmenu"; + "${modifier0}+m" = "exec autorandr --change"; + "${modifier0}+w" = "exec brave"; + "${modifier0}+p" = "exec rofi -show combi"; + "${modifier0}+d" = "exec Discord"; + "${modifier0}+t" = "exec telegram-desktop"; + "${modifier0}+s" = "exec flameshot gui"; + "${modifier0}+n" = "exec dunstctl history-pop"; + "${modifier0}+Shift+n" = "exec dunstctl close-all"; + "${modifier0}+g" = "exec gedit"; + "${modifier0}+space" = "exec wmfocus"; + "${modifier0}+b" = "exec polybar-msg cmd toggle"; + + # Disable tiling_drag before there is a threshold for it. + "button1" = "focus"; + }; + modes = lib.mkOptionDefault { + resize = { + j = "resize shrink height 10 px or 10 ppt"; + h = "resize shrink width 10 px or 10 ppt"; + l = "resize grow width 10 px or 10 ppt"; + k = "resize grow height 10 px or 10 ppt"; }; - startup = [ - { - command = "fcitx5 -dr"; - always = true; - } - { - command = "feh --bg-scale --conversion-timeout 1 ~/.background-image"; - always = true; - } - { - command = "${betterlockscreen} -u ~/.background-image --fx dim,pixel"; - always = true; - } - { - command = "systemctl restart --user polybar.service"; - always = true; - } - { - command = "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1"; - always = true; - } - { - command = "i3-msg workspace 1: main"; - } - { - command = "firefox-nightly"; - } - { - command = "logseq"; - } - { - command = "kitty tmux"; - } - { - command = "thunderbird"; - } + }; + workspaceAutoBackAndForth = true; + workspaceLayout = "tabbed"; + workspaceOutputAssign = [ + { + workspace = "1: main"; + output = "primary"; + } + { + workspace = "2: chat"; + output = "primary"; + } + { + workspace = "3: mail"; + output = "primary"; + } + { + workspace = "4: music"; + output = "primary"; + } + { + workspace = "5: vm"; + output = "primary"; + } + ]; + assigns = { + "1: main" = [ + { class = "^firefox-nightly$"; } + { class = "^logseq$"; } + ]; + "2: chat" = [ + { class = "^Discord$"; } + { class = "^TelegramDesktop$"; } ]; - bars = lib.mkForce [ ]; + "3: mail" = [ { class = "^thunderbird$"; } ]; + "4: music" = [ { class = "^Spotify$"; } ]; + "5: vm" = [ { class = "^Remote-viewer$"; } ]; }; + startup = [ + { + command = "fcitx5 -dr"; + always = true; + } + { + command = "feh --bg-scale --conversion-timeout 1 ~/.background-image"; + always = true; + } + { + command = "${betterlockscreen} -u ~/.background-image --fx dim,pixel"; + always = true; + } + { + command = "systemctl restart --user polybar.service"; + always = true; + } + { + command = "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1"; + always = true; + } + { command = "i3-msg workspace 1: main"; } + { command = "firefox-nightly"; } + { command = "logseq"; } + { command = "kitty tmux"; } + { command = "thunderbird"; } + ]; + bars = lib.mkForce [ ]; + }; extraConfig = '' set $base00 ${colors.base00} set $base01 ${colors.base01} diff --git a/nixos/workstation/home/fcitx5/default.nix b/nixos/workstation/home/fcitx5/default.nix index b791404..c334dd3 100644 --- a/nixos/workstation/home/fcitx5/default.nix +++ b/nixos/workstation/home/fcitx5/default.nix @@ -1,16 +1,15 @@ -{ config -, lib -, pkgs -, ... +{ + config, + lib, + pkgs, + ... }: -with lib ; +with lib; let fcitx5Home = "${config.xdg.configHome}/fcitx5"; in { - home.packages = with pkgs; [ - fcitx5-configtool - ]; + home.packages = with pkgs; [ fcitx5-configtool ]; home.immutable-file = { fcitx5-profile = { diff --git a/nixos/workstation/home/firefox/default.nix b/nixos/workstation/home/firefox/default.nix index cda4e2e..e9205fe 100644 --- a/nixos/workstation/home/firefox/default.nix +++ b/nixos/workstation/home/firefox/default.nix @@ -1,8 +1,10 @@ -{ config -, self -, pkgs -, ... -}: { +{ + config, + self, + pkgs, + ... +}: +{ programs.firefox = { enable = true; package = self.inputs.firefox.packages.${pkgs.system}.firefox-nightly-bin.unwrapped; diff --git a/nixos/workstation/home/gpg/default.nix b/nixos/workstation/home/gpg/default.nix index 7fddd43..e1abb71 100644 --- a/nixos/workstation/home/gpg/default.nix +++ b/nixos/workstation/home/gpg/default.nix @@ -1,7 +1,4 @@ -{ pkgs -, config -, ... -}: +{ pkgs, config, ... }: let importGPGKeys = pkgs.writeShellScript "import_gpg_keys" '' while [ ! -f "${config.programs.gpg.homedir}/pubring.kbx" ]; do @@ -17,8 +14,14 @@ in mutableKeys = false; mutableTrust = false; publicKeys = [ - { source = ./0xDEE5BAABFE092169.gpg; trust = "ultimate"; } - { source = ./0xC16B34E00DCD8AE9.gpg; trust = "ultimate"; } + { + source = ./0xDEE5BAABFE092169.gpg; + trust = "ultimate"; + } + { + source = ./0xC16B34E00DCD8AE9.gpg; + trust = "ultimate"; + } ]; }; diff --git a/nixos/workstation/home/polybar/default.nix b/nixos/workstation/home/polybar/default.nix index f59ddd8..499292e 100644 --- a/nixos/workstation/home/polybar/default.nix +++ b/nixos/workstation/home/polybar/default.nix @@ -1,7 +1,4 @@ -{ config -, pkgs -, ... -}: +{ config, pkgs, ... }: let playerctl = import ./playerctl.nix { inherit pkgs; }; diff --git a/nixos/workstation/home/shell/alias.nix b/nixos/workstation/home/shell/alias.nix index 4a8db05..1d14e95 100644 --- a/nixos/workstation/home/shell/alias.nix +++ b/nixos/workstation/home/shell/alias.nix @@ -1,11 +1,6 @@ -{ pkgs -, ... -}: +{ pkgs, ... }: let - ignoreOutput = pkgs.writers.writePython3 "ignore_output" - { - libraries = [ ]; - } '' + ignoreOutput = pkgs.writers.writePython3 "ignore_output" { libraries = [ ]; } '' import subprocess import sys diff --git a/nixos/workstation/home/shell/default.nix b/nixos/workstation/home/shell/default.nix index 6a50c08..5c7d3f8 100644 --- a/nixos/workstation/home/shell/default.nix +++ b/nixos/workstation/home/shell/default.nix @@ -1,8 +1,10 @@ -{ config -, pkgs -, lib -, ... -}: { +{ + config, + pkgs, + lib, + ... +}: +{ imports = [ ./starship.nix ./alias.nix @@ -10,7 +12,9 @@ programs.direnv = { enable = true; enableZshIntegration = true; - nix-direnv = { enable = true; }; + nix-direnv = { + enable = true; + }; }; programs.zoxide = { diff --git a/nixos/workstation/home/shell/starship.nix b/nixos/workstation/home/shell/starship.nix index 59e2750..9517a3e 100644 --- a/nixos/workstation/home/shell/starship.nix +++ b/nixos/workstation/home/shell/starship.nix @@ -1,4 +1,5 @@ -{ ... }: { +{ ... }: +{ programs.starship = { enable = true; enableZshIntegration = true; @@ -31,8 +32,7 @@ }; memory_usage = { disabled = false; - format = - "[using ](green)$symbol[\${ram}](bold blue)[ = \${ram_pct} ](bold cyan)"; + format = "[using ](green)$symbol[\${ram}](bold blue)[ = \${ram_pct} ](bold cyan)"; threshold = -1; }; cmd_duration = { @@ -43,8 +43,12 @@ ssh_only = false; style = "bold yellow"; }; - gcloud = { disabled = true; }; - aws = { disabled = true; }; + gcloud = { + disabled = true; + }; + aws = { + disabled = true; + }; }; }; } diff --git a/nixos/workstation/home/tmux.nix b/nixos/workstation/home/tmux.nix index 7159907..a972f4c 100644 --- a/nixos/workstation/home/tmux.nix +++ b/nixos/workstation/home/tmux.nix @@ -1,7 +1,5 @@ -{ pkgs -, config -, ... -}: { +{ pkgs, config, ... }: +{ home.packages = [ pkgs.xsel ]; programs.tmux = { enable = true; @@ -19,9 +17,7 @@ set -g @minimal-tmux-indicator-str " 😊 " ''; } - { - plugin = pkgs.tmux-yank; - } + { plugin = pkgs.tmux-yank; } ]; extraConfig = '' set -g mouse diff --git a/nixos/workstation/home/vscode/default.nix b/nixos/workstation/home/vscode/default.nix index 7576bbf..9473541 100644 --- a/nixos/workstation/home/vscode/default.nix +++ b/nixos/workstation/home/vscode/default.nix @@ -1,16 +1,15 @@ -{ lib -, config -, pkgs -, ... +{ + lib, + config, + pkgs, + ... }: let fcitx-remote = "${pkgs.fcitx5}/bin/fcitx5-remote"; nvim = "${pkgs.neovim}/bin/nvim"; in { - home.packages = with pkgs; [ - nixpkgs-fmt - ]; + home.packages = with pkgs; [ nixfmt-rfc-style ]; home.sessionVariables = { EDITOR = "${pkgs.vscode-launcher} --wait"; @@ -26,7 +25,8 @@ in "password-store": "basic" } ''; - target = ".vscode" + target = + ".vscode" + (lib.optionalString (config.programs.vscode.package == pkgs.vscode-insiders) "-insiders") + "/argv.json"; }; @@ -45,33 +45,31 @@ in version = "34.3.1"; } ]; - extensions = pkgs.vscode-utils.extensionsFromVscodeMarketplace - (builtins.fromJSON ( + extensions = + pkgs.vscode-utils.extensionsFromVscodeMarketplace (builtins.fromJSON ( builtins.readFile ./extensions.json )).extensions - ++ (with pkgs.vscode-extensions; [ - eamodio.gitlens - rust-lang.rust-analyzer - ms-python.python - ms-vscode-remote.remote-ssh - redhat.vscode-yaml - hashicorp.terraform - matthewpi.caddyfile-support - ms-vscode.makefile-tools - ]); + ++ (with pkgs.vscode-extensions; [ + eamodio.gitlens + rust-lang.rust-analyzer + ms-python.python + ms-vscode-remote.remote-ssh + redhat.vscode-yaml + hashicorp.terraform + matthewpi.caddyfile-support + ms-vscode.makefile-tools + ]); keybindings = [ { command = "selectNextSuggestion"; key = "tab"; - when = - "editorTextFocus && suggestWidgetMultipleSuggestions && suggestWidgetVisible"; + when = "editorTextFocus && suggestWidgetMultipleSuggestions && suggestWidgetVisible"; } { command = "selectPrevSuggestion"; key = "shift+tab"; - when = - "editorTextFocus && suggestWidgetMultipleSuggestions && suggestWidgetVisible"; + when = "editorTextFocus && suggestWidgetMultipleSuggestions && suggestWidgetVisible"; } { key = "ctrl+j"; @@ -161,15 +159,25 @@ in commands = [ "redo" ]; } { - before = [ "g" "i" ]; + before = [ + "g" + "i" + ]; commands = [ "references-view.findImplementations" ]; } { - before = [ "g" "p" "i" ]; + before = [ + "g" + "p" + "i" + ]; commands = [ "editor.action.peekImplementation" ]; } { - before = [ "g" "r" ]; + before = [ + "g" + "r" + ]; commands = [ "references-view.findReferences" ]; } ]; @@ -202,17 +210,13 @@ in "[Material Theme Darker High Contrast]" = { "textMateRules" = [ { - "scope" = [ - "variable" - ]; + "scope" = [ "variable" ]; "settings" = { "foreground" = "${config.scheme.withHashtag.base0E}"; }; } { - "scope" = [ - "variable.parameter" - ]; + "scope" = [ "variable.parameter" ]; "settings" = { "foreground" = "${config.scheme.withHashtag.base0F}"; }; @@ -222,7 +226,7 @@ in }; "nix.enableLanguageServer" = true; - "nix.serverSettings.nil.formatting.command" = [ "nixpkgs-fmt" ]; + "nix.serverSettings.nil.formatting.command" = [ "nixfmt" ]; "nix.serverPath" = "${pkgs.nil}/bin/nil"; "redhat.telemetry.enabled" = false; "cmake.configureOnOpen" = true; diff --git a/nixos/workstation/network.nix b/nixos/workstation/network.nix index 7aec67f..a4ae69f 100644 --- a/nixos/workstation/network.nix +++ b/nixos/workstation/network.nix @@ -1,8 +1,10 @@ -{ lib -, config -, pkgs -, ... -}: { +{ + lib, + config, + pkgs, + ... +}: +{ networking = { nameservers = [ "119.29.29.29" diff --git a/nixos/workstation/o11y/default.nix b/nixos/workstation/o11y/default.nix index 3ac74c6..ec038d8 100644 --- a/nixos/workstation/o11y/default.nix +++ b/nixos/workstation/o11y/default.nix @@ -1,4 +1,5 @@ -{ ... }: { +{ ... }: +{ services.grafana = { enable = true; settings = { @@ -21,9 +22,7 @@ http_listen_port = 0; grpc_listen_port = 0; }; - clients = [{ - url = "http://127.0.0.1:3100/loki/api/v1/push"; - }]; + clients = [ { url = "http://127.0.0.1:3100/loki/api/v1/push"; } ]; scrape_configs = [ { job_name = "journal"; @@ -37,9 +36,7 @@ }; relabel_configs = [ { - source_labels = [ - "__journal__systemd_unit" - ]; + source_labels = [ "__journal__systemd_unit" ]; target_label = "unit"; } ]; diff --git a/nixos/workstation/users.nix b/nixos/workstation/users.nix index f4c9c74..1a8c3b0 100644 --- a/nixos/workstation/users.nix +++ b/nixos/workstation/users.nix @@ -1,6 +1,5 @@ -{ config -, ... -}: { +{ config, ... }: +{ users = { mutableUsers = false; users.${config.admin.name} = { @@ -9,25 +8,22 @@ isNormalUser = true; inherit (config.admin) home; description = config.admin.name; - extraGroups = - [ - "audio" - "input" - "storage" - "video" - "wheel" + extraGroups = [ + "audio" + "input" + "storage" + "video" + "wheel" - "adbusers" - "docker" - "libvirtd" - "networkmanager" - "tor" - "wireshark" - ]; - - openssh.authorizedKeys.keys = [ - config.admin.sshPubKey + "adbusers" + "docker" + "libvirtd" + "networkmanager" + "tor" + "wireshark" ]; + + openssh.authorizedKeys.keys = [ config.admin.sshPubKey ]; }; }; } diff --git a/packages/base16-rofi/default.nix b/packages/base16-rofi/default.nix index 1081648..23725f9 100644 --- a/packages/base16-rofi/default.nix +++ b/packages/base16-rofi/default.nix @@ -1,7 +1,4 @@ -{ pkgs -, stdenv -, ... -}: +{ pkgs, stdenv, ... }: stdenv.mkDerivation { name = "base16-rofi"; src = pkgs.fetchFromGitHub { diff --git a/packages/chinadns/default.nix b/packages/chinadns/default.nix index b92c36c..2840d90 100644 --- a/packages/chinadns/default.nix +++ b/packages/chinadns/default.nix @@ -1,5 +1,4 @@ -{ buildGoModule -}: +{ buildGoModule }: buildGoModule { pname = "chinadns"; diff --git a/packages/default.nix b/packages/default.nix index 51d5612..42f4405 100644 --- a/packages/default.nix +++ b/packages/default.nix @@ -4,108 +4,118 @@ let "yesplaymusic" ]; branchOverlay = - { branch - , system - , config - , packages - , ... + { + branch, + system, + config, + packages, + ... }: let - pkgs = import branch { - inherit system config; - }; + pkgs = import branch { inherit system config; }; in - final: prev: builtins.foldl' - (overlay: package: overlay // { - ${package} = pkgs.${package}; - }) - { } - packages; - packageDirs = with builtins; - filter (k: k != null) - (attrValues - (mapAttrs (k: v: if v == "directory" && !(builtins.any (d: k == d) ignoredDirs) then k else null) - (readDir ./.))); - mkPackages = callPackage: - builtins.foldl' - (pkgs: pkgDir: pkgs // { + final: prev: + builtins.foldl' (overlay: package: overlay // { ${package} = pkgs.${package}; }) { } packages; + packageDirs = + with builtins; + filter (k: k != null) ( + attrValues ( + mapAttrs ( + k: v: if v == "directory" && !(builtins.any (d: k == d) ignoredDirs) then k else null + ) (readDir ./.) + ) + ); + mkPackages = + callPackage: + builtins.foldl' ( + pkgs: pkgDir: + pkgs + // { ${pkgDir} = callPackage (./. + "/${pkgDir}") { }; - }) - { } - packageDirs; + } + ) { } packageDirs; in rec { inherit branchOverlay; packages = pkgs: mkPackages pkgs.callPackage; - overlay = final: prev: (packages prev) // { - lib = prev.lib // (import ./lib { pkgs = prev; }); - } // { - # override attributes - graphite-gtk-theme = prev.graphite-gtk-theme.overrideAttrs (_: { - version = "unstable-2023-03-31"; - src = prev.fetchFromGitHub { - owner = "vinceliuice"; - repo = "Graphite-gtk-theme"; - rev = "54b3cf69ceb4ca204d38dda9d19f4f1bdbcf5739"; - sha256 = "1h090lish16l36pabwkfnd469dp0pmlp6j1qy9ww21mg3rfrnmqz"; - }; - }); + overlay = + final: prev: + (packages prev) + // { + lib = prev.lib // (import ./lib { pkgs = prev; }); + } + // { + # override attributes + graphite-gtk-theme = prev.graphite-gtk-theme.overrideAttrs (_: { + version = "unstable-2023-03-31"; + src = prev.fetchFromGitHub { + owner = "vinceliuice"; + repo = "Graphite-gtk-theme"; + rev = "54b3cf69ceb4ca204d38dda9d19f4f1bdbcf5739"; + sha256 = "1h090lish16l36pabwkfnd469dp0pmlp6j1qy9ww21mg3rfrnmqz"; + }; + }); - fluent-gtk-theme = prev.fluent-gtk-theme.overrideAttrs (_: { - version = "unstable-2023-12-12"; - src = prev.fetchFromGitHub { - owner = "vinceliuice"; - repo = "Fluent-gtk-theme"; - rev = "53d44a2cd1869df84b59e92f244cd922a16c4017"; - sha256 = "0addy0nhyjflvrnwwi0df6k44p09x27nsd66g4yla395x5g82zrp"; - }; - }); + fluent-gtk-theme = prev.fluent-gtk-theme.overrideAttrs (_: { + version = "unstable-2023-12-12"; + src = prev.fetchFromGitHub { + owner = "vinceliuice"; + repo = "Fluent-gtk-theme"; + rev = "53d44a2cd1869df84b59e92f244cd922a16c4017"; + sha256 = "0addy0nhyjflvrnwwi0df6k44p09x27nsd66g4yla395x5g82zrp"; + }; + }); - colloid-gtk-theme = prev.colloid-gtk-theme.overrideAttrs (_: { - src = prev.fetchFromGitHub { - owner = "vinceliuice"; - repo = "Colloid-gtk-theme"; - rev = "6cba9239b8d04e82171899211fb6df2455d6a89d"; - sha256 = "16wzhracfxn7cjzyz8dalrr6rd53wxvh1lcxcc13ssn02v7202z3"; - }; - }); + colloid-gtk-theme = prev.colloid-gtk-theme.overrideAttrs (_: { + src = prev.fetchFromGitHub { + owner = "vinceliuice"; + repo = "Colloid-gtk-theme"; + rev = "6cba9239b8d04e82171899211fb6df2455d6a89d"; + sha256 = "16wzhracfxn7cjzyz8dalrr6rd53wxvh1lcxcc13ssn02v7202z3"; + }; + }); - # feishu = prev.feishu.overrideAttrs (_: rec { - # version = "7.11.9"; - # packageHash = "ec62a2df"; - # src = builtins.fetchurl { - # url = "https://sf3-cn.feishucdn.com/obj/ee-appcenter/${packageHash}/Feishu-linux_x64-${version}.deb"; - # sha256 = "1c4ggcq10knb1gac6rmlb5mdxlz1xrz6i735mfqinvr7qfrqzi4q"; - # }; - # }); + # feishu = prev.feishu.overrideAttrs (_: rec { + # version = "7.11.9"; + # packageHash = "ec62a2df"; + # src = builtins.fetchurl { + # url = "https://sf3-cn.feishucdn.com/obj/ee-appcenter/${packageHash}/Feishu-linux_x64-${version}.deb"; + # sha256 = "1c4ggcq10knb1gac6rmlb5mdxlz1xrz6i735mfqinvr7qfrqzi4q"; + # }; + # }); - vistafonts-chs = prev.vistafonts-chs.overrideAttrs (_: { - src = builtins.fetchurl { - url = "https://github.com/iosmanthus/nowhere/releases/download/v0.1.0/VistaFont_CHS.EXE"; - sha256 = "1qwm30b8aq9piyqv07hv8b5bac9ms40rsdf8pwix5dyk8020i8xi"; + vistafonts-chs = prev.vistafonts-chs.overrideAttrs (_: { + src = builtins.fetchurl { + url = "https://github.com/iosmanthus/nowhere/releases/download/v0.1.0/VistaFont_CHS.EXE"; + sha256 = "1qwm30b8aq9piyqv07hv8b5bac9ms40rsdf8pwix5dyk8020i8xi"; + }; + }); + + caddy = prev.callPackage "${prev.path}/pkgs/by-name/ca/caddy/package.nix" { + buildGoModule = + args: + prev.buildGoModule ( + args + // { + version = "unstable-2024-06-05"; + src = prev.fetchFromGitHub { + owner = "iosmanthus"; + repo = "caddy"; + rev = "2c658e7715257b793acd9552518c38badf40a34a"; + hash = "sha256-nPUv7ZHwrLxHstzS1L3Os0AY//7CJvv1IQ2Hi7QmC30="; + }; + vendorHash = "sha256-/Vj8Yn34c81W1KZoCogfG3Z3fzmJnjvubxq3nIqHxm4="; + } + ); }; - }); - caddy = prev.callPackage "${prev.path}/pkgs/by-name/ca/caddy/package.nix" { - buildGoModule = args: prev.buildGoModule (args // { - version = "unstable-2024-06-05"; - src = prev.fetchFromGitHub { - owner = "iosmanthus"; - repo = "caddy"; - rev = "2c658e7715257b793acd9552518c38badf40a34a"; - hash = "sha256-nPUv7ZHwrLxHstzS1L3Os0AY//7CJvv1IQ2Hi7QmC30="; - }; - vendorHash = "sha256-/Vj8Yn34c81W1KZoCogfG3Z3fzmJnjvubxq3nIqHxm4="; + fail2ban = prev.fail2ban.overrideAttrs (_: { + patches = [ + (prev.fetchpatch { + url = "https://github.com/fail2ban/fail2ban/commit/2fed408c05ac5206b490368d94599869bd6a056d.patch"; + sha256 = "sha256-uyrCdcBm0QyA97IpHzuGfiQbSSvhGH6YaQluG5jVIiI="; + }) + ]; }); }; - - fail2ban = prev.fail2ban.overrideAttrs (_: { - patches = [ - (prev.fetchpatch { - url = "https://github.com/fail2ban/fail2ban/commit/2fed408c05ac5206b490368d94599869bd6a056d.patch"; - sha256 = "sha256-uyrCdcBm0QyA97IpHzuGfiQbSSvhGH6YaQluG5jVIiI="; - }) - ]; - }); - }; } diff --git a/packages/fcitx5-adwaita-dark/default.nix b/packages/fcitx5-adwaita-dark/default.nix index b43f205..9a50eef 100644 --- a/packages/fcitx5-adwaita-dark/default.nix +++ b/packages/fcitx5-adwaita-dark/default.nix @@ -1,7 +1,4 @@ -{ fetchFromGitHub -, stdenv -, ... -}: +{ fetchFromGitHub, stdenv, ... }: let name = "fcitx5-adwaita-dark"; diff --git a/packages/fcitx5-material-color/default.nix b/packages/fcitx5-material-color/default.nix index 034f200..3aaf74a 100644 --- a/packages/fcitx5-material-color/default.nix +++ b/packages/fcitx5-material-color/default.nix @@ -1,6 +1,7 @@ -{ pkgs -, themeVariant ? "black" -, ... +{ + pkgs, + themeVariant ? "black", + ... }: let diff --git a/packages/follow/default.nix b/packages/follow/default.nix index da460c9..dbedf89 100644 --- a/packages/follow/default.nix +++ b/packages/follow/default.nix @@ -1,13 +1,13 @@ -{ lib -, stdenvNoCC -, fetchurl -, appimageTools -, makeWrapper -, writeShellApplication -, curl -, yq -, common-updater-scripts -, +{ + lib, + stdenvNoCC, + fetchurl, + appimageTools, + makeWrapper, + writeShellApplication, + curl, + yq, + common-updater-scripts, }: let pname = "follow"; diff --git a/packages/gemini-openai-proxy/default.nix b/packages/gemini-openai-proxy/default.nix index 704c485..1b0faf2 100644 --- a/packages/gemini-openai-proxy/default.nix +++ b/packages/gemini-openai-proxy/default.nix @@ -1,6 +1,4 @@ -{ buildGoModule -, fetchFromGitHub -}: +{ buildGoModule, fetchFromGitHub }: buildGoModule { pname = "gemini-openai-proxy"; diff --git a/packages/jetbrains-nerd-font/default.nix b/packages/jetbrains-nerd-font/default.nix index 2419d01..97cd8d8 100644 --- a/packages/jetbrains-nerd-font/default.nix +++ b/packages/jetbrains-nerd-font/default.nix @@ -1,6 +1,4 @@ -{ stdenvNoCC -, fetchFromGitHub -}: +{ stdenvNoCC, fetchFromGitHub }: stdenvNoCC.mkDerivation { pname = "jetbrains-nerd-font"; diff --git a/packages/kitty-themes/default.nix b/packages/kitty-themes/default.nix index 8fdc8c3..ad33601 100644 --- a/packages/kitty-themes/default.nix +++ b/packages/kitty-themes/default.nix @@ -1,7 +1,8 @@ -{ stdenv -, fetchFromGitHub -, pkgs -, ... +{ + stdenv, + fetchFromGitHub, + pkgs, + ... }: stdenv.mkDerivation { pname = "kitty-themes"; @@ -9,22 +10,18 @@ stdenv.mkDerivation { version = "unstable-2022-07-02"; srcs = [ - ( - fetchFromGitHub { - owner = "kdrag0n"; - repo = "base16-kitty"; - rev = "fe5862cec41bfd0b46a1ac3d7565a50680051226"; - sha256 = "096sa969z9v9w3ggsqd4d7gmqh52aavkmjhbz4zb35wq7fg5g5zs"; - } - ) - ( - fetchFromGitHub { - repo = "gruvbox-material-kitty"; - owner = "iosmanthus"; - rev = "1dc12befe1022226a0e618e36cb26e58b3d248bb"; - sha256 = "0d7cl49z74l7v04sfwlpv76ihvckqn21v4i60hcv93x67x6xqaz5"; - } - ) + (fetchFromGitHub { + owner = "kdrag0n"; + repo = "base16-kitty"; + rev = "fe5862cec41bfd0b46a1ac3d7565a50680051226"; + sha256 = "096sa969z9v9w3ggsqd4d7gmqh52aavkmjhbz4zb35wq7fg5g5zs"; + }) + (fetchFromGitHub { + repo = "gruvbox-material-kitty"; + owner = "iosmanthus"; + rev = "1dc12befe1022226a0e618e36cb26e58b3d248bb"; + sha256 = "0d7cl49z74l7v04sfwlpv76ihvckqn21v4i60hcv93x67x6xqaz5"; + }) ]; passthru = { diff --git a/packages/leaf/default.nix b/packages/leaf/default.nix index d239417..4fbf192 100644 --- a/packages/leaf/default.nix +++ b/packages/leaf/default.nix @@ -1,6 +1,7 @@ -{ lib -, fetchFromGitHub -, rustPlatform +{ + lib, + fetchFromGitHub, + rustPlatform, }: with lib; rustPlatform.buildRustPackage { diff --git a/packages/lib/default.nix b/packages/lib/default.nix index fe56910..1ba16c7 100644 --- a/packages/lib/default.nix +++ b/packages/lib/default.nix @@ -1,5 +1,4 @@ -{ pkgs -, ... -}: { +{ pkgs, ... }: +{ mkNixBackground = pkgs.callPackage ./nix-background.nix { }; } diff --git a/packages/lib/nix-background.nix b/packages/lib/nix-background.nix index 92edd07..ca986d9 100644 --- a/packages/lib/nix-background.nix +++ b/packages/lib/nix-background.nix @@ -1,12 +1,10 @@ -{ stdenv -, lib -, ... -}: +{ stdenv, lib, ... }: let mkNixBackground = - { name - , src - , description + { + name, + src, + description, }: let pkg = stdenv.mkDerivation { @@ -62,6 +60,6 @@ let }; in pkg; -in +in mkNixBackground diff --git a/packages/logseq/default.nix b/packages/logseq/default.nix index a90eb94..7a51a81 100644 --- a/packages/logseq/default.nix +++ b/packages/logseq/default.nix @@ -1,6 +1,4 @@ -{ pkgs -, ... -}: +{ pkgs, ... }: with pkgs; let pname = "logseq"; diff --git a/packages/minimal-tmux-status/default.nix b/packages/minimal-tmux-status/default.nix index 225872c..5b8b08b 100644 --- a/packages/minimal-tmux-status/default.nix +++ b/packages/minimal-tmux-status/default.nix @@ -1,7 +1,4 @@ -{ fetchFromGitHub -, tmuxPlugins -, ... -}: +{ fetchFromGitHub, tmuxPlugins, ... }: tmuxPlugins.mkTmuxPlugin { pluginName = "minimal-tmux-status"; diff --git a/packages/monaspace/default.nix b/packages/monaspace/default.nix index 8fc9200..ee71ede 100644 --- a/packages/monaspace/default.nix +++ b/packages/monaspace/default.nix @@ -1,7 +1,4 @@ -{ stdenv -, fetchFromGitHub -, ... -}: +{ stdenv, fetchFromGitHub, ... }: let pname = "monaspace"; version = "v1.000"; @@ -12,8 +9,7 @@ let sha256 = "02x50kybw3b2g12x06rl9p3sqmhfbkz5hp0b35q0qbr88jppm3k6"; }; in -stdenv.mkDerivation -{ +stdenv.mkDerivation { inherit pname version src; installPhase = '' mkdir -p $out/share/fonts/${pname} diff --git a/packages/r3playx/default.nix b/packages/r3playx/default.nix index 744b662..bc81523 100644 --- a/packages/r3playx/default.nix +++ b/packages/r3playx/default.nix @@ -1,7 +1,4 @@ -{ pkgs -, lib -, ... -}: +{ pkgs, lib, ... }: with pkgs; let pname = "r3playx"; @@ -23,7 +20,10 @@ let name = "R3PLAYX"; desktopName = name; exec = "r3playx"; - categories = [ "Audio" "Player" ]; + categories = [ + "Audio" + "Player" + ]; terminal = false; icon = "${extracted}/desktop.png"; comment = "R3PLAYX Launcher"; diff --git a/packages/rime-data-cantonia/default.nix b/packages/rime-data-cantonia/default.nix index 516e484..d02663a 100644 --- a/packages/rime-data-cantonia/default.nix +++ b/packages/rime-data-cantonia/default.nix @@ -1,6 +1,4 @@ -{ stdenv -, ... -}: +{ stdenv, ... }: stdenv.mkDerivation { pname = "rime-data-cantonia"; diff --git a/packages/sing-box/default.nix b/packages/sing-box/default.nix index 0b6975c..cb07466 100644 --- a/packages/sing-box/default.nix +++ b/packages/sing-box/default.nix @@ -1,10 +1,11 @@ -{ lib -, stdenv -, buildGoModule -, fetchFromGitHub -, installShellFiles -, buildPackages -, nix-update-script +{ + lib, + stdenv, + buildGoModule, + fetchFromGitHub, + installShellFiles, + buildPackages, + nix-update-script, }: buildGoModule rec { @@ -38,26 +39,26 @@ buildGoModule rec { "with_gvisor" ]; - subPackages = [ - "cmd/sing-box" - ]; + subPackages = [ "cmd/sing-box" ]; nativeBuildInputs = [ installShellFiles ]; - ldflags = [ - "-X=github.com/sagernet/sing-box/constant.Version=${version}" - ]; + ldflags = [ "-X=github.com/sagernet/sing-box/constant.Version=${version}" ]; - postInstall = let emulator = stdenv.hostPlatform.emulator buildPackages; in '' - installShellCompletion --cmd sing-box \ - --bash <(${emulator} $out/bin/sing-box completion bash) \ - --fish <(${emulator} $out/bin/sing-box completion fish) \ - --zsh <(${emulator} $out/bin/sing-box completion zsh ) - ''; + postInstall = + let + emulator = stdenv.hostPlatform.emulator buildPackages; + in + '' + installShellCompletion --cmd sing-box \ + --bash <(${emulator} $out/bin/sing-box completion bash) \ + --fish <(${emulator} $out/bin/sing-box completion fish) \ + --zsh <(${emulator} $out/bin/sing-box completion zsh ) + ''; passthru.updateScript = nix-update-script { }; - meta = with lib;{ + meta = with lib; { homepage = "https://sing-box.sagernet.org"; description = "The universal proxy platform"; license = licenses.gpl3Plus; diff --git a/packages/subgen/default.nix b/packages/subgen/default.nix index 8db9a65..5789010 100644 --- a/packages/subgen/default.nix +++ b/packages/subgen/default.nix @@ -1,5 +1,4 @@ -{ buildGoModule -}: +{ buildGoModule }: buildGoModule { pname = "subgen"; diff --git a/packages/tmux-yank/default.nix b/packages/tmux-yank/default.nix index fb96b50..cbaa282 100644 --- a/packages/tmux-yank/default.nix +++ b/packages/tmux-yank/default.nix @@ -1,7 +1,4 @@ -{ fetchFromGitHub -, tmuxPlugins -, ... -}: +{ fetchFromGitHub, tmuxPlugins, ... }: tmuxPlugins.mkTmuxPlugin { pluginName = "tmux-yank"; version = "unstable-2021-06-20"; diff --git a/packages/unguarded/default.nix b/packages/unguarded/default.nix index 805f953..9479837 100644 --- a/packages/unguarded/default.nix +++ b/packages/unguarded/default.nix @@ -1,5 +1,4 @@ -{ buildGoModule -}: +{ buildGoModule }: buildGoModule { pname = "unguarded"; diff --git a/packages/vscode-launcher/default.nix b/packages/vscode-launcher/default.nix index d194aea..1243d4b 100644 --- a/packages/vscode-launcher/default.nix +++ b/packages/vscode-launcher/default.nix @@ -1,8 +1,5 @@ { pkgs, ... }: -(pkgs.writers.writePython3 "run_vscode" -{ - libraries = [ ]; -} '' +(pkgs.writers.writePython3 "run_vscode" { libraries = [ ]; } '' import shutil import subprocess import sys diff --git a/packages/warp-terminal/default.nix b/packages/warp-terminal/default.nix index 82cadc0..51c8422 100644 --- a/packages/warp-terminal/default.nix +++ b/packages/warp-terminal/default.nix @@ -1,19 +1,20 @@ -{ lib -, stdenvNoCC -, stdenv -, fetchurl -, undmg -, appimageTools -, zstd -, autoPatchelfHook -, curl -, fontconfig -, xorg -, libxkbcommon -, xdg-utils -, zlib -, libglvnd -, vulkan-loader +{ + lib, + stdenvNoCC, + stdenv, + fetchurl, + undmg, + appimageTools, + zstd, + autoPatchelfHook, + curl, + fontconfig, + xorg, + libxkbcommon, + xdg-utils, + zlib, + libglvnd, + vulkan-loader, }: let @@ -28,7 +29,10 @@ let hash = "sha256-u3VZ2l2ec8UHzt4tOJgnn98HiASSWJAQwBRdoaR/aO4="; }; - nativeBuildInputs = [ autoPatchelfHook zstd ]; + nativeBuildInputs = [ + autoPatchelfHook + zstd + ]; buildInputs = [ curl @@ -90,11 +94,12 @@ let homepage = "https://www.warp.dev"; license = licenses.unfree; sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; - maintainers = with maintainers; [ emilytrau Enzime ]; + maintainers = with maintainers; [ + emilytrau + Enzime + ]; platforms = platforms.darwin ++ [ "x86_64-linux" ]; }; in -if stdenvNoCC.isDarwin -then darwin -else linux +if stdenvNoCC.isDarwin then darwin else linux diff --git a/packages/yesplaymusic/default.nix b/packages/yesplaymusic/default.nix index c2276cf..374adf3 100644 --- a/packages/yesplaymusic/default.nix +++ b/packages/yesplaymusic/default.nix @@ -1,7 +1,4 @@ -{ pkgs -, lib -, ... -}: +{ pkgs, lib, ... }: with pkgs; let pname = "yesplaymusic"; @@ -22,7 +19,10 @@ let name = "YesPlayMusic"; desktopName = name; exec = "yesplaymusic"; - categories = [ "Audio" "Player" ]; + categories = [ + "Audio" + "Player" + ]; terminal = false; icon = "${extracted}/yesplaymusic.png"; comment = "YesPlayMusic Launcher"; diff --git a/secrets/aws-lightsail-0/default.nix b/secrets/aws-lightsail-0/default.nix index 2c664c4..762bd27 100644 --- a/secrets/aws-lightsail-0/default.nix +++ b/secrets/aws-lightsail-0/default.nix @@ -1,4 +1,5 @@ -{ ... }: { +{ ... }: +{ sops = { defaultSopsFile = ./secrets.yaml; secrets = { diff --git a/secrets/cloud/cloudflare/default.nix b/secrets/cloud/cloudflare/default.nix index 59b2653..ba7879b 100644 --- a/secrets/cloud/cloudflare/default.nix +++ b/secrets/cloud/cloudflare/default.nix @@ -5,7 +5,9 @@ in { sops = { secrets = { - "cloudflare/api-token" = { inherit sopsFile; }; + "cloudflare/api-token" = { + inherit sopsFile; + }; }; }; } diff --git a/secrets/cloud/endpoints/default.nix b/secrets/cloud/endpoints/default.nix index b99974d..95de6fe 100644 --- a/secrets/cloud/endpoints/default.nix +++ b/secrets/cloud/endpoints/default.nix @@ -5,9 +5,15 @@ in { sops = { secrets = { - "aws-lightsail-0/external-address-v4" = { inherit sopsFile; }; - "gcp-instance-0/external-address-v4" = { inherit sopsFile; }; - "gcp-instance-1/external-address-v4" = { inherit sopsFile; }; + "aws-lightsail-0/external-address-v4" = { + inherit sopsFile; + }; + "gcp-instance-0/external-address-v4" = { + inherit sopsFile; + }; + "gcp-instance-1/external-address-v4" = { + inherit sopsFile; + }; }; }; } diff --git a/secrets/cloud/grafana/default.nix b/secrets/cloud/grafana/default.nix index 42fe8d3..1b0ce7f 100644 --- a/secrets/cloud/grafana/default.nix +++ b/secrets/cloud/grafana/default.nix @@ -5,8 +5,12 @@ in { sops = { secrets = { - "grafana/promtail-basic-auth" = { inherit sopsFile; }; - "grafana/prometheus-basic-auth" = { inherit sopsFile; }; + "grafana/promtail-basic-auth" = { + inherit sopsFile; + }; + "grafana/prometheus-basic-auth" = { + inherit sopsFile; + }; }; }; } diff --git a/secrets/cloud/sing-box/default.nix b/secrets/cloud/sing-box/default.nix index 0706276..275e398 100644 --- a/secrets/cloud/sing-box/default.nix +++ b/secrets/cloud/sing-box/default.nix @@ -6,14 +6,28 @@ in { sops = { secrets = { - "sing-box/shadowtls/username" = { inherit sopsFile format; }; - "sing-box/shadowtls/password" = { inherit sopsFile format; }; - "sing-box/shadowtls/server-name" = { inherit sopsFile format; }; + "sing-box/shadowtls/username" = { + inherit sopsFile format; + }; + "sing-box/shadowtls/password" = { + inherit sopsFile format; + }; + "sing-box/shadowtls/server-name" = { + inherit sopsFile format; + }; - "sing-box/shadowsocks/users" = { inherit sopsFile format; }; - "sing-box/shadowsocks/method" = { inherit sopsFile format; }; - "sing-box/shadowsocks/server-password" = { inherit sopsFile format; }; - "sing-box/shadowsocks/default-user" = { inherit sopsFile format; }; + "sing-box/shadowsocks/users" = { + inherit sopsFile format; + }; + "sing-box/shadowsocks/method" = { + inherit sopsFile format; + }; + "sing-box/shadowsocks/server-password" = { + inherit sopsFile format; + }; + "sing-box/shadowsocks/default-user" = { + inherit sopsFile format; + }; }; }; } diff --git a/secrets/cloud/subgen/default.nix b/secrets/cloud/subgen/default.nix index ca5000c..fdcaefd 100644 --- a/secrets/cloud/subgen/default.nix +++ b/secrets/cloud/subgen/default.nix @@ -5,7 +5,11 @@ let in { sops.secrets = { - "subgen/relay-subscription-url" = { inherit sopsFile format; }; - "subgen/users" = { inherit sopsFile format; }; + "subgen/relay-subscription-url" = { + inherit sopsFile format; + }; + "subgen/users" = { + inherit sopsFile format; + }; }; } diff --git a/secrets/gcp-instance-0/default.nix b/secrets/gcp-instance-0/default.nix index 96c38ea..d75d865 100644 --- a/secrets/gcp-instance-0/default.nix +++ b/secrets/gcp-instance-0/default.nix @@ -1,4 +1,5 @@ -{ ... }: { +{ ... }: +{ sops = { defaultSopsFile = ./secrets.yaml; secrets = { diff --git a/secrets/gcp-instance-1/default.nix b/secrets/gcp-instance-1/default.nix index c618592..c14323b 100644 --- a/secrets/gcp-instance-1/default.nix +++ b/secrets/gcp-instance-1/default.nix @@ -1,4 +1,5 @@ -{ ... }: { +{ ... }: +{ sops = { defaultSopsFile = ./secrets.yaml; secrets = { diff --git a/secrets/gcp-instance-2/default.nix b/secrets/gcp-instance-2/default.nix index c618592..c14323b 100644 --- a/secrets/gcp-instance-2/default.nix +++ b/secrets/gcp-instance-2/default.nix @@ -1,4 +1,5 @@ -{ ... }: { +{ ... }: +{ sops = { defaultSopsFile = ./secrets.yaml; secrets = { diff --git a/secrets/iosmanthus/default.nix b/secrets/iosmanthus/default.nix index 8c2873e..28414ca 100644 --- a/secrets/iosmanthus/default.nix +++ b/secrets/iosmanthus/default.nix @@ -1,6 +1,4 @@ -{ config -, ... -}: +{ config, ... }: let inherit (config.admin) home; in diff --git a/secrets/workstation/default.nix b/secrets/workstation/default.nix index 4b113fc..a6ed0dd 100644 --- a/secrets/workstation/default.nix +++ b/secrets/workstation/default.nix @@ -1,6 +1,4 @@ -{ config -, ... -}: +{ config, ... }: { sops = { defaultSopsFile = ./secrets.yaml; diff --git a/secrets/workstation/update.py b/secrets/workstation/update.py index 1423bd3..fe59d45 100755 --- a/secrets/workstation/update.py +++ b/secrets/workstation/update.py @@ -26,7 +26,7 @@ def override(resp): cfg = json.loads(resp) dns_rules = cfg['dns']['rules'] dns_rules.insert(3, { - 'domain_keyword': [ 'aws', 'pingcap', 'tidb', 'clinic' ], + 'domain_keyword': ['aws', 'pingcap', 'tidb', 'clinic'], 'server': 'secure' }) # tun = cfg['inbounds'][0]