diff --git a/flake.nix b/flake.nix index fca1629..006d52d 100644 --- a/flake.nix +++ b/flake.nix @@ -254,22 +254,24 @@ }; }; - nixOnDroidConfigurations.default = let - pkgs = mkPkgs { system = arm; }; - in nix-on-droid.lib.nixOnDroidConfiguration { - modules = [ - ./common - ./nix-on-droid - ]; - extraSpecialArgs = { - inputs = mkInputs { }; - inherit (inputs) dns; - inherit vacuModules; - vaculib = import ./vaculib { inherit pkgs; }; - vacuModuleType = "nix-on-droid"; + nixOnDroidConfigurations.default = + let + pkgs = mkPkgs { system = arm; }; + in + nix-on-droid.lib.nixOnDroidConfiguration { + modules = [ + ./common + ./nix-on-droid + ]; + extraSpecialArgs = { + inputs = mkInputs { }; + inherit (inputs) dns; + inherit vacuModules; + vaculib = import ./vaculib { inherit pkgs; }; + vacuModuleType = "nix-on-droid"; + }; + inherit pkgs; }; - inherit pkgs; - }; checks = nixpkgs.lib.genAttrs [ x86 ] ( system: diff --git a/liam/sieve.nix b/liam/sieve.nix index 1c8a068..46a9a8a 100644 --- a/liam/sieve.nix +++ b/liam/sieve.nix @@ -797,19 +797,28 @@ let ${pure_flags [ "genshin" "D" ] (envelope_is "genshin@shelvacu.com")} ${pure_flags [ "jork" "B" ] (envelope_is "jork@shelvacu.com")} ${pure_flags [ "patreon" "not-spamish" ] (envelope_is "patreon@shelvacu.com")} - ${pure_flags [ "patreon-post" "B.subscriptions" ] [ - (has_flag "patreon") - (header_is "X-Mailgun-Tag" "template_newsletterpostcontrol") - ]} - ${pure_flags [ "patreon-free-member-digest" "D" ] [ - (has_flag "patreon") - (header_is "X-Mailgun-Tag" "template_freememberdigest") - ]} - ${pure_flags [ "patreon-other" "B" ] [ - (has_flag "patreon") - (not (has_flag "patreon-post")) - (not (has_flag "patreon-free-member-digest")) - ]} + ${pure_flags + [ "patreon-post" "B.subscriptions" ] + [ + (has_flag "patreon") + (header_is "X-Mailgun-Tag" "template_newsletterpostcontrol") + ] + } + ${pure_flags + [ "patreon-free-member-digest" "D" ] + [ + (has_flag "patreon") + (header_is "X-Mailgun-Tag" "template_freememberdigest") + ] + } + ${pure_flags + [ "patreon-other" "B" ] + [ + (has_flag "patreon") + (not (has_flag "patreon-post")) + (not (has_flag "patreon-free-member-digest")) + ] + } ${pure_flags [ "rsb" "B" ] (from_is "support@rapidseedbox.com")} ${pure_flags [ "fresh-avocado-dis8" "D" ] (envelope_is "fresh.avocado@dis8.net")} ${pure_flags [ "discord" "A" ] (envelope_matches "discord@*")} diff --git a/modules/git/module.nix b/modules/git/module.nix index 02adc47..47cecbb 100644 --- a/modules/git/module.nix +++ b/modules/git/module.nix @@ -81,13 +81,19 @@ in enable = true; package = cfg.lfs.package; }; - vacu.git.config = lib.mkIf cfg.lfs.enable (let bin = lib.getExe cfg.lfs.package; in { - filter.lfs = { - clean = "${bin} clean -- %f"; - smudge = "${bin} smudge -- %f"; - process = "${bin} filter-process"; - required = true; - }; - }); + vacu.git.config = lib.mkIf cfg.lfs.enable ( + let + bin = lib.getExe cfg.lfs.package; + in + { + filter.lfs = { + clean = "${bin} clean -- %f"; + smudge = "${bin} smudge -- %f"; + process = "${bin} filter-process"; + required = true; + }; + } + ); }; -} // lib.optionalAttrs (vacuModuleType == "nixos") { _class = "nixos"; } +} +// lib.optionalAttrs (vacuModuleType == "nixos") { _class = "nixos"; } diff --git a/modules/hath/module.nix b/modules/hath/module.nix index c707365..6dc50e2 100644 --- a/modules/hath/module.nix +++ b/modules/hath/module.nix @@ -74,7 +74,7 @@ in }; extraArgs = mkOption { type = types.listOf types.str; - default = []; + default = [ ]; }; bandwidthMonitor = mkOption { diff --git a/modules/knownHosts/module.nix b/modules/knownHosts/module.nix index d39a190..d4f56ce 100644 --- a/modules/knownHosts/module.nix +++ b/modules/knownHosts/module.nix @@ -80,4 +80,5 @@ in // lib.optionalAttrs (vacuModuleType == "nix-on-droid") { environment.etc.hosts.text = config.vacu.etcHostsText; }; -} // lib.optionalAttrs (vacuModuleType == "nixos") { _class = "nixos"; } +} +// lib.optionalAttrs (vacuModuleType == "nixos") { _class = "nixos"; } diff --git a/modules/packageSet/module.nix b/modules/packageSet/module.nix index c3c7801..0231f1e 100644 --- a/modules/packageSet/module.nix +++ b/modules/packageSet/module.nix @@ -111,4 +111,5 @@ in // lib.optionalAttrs (vacuModuleType == "nix-on-droid") { environment.packages = config.vacu.finalPackageList; }; -} // lib.optionalAttrs (vacuModuleType == "nixos") { _class = "nixos"; } +} +// lib.optionalAttrs (vacuModuleType == "nixos") { _class = "nixos"; } diff --git a/modules/ssh/module.nix b/modules/ssh/module.nix index 08698aa..06a620b 100644 --- a/modules/ssh/module.nix +++ b/modules/ssh/module.nix @@ -91,4 +91,5 @@ in // lib.optionalAttrs (vacuModuleType == "nix-on-droid") { environment.etc."ssh/ssh_config".text = config.vacu.ssh.config; }; -} // lib.optionalAttrs (vacuModuleType == "nixos") { _class = "nixos"; } +} +// lib.optionalAttrs (vacuModuleType == "nixos") { _class = "nixos"; } diff --git a/modules/tf2/module.nix b/modules/tf2/module.nix index 741893e..e600daf 100644 --- a/modules/tf2/module.nix +++ b/modules/tf2/module.nix @@ -464,7 +464,8 @@ in default = pkgs.writeFile "autoexec.cfg" cfg.autoexecLines; readOnly = true; }; - build.classes = mkAttrsOfClasses (classname: + build.classes = mkAttrsOfClasses ( + classname: mkOption { type = types.pkg; default = pkgs.writeText "${classname}.cfg" cfg.classLines.${classname}; diff --git a/nur.nix b/nur.nix index 8863300..f350304 100644 --- a/nur.nix +++ b/nur.nix @@ -3,6 +3,8 @@ let inherit (pkgs) lib; packagePaths = import ./packages; - shelPackages = builtins.mapAttrs (_: path: lib.callPackageWith (pkgs // shelPackages) path { }) packagePaths; + shelPackages = builtins.mapAttrs ( + _: path: lib.callPackageWith (pkgs // shelPackages) path { } + ) packagePaths; in shelPackages diff --git a/packages/haproxy-lua-http/package.nix b/packages/haproxy-lua-http/package.nix index 59e1500..75c1f43 100644 --- a/packages/haproxy-lua-http/package.nix +++ b/packages/haproxy-lua-http/package.nix @@ -1,4 +1,4 @@ -{ +{ lib, fetchFromGitHub, stdenv, @@ -31,7 +31,7 @@ let license = [ lib.licenses.asl20 ]; sourceProvenance = [ lib.sourceTypes.fromSource ]; # no mainProgram - platforms = lib.platforms.all; + platforms = lib.platforms.all; }; }) // { diff --git a/packages/shellvaculib/package.nix b/packages/shellvaculib/package.nix index 0967aca..fb85cb0 100644 --- a/packages/shellvaculib/package.nix +++ b/packages/shellvaculib/package.nix @@ -1,4 +1,4 @@ -{ +{ lib, runCommandLocal, writeText, @@ -6,19 +6,21 @@ let filePkg = writeText "shellvaculib.bash" (builtins.readFile ./shellvaculib.bash); in -runCommandLocal "shellvaculib" { - passthru.file = filePkg; +runCommandLocal "shellvaculib" + { + passthru.file = filePkg; - meta = { - description = "Bunch of misc shell functions I find useful"; - license = [ lib.licenses.mit ]; - sourceProvenance = [ lib.sourceTypes.fromSource ]; - # no mainProgram - platforms = lib.platforms.all; - }; -} '' - mkdir -p "$out"/share - mkdir -p "$out"/bin - ln -s ${filePkg} "$out"/share/shellvaculib.bash - ln -s ${filePkg} "$out"/bin/shellvaculib.bash -'' + meta = { + description = "Bunch of misc shell functions I find useful"; + license = [ lib.licenses.mit ]; + sourceProvenance = [ lib.sourceTypes.fromSource ]; + # no mainProgram + platforms = lib.platforms.all; + }; + } + '' + mkdir -p "$out"/share + mkdir -p "$out"/bin + ln -s ${filePkg} "$out"/share/shellvaculib.bash + ln -s ${filePkg} "$out"/bin/shellvaculib.bash + '' diff --git a/prophecy/btrfs.nix b/prophecy/btrfs.nix index d05ff63..b3ad365 100644 --- a/prophecy/btrfs.nix +++ b/prophecy/btrfs.nix @@ -3,7 +3,15 @@ let btrfs-progs = pkgs.btrfs-progs; btrfs = "${btrfs-progs}/bin/btrfs"; btrfsDevice = "/dev/mapper/prophecy-root-decrypted"; - btrfsOpts = [ "compress=zstd:2" "datacow" "datasum" "discard=async" "ssd_spread" "noatime" "fatal_errors=panic" ]; + btrfsOpts = [ + "compress=zstd:2" + "datacow" + "datasum" + "discard=async" + "ssd_spread" + "noatime" + "fatal_errors=panic" + ]; in { fileSystems."/" = { diff --git a/prophecy/hath.nix b/prophecy/hath.nix index c9255c9..813d589 100644 --- a/prophecy/hath.nix +++ b/prophecy/hath.nix @@ -19,11 +19,13 @@ in clientKeyPath = config.sops.secrets.hathClientKey.path; }; }; - environment.persistence."/persistent".directories = [ { - directory = "/var/lib/hath"; - user = config.vacu.hath.user; - group = config.vacu.hath.group; - mode = "u=rwx,g=,o="; - } ]; + environment.persistence."/persistent".directories = [ + { + directory = "/var/lib/hath"; + user = config.vacu.hath.user; + group = config.vacu.hath.group; + mode = "u=rwx,g=,o="; + } + ]; networking.firewall.allowedTCPPorts = [ port ]; } diff --git a/scripts/archive/archive.py b/scripts/archive/archive.py index 518ca66..6341993 100644 --- a/scripts/archive/archive.py +++ b/scripts/archive/archive.py @@ -10,6 +10,7 @@ from typing import Any import humanfriendly + @dataclass class ProcessResult[T]: stdout: T @@ -90,13 +91,17 @@ args = parser.parse_args() min_space_bytes = human_friendly.parse_size(args.min_space) min_space_text = human_friendly.format_size(min_space_bytes) + def clean_if_space_needed(): usage = shutil.disk_usage("/nix/store") if usage.free < min_space_bytes: free_space_text = human_friendly.format_size(usage.free) - print(f"free space ({free_space_text}) is less than min ({min_space_text}), running a gc") + print( + f"free space ({free_space_text}) is less than min ({min_space_text}), running a gc" + ) must_succeed("nix", "store", "gc") + res = run_json("nix", "eval", ".#.", "--json", "--apply", "f: f.archival.archiveList") assert res.success() build_list = res.stdout diff --git a/scripts/archive/default.nix b/scripts/archive/default.nix index 15a6403..255eed0 100644 --- a/scripts/archive/default.nix +++ b/scripts/archive/default.nix @@ -1,6 +1,4 @@ -{ - python3Packages, - writers, -}: writers.writePython3Bin "vacu-flake-archive" { - libraries = [ python3Packages.humanfriendly ]; -} (builtins.readFile ./archive.py) +{ python3Packages, writers }: +writers.writePython3Bin "vacu-flake-archive" { libraries = [ python3Packages.humanfriendly ]; } ( + builtins.readFile ./archive.py +) diff --git a/vaculib/default.nix b/vaculib/default.nix index 5e97f85..cc8aea6 100644 --- a/vaculib/default.nix +++ b/vaculib/default.nix @@ -1,7 +1,9 @@ { ... }@passedArgs: let lib = passedArgs.lib or passedArgs.pkgs.lib; - args = passedArgs // { inherit lib vaculib; }; + args = passedArgs // { + inherit lib vaculib; + }; directoryListing = builtins.removeAttrs (builtins.readDir ./.) [ "default.nix" ]; filePaths = lib.mapAttrsToList ( k: v: