chore: Fix nixd / statix errors

I'm okay with editing hardware-configuration.nix now that I understand
how it works.
This commit is contained in:
Donovan Glover 2024-08-03 01:51:58 -04:00
parent b397048a31
commit f73e302f2e
No known key found for this signature in database
GPG Key ID: EA7408A77AE1BE65
6 changed files with 325 additions and 314 deletions

View File

@ -90,7 +90,7 @@
let let
directory = replaceStrings flakeOutputs flakeDirectories attributeName; directory = replaceStrings flakeOutputs flakeDirectories attributeName;
attributeValue = (listToAttrs attributeValue = listToAttrs
(map (map
(file: { (file: {
name = replaceStrings [ ".nix" ] [ "" ] file; name = replaceStrings [ ".nix" ] [ "" ] file;
@ -107,9 +107,9 @@
} }
else import ./${directory}/${file}; else import ./${directory}/${file};
}) })
(attrNames (readDir ./${directory})))); (attrNames (readDir ./${directory})));
aarch64Packages = (listToAttrs aarch64Packages = listToAttrs
(map (map
(file: { (file: {
name = replaceStrings [ ".nix" ] [ "" ] file; name = replaceStrings [ ".nix" ] [ "" ] file;
@ -118,7 +118,7 @@
then aarch64-linux.callPackage ./${directory}/${file} { } then aarch64-linux.callPackage ./${directory}/${file} { }
else null; else null;
}) })
(attrNames (readDir ./${directory})))); (attrNames (readDir ./${directory})));
attributeSet = attributeSet =
if directory == "packages" if directory == "packages"
@ -133,7 +133,7 @@
} }
else attributeValue; else attributeValue;
in in
(attributeSet); attributeSet;
}) })
(flakeOutputs))); flakeOutputs));
} }

View File

@ -261,80 +261,82 @@ in
''; '';
}; };
xdg.configFile.${gapsScript} = { xdg.configFile = {
executable = true; ${gapsScript} = {
text = /* fish */ '' executable = true;
#!/usr/bin/env fish text = /* fish */ ''
#!/usr/bin/env fish
hyprctl keyword general:gaps_out $(math 10 - $(hyprctl getoption general:gaps_out -j | jq -r ".custom" | choose 1)) hyprctl keyword general:gaps_out $(math 10 - $(hyprctl getoption general:gaps_out -j | jq -r ".custom" | choose 1))
hyprctl keyword general:gaps_in $(math 5 - $(hyprctl getoption general:gaps_in -j | jq -r ".custom" | choose 1)) hyprctl keyword general:gaps_in $(math 5 - $(hyprctl getoption general:gaps_in -j | jq -r ".custom" | choose 1))
hyprctl keyword general:border_size $(math 2 - $(hyprctl getoption general:border_size -j | jq -r ".int")) hyprctl keyword general:border_size $(math 2 - $(hyprctl getoption general:border_size -j | jq -r ".int"))
hyprctl keyword decoration:rounding $(math 8 - $(hyprctl getoption decoration:rounding -j | jq -r ".int")) hyprctl keyword decoration:rounding $(math 8 - $(hyprctl getoption decoration:rounding -j | jq -r ".int"))
''; '';
}; };
xdg.configFile.${setBackgroundScript} = { ${setBackgroundScript} = {
executable = true; executable = true;
text = /* fish */ '' text = /* fish */ ''
#!/usr/bin/env fish #!/usr/bin/env fish
if [ (hyprctl getoption animations:enabled -j | jq -r ".int") = "1" ] if [ (hyprctl getoption animations:enabled -j | jq -r ".int") = "1" ]
swww img \ swww img \
--transition-type $(random choice grow wave outer) \ --transition-type $(random choice grow wave outer) \
--transition-wave 80,40 \ --transition-wave 80,40 \
--transition-angle $(random choice 45 90 135 225 270 315) \ --transition-angle $(random choice 45 90 135 225 270 315) \
--transition-pos $(random choice center top left right bottom top-left top-right bottom-left bottom-right) \ --transition-pos $(random choice center top left right bottom top-left top-right bottom-left bottom-right) \
--transition-step 200 \ --transition-step 200 \
--transition-duration 1.5 \ --transition-duration 1.5 \
--transition-fps 240 \ --transition-fps 240 \
--outputs "$argv[1]" \ --outputs "$argv[1]" \
"$argv[2]" "$argv[2]"
else else
swww img \ swww img \
--transition-type simple \ --transition-type simple \
--transition-step 255 \ --transition-step 255 \
--outputs "$argv[1]" \ --outputs "$argv[1]" \
"$argv[2]" "$argv[2]"
end end
''; '';
}; };
xdg.configFile.${randomBackgroundScript} = { ${randomBackgroundScript} = {
executable = true; executable = true;
text = /* fish */ '' text = /* fish */ ''
#!/usr/bin/env fish #!/usr/bin/env fish
for monitor in (hyprctl monitors -j | jq -r '.[].name') for monitor in (hyprctl monitors -j | jq -r '.[].name')
~/.config/${setBackgroundScript} "$monitor" "$(random choice $(fd . ${osu-backgrounds}/2024-07-15-Aerial-Antics-Art-Contest-All-Entries --follow -e jpg -e png))" ~/.config/${setBackgroundScript} "$monitor" "$(random choice $(fd . ${osu-backgrounds}/2024-07-15-Aerial-Antics-Art-Contest-All-Entries --follow -e jpg -e png))"
end end
''; '';
}; };
xdg.configFile.${swapBackgroundScript} = { ${swapBackgroundScript} = {
executable = true; executable = true;
text = /* fish */ '' text = /* fish */ ''
#!/usr/bin/env fish #!/usr/bin/env fish
set M "$(swww query | cut -d ':' -f 5)" set M "$(swww query | cut -d ':' -f 5)"
set M1 "$(echo "$M" | head -n 1 | awk '{$1=$1};1')" set M1 "$(echo "$M" | head -n 1 | awk '{$1=$1};1')"
set M2 "$(echo "$M" | tail -n 1 | awk '{$1=$1};1')" set M2 "$(echo "$M" | tail -n 1 | awk '{$1=$1};1')"
~/.config/${setBackgroundScript} "$(swww query | choose 0 | choose -c 0..-1 | tail -n 1)" "$M1" ~/.config/${setBackgroundScript} "$(swww query | choose 0 | choose -c 0..-1 | tail -n 1)" "$M1"
~/.config/${setBackgroundScript} "$(swww query | choose 0 | choose -c 0..-1 | head -n 1)" "$M2" ~/.config/${setBackgroundScript} "$(swww query | choose 0 | choose -c 0..-1 | head -n 1)" "$M2"
''; '';
}; };
xdg.configFile.${monitorScript} = { ${monitorScript} = {
executable = true; executable = true;
text = /* fish */ '' text = /* fish */ ''
#!/usr/bin/env fish #!/usr/bin/env fish
if test -n "$(hyprctl monitors -j | jq -r '.[] | select(.name | contains("eDP-1"))')" if test -n "$(hyprctl monitors -j | jq -r '.[] | select(.name | contains("eDP-1"))')"
hyprctl keyword monitor eDP-1,disable hyprctl keyword monitor eDP-1,disable
else else
hyprctl keyword monitor eDP-1,preferred,auto-left,1 hyprctl keyword monitor eDP-1,preferred,auto-left,1
end end
''; '';
};
}; };
programs.hyprlock = { programs.hyprlock = {

View File

@ -13,259 +13,261 @@ in
{ {
home.packages = [ ironbar ]; home.packages = [ ironbar ];
xdg.configFile."ironbar/config.json".text = toJSON { xdg.configFile = {
name = "main"; "ironbar/config.json".text = toJSON {
icon_theme = "Fluent-dark"; name = "main";
position = "bottom"; icon_theme = "Fluent-dark";
anchor_to_edges = true; position = "bottom";
anchor_to_edges = true;
start = [ start = [
{ {
name = "startMenu"; name = "startMenu";
type = "label"; type = "label";
label = ""; label = "";
on_mouse_enter = "rofi -show drun"; on_mouse_enter = "rofi -show drun";
} }
{ {
type = "script"; type = "script";
on_click_left = "mullvad relay set location any && mullvad relay set location us"; on_click_left = "mullvad relay set location any && mullvad relay set location us";
cmd = "~/.config/${mullvadScript}"; cmd = "~/.config/${mullvadScript}";
mode = "watch"; mode = "watch";
} }
]; ];
center = singleton { center = singleton {
type = "launcher"; type = "launcher";
icon_size = 39; icon_size = 39;
favorites = [ favorites = [
"librewolf" "librewolf"
"kitty" "kitty"
"thunar" "thunar"
"org.qutebrowser.qutebrowser" "org.qutebrowser.qutebrowser"
"anki" "anki"
];
};
end = [
{
type = "script";
cmd = "~/.config/${volumeScript}";
on_click_left = "swayosd-client --output-volume raise";
on_click_right = "swayosd-client --output-volume lower";
mode = "watch";
}
{
type = "upower";
show_if = "upower -e | grep BAT";
}
{
type = "clock";
format = "%x%a%R";
}
{
type = "notifications";
}
]; ];
}; };
end = [ "ironbar/style.css".text = /* css */ ''
{ * {
type = "script"; font-family: "Noto Sans CJK JP", "Font Awesome 6 Free Solid";
cmd = "~/.config/${volumeScript}"; font-size: 16px;
on_click_left = "swayosd-client --output-volume raise"; text-shadow: 2px 2px #${base00};
on_click_right = "swayosd-client --output-volume lower"; border: none;
mode = "watch"; border-radius: 0;
outline: none;
font-weight: 500;
background: none;
color: #${base05};
} }
{
type = "upower"; .background {
show_if = "upower -e | grep BAT"; background: alpha(#${base00}, 0.925);
} }
{
type = "clock"; button:hover {
format = "%x%a%R"; background: #${base01};
} }
{
type = "notifications"; #bar {
border-top: 1px solid #${base01};
} }
];
};
xdg.configFile."ironbar/style.css".text = /* css */ '' .label, .script, .tray {
* { padding-left: 0.5em;
font-family: "Noto Sans CJK JP", "Font Awesome 6 Free Solid"; padding-right: 0.5em;
font-size: 16px; }
text-shadow: 2px 2px #${base00};
border: none;
border-radius: 0;
outline: none;
font-weight: 500;
background: none;
color: #${base05};
}
.background { .notifications button {
background: alpha(#${base00}, 0.925); padding-left: 0.2em;
} padding-right: 0.7em;
}
button:hover { .upower {
background: #${base01}; padding-left: 0.2em;
} padding-right: 0.2em;
}
#bar { .upower .label {
border-top: 1px solid #${base01}; padding-left: 0;
} padding-right: 0;
}
.label, .script, .tray { .popup {
padding-left: 0.5em; border: 1px solid #${base01};
padding-right: 0.5em; padding: 1em;
} }
.notifications button { .clock {
padding-left: 0.2em; padding-right: 0.4em;
padding-right: 0.7em; }
}
.upower { .popup-clock .calendar-clock {
padding-left: 0.2em; font-family: "Maple Mono";
padding-right: 0.2em; font-size: 2.5em;
} padding-bottom: 0.1em;
}
.upower .label { .popup-clock .calendar .header {
padding-left: 0; padding-top: 1em;
padding-right: 0; border-top: 1px solid #${base01};
} font-size: 1.5em;
}
.popup { .popup-clock .calendar {
border: 1px solid #${base01}; padding: 0.2em 0.4em;
padding: 1em; }
}
.clock { .popup-clock .calendar:selected {
padding-right: 0.4em; color: #${base0D};
} }
.popup-clock .calendar-clock { .launcher .item {
font-family: "Maple Mono"; padding-left: 1em;
font-size: 2.5em; padding-right: 1em;
padding-bottom: 0.1em; margin-right: 4px;
} }
.popup-clock .calendar .header { button:active {
padding-top: 1em; background: #${base04};
border-top: 1px solid #${base01}; }
font-size: 1.5em;
}
.popup-clock .calendar { .launcher .open {
padding: 0.2em 0.4em; box-shadow: inset 0 -2px #${base04};
} }
.popup-clock .calendar:selected { .launcher .focused {
color: #${base0D}; box-shadow: inset 0 -2px #${base0D};
} background: #${base01};
}
.launcher .item { .popup-launcher {
padding-left: 1em; padding: 0;
padding-right: 1em; }
margin-right: 4px;
}
button:active { .popup-launcher .popup-item:not(:first-child) {
background: #${base04}; border-top: 1px solid #${base01};
} }
.launcher .open { #startMenu {
box-shadow: inset 0 -2px #${base04}; padding-left: 1em;
} padding-right: 0.5em;
}
.launcher .focused {
box-shadow: inset 0 -2px #${base0D};
background: #${base01};
}
.popup-launcher {
padding: 0;
}
.popup-launcher .popup-item:not(:first-child) {
border-top: 1px solid #${base01};
}
#startMenu {
padding-left: 1em;
padding-right: 0.5em;
}
'';
xdg.configFile.${mullvadScript} = {
executable = true;
text = /* fish */ ''
#!/usr/bin/env fish
sleep 2
function get_mullvad_status
if test -z "$inside"
set inside true
test -n "$initialized" && sleep 0.2
set MULLVAD (mullvad status | head -1)
set LOCATION (echo "$MULLVAD" | choose 4.. | sed \
-e 's/Ashburn.*//g' \
-e 's/Atlanta.*//g' \
-e 's/Boston.*//g' \
-e 's/Charlotte.*//g' \
-e 's/Chicago.*//g' \
-e 's/Cleveland.*//g' \
-e 's/Dallas.*//g' \
-e 's/Detroit.*//g' \
-e 's/Denver.*//g' \
-e 's/Honolulu.*//g' \
-e 's/Houston.*//g' \
-e 's/Jackson.*//g' \
-e 's/Los Angeles.*//g' \
-e 's/Louisville.*//g' \
-e 's/McAllen.*//g' \
-e 's/Miami.*//g' \
-e 's/Milwaukee.*//g' \
-e 's/Minneapolis.*//g' \
-e 's/New York.*//g' \
-e 's/Oklahoma.*//g' \
-e 's/Philadelphia.*//g' \
-e 's/Phoenix.*//g' \
-e 's/Piscataway.*//g' \
-e 's/Portland.*//g' \
-e 's/Raleigh.*//g' \
-e 's/Richmond.*//g' \
-e 's/Salt Lake.*//g' \
-e 's/San Francisco.*//g' \
-e 's/San Jose.*//g' \
-e 's/Seattle.*//g' \
-e 's/Secaucus.*//g' \
-e 's/Sioux Falls.*//g' \
-e 's/St. Louis.*//g' \
-e 's/Stamford.*//g' \
-e 's/Washington.*//g'
)
echo "$LOCATION"
set -e inside
end
end
get_mullvad_status
set initialized true
${inotify-tools}/bin/inotifywait -q -e close_write,moved_to,create -m /etc/mullvad-vpn |
while read directory events filename
get_mullvad_status
end
''; '';
};
xdg.configFile.${volumeScript} = { ${mullvadScript} = {
executable = true; executable = true;
text = /* fish */ '' text = /* fish */ ''
#!/usr/bin/env fish #!/usr/bin/env fish
sleep 2
function get_mullvad_status
if test -z "$inside"
set inside true
test -n "$initialized" && sleep 0.2
set MULLVAD (mullvad status | head -1)
set LOCATION (echo "$MULLVAD" | choose 4.. | sed \
-e 's/Ashburn.*//g' \
-e 's/Atlanta.*//g' \
-e 's/Boston.*//g' \
-e 's/Charlotte.*//g' \
-e 's/Chicago.*//g' \
-e 's/Cleveland.*//g' \
-e 's/Dallas.*//g' \
-e 's/Detroit.*//g' \
-e 's/Denver.*//g' \
-e 's/Honolulu.*//g' \
-e 's/Houston.*//g' \
-e 's/Jackson.*//g' \
-e 's/Los Angeles.*//g' \
-e 's/Louisville.*//g' \
-e 's/McAllen.*//g' \
-e 's/Miami.*//g' \
-e 's/Milwaukee.*//g' \
-e 's/Minneapolis.*//g' \
-e 's/New York.*//g' \
-e 's/Oklahoma.*//g' \
-e 's/Philadelphia.*//g' \
-e 's/Phoenix.*//g' \
-e 's/Piscataway.*//g' \
-e 's/Portland.*//g' \
-e 's/Raleigh.*//g' \
-e 's/Richmond.*//g' \
-e 's/Salt Lake.*//g' \
-e 's/San Francisco.*//g' \
-e 's/San Jose.*//g' \
-e 's/Seattle.*//g' \
-e 's/Secaucus.*//g' \
-e 's/Sioux Falls.*//g' \
-e 's/St. Louis.*//g' \
-e 's/Stamford.*//g' \
-e 's/Washington.*//g'
)
echo "$LOCATION"
set -e inside
end
end
get_mullvad_status
set initialized true
${inotify-tools}/bin/inotifywait -q -e close_write,moved_to,create -m /etc/mullvad-vpn |
while read directory events filename
get_mullvad_status
end
'';
};
${volumeScript} = {
executable = true;
text = /* fish */ ''
#!/usr/bin/env fish
function get_volume
set VOLUME (wpctl get-volume @DEFAULT_AUDIO_SINK@ | choose 1)
echo "$(math "$VOLUME * 100")%"
end
~/.config/${volumeGet}
pactl subscribe | grep --line-buffered -e "" | xargs -L 1 ~/.config/${volumeGet}
'';
};
${volumeGet} = {
executable = true;
text = /* fish */ ''
#!/usr/bin/env fish
function get_volume
set VOLUME (wpctl get-volume @DEFAULT_AUDIO_SINK@ | choose 1) set VOLUME (wpctl get-volume @DEFAULT_AUDIO_SINK@ | choose 1)
echo "$(math "$VOLUME * 100")%" echo "$(math "$VOLUME * 100")%"
end '';
};
~/.config/${volumeGet}
pactl subscribe | grep --line-buffered -e "" | xargs -L 1 ~/.config/${volumeGet}
'';
};
xdg.configFile.${volumeGet} = {
executable = true;
text = /* fish */ ''
#!/usr/bin/env fish
set VOLUME (wpctl get-volume @DEFAULT_AUDIO_SINK@ | choose 1)
echo "$(math "$VOLUME * 100")%"
'';
}; };
} }

View File

@ -5,10 +5,15 @@
(modulesPath + "/installer/scan/not-detected.nix") (modulesPath + "/installer/scan/not-detected.nix")
]; ];
boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "usb_storage" "sd_mod" ]; boot = {
boot.initrd.kernelModules = [ ]; initrd = {
boot.kernelModules = [ "kvm-amd" ]; availableKernelModules = [ "nvme" "xhci_pci" "usb_storage" "sd_mod" ];
boot.extraModulePackages = [ ]; kernelModules = [ ];
};
kernelModules = [ "kvm-amd" ];
extraModulePackages = [ ];
};
fileSystems."/" = { fileSystems."/" = {
device = "/dev/disk/by-label/nixos"; device = "/dev/disk/by-label/nixos";

View File

@ -171,18 +171,19 @@ in
fonts = { fonts = {
enableDefaultPackages = false; enableDefaultPackages = false;
packages = with pkgs; [ packages = [
noto-fonts
noto-fonts-cjk-sans noto-fonts-cjk-sans
noto-fonts-cjk-serif
noto-fonts-emoji noto-fonts-emoji
maple-mono maple-mono
aleo-fonts
] ++ (with pkgs; [
noto-fonts
noto-fonts-cjk-serif
font-awesome font-awesome
(nerdfonts.override { fonts = [ "Noto" ]; }) (nerdfonts.override { fonts = [ "Noto" ]; })
kanji-stroke-order-font kanji-stroke-order-font
liberation_ttf liberation_ttf
aleo-fonts ]);
];
fontconfig = { fontconfig = {
defaultFonts = { defaultFonts = {

View File

@ -6,11 +6,12 @@ let
inherit (builtins) attrValues; inherit (builtins) attrValues;
in in
{ {
config = { users.defaultUserShell = fish;
users.defaultUserShell = fish;
environment.shells = [ fish ];
environment.sessionVariables = { environment = {
shells = [ fish ];
sessionVariables = {
GIT_DISCOVERY_ACROSS_FILESYSTEM = "1"; GIT_DISCOVERY_ACROSS_FILESYSTEM = "1";
FZF_DEFAULT_OPTS = "--height 40% --reverse --border --color=16"; FZF_DEFAULT_OPTS = "--height 40% --reverse --border --color=16";
NODE_OPTIONS = "--max-old-space-size=16384"; NODE_OPTIONS = "--max-old-space-size=16384";
@ -18,7 +19,7 @@ in
GATSBY_TELEMETRY_DISABLED = "1"; GATSBY_TELEMETRY_DISABLED = "1";
}; };
environment.systemPackages = mkMerge [ systemPackages = mkMerge [
(attrValues { (attrValues {
inherit (pkgs) inherit (pkgs)
wget wget
@ -119,15 +120,15 @@ in
; ;
}) })
]; ];
};
programs = { programs = {
fish.enable = true; fish.enable = true;
neovim.enable = true; neovim.enable = true;
direnv = { direnv = {
enable = true; enable = true;
silent = true; silent = true;
};
}; };
}; };
} }