refactor(flake): move stuff in flake dir
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-07-21 16:10:13 -04:00
parent 8e98d62921
commit b3b65c1bd9
9 changed files with 9 additions and 132 deletions

View file

@ -8,7 +8,7 @@
inherit (config.vars) neovimIde;
inherit (pkgs) vimPlugins;
inherit (import ../../../../lib.nix {inherit pkgs;}) buildPlugin;
inherit (import ../../../../flake/lib.nix {inherit pkgs;}) buildPlugin;
in
lib.mkIf neovimIde {
programs = {

View file

@ -8,7 +8,7 @@
inherit (config.vars) neovimIde;
inherit (pkgs) vimPlugins;
inherit (import ../../../../lib.nix {inherit pkgs;}) buildPlugin;
inherit (import ../../../../flake/lib.nix {inherit pkgs;}) buildPlugin;
in
lib.mkIf neovimIde {
programs = {

View file

@ -1,6 +1,6 @@
{
inputs = let
inherit (import ./inputs.nix) mkDep mkInput otherInputs;
inherit (import ./flake/inputs.nix) mkDep mkInput otherInputs;
mainInputs = {
nixpkgs = mkInput {
@ -47,7 +47,7 @@
self,
...
}: let
inherit (import ./lib.nix inputs) mkVersion mkNixOS mkNixOnDroid mkPkgs;
inherit (import ./flake/lib.nix inputs) mkVersion mkNixOS mkNixOnDroid mkPkgs;
supportedSystems = ["x86_64-linux" "aarch64-linux"];
@ -176,6 +176,6 @@
# For nix-fast-build
checks =
perSystem (system: pkgs:
import ./ci.nix {inherit system pkgs self;});
import ./flake/ci.nix {inherit system pkgs self;});
};
}

View file

@ -35,7 +35,7 @@
modules =
[
{home-manager.extraSpecialArgs = specialArgs;}
./common
../common
]
++ mods;
};
@ -56,7 +56,7 @@
};
}
{home-manager = {inherit extraSpecialArgs;};}
./common/nix-on-droid.nix
../common/nix-on-droid.nix
]
++ mods;
};

View file

@ -3,7 +3,7 @@
firefox-gx-src,
stdenvNoCC,
}: let
inherit (import ../../lib.nix {}) mkVersion;
inherit (import ../../flake/lib.nix {}) mkVersion;
in
stdenvNoCC.mkDerivation {
pname = "firefox-gx";

View file

@ -4,7 +4,7 @@
piper-src,
...
}: let
inherit (import ../lib.nix {}) mkVersion;
inherit (import ../flake/lib.nix {}) mkVersion;
in {
services.ratbagd = {
enable = true;

123
update.sh
View file

@ -1,123 +0,0 @@
#!/usr/bin/env bash
# Deps:
# - jq
# - mozilla-addons-to-nix
# - alejandra
# - updateImages
# - nix-fast-build
parseFetchurl() {
URL="$1"
FILE="$2"
HASH="$(nix store prefetch-file --refresh --json \
--hash-type sha256 "$URL" --name "escaped" | jq -r .hash)"
sed -i "s,url = .*,url = \"$URL\";," "$FILE"
sed -i "s,hash = .*,hash = \"$HASH\";," "$FILE"
# For Firefox addons
sed -i "s,sha256 = .*,sha256 = \"$HASH\";," "$FILE"
}
updateDocker() {
find "$FLAKE/devices/nos/modules/arion" \
-name "*compose.nix" \
-exec sh -c 'i="$1"; updateImages $(dirname "$i")' shell {} \;
}
updateFFZ() {
FILE="$FLAKE/pkgs/firefox-addons/default.nix"
URL="https://cdn.frankerfacez.com/script/frankerfacez-4.0-an+fx.xpi"
parseFetchurl "$URL" "$FILE"
}
updateFirefoxAddons() {
echo "Updating firefox addons using mozilla-addons-to-nix"
(
cd "$FLAKE/pkgs/firefox-addons" || return;
file=generated-firefox-addons.nix
if [[ -f $file ]]; then
readarray -t OLD_VERS <<< "$(grep -A 1 --no-group-separator 'pname' "$file" |
awk '{ gsub(/"/, ""); gsub(/;/, ""); print $3 }' |
awk 'NR%2{printf $0" version ";next;}1' | paste -sd'\n' -)"
readarray -t NEW_VERS <<< "$(sed 's/Fetched //' \
<(mozilla-addons-to-nix addons.json generated-firefox-addons.nix) |
sed 's/bitwarden-password-manager/bitwarden/' |
sed 's/600-sound-volume/sound-volume/' |
sed 's/styl-us/stylus/' |
sort)"
for (( i=0; i<${#OLD_VERS[@]}; i++ )); do
if [[ "${OLD_VERS[$i]}" != "${NEW_VERS[$i]}" ]]; then
echo "${OLD_VERS[$i]} -> $(echo "${NEW_VERS[$i]}" | awk '{print $NF}')"
fi
done
else
mozilla-addons-to-nix addons.json generated-firefox-addons.nix
fi
)
}
updateVuetorrent() {
FILE="$FLAKE/devices/nos/modules/qbittorrent/vuetorrent.nix"
release=$(curl -s https://api.github.com/repos/VueTorrent/VueTorrent/releases/latest)
version=$(echo "$release" | jq -r .tag_name | tr -d v)
url="https://github.com/VueTorrent/VueTorrent/releases/download/v${version}/vuetorrent.zip"
hash="$(nix store prefetch-file --refresh --json \
--hash-type sha256 "$url" --name "escaped" | jq -r .hash)"
{
echo '# This file was autogenerated. DO NOT EDIT!'
echo '{'
echo " version = \"$version\";"
echo " url = \"$url\";"
echo " hash = \"$hash\";"
echo '}'
} >"$FILE"
}
doAll() {
flakeUpdates="$(nix flake update |& grep -v "warning: updating lock file")"
dockerUpdates="$(updateDocker)"
updateFFZ
updateFirefoxAddons
updateVuetorrent
nix-fast-build
echo 'Commit messages:
'
msg=$(cat <<EOF
chore: update flake.lock
Flake inputs:
$flakeUpdates
Docker Images:
$dockerUpdates
EOF
)
echo "$msg"
}
doAllWithoutDocker() {
updateFFZ
updateFirefoxAddons
updateVuetorrent
}
[[ "$1" == "-a" || "$1" == "--all" ]] && doAll
[[ "$1" == "-ad" || "$1" == "--all-no-docker" ]] && doAllWithoutDocker
[[ "$1" == "-d" || "$1" == "--docker" ]] && updateDocker
[[ "$1" == "-f" || "$1" == "--firefox" ]] && updateFirefoxAddons
[[ "$1" == "-ffz" || "$1" == "--frankerfacez" ]] && updateFFZ
[[ "$1" == "-v" || "$1" == "--vuetorrent" ]] && updateVuetorrent
alejandra -q "$FLAKE"