chore: format everything

This commit is contained in:
oddlama 2024-11-26 13:34:55 +01:00
parent deca311c68
commit 7ccd7856ee
No known key found for this signature in database
GPG key ID: 14EFE510775FE39A
162 changed files with 4750 additions and 3718 deletions

View file

@ -8,7 +8,8 @@
gitMinimal,
nodejs,
yarn,
}: let
}:
let
version = "24.10.1";
src = fetchFromGitHub {
owner = "actualbudget";
@ -30,9 +31,20 @@
];
SUPPORTED_ARCHITECTURES = builtins.toJSON {
os = ["darwin" "linux"];
cpu = ["arm" "arm64" "ia32" "x64"];
libc = ["glibc" "musl"];
os = [
"darwin"
"linux"
];
cpu = [
"arm"
"arm64"
"ia32"
"x64"
];
libc = [
"glibc"
"musl"
];
};
buildPhase = ''
@ -54,38 +66,41 @@
outputHash = "sha256-eNpOS21pkamugoYVhzsEnstxeVN/J06yDZcshfr0Ek4=";
};
in
stdenv.mkDerivation {
pname = "actual-server";
inherit version src;
stdenv.mkDerivation {
pname = "actual-server";
inherit version src;
nativeBuildInputs = [
makeWrapper
yarn
nativeBuildInputs = [
makeWrapper
yarn
];
installPhase = ''
runHook preInstall
mkdir -p $out/{bin,lib,lib/actual}
cp -r ${offlineCache}/node_modules/ $out/lib/actual
cp -r ./ $out/lib/actual
makeWrapper ${lib.getExe nodejs} "$out/bin/actual-server" \
--add-flags "$out/lib/actual/app.js" \
--set NODE_PATH "$out/node_modules"
runHook postInstall
'';
passthru = {
inherit offlineCache;
};
meta = with lib; {
description = "A super fast privacy-focused app for managing your finances";
homepage = "https://actualbudget.com/";
license = licenses.mit;
mainProgram = "actual-server";
maintainers = with maintainers; [
oddlama
patrickdag
];
installPhase = ''
runHook preInstall
mkdir -p $out/{bin,lib,lib/actual}
cp -r ${offlineCache}/node_modules/ $out/lib/actual
cp -r ./ $out/lib/actual
makeWrapper ${lib.getExe nodejs} "$out/bin/actual-server" \
--add-flags "$out/lib/actual/app.js" \
--set NODE_PATH "$out/node_modules"
runHook postInstall
'';
passthru = {
inherit offlineCache;
};
meta = with lib; {
description = "A super fast privacy-focused app for managing your finances";
homepage = "https://actualbudget.com/";
license = licenses.mit;
mainProgram = "actual-server";
maintainers = with maintainers; [oddlama patrickdag];
};
}
};
}

View file

@ -1,7 +1,8 @@
{
pkgs,
fetchurl,
}: let
}:
let
name = "awakened-poe-trade";
version = "3.24.10002";
description = "Path of Exile trading app for price checking";
@ -18,17 +19,17 @@
'';
file = "Awakened-PoE-Trade-${version}.AppImage";
in
pkgs.appimageTools.wrapType2 {
name = "awakened-poe-trade";
src = fetchurl {
url = "https://github.com/SnosMe/awakened-poe-trade/releases/download/v${version}/${file}";
hash = "sha256-ieRBYrtpB8GgnDDy+fDuwamix5syRH3NG5jE5UoGg5A=";
};
pkgs.appimageTools.wrapType2 {
name = "awakened-poe-trade";
src = fetchurl {
url = "https://github.com/SnosMe/awakened-poe-trade/releases/download/v${version}/${file}";
hash = "sha256-ieRBYrtpB8GgnDDy+fDuwamix5syRH3NG5jE5UoGg5A=";
};
extraInstallCommands = ''
mkdir -p $out/share/applications
cp ${./TransferOrb.png} $out/share/applications/awakened-poe-trade.png
cp ${desktopEntry} $out/share/applications/${name}.desktop
substituteInPlace $out/share/applications/awakened-poe-trade.desktop --replace /share/ $out/share/
'';
}
extraInstallCommands = ''
mkdir -p $out/share/applications
cp ${./TransferOrb.png} $out/share/applications/awakened-poe-trade.png
cp ${desktopEntry} $out/share/applications/${name}.desktop
substituteInPlace $out/share/applications/awakened-poe-trade.desktop --replace /share/ $out/share/
'';
}

View file

@ -1,14 +1,14 @@
_inputs: [
(import ./scripts)
(_final: prev: {
deploy = prev.callPackage ./deploy.nix {};
git-fuzzy = prev.callPackage ./git-fuzzy {};
awakened-poe-trade = prev.callPackage ./awakened-poe-trade.nix {};
segoe-ui-ttf = prev.callPackage ./segoe-ui-ttf.nix {};
zsh-histdb-skim = prev.callPackage ./zsh-skim-histdb.nix {};
actual-server = prev.callPackage ./actual-server.nix {};
deploy = prev.callPackage ./deploy.nix { };
git-fuzzy = prev.callPackage ./git-fuzzy { };
awakened-poe-trade = prev.callPackage ./awakened-poe-trade.nix { };
segoe-ui-ttf = prev.callPackage ./segoe-ui-ttf.nix { };
zsh-histdb-skim = prev.callPackage ./zsh-skim-histdb.nix { };
actual-server = prev.callPackage ./actual-server.nix { };
neovim-clean = prev.neovim-unwrapped.overrideAttrs (old: {
nativeBuildInputs = (old.nativeBuildInputs or []) ++ [prev.makeWrapper];
nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ prev.makeWrapper ];
postInstall =
(old.postInstall or "")
+ ''
@ -22,10 +22,8 @@ _inputs: [
# })
# ];
formats =
prev.formats
// {
ron = import ./ron.nix {inherit (prev) lib pkgs;};
};
formats = prev.formats // {
ron = import ./ron.nix { inherit (prev) lib pkgs; };
};
})
]

View file

@ -1,7 +1,8 @@
{
bc,
writeShellApplication,
}: let
}:
let
deploy = writeShellApplication {
name = "deploy";
text = ''
@ -116,4 +117,4 @@
'';
};
in
deploy
deploy

View file

@ -6,64 +6,73 @@
gitAndTools,
bc,
bat,
extraPackages ? [],
}: let
binPath = lib.makeBinPath ([gitAndTools.hub gitAndTools.delta bc bat] ++ extraPackages);
extraPackages ? [ ],
}:
let
binPath = lib.makeBinPath (
[
gitAndTools.hub
gitAndTools.delta
bc
bat
]
++ extraPackages
);
in
stdenvNoCC.mkDerivation {
pname = "git-fuzzy";
version = "unstable-2023-09-18";
src = fetchFromGitHub {
owner = "bigH";
repo = "git-fuzzy";
rev = "fb02ba3522e19ae1c69be80e2a58561fe2416155";
hash = "sha256-Eo2TCx3w3SppoXi8RZu8EC1NhLOnL39bFliHDc2YsyM=";
};
stdenvNoCC.mkDerivation {
pname = "git-fuzzy";
version = "unstable-2023-09-18";
src = fetchFromGitHub {
owner = "bigH";
repo = "git-fuzzy";
rev = "fb02ba3522e19ae1c69be80e2a58561fe2416155";
hash = "sha256-Eo2TCx3w3SppoXi8RZu8EC1NhLOnL39bFliHDc2YsyM=";
};
patches = [
./0001-load-git-config.patch
];
patches = [
./0001-load-git-config.patch
];
postPatch = ''
for GF_key in $(grep -ohr -- 'GF_[A-Z0-9_]*' lib | sort -u); do
key=''${GF_key#"GF_"}
key=''${key//_/-}
key=''${key,,}
cat >> lib/load-configs-from-git.sh <<EOF
if val=\$(git config --get fuzzy.''${key@Q}); then
export $GF_key=\$val
fi
EOF
done
postPatch = ''
for GF_key in $(grep -ohr -- 'GF_[A-Z0-9_]*' lib | sort -u); do
key=''${GF_key#"GF_"}
key=''${key//_/-}
key=''${key,,}
cat >> lib/load-configs-from-git.sh <<EOF
if val=\$(git config --get fuzzy.''${key@Q}); then
export $GF_key=\$val
fi
EOF
done
for GIT_FUZZY_key in $(grep -ohr -- 'GIT_FUZZY_[A-Z0-9_]*' lib | sort -u); do
key=''${GIT_FUZZY_key#"GIT_FUZZY_"}
key=''${key//_/-}
key=''${key,,}
cat >> lib/load-configs-from-git.sh <<EOF
if val=\$(git config --get fuzzy.''${key@Q}); then
export $GIT_FUZZY_key=\$val
fi
EOF
done
'';
for GIT_FUZZY_key in $(grep -ohr -- 'GIT_FUZZY_[A-Z0-9_]*' lib | sort -u); do
key=''${GIT_FUZZY_key#"GIT_FUZZY_"}
key=''${key//_/-}
key=''${key,,}
cat >> lib/load-configs-from-git.sh <<EOF
if val=\$(git config --get fuzzy.''${key@Q}); then
export $GIT_FUZZY_key=\$val
fi
EOF
done
'';
nativeBuildInputs = [makeWrapper];
installPhase = ''
install -m755 -D ./bin/git-fuzzy $out/bin/git-fuzzy
cp -r lib "$out/lib"
'';
nativeBuildInputs = [ makeWrapper ];
installPhase = ''
install -m755 -D ./bin/git-fuzzy $out/bin/git-fuzzy
cp -r lib "$out/lib"
'';
postFixup = ''
sed -i 's%git_fuzzy_dir="$script_dir/.."%git_fuzzy_dir='"$out"'%' $out/bin/git-fuzzy
wrapProgram "$out/bin/git-fuzzy" --prefix PATH : ${binPath}
'';
postFixup = ''
sed -i 's%git_fuzzy_dir="$script_dir/.."%git_fuzzy_dir='"$out"'%' $out/bin/git-fuzzy
wrapProgram "$out/bin/git-fuzzy" --prefix PATH : ${binPath}
'';
meta = {
description = "FZF-based github cli interface";
homepage = "https://github.com/bigH/git-fuzzy";
maintainers = with lib.maintainers; [oddlama];
license = lib.licenses.mit;
platforms = lib.platforms.all;
};
}
meta = {
description = "FZF-based github cli interface";
homepage = "https://github.com/bigH/git-fuzzy";
maintainers = with lib.maintainers; [ oddlama ];
license = lib.licenses.mit;
platforms = lib.platforms.all;
};
}

View file

@ -2,9 +2,12 @@
lib,
pkgs,
...
}: {extensions ? []}: let
inherit
(lib)
}:
{
extensions ? [ ],
}:
let
inherit (lib)
boolToString
concatMapStrings
concatStringsSep
@ -15,135 +18,163 @@
types
;
toRon = indent: value:
toRon =
indent: value:
with builtins;
if value == null
then "None"
else if isBool value
then boolToString value
else if isInt value || isFloat value
then toString value
else if isString value
then string value
else if isList value
then list indent value
else if isAttrs value
then attrs indent value
else abort "formats.ron: should never happen (value = ${value})";
if value == null then
"None"
else if isBool value then
boolToString value
else if isInt value || isFloat value then
toString value
else if isString value then
string value
else if isList value then
list indent value
else if isAttrs value then
attrs indent value
else
abort "formats.ron: should never happen (value = ${value})";
specialType = indent: {
value,
_ronType,
...
} @ args:
if _ronType == "literal"
then value
else if _ronType == "raw_string"
then rawString value
else if _ronType == "char"
then char value
else if _ronType == "optional"
then some indent value
else if _ronType == "tuple"
then tuple indent value
else if _ronType == "struct"
then struct indent args
else abort "formats.ron: should never happen (_ronType = ${_ronType})";
specialType =
indent:
{
value,
_ronType,
...
}@args:
if _ronType == "literal" then
value
else if _ronType == "raw_string" then
rawString value
else if _ronType == "char" then
char value
else if _ronType == "optional" then
some indent value
else if _ronType == "tuple" then
tuple indent value
else if _ronType == "struct" then
struct indent args
else
abort "formats.ron: should never happen (_ronType = ${_ronType})";
escapedValues = escape ["\\" "\""];
escapedValues = escape [
"\\"
"\""
];
string = value: ''"${escapedValues value}"'';
listContent = indent: values: concatStringsSep ",\n${indent}" (map (toRon indent) values);
list = indent: values:
if length values <= 1
then "[${listContent indent values}]"
else let newIndent = "${indent}\t"; in "[\n${newIndent}${listContent newIndent values}\n${indent}]";
list =
indent: values:
if length values <= 1 then
"[${listContent indent values}]"
else
let
newIndent = "${indent}\t";
in
"[\n${newIndent}${listContent newIndent values}\n${indent}]";
attrs = indent: set:
if set ? _ronType
then specialType indent set
else let
newIndent = "${indent}\t";
toEntry = n: v: "${toRon newIndent n}: ${toRon newIndent v}";
entries = concatStringsSep ",\n${newIndent}" (mapAttrsToList toEntry set);
in "{\n${indent}${entries}\n${indent}}";
attrs =
indent: set:
if set ? _ronType then
specialType indent set
else
let
newIndent = "${indent}\t";
toEntry = n: v: "${toRon newIndent n}: ${toRon newIndent v}";
entries = concatStringsSep ",\n${newIndent}" (mapAttrsToList toEntry set);
in
"{\n${indent}${entries}\n${indent}}";
rawString = value: ''r#"${value}"#'';
char = value: "'${escapedValues value}'";
some = indent: value: "Some(${toRon indent value})";
tuple = indent: values: let
newIndent = "${indent}\t";
in "(\n${newIndent}${listContent newIndent values}\n${indent})";
tuple =
indent: values:
let
newIndent = "${indent}\t";
in
"(\n${newIndent}${listContent newIndent values}\n${indent})";
struct = indent: {
name,
value,
...
}: let
newIndent = "${indent}\t";
toEntry = n: v: "${n}: ${toRon newIndent v}";
entriesStr =
if value ? _ronType
then specialType indent value
else if !builtins.isAttrs value
then toRon indent value
else let
entries = mapAttrsToList toEntry value;
entriesStrSpace = concatStringsSep ", " entries;
entriesStrNl = "\n${newIndent}${concatStringsSep ",\n${newIndent}" entries}\n${indent}";
in
if stringLength (indent + entriesStrSpace) < 120
then entriesStrSpace
else entriesStrNl;
in
if stringLength name == 0
then "(${entriesStr})"
else "${name} (${entriesStr})";
struct =
indent:
{
name,
value,
...
}:
let
newIndent = "${indent}\t";
toEntry = n: v: "${n}: ${toRon newIndent v}";
entriesStr =
if value ? _ronType then
specialType indent value
else if !builtins.isAttrs value then
toRon indent value
else
let
entries = mapAttrsToList toEntry value;
entriesStrSpace = concatStringsSep ", " entries;
entriesStrNl = "\n${newIndent}${concatStringsSep ",\n${newIndent}" entries}\n${indent}";
in
if stringLength (indent + entriesStrSpace) < 120 then entriesStrSpace else entriesStrNl;
in
if stringLength name == 0 then "(${entriesStr})" else "${name} (${entriesStr})";
toFile = value: ''${concatMapStrings (x: "${x}\n") extensions}${toRon "" value}'';
in {
type = let
valueType =
types.nullOr (types.oneOf [
types.bool
types.int
types.float
types.str
(types.attrsOf valueType)
(types.listOf valueType)
])
// {
description = "RON value";
};
in
in
{
type =
let
valueType =
types.nullOr (
types.oneOf [
types.bool
types.int
types.float
types.str
(types.attrsOf valueType)
(types.listOf valueType)
]
)
// {
description = "RON value";
};
in
valueType;
lib = let
mkType = typeName: value: {
inherit value;
_ronType = typeName;
};
in rec {
mkLiteral = mkType "literal";
rawString = mkType "raw_string";
char = mkType "character";
some = mkType "optional";
enum = mkLiteral;
tuple = mkType "tuple";
struct = name: value: {
inherit value name;
_ronType = "struct";
lib =
let
mkType = typeName: value: {
inherit value;
_ronType = typeName;
};
in
rec {
mkLiteral = mkType "literal";
rawString = mkType "raw_string";
char = mkType "character";
some = mkType "optional";
enum = mkLiteral;
tuple = mkType "tuple";
struct = name: value: {
inherit value name;
_ronType = "struct";
};
types = { };
};
types = {};
};
generate = name: value:
pkgs.runCommand name {
value = toFile value;
passAsFile = ["value"];
} ''
cp "$valuePath" "$out"
'';
generate =
name: value:
pkgs.runCommand name
{
value = toFile value;
passAsFile = [ "value" ];
}
''
cp "$valuePath" "$out"
'';
}

View file

@ -8,7 +8,12 @@
}:
writeShellApplication {
name = "clone-term";
runtimeInputs = [ps procps xdotool jq];
runtimeInputs = [
ps
procps
xdotool
jq
];
text = ''
if [[ ''${XDG_CURRENT_DESKTOP-} == sway ]]; then

View file

@ -1,10 +1,10 @@
_final: prev: {
scripts = {
brightness = prev.callPackage ./brightness.nix {};
clone-term = prev.callPackage ./clone-term.nix {};
screenshot-area = prev.callPackage ./screenshot-area.nix {};
screenshot-area-scan-qr = prev.callPackage ./screenshot-area-scan-qr.nix {};
screenshot-screen = prev.callPackage ./screenshot-screen.nix {};
volume = prev.callPackage ./volume.nix {};
brightness = prev.callPackage ./brightness.nix { };
clone-term = prev.callPackage ./clone-term.nix { };
screenshot-area = prev.callPackage ./screenshot-area.nix { };
screenshot-area-scan-qr = prev.callPackage ./screenshot-area-scan-qr.nix { };
screenshot-screen = prev.callPackage ./screenshot-screen.nix { };
volume = prev.callPackage ./volume.nix { };
};
}

View file

@ -7,7 +7,7 @@ rustPlatform.buildRustPackage rec {
pname = "zsh-histdb-skim";
version = "0.8.6";
buildInputs = [sqlite];
buildInputs = [ sqlite ];
src = fetchFromGitHub {
owner = "m42e";
repo = "zsh-histdb-skim";