Compare commits
No commits in common. "696d5439dab907f41060b8e319a9657832b2eddb" and "1a71ed17758b5ed98c8b7ece73167f78ec97fb09" have entirely different histories.
696d5439da
...
1a71ed1775
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,4 +1,2 @@
|
|||
result
|
||||
*.qcow2
|
||||
*~x
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
{pkgs, ...}: {
|
||||
script = pkgs.writeShellScript "nano-lint-nix.sh" ''
|
||||
#!/usr/bin/env bash
|
||||
set -uxeo pipefail
|
||||
|
||||
env SCRIPT_LIB_DIR=${builtins.path {
|
||||
path = ./.;
|
||||
filter = path: type:
|
||||
path == toString ./statix-to-nano-linter.jq;
|
||||
}} bash ${./statix-nano-lint.sh} $@
|
||||
'';
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -uxe
|
||||
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
|
||||
if [ ! -z "${DEBUG:-}" ]; then
|
||||
JQ_ARGS="--debug-trace"
|
||||
else
|
||||
JQ_ARGS=""
|
||||
fi
|
||||
|
||||
|
||||
statix check -o json "$@" | jq ${JQ_ARGS:-} -rnesM -L $SCRIPT_DIR -L "${SCRIPT_LIB_DIR:-}" 'include "statix-to-nano-linter"; main'
|
||||
|
|
@ -1,70 +0,0 @@
|
|||
def lpad($len; $fill):
|
||||
tostring | ($len - length) as $l | ($fill * $l)[:$l] + .;
|
||||
|
||||
# Severity Enum: https://github.com/nerdypepper/statix/blob/d324490e45bcda1b664f28b6f88da8580deda76b/lib/src/lib.rs#L21
|
||||
# Warn/Error/Hint
|
||||
def severity_or_unknown($severity):
|
||||
if
|
||||
(["Warn","Error","Hint"] | any(index($severity)))
|
||||
then
|
||||
$severity
|
||||
else "Unknown" end;
|
||||
|
||||
def severity_or_unknown: severity_or_unknown(.);
|
||||
|
||||
|
||||
# Emulating how the fancy stderr displays messages
|
||||
# https://github.com/nerdypepper/statix/blob/d324490e45bcda1b664f28b6f88da8580deda76b/bin/src/traits.rs#L112
|
||||
def severity_to_inital($severity):
|
||||
{"Warn": "W", "Error": "E", "Hint": "I"} as $mapping |
|
||||
($mapping).[$severity]
|
||||
// debug("severity '\($severity)' could not be be matched to an initial");
|
||||
|
||||
def severity_to_inital: severity_to_inital(.);
|
||||
|
||||
# Emulating how fancy stderr via ariadne & how errfmt displays
|
||||
# https://github.com/nerdypepper/statix/blob/d324490e45bcda1b664f28b6f88da8580deda76b/bin/src/traits.rs#L62
|
||||
def severity_to_name($severity):
|
||||
{
|
||||
"Warn": "Warning",
|
||||
"Error",
|
||||
"Hint": "Advice",
|
||||
"Unknown"
|
||||
} as $mapping | ($mapping).[$severity];
|
||||
|
||||
def severity_to_tag($severity; $code):
|
||||
($code | lpad(2; "0")) as $code |
|
||||
if $severity != "Unknown"
|
||||
then "[\(severity_to_inital($severity))\($code)]"
|
||||
else "[\($code)?]"
|
||||
end;
|
||||
|
||||
def print_diagnostic($filename; $report; $issue; $diagnostic):
|
||||
$diagnostic.at.from as $from |
|
||||
$from.line as $line |
|
||||
$from.column as $column |
|
||||
severity_or_unknown($issue.severity) as $severity |
|
||||
severity_to_name($severity) as $severity_name |
|
||||
severity_to_tag($severity; $issue.code) as $severity_tag |
|
||||
"\($filename):\($line):\($column): \($severity_tag) \($severity_name): \($issue.note)";
|
||||
|
||||
def process_input:
|
||||
. as $root |
|
||||
.file as $filename |
|
||||
.report as $report |
|
||||
$report[] as $issue |
|
||||
$issue.diagnostics[] as $diagnostic |
|
||||
print_diagnostic($filename; $report; $issue; $diagnostic);
|
||||
|
||||
def process_inputs:
|
||||
. as $inputs |
|
||||
if length == 0 or (. == null) then halt else
|
||||
[$inputs | .[] | process_input] | join("\n") | .+"\n" | halt_error(1)
|
||||
end;
|
||||
|
||||
def main:
|
||||
[try input catch infinite] | .[0] | if isinfinite then halt else ., inputs | process_inputs end;
|
||||
#|
|
||||
#if
|
||||
# isempty(.) or (. == null)
|
||||
#then debug("x") else (. | process_input) end;
|
|
@ -1,39 +0,0 @@
|
|||
# severity_or_unknown tests
|
||||
## All Valid Severities
|
||||
include "statix-to-nano-linter"; . | severity_or_unknown
|
||||
"Warn"
|
||||
"Warn"
|
||||
|
||||
include "statix-to-nano-linter"; severity_or_unknown
|
||||
"Error"
|
||||
"Error"
|
||||
|
||||
include "statix-to-nano-linter"; severity_or_unknown
|
||||
"Hint"
|
||||
"Hint"
|
||||
|
||||
## Invalid but used elsewhere in other code
|
||||
include "statix-to-nano-linter"; severity_or_unknown
|
||||
"Info"
|
||||
"Unknown"
|
||||
|
||||
include "statix-to-nano-linter"; severity_or_unknown
|
||||
"Advice"
|
||||
"Unknown"
|
||||
|
||||
## Fake
|
||||
include "statix-to-nano-linter"; severity_or_unknown
|
||||
"beep"
|
||||
"Unknown"
|
||||
|
||||
## Technically True
|
||||
include "statix-to-nano-linter"; severity_or_unknown
|
||||
"Unknown"
|
||||
"Unknown"
|
||||
|
||||
|
||||
# severity_to_inital tests
|
||||
# Valid
|
||||
include "statix-to-nano-linter"; severity_to_inital
|
||||
"Warn"
|
||||
"W"
|
|
@ -1,7 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -x
|
||||
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
|
||||
jq -L $SCRIPT_DIR --run-tests $SCRIPT_DIR/statix-to-nano-linter.test.jq
|
|
@ -42,5 +42,5 @@
|
|||
food-site.inputs.flake-compat.follows = "flake-compat";
|
||||
};
|
||||
|
||||
outputs = inputs: import ./outputs.nix inputs ;
|
||||
outputs = inputs: import ./outputs.nix inputs;
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ in {
|
|||
tar = "bsdtar";
|
||||
exa = "eza";
|
||||
eza = "eza --time-style long-iso";
|
||||
ls = "eza -G";
|
||||
la = "eza -Ga";
|
||||
ll = "eza -l";
|
||||
lla = "eza -lga";
|
||||
|
|
|
@ -2,6 +2,5 @@
|
|||
home.packages = with pkgs; [
|
||||
libarchive
|
||||
zip
|
||||
p7zip
|
||||
];
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
{pkgs, ...}: {
|
||||
home.packages = with pkgs; [
|
||||
cabextract
|
||||
unshield
|
||||
squashfsTools
|
||||
cpio
|
||||
lz4
|
||||
|
|
|
@ -1,5 +1 @@
|
|||
{tree, ...}: {
|
||||
imports = with tree; [
|
||||
home.programming.editors.nano
|
||||
];
|
||||
}
|
||||
{pkgs, ...}: {home.packages = with pkgs; [nano];}
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
python3
|
||||
binutils # for strings
|
||||
qrencode
|
||||
dos2unix
|
||||
|
||||
# This saves a rebuild of already cached busybox
|
||||
(pkgs.runCommand "busybox-no-applets" {} ''
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
{pkgs, ...}: {
|
||||
home.packages = with pkgs;
|
||||
[
|
||||
wmctrl
|
||||
ddcutil
|
||||
glxinfo
|
||||
|
||||
libva-utils
|
||||
vdpauinfo
|
||||
clinfo
|
||||
]
|
||||
++ (with pkgs.xorg; [
|
||||
xdpyinfo
|
||||
xprop
|
||||
xrandr
|
||||
]);
|
||||
}
|
|
@ -1,21 +1,3 @@
|
|||
{pkgs, ...}: {
|
||||
home.packages = with pkgs; [
|
||||
neofetch
|
||||
(inxi.override {
|
||||
withRecommendedSystemPrograms = true;
|
||||
})
|
||||
lm_sensors
|
||||
hddtemp
|
||||
freeipmi
|
||||
ipmitool
|
||||
smartmontools
|
||||
tree
|
||||
btop
|
||||
htop
|
||||
pciutils
|
||||
usbutils
|
||||
i2c-tools
|
||||
iotop
|
||||
iptraf-ng
|
||||
];
|
||||
home.packages = with pkgs; [neofetch inxi btop htop pciutils usbutils iotop iptraf-ng];
|
||||
}
|
||||
|
|
|
@ -1,54 +0,0 @@
|
|||
{
|
||||
self,
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
} @ inputs: let
|
||||
package =
|
||||
if inputs ? "nixosConfig"
|
||||
then inputs.nixosConfig.programs.nano.package
|
||||
else pkgs.nano;
|
||||
in {
|
||||
home.packages = with pkgs; [package deadnix statix ];
|
||||
systemd.user.tmpfiles.rules = [
|
||||
"d ${config.xdg.cacheHome}/nano - ${config.home.username} users"
|
||||
];
|
||||
|
||||
xdg.configFile."nano/nanorc".text = ''
|
||||
set softwrap
|
||||
set tabsize 2
|
||||
set autoindent
|
||||
set backup
|
||||
set backupdir "${config.xdg.cacheHome}/nano"
|
||||
set indicator
|
||||
set magic
|
||||
unset mouse
|
||||
set nonewlines
|
||||
set constantshow
|
||||
set positionlog
|
||||
set multibuffer
|
||||
unset minibar
|
||||
|
||||
bind ^I formatter all
|
||||
bind M-I formatter all
|
||||
bind Sh-M-I formatter all
|
||||
|
||||
bind ^L linter all
|
||||
bind M-L linter all
|
||||
bind Sh-M-L linter all
|
||||
|
||||
include "${package}/share/nano/*.nanorc"
|
||||
include "${package}/share/nano/extra/*.nanorc"
|
||||
include "${pkgs.nanorc}/share/*.nanorc"
|
||||
|
||||
extendsyntax rust formatter rustfmt
|
||||
extendsyntax nix formatter alejandra -t1
|
||||
extendsyntax nix linter ${pkgs.writeShellScript "nano-lint-nix.sh" (let
|
||||
statix-nano = import "${self}/extras/statix-nano/statix-nano-lint.nix" inputs;
|
||||
in ''
|
||||
#!/usr/bin/env bash
|
||||
set -uxeo pipefail
|
||||
deadnix $@ -o json | jq -r '.file as $filename | .results | .[] | $filename + ":" + (.line|tostring) + ":" + (.column|tostring) + ": " + .message'
|
||||
'')}
|
||||
'';
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
{pkgs, ...}: {
|
||||
home.packages = with pkgs; [
|
||||
ilspycmd
|
||||
];
|
||||
}
|
|
@ -3,6 +3,6 @@
|
|||
binwalk
|
||||
file
|
||||
binutils
|
||||
diffoscopeMinimal
|
||||
diffoscope
|
||||
];
|
||||
}
|
|
@ -28,11 +28,9 @@
|
|||
imports = with tree; [
|
||||
home.base
|
||||
home.dev.all
|
||||
home.reversing
|
||||
home.homeFolders
|
||||
home.musicLibrary
|
||||
|
||||
home.programming.editors.nano
|
||||
home.programming.editors.vscode
|
||||
home.programming.languages.rust
|
||||
home.programming.languages.nix
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
{...}: {
|
||||
programs.nano.syntaxHighlight = false;
|
||||
}
|
|
@ -19,4 +19,4 @@ fi
|
|||
|
||||
|
||||
sudo cpupower frequency-set -g performance
|
||||
nixos-rebuild --fast --flake "${REPO_ROOT}#$(hostname)" "$MODE" "$@"
|
||||
nixos-rebuild --flake "${REPO_ROOT}#$(hostname)" "$MODE" "$@"
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
disabled = [
|
||||
"empty_pattern",
|
||||
"repeated_keys"
|
||||
"empty_pattern"
|
||||
]
|
||||
|
|
Loading…
Reference in a new issue