Merge branch 'master' of git.uninsane.org:colin/nix-files
This commit is contained in:
commit
c745612cfd
24
flake.lock
24
flake.lock
|
@ -69,11 +69,11 @@
|
|||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1670751203,
|
||||
"narHash": "sha256-XdoH1v3shKDGlrwjgrNX/EN8s3c+kQV7xY6cLCE8vcI=",
|
||||
"lastModified": 1671359686,
|
||||
"narHash": "sha256-3MpC6yZo+Xn9cPordGz2/ii6IJpP2n8LE8e/ebUXLrs=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "64e0bf055f9d25928c31fb12924e59ff8ce71e60",
|
||||
"rev": "04f574a1c0fde90b51bf68198e2297ca4e7cccf4",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -84,11 +84,11 @@
|
|||
},
|
||||
"nixpkgs-stable": {
|
||||
"locked": {
|
||||
"lastModified": 1670856834,
|
||||
"narHash": "sha256-GitzxDZo7385SBoMpHRA9NBAhBh/5TBK8ptpQFAoMYc=",
|
||||
"lastModified": 1671313200,
|
||||
"narHash": "sha256-itZTrtHeDJjV696+ur0/TzkTqb5y3Eb57WRLRPK3rwA=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "06278c77b5d162e62df170fec307e83f1812d94b",
|
||||
"rev": "0938d73bb143f4ae037143572f11f4338c7b2d1c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -99,11 +99,11 @@
|
|||
},
|
||||
"nixpkgs-stable_2": {
|
||||
"locked": {
|
||||
"lastModified": 1670146390,
|
||||
"narHash": "sha256-XrEoDpuloRHHbUkbPnhF2bQ0uwHllXq3NHxtuVe/QK4=",
|
||||
"lastModified": 1671459584,
|
||||
"narHash": "sha256-6wRK7xmeHfClJ0ICOkax1avLZVGTDqBodQlkl/opccY=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "86370507cb20c905800527539fc049a2bf09c667",
|
||||
"rev": "87b58217c9a05edcf7630b9be32570f889217aef",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -132,11 +132,11 @@
|
|||
"nixpkgs-stable": "nixpkgs-stable_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1670149631,
|
||||
"narHash": "sha256-rwmtlxx45PvOeZNP51wql/cWjY3rqzIR3Oj2Y+V7jM0=",
|
||||
"lastModified": 1671472949,
|
||||
"narHash": "sha256-9iHSGpljCX+RypahQssBXPwkru9onfKfceCTeVrMpH4=",
|
||||
"owner": "Mic92",
|
||||
"repo": "sops-nix",
|
||||
"rev": "da98a111623101c64474a14983d83dad8f09f93d",
|
||||
"rev": "32840f16ffa0856cdf9503a8658f2dd42bf70342",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
|
@ -40,7 +40,9 @@
|
|||
|
||||
boot.loader.efi.canTouchEfiVariables = false;
|
||||
# /boot space is at a premium. default was 20.
|
||||
boot.loader.generic-extlinux-compatible.configurationLimit = 10;
|
||||
# even 10 can be too much
|
||||
# TODO: compress moby kernels!
|
||||
boot.loader.generic-extlinux-compatible.configurationLimit = 8;
|
||||
# mobile.bootloader.enable = false;
|
||||
# mobile.boot.stage-1.enable = false;
|
||||
# boot.initrd.systemd.enable = false;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
https://search.nixos.org/packages?channel=unstable&query=
|
||||
https://nixos.wiki/index.php?go=Go&search=
|
||||
https://github.com/nixos/nixpkgs/pulls?q=
|
||||
https://nix-community.github.io/home-manager/options.html
|
||||
https://w.uninsane.org/viewer#search?books.name=wikipedia_en_all_maxi_2022-05&pattern=
|
||||
https://fed.uninsane.org
|
||||
https://jackett.uninsane.org
|
||||
|
|
|
@ -60,7 +60,7 @@ let
|
|||
(addon "bypass-paywalls-clean" "{d133e097-46d9-4ecc-9903-fa6a722a6e0e}" "sha256-7ZDkG8O1rEYdh/La0PLi9tp92JxYeQvaOFt/BmnDv3U=")
|
||||
(addon "sidebery" "{3c078156-979c-498b-8990-85f7987dd929}" "sha256-YONfK/rIjlsrTgRHIt3km07Q7KnpIW89Z9r92ZSCc6w=")
|
||||
(addon "ether-metamask" "webextension@metamask.io" "sha256-G+MwJDOcsaxYSUXjahHJmkWnjLeQ0Wven8DU/lGeMzA=")
|
||||
(addon "ublacklist" "@ublacklist" "sha256-564rVP4JQ7MYAYfPPG7JxNDB7q/hLl2T7U2ExYO04mU=")
|
||||
(addon "ublacklist" "@ublacklist" "sha256-vHe/7EYOzcKeAbTElmt0Rb4E2rX0f3JgXThJaUmaz+M=")
|
||||
(addon "i2p-in-private-browsing" "i2ppb@eyedeekay.github.io" "sha256-dJcJ3jxeAeAkRvhODeIVrCflvX+S4E0wT/PyYzQBQWs=")
|
||||
# (addon "browserpass-ce" "browserpass@maximbaz.com" "sha256-sXgUBbRvMnRpeIW1MTkmTcoqtW/8RDXAkxAq1evFkpc=")
|
||||
(localAddon pkgs.browserpass-extension)
|
||||
|
|
26
nixpatches/2022-12-19-i2p-aarch64.patch
Normal file
26
nixpatches/2022-12-19-i2p-aarch64.patch
Normal file
|
@ -0,0 +1,26 @@
|
|||
diff --git a/pkgs/tools/networking/i2p/default.nix b/pkgs/tools/networking/i2p/default.nix
|
||||
index e835007fdc5..1406486c7d4 100644
|
||||
--- a/pkgs/tools/networking/i2p/default.nix
|
||||
+++ b/pkgs/tools/networking/i2p/default.nix
|
||||
@@ -50,7 +50,7 @@ stdenv.mkDerivation rec {
|
||||
binaryBytecode # source bundles dependencies as jars
|
||||
];
|
||||
license = licenses.gpl2;
|
||||
- platforms = [ "x86_64-linux" "i686-linux" ];
|
||||
+ platforms = [ "x86_64-linux" "i686-linux" "aarch64-linux" ];
|
||||
maintainers = with maintainers; [ joelmo ];
|
||||
};
|
||||
}
|
||||
diff --git a/pkgs/tools/system/java-service-wrapper/default.nix b/pkgs/tools/system/java-service-wrapper/default.nix
|
||||
index 93d86a75d18..ab563085f93 100644
|
||||
--- a/pkgs/tools/system/java-service-wrapper/default.nix
|
||||
+++ b/pkgs/tools/system/java-service-wrapper/default.nix
|
||||
@@ -44,7 +44,7 @@ stdenv.mkDerivation rec {
|
||||
homepage = "https://wrapper.tanukisoftware.com/";
|
||||
changelog = "https://wrapper.tanukisoftware.com/doc/english/release-notes.html#${version}";
|
||||
license = licenses.gpl2Only;
|
||||
- platforms = [ "x86_64-linux" "i686-linux" ];
|
||||
+ platforms = [ "x86_64-linux" "i686-linux" "aarch64-linux" ];
|
||||
maintainers = [ maintainers.suhr ];
|
||||
};
|
||||
}
|
|
@ -19,6 +19,8 @@
|
|||
sha256 = "sha256-Z4V9mOv4HYg3kDnWoYcxz3ch03I/1USrLjzlq4X9YqI=";
|
||||
})
|
||||
|
||||
./2022-12-19-i2p-aarch64.patch
|
||||
|
||||
# # kaiteki: init at 2022-09-03
|
||||
# vendorHash changes too frequently (might not be reproducible).
|
||||
# using local package defn until stabilized
|
||||
|
|
|
@ -27,6 +27,7 @@ resholve.mkDerivation {
|
|||
duplicity
|
||||
file
|
||||
findutils
|
||||
git
|
||||
gnugrep
|
||||
gnused
|
||||
gocryptfs
|
||||
|
@ -75,6 +76,7 @@ resholve.mkDerivation {
|
|||
# list of programs which *can* or *cannot* exec their arguments
|
||||
execer = with pkgs; [
|
||||
"cannot:${duplicity}/bin/duplicity"
|
||||
"cannot:${git}/bin/git"
|
||||
"cannot:${gocryptfs}/bin/gocryptfs"
|
||||
"cannot:${ifuse}/bin/ifuse"
|
||||
"cannot:${iwd}/bin/iwctl"
|
||||
|
@ -89,9 +91,16 @@ resholve.mkDerivation {
|
|||
};
|
||||
};
|
||||
|
||||
patchPhase = ''
|
||||
# remove python scripts
|
||||
# TODO: figure out how to make resholve process only shell scripts
|
||||
rm sane-reclaim-boot-space
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p "$out/bin"
|
||||
cp -R * "$out"/bin/
|
||||
mkdir -p $out/bin
|
||||
cp -R * $out/bin/
|
||||
# allow scripts to make use of sudo, umount wrappers
|
||||
sed -i '3iPATH=$PATH:/run/wrappers/bin' $out/bin/*;
|
||||
'';
|
||||
|
||||
|
|
14
pkgs/sane-scripts/src/sane-git-init
Executable file
14
pkgs/sane-scripts/src/sane-git-init
Executable file
|
@ -0,0 +1,14 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -x
|
||||
|
||||
# initialize a repository with each of my machines configured as remotes.
|
||||
# it's assumed each machine stores the repo at the same fs path
|
||||
|
||||
path=$PWD
|
||||
|
||||
git init
|
||||
git remote add desko "colin@desko:$path"
|
||||
git remote add lappy "colin@lappy:$path"
|
||||
git remote add moby "colin@moby:$path"
|
||||
git remote add servo "colin@servo:$path"
|
194
pkgs/sane-scripts/src/sane-reclaim-boot-space
Executable file
194
pkgs/sane-scripts/src/sane-reclaim-boot-space
Executable file
|
@ -0,0 +1,194 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
import os.path
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
EXTLINUX_CONF = "/boot/extlinux/extlinux.conf"
|
||||
|
||||
class ConfItem:
|
||||
pass
|
||||
|
||||
class ConfLine:
|
||||
""" uninteresting line in the config """
|
||||
def __init__(self, line: str):
|
||||
self.line = line
|
||||
|
||||
def __str__(self) -> str:
|
||||
return self.line
|
||||
|
||||
class ConfEntry:
|
||||
""" boot entry, with label/linux/etc """
|
||||
menu = linux = initrd = append = fdtdir = None
|
||||
def __init__(self, label: str):
|
||||
self.label = label
|
||||
|
||||
def format_attr(self, attr_name: str) -> str:
|
||||
attr_val = getattr(self, attr_name)
|
||||
assert attr_val is not None, f"not set: {attr_name}"
|
||||
return f"{attr_name.upper()} {attr_val}"
|
||||
|
||||
def __str__(self) -> str:
|
||||
return f"""
|
||||
{self.format_attr("label")}
|
||||
{self.format_attr("menu")}
|
||||
{self.format_attr("linux")}
|
||||
{self.format_attr("initrd")}
|
||||
{self.format_attr("append")}
|
||||
{self.format_attr("fdtdir")}
|
||||
""".strip()
|
||||
|
||||
def parse(self, line: str) -> None:
|
||||
split_at = line.index(" ")
|
||||
directive, contents = line[:split_at], line[1+split_at:]
|
||||
self.setattr(directive.lower(), contents)
|
||||
|
||||
def setattr(self, directive: str, contents: str) -> None:
|
||||
assert getattr(self, directive) is None, f"attr already set: {directive} = {contents!r}"
|
||||
setattr(self, directive, contents)
|
||||
|
||||
|
||||
class UseTracker:
|
||||
def __init__(self):
|
||||
self.linux = []
|
||||
self.initrd = []
|
||||
self.fdtdir = []
|
||||
self.sizes = {} # item: str -> [num_using, bytes]
|
||||
|
||||
@staticmethod
|
||||
def from_items(entries: list) -> 'UseTracker':
|
||||
me = UseTracker()
|
||||
me.populate_from_fs()
|
||||
for i in entries:
|
||||
me.track(i)
|
||||
return me
|
||||
|
||||
def populate_from_fs(self) -> None:
|
||||
for entry in os.listdir("/boot/nixos"):
|
||||
item = os.path.join("../nixos", entry)
|
||||
self.sizes[item] = [0, self._get_size(item)]
|
||||
|
||||
def append_unique(self, list_: list, item: str) -> None:
|
||||
if item not in list_:
|
||||
list_.append(item)
|
||||
self.sizes[item][0] += 1
|
||||
|
||||
def track(self, entry: ConfItem) -> None:
|
||||
if isinstance(entry, ConfEntry):
|
||||
self.append_unique(self.linux, entry.linux)
|
||||
self.append_unique(self.initrd, entry.initrd)
|
||||
self.append_unique(self.fdtdir, entry.fdtdir)
|
||||
|
||||
def get_use_count(self, item: str) -> int:
|
||||
return self.sizes[item][0]
|
||||
|
||||
def get_size(self, item: str) -> int:
|
||||
return self.sizes[item][1]
|
||||
|
||||
def used_size(self) -> int:
|
||||
return sum(i[1] for i in self.sizes.values() if i[0] != 0)
|
||||
|
||||
def get_unused(self) -> list:
|
||||
return [i for (i, v) in self.sizes.items() if v[0] == 0]
|
||||
|
||||
def unused_size(self) -> int:
|
||||
return sum(self.get_size(i) for i in self.get_unused())
|
||||
|
||||
def _get_size(self, item: str) -> int:
|
||||
path = os.path.join("/boot/extlinux", item)
|
||||
du_output = subprocess.check_output(["du", "-b", "-c", path], text=True).strip()
|
||||
last = du_output.split("\n")[-1]
|
||||
size, label = last.split("\t")
|
||||
assert label == "total", f"unexpected du output: {last}"
|
||||
return int(size)
|
||||
|
||||
def print_use_by_cat(tracker: UseTracker, label: str) -> None:
|
||||
items = getattr(tracker, label)
|
||||
formatted_items = []
|
||||
for item in items:
|
||||
count, size = tracker.get_use_count(item), tracker.get_size(item)
|
||||
formatted_items.append(f"\n {item}\n {count}x {size}")
|
||||
print(f" {label}:{''.join(formatted_items)}")
|
||||
|
||||
def print_tracker_use(tracker: UseTracker) -> None:
|
||||
print("in use:")
|
||||
print_use_by_cat(tracker, "linux")
|
||||
print_use_by_cat(tracker, "initrd")
|
||||
print_use_by_cat(tracker, "fdtdir")
|
||||
print("unused:")
|
||||
for i in tracker.get_unused():
|
||||
print(f" {i}\n {tracker.get_size(i)}")
|
||||
print(f"used space: {tracker.used_size()}")
|
||||
|
||||
def delete_unused_from_disk(tracker: UseTracker) -> None:
|
||||
for f in tracker.get_unused():
|
||||
path = os.path.join("/boot/extlinux", f)
|
||||
cmd = ["rm", "-r", "-f", path]
|
||||
print(" ".join(cmd))
|
||||
subprocess.check_output(cmd)
|
||||
|
||||
def parse_extlinux(contents: str) -> list:
|
||||
items = []
|
||||
active_entry = None
|
||||
for line in contents.split("\n"):
|
||||
if line.startswith("#") or line == "" or line.startswith("DEFAULT ") or line.startswith("MENU ") or line.startswith("TIMEOUT "):
|
||||
items.append(ConfLine(line))
|
||||
elif line.startswith("LABEL "):
|
||||
items.append(ConfEntry(line[len("LABEL "):]))
|
||||
elif line.startswith(" "):
|
||||
items[-1].parse(line[2:])
|
||||
else:
|
||||
assert False, f"unknown directive {line!r}"
|
||||
|
||||
return items
|
||||
|
||||
def write_extlinux(contents: str) -> None:
|
||||
with open(EXTLINUX_CONF, "r+") as new:
|
||||
# backup file
|
||||
with open("./extlinux.conf.back", "w") as back:
|
||||
back.write(new.read())
|
||||
|
||||
new.seek(0)
|
||||
new.write(new_extlinux)
|
||||
new.truncate()
|
||||
|
||||
def dump_items(items: list) -> str:
|
||||
return "\n".join(str(i) for i in items)
|
||||
|
||||
def prompt_continue() -> None:
|
||||
if input("continue? [y/N] ").lower() != "y":
|
||||
print("aborting")
|
||||
sys.exit(0)
|
||||
|
||||
orig_extlinux = open(EXTLINUX_CONF, "r").read()
|
||||
items = parse_extlinux(orig_extlinux)
|
||||
tracker = UseTracker.from_items(items)
|
||||
print_tracker_use(tracker)
|
||||
print()
|
||||
|
||||
if tracker.get_unused():
|
||||
print(f"recommended to delete unused items from disk to save {tracker.unused_size()}b")
|
||||
prompt_continue()
|
||||
else:
|
||||
orig_tracker = tracker
|
||||
rmcount = 0
|
||||
while tracker.used_size() == orig_tracker.used_size():
|
||||
item = items.pop()
|
||||
rmcount += isinstance(item, ConfEntry)
|
||||
tracker = UseTracker.from_items(items)
|
||||
|
||||
orig_size = orig_tracker.used_size()
|
||||
new_size = tracker.used_size()
|
||||
print(f"recommended to delete {rmcount} oldest entries to save {orig_size - new_size}b")
|
||||
print_tracker_use(tracker)
|
||||
prompt_continue()
|
||||
print()
|
||||
|
||||
new_extlinux = dump_items(items)
|
||||
print(f"new contents:\n{new_extlinux}")
|
||||
prompt_continue()
|
||||
|
||||
write_extlinux(new_extlinux)
|
||||
|
||||
delete_unused_from_disk(tracker)
|
Loading…
Reference in New Issue
Block a user