nix fmt
This commit is contained in:
32
flake.nix
32
flake.nix
@@ -254,22 +254,24 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
nixOnDroidConfigurations.default = let
|
nixOnDroidConfigurations.default =
|
||||||
pkgs = mkPkgs { system = arm; };
|
let
|
||||||
in nix-on-droid.lib.nixOnDroidConfiguration {
|
pkgs = mkPkgs { system = arm; };
|
||||||
modules = [
|
in
|
||||||
./common
|
nix-on-droid.lib.nixOnDroidConfiguration {
|
||||||
./nix-on-droid
|
modules = [
|
||||||
];
|
./common
|
||||||
extraSpecialArgs = {
|
./nix-on-droid
|
||||||
inputs = mkInputs { };
|
];
|
||||||
inherit (inputs) dns;
|
extraSpecialArgs = {
|
||||||
inherit vacuModules;
|
inputs = mkInputs { };
|
||||||
vaculib = import ./vaculib { inherit pkgs; };
|
inherit (inputs) dns;
|
||||||
vacuModuleType = "nix-on-droid";
|
inherit vacuModules;
|
||||||
|
vaculib = import ./vaculib { inherit pkgs; };
|
||||||
|
vacuModuleType = "nix-on-droid";
|
||||||
|
};
|
||||||
|
inherit pkgs;
|
||||||
};
|
};
|
||||||
inherit pkgs;
|
|
||||||
};
|
|
||||||
|
|
||||||
checks = nixpkgs.lib.genAttrs [ x86 ] (
|
checks = nixpkgs.lib.genAttrs [ x86 ] (
|
||||||
system:
|
system:
|
||||||
|
@@ -797,19 +797,28 @@ let
|
|||||||
${pure_flags [ "genshin" "D" ] (envelope_is "genshin@shelvacu.com")}
|
${pure_flags [ "genshin" "D" ] (envelope_is "genshin@shelvacu.com")}
|
||||||
${pure_flags [ "jork" "B" ] (envelope_is "jork@shelvacu.com")}
|
${pure_flags [ "jork" "B" ] (envelope_is "jork@shelvacu.com")}
|
||||||
${pure_flags [ "patreon" "not-spamish" ] (envelope_is "patreon@shelvacu.com")}
|
${pure_flags [ "patreon" "not-spamish" ] (envelope_is "patreon@shelvacu.com")}
|
||||||
${pure_flags [ "patreon-post" "B.subscriptions" ] [
|
${pure_flags
|
||||||
(has_flag "patreon")
|
[ "patreon-post" "B.subscriptions" ]
|
||||||
(header_is "X-Mailgun-Tag" "template_newsletterpostcontrol")
|
[
|
||||||
]}
|
(has_flag "patreon")
|
||||||
${pure_flags [ "patreon-free-member-digest" "D" ] [
|
(header_is "X-Mailgun-Tag" "template_newsletterpostcontrol")
|
||||||
(has_flag "patreon")
|
]
|
||||||
(header_is "X-Mailgun-Tag" "template_freememberdigest")
|
}
|
||||||
]}
|
${pure_flags
|
||||||
${pure_flags [ "patreon-other" "B" ] [
|
[ "patreon-free-member-digest" "D" ]
|
||||||
(has_flag "patreon")
|
[
|
||||||
(not (has_flag "patreon-post"))
|
(has_flag "patreon")
|
||||||
(not (has_flag "patreon-free-member-digest"))
|
(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 [ "rsb" "B" ] (from_is "support@rapidseedbox.com")}
|
||||||
${pure_flags [ "fresh-avocado-dis8" "D" ] (envelope_is "fresh.avocado@dis8.net")}
|
${pure_flags [ "fresh-avocado-dis8" "D" ] (envelope_is "fresh.avocado@dis8.net")}
|
||||||
${pure_flags [ "discord" "A" ] (envelope_matches "discord@*")}
|
${pure_flags [ "discord" "A" ] (envelope_matches "discord@*")}
|
||||||
|
@@ -81,13 +81,19 @@ in
|
|||||||
enable = true;
|
enable = true;
|
||||||
package = cfg.lfs.package;
|
package = cfg.lfs.package;
|
||||||
};
|
};
|
||||||
vacu.git.config = lib.mkIf cfg.lfs.enable (let bin = lib.getExe cfg.lfs.package; in {
|
vacu.git.config = lib.mkIf cfg.lfs.enable (
|
||||||
filter.lfs = {
|
let
|
||||||
clean = "${bin} clean -- %f";
|
bin = lib.getExe cfg.lfs.package;
|
||||||
smudge = "${bin} smudge -- %f";
|
in
|
||||||
process = "${bin} filter-process";
|
{
|
||||||
required = true;
|
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"; }
|
||||||
|
@@ -74,7 +74,7 @@ in
|
|||||||
};
|
};
|
||||||
extraArgs = mkOption {
|
extraArgs = mkOption {
|
||||||
type = types.listOf types.str;
|
type = types.listOf types.str;
|
||||||
default = [];
|
default = [ ];
|
||||||
};
|
};
|
||||||
|
|
||||||
bandwidthMonitor = mkOption {
|
bandwidthMonitor = mkOption {
|
||||||
|
@@ -80,4 +80,5 @@ in
|
|||||||
// lib.optionalAttrs (vacuModuleType == "nix-on-droid") {
|
// lib.optionalAttrs (vacuModuleType == "nix-on-droid") {
|
||||||
environment.etc.hosts.text = config.vacu.etcHostsText;
|
environment.etc.hosts.text = config.vacu.etcHostsText;
|
||||||
};
|
};
|
||||||
} // lib.optionalAttrs (vacuModuleType == "nixos") { _class = "nixos"; }
|
}
|
||||||
|
// lib.optionalAttrs (vacuModuleType == "nixos") { _class = "nixos"; }
|
||||||
|
@@ -111,4 +111,5 @@ in
|
|||||||
// lib.optionalAttrs (vacuModuleType == "nix-on-droid") {
|
// lib.optionalAttrs (vacuModuleType == "nix-on-droid") {
|
||||||
environment.packages = config.vacu.finalPackageList;
|
environment.packages = config.vacu.finalPackageList;
|
||||||
};
|
};
|
||||||
} // lib.optionalAttrs (vacuModuleType == "nixos") { _class = "nixos"; }
|
}
|
||||||
|
// lib.optionalAttrs (vacuModuleType == "nixos") { _class = "nixos"; }
|
||||||
|
@@ -91,4 +91,5 @@ in
|
|||||||
// lib.optionalAttrs (vacuModuleType == "nix-on-droid") {
|
// lib.optionalAttrs (vacuModuleType == "nix-on-droid") {
|
||||||
environment.etc."ssh/ssh_config".text = config.vacu.ssh.config;
|
environment.etc."ssh/ssh_config".text = config.vacu.ssh.config;
|
||||||
};
|
};
|
||||||
} // lib.optionalAttrs (vacuModuleType == "nixos") { _class = "nixos"; }
|
}
|
||||||
|
// lib.optionalAttrs (vacuModuleType == "nixos") { _class = "nixos"; }
|
||||||
|
@@ -464,7 +464,8 @@ in
|
|||||||
default = pkgs.writeFile "autoexec.cfg" cfg.autoexecLines;
|
default = pkgs.writeFile "autoexec.cfg" cfg.autoexecLines;
|
||||||
readOnly = true;
|
readOnly = true;
|
||||||
};
|
};
|
||||||
build.classes = mkAttrsOfClasses (classname:
|
build.classes = mkAttrsOfClasses (
|
||||||
|
classname:
|
||||||
mkOption {
|
mkOption {
|
||||||
type = types.pkg;
|
type = types.pkg;
|
||||||
default = pkgs.writeText "${classname}.cfg" cfg.classLines.${classname};
|
default = pkgs.writeText "${classname}.cfg" cfg.classLines.${classname};
|
||||||
|
4
nur.nix
4
nur.nix
@@ -3,6 +3,8 @@
|
|||||||
let
|
let
|
||||||
inherit (pkgs) lib;
|
inherit (pkgs) lib;
|
||||||
packagePaths = import ./packages;
|
packagePaths = import ./packages;
|
||||||
shelPackages = builtins.mapAttrs (_: path: lib.callPackageWith (pkgs // shelPackages) path { }) packagePaths;
|
shelPackages = builtins.mapAttrs (
|
||||||
|
_: path: lib.callPackageWith (pkgs // shelPackages) path { }
|
||||||
|
) packagePaths;
|
||||||
in
|
in
|
||||||
shelPackages
|
shelPackages
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
lib,
|
lib,
|
||||||
fetchFromGitHub,
|
fetchFromGitHub,
|
||||||
stdenv,
|
stdenv,
|
||||||
@@ -31,7 +31,7 @@ let
|
|||||||
license = [ lib.licenses.asl20 ];
|
license = [ lib.licenses.asl20 ];
|
||||||
sourceProvenance = [ lib.sourceTypes.fromSource ];
|
sourceProvenance = [ lib.sourceTypes.fromSource ];
|
||||||
# no mainProgram
|
# no mainProgram
|
||||||
platforms = lib.platforms.all;
|
platforms = lib.platforms.all;
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
// {
|
// {
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
lib,
|
lib,
|
||||||
runCommandLocal,
|
runCommandLocal,
|
||||||
writeText,
|
writeText,
|
||||||
@@ -6,19 +6,21 @@
|
|||||||
let
|
let
|
||||||
filePkg = writeText "shellvaculib.bash" (builtins.readFile ./shellvaculib.bash);
|
filePkg = writeText "shellvaculib.bash" (builtins.readFile ./shellvaculib.bash);
|
||||||
in
|
in
|
||||||
runCommandLocal "shellvaculib" {
|
runCommandLocal "shellvaculib"
|
||||||
passthru.file = filePkg;
|
{
|
||||||
|
passthru.file = filePkg;
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
description = "Bunch of misc shell functions I find useful";
|
description = "Bunch of misc shell functions I find useful";
|
||||||
license = [ lib.licenses.mit ];
|
license = [ lib.licenses.mit ];
|
||||||
sourceProvenance = [ lib.sourceTypes.fromSource ];
|
sourceProvenance = [ lib.sourceTypes.fromSource ];
|
||||||
# no mainProgram
|
# no mainProgram
|
||||||
platforms = lib.platforms.all;
|
platforms = lib.platforms.all;
|
||||||
};
|
};
|
||||||
} ''
|
}
|
||||||
mkdir -p "$out"/share
|
''
|
||||||
mkdir -p "$out"/bin
|
mkdir -p "$out"/share
|
||||||
ln -s ${filePkg} "$out"/share/shellvaculib.bash
|
mkdir -p "$out"/bin
|
||||||
ln -s ${filePkg} "$out"/bin/shellvaculib.bash
|
ln -s ${filePkg} "$out"/share/shellvaculib.bash
|
||||||
''
|
ln -s ${filePkg} "$out"/bin/shellvaculib.bash
|
||||||
|
''
|
||||||
|
@@ -3,7 +3,15 @@ let
|
|||||||
btrfs-progs = pkgs.btrfs-progs;
|
btrfs-progs = pkgs.btrfs-progs;
|
||||||
btrfs = "${btrfs-progs}/bin/btrfs";
|
btrfs = "${btrfs-progs}/bin/btrfs";
|
||||||
btrfsDevice = "/dev/mapper/prophecy-root-decrypted";
|
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
|
in
|
||||||
{
|
{
|
||||||
fileSystems."/" = {
|
fileSystems."/" = {
|
||||||
|
@@ -19,11 +19,13 @@ in
|
|||||||
clientKeyPath = config.sops.secrets.hathClientKey.path;
|
clientKeyPath = config.sops.secrets.hathClientKey.path;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
environment.persistence."/persistent".directories = [ {
|
environment.persistence."/persistent".directories = [
|
||||||
directory = "/var/lib/hath";
|
{
|
||||||
user = config.vacu.hath.user;
|
directory = "/var/lib/hath";
|
||||||
group = config.vacu.hath.group;
|
user = config.vacu.hath.user;
|
||||||
mode = "u=rwx,g=,o=";
|
group = config.vacu.hath.group;
|
||||||
} ];
|
mode = "u=rwx,g=,o=";
|
||||||
|
}
|
||||||
|
];
|
||||||
networking.firewall.allowedTCPPorts = [ port ];
|
networking.firewall.allowedTCPPorts = [ port ];
|
||||||
}
|
}
|
||||||
|
@@ -10,6 +10,7 @@ from typing import Any
|
|||||||
|
|
||||||
import humanfriendly
|
import humanfriendly
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class ProcessResult[T]:
|
class ProcessResult[T]:
|
||||||
stdout: T
|
stdout: T
|
||||||
@@ -90,13 +91,17 @@ args = parser.parse_args()
|
|||||||
min_space_bytes = human_friendly.parse_size(args.min_space)
|
min_space_bytes = human_friendly.parse_size(args.min_space)
|
||||||
min_space_text = human_friendly.format_size(min_space_bytes)
|
min_space_text = human_friendly.format_size(min_space_bytes)
|
||||||
|
|
||||||
|
|
||||||
def clean_if_space_needed():
|
def clean_if_space_needed():
|
||||||
usage = shutil.disk_usage("/nix/store")
|
usage = shutil.disk_usage("/nix/store")
|
||||||
if usage.free < min_space_bytes:
|
if usage.free < min_space_bytes:
|
||||||
free_space_text = human_friendly.format_size(usage.free)
|
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")
|
must_succeed("nix", "store", "gc")
|
||||||
|
|
||||||
|
|
||||||
res = run_json("nix", "eval", ".#.", "--json", "--apply", "f: f.archival.archiveList")
|
res = run_json("nix", "eval", ".#.", "--json", "--apply", "f: f.archival.archiveList")
|
||||||
assert res.success()
|
assert res.success()
|
||||||
build_list = res.stdout
|
build_list = res.stdout
|
||||||
|
@@ -1,6 +1,4 @@
|
|||||||
{
|
{ python3Packages, writers }:
|
||||||
python3Packages,
|
writers.writePython3Bin "vacu-flake-archive" { libraries = [ python3Packages.humanfriendly ]; } (
|
||||||
writers,
|
builtins.readFile ./archive.py
|
||||||
}: writers.writePython3Bin "vacu-flake-archive" {
|
)
|
||||||
libraries = [ python3Packages.humanfriendly ];
|
|
||||||
} (builtins.readFile ./archive.py)
|
|
||||||
|
@@ -1,7 +1,9 @@
|
|||||||
{ ... }@passedArgs:
|
{ ... }@passedArgs:
|
||||||
let
|
let
|
||||||
lib = passedArgs.lib or passedArgs.pkgs.lib;
|
lib = passedArgs.lib or passedArgs.pkgs.lib;
|
||||||
args = passedArgs // { inherit lib vaculib; };
|
args = passedArgs // {
|
||||||
|
inherit lib vaculib;
|
||||||
|
};
|
||||||
directoryListing = builtins.removeAttrs (builtins.readDir ./.) [ "default.nix" ];
|
directoryListing = builtins.removeAttrs (builtins.readDir ./.) [ "default.nix" ];
|
||||||
filePaths = lib.mapAttrsToList (
|
filePaths = lib.mapAttrsToList (
|
||||||
k: v:
|
k: v:
|
||||||
|
Reference in New Issue
Block a user