style(nix): format with Fmt
All checks were successful
Check Formatting of Files / Check-Formatting (push) Successful in 53s

This commit is contained in:
Price Hiller 2024-04-19 22:27:46 -05:00
parent 18059076ae
commit bea2a0bac8
Signed by: Price
GPG Key ID: C3FADDE7A8534BEB
8 changed files with 313 additions and 196 deletions

View File

@ -1,8 +1,16 @@
{ pkgs, config, lib, ... }: {
pkgs,
config,
lib,
...
}:
let let
dotsDir = "${config.home.homeDirectory}/.config/home-manager/dots"; dotsDir = "${config.home.homeDirectory}/.config/home-manager/dots";
softLinkDots = dir: softLinkDots =
(builtins.listToAttrs (map (n: { dir:
(builtins.listToAttrs (
map
(n: {
name = "${dir + "/" + n}"; name = "${dir + "/" + n}";
value = { value = {
source = config.lib.file.mkOutOfStoreSymlink "${dotsDir}/${dir}/${n}"; source = config.lib.file.mkOutOfStoreSymlink "${dotsDir}/${dir}/${n}";
@ -10,8 +18,10 @@ let
}; };
}) })
# HACK: We don't use the absolute path in readDir to respect pure evaluation in nix flakes. # HACK: We don't use the absolute path in readDir to respect pure evaluation in nix flakes.
(builtins.attrNames (builtins.readDir ../dots/${dir})))); (builtins.attrNames (builtins.readDir ../dots/${dir}))
nixGLWrap = pkg: ));
nixGLWrap =
pkg:
pkgs.runCommand "${pkg.name}-nixgl-wrapper" { } '' pkgs.runCommand "${pkg.name}-nixgl-wrapper" { } ''
mkdir $out mkdir $out
ln -s ${pkg}/* $out ln -s ${pkg}/* $out
@ -23,10 +33,12 @@ let
chmod +x $wrapped_bin chmod +x $wrapped_bin
done done
''; '';
in { in
{
programs.home-manager.enable = true; programs.home-manager.enable = true;
home = { home = {
packages = with pkgs; packages =
with pkgs;
[ [
Fmt Fmt
nodePackages.prettier nodePackages.prettier
@ -85,7 +97,16 @@ in {
keyd keyd
tidal-hifi tidal-hifi
nix-output-monitor nix-output-monitor
] ++ [ go (lib.hiPrio gotools) ] ++ [ age age-plugin-yubikey passage ] ]
++ [
go
(lib.hiPrio gotools)
]
++ [
age
age-plugin-yubikey
passage
]
++ [ ++ [
libsForQt5.qtstyleplugins libsForQt5.qtstyleplugins
libsForQt5.qtcurve libsForQt5.qtcurve
@ -93,7 +114,12 @@ in {
gtk-engine-murrine gtk-engine-murrine
gnome.gnome-themes-extra gnome.gnome-themes-extra
gtk_engines gtk_engines
] ++ [ ansible ansible-lint ] ++ [ ]
++ [
ansible
ansible-lint
]
++ [
# gnumake # gnumake
# cmake # cmake
# gcc # gcc
@ -120,8 +146,7 @@ in {
} // softLinkDots ".config"; } // softLinkDots ".config";
sessionVariables = { sessionVariables = {
TERMINFO_DIRS = TERMINFO_DIRS = "${config.home.homeDirectory}/.nix-profile/share/terminfo";
"${config.home.homeDirectory}/.nix-profile/share/terminfo";
WSLENV = "TERMINFO_DIRS"; WSLENV = "TERMINFO_DIRS";
LOCALE_ARCHIVE = "${pkgs.glibcLocales}/lib/locale/locale-archive"; LOCALE_ARCHIVE = "${pkgs.glibcLocales}/lib/locale/locale-archive";
}; };
@ -146,7 +171,6 @@ in {
"application/xhtml+xml" = [ "firefoxdeveloperedition.desktop" ]; "application/xhtml+xml" = [ "firefoxdeveloperedition.desktop" ];
"application/x-extension-xhtml" = [ "firefoxdeveloperedition.desktop" ]; "application/x-extension-xhtml" = [ "firefoxdeveloperedition.desktop" ];
"application/x-extension-xht" = [ "firefoxdeveloperedition.desktop" ]; "application/x-extension-xht" = [ "firefoxdeveloperedition.desktop" ];
}; };
defaultApplications = { defaultApplications = {
"application/pdf" = [ "org.pwmt.zathura.desktop" ]; "application/pdf" = [ "org.pwmt.zathura.desktop" ];
@ -160,7 +184,6 @@ in {
"application/xhtml+xml" = [ "firefoxdeveloperedition.desktop" ]; "application/xhtml+xml" = [ "firefoxdeveloperedition.desktop" ];
"application/x-extension-xhtml" = [ "firefoxdeveloperedition.desktop" ]; "application/x-extension-xhtml" = [ "firefoxdeveloperedition.desktop" ];
"application/x-extension-xht" = [ "firefoxdeveloperedition.desktop" ]; "application/x-extension-xht" = [ "firefoxdeveloperedition.desktop" ];
}; };
}; };
systemDirs.data = [ systemDirs.data = [
@ -232,7 +255,9 @@ in {
enable = true; enable = true;
userName = "Price Hiller"; userName = "Price Hiller";
userEmail = "price@orion-technologies.io"; userEmail = "price@orion-technologies.io";
aliases = { unstage = "reset HEAD --"; }; aliases = {
unstage = "reset HEAD --";
};
extraConfig = { extraConfig = {
init.defaultBranch = "Development"; init.defaultBranch = "Development";
merge.conflictstyle = "zdiff3"; merge.conflictstyle = "zdiff3";
@ -291,7 +316,9 @@ in {
options = { options = {
navigate = true; navigate = true;
features = "interactive decorations"; features = "interactive decorations";
interactive = { keep-plus-minus-markers = false; }; interactive = {
keep-plus-minus-markers = false;
};
decorations = { decorations = {
commit-decoration-style = "bold box ul"; commit-decoration-style = "bold box ul";
dark = true; dark = true;
@ -317,7 +344,8 @@ in {
platformTheme.name = "gtk"; platformTheme.name = "gtk";
}; };
gtk = let gtk =
let
extraGtkConfig = { extraGtkConfig = {
gtk-application-prefer-dark-theme = true; gtk-application-prefer-dark-theme = true;
gtk-cursor-theme-size = 0; gtk-cursor-theme-size = 0;
@ -327,7 +355,8 @@ in {
gtk-xft-hinting = 1; gtk-xft-hinting = 1;
gtk-xft-hintstyle = "hintfull"; gtk-xft-hintstyle = "hintfull";
}; };
in { in
{
enable = true; enable = true;
theme = { theme = {
name = "Kanagawa-BL"; name = "Kanagawa-BL";
@ -388,19 +417,30 @@ in {
device = "default"; device = "default";
color = "red"; color = "red";
arrowSize = 5; arrowSize = 5;
modifiers = [ "CONTROL" "SHIFT" ]; modifiers = [
"CONTROL"
"SHIFT"
];
} }
{ {
device = "default"; device = "default";
color = "blue"; color = "blue";
arrowSize = 5; arrowSize = 5;
modifiers = [ "CONTROL" "SHIFT" "2" ]; modifiers = [
"CONTROL"
"SHIFT"
"2"
];
} }
{ {
device = "default"; device = "default";
color = "yellow"; color = "yellow";
arrowSize = 5; arrowSize = 5;
modifiers = [ "CONTROL" "SHIFT" "3" ]; modifiers = [
"CONTROL"
"SHIFT"
"3"
];
} }
]; ];
}; };
@ -425,7 +465,10 @@ in {
targets.compositor = { targets.compositor = {
Unit = { Unit = {
Description = "Unit for DE to launch"; Description = "Unit for DE to launch";
ConditionEnvironment = [ "WAYLAND_DISPLAY" "DISPLAY" ]; ConditionEnvironment = [
"WAYLAND_DISPLAY"
"DISPLAY"
];
}; };
}; };
services = { services = {
@ -439,7 +482,8 @@ in {
rm -f $XDG_RUNTIME_DIR/swww.socket || exit 1 rm -f $XDG_RUNTIME_DIR/swww.socket || exit 1
fi fi
''; '';
in { in
{
RestartSec = 3; RestartSec = 3;
PassEnvironment = [ "XDG_RUNTIME_DIR" ]; PassEnvironment = [ "XDG_RUNTIME_DIR" ];
ExecStartPre = "${cleanup-socket-script}"; ExecStartPre = "${cleanup-socket-script}";
@ -462,8 +506,11 @@ in {
"SWWW_TRANSITION_STEP=30" "SWWW_TRANSITION_STEP=30"
"SWWW_TRANSITION_DURATION=0.75" "SWWW_TRANSITION_DURATION=0.75"
]; ];
ExecStart = let wallpaper-dir = "${dotsDir}/.local/share/wallpapers"; ExecStart =
in [ let
wallpaper-dir = "${dotsDir}/.local/share/wallpapers";
in
[
"${pkgs.swww}/bin/swww img -t random ${wallpaper-dir}/Nebula.jpg" "${pkgs.swww}/bin/swww img -t random ${wallpaper-dir}/Nebula.jpg"
"${pkgs.swww}/bin/swww img -t wipe --transition-angle 40 -o eDP-1 ${wallpaper-dir}/Autumn-Leaves.jpg" "${pkgs.swww}/bin/swww img -t wipe --transition-angle 40 -o eDP-1 ${wallpaper-dir}/Autumn-Leaves.jpg"
]; ];
@ -497,14 +544,16 @@ in {
After = [ "compositor.target" ]; After = [ "compositor.target" ];
}; };
}; };
gromit-mpx.Service.ExecStart = gromit-mpx.Service.ExecStart = lib.mkForce "echo 'Disabled, managed by WM'";
lib.mkForce "echo 'Disabled, managed by WM'";
opensnitch-ui = { opensnitch-ui = {
Service.RestartSec = 3; Service.RestartSec = 3;
Install.WantedBy = [ "compositor.target" ]; Install.WantedBy = [ "compositor.target" ];
Unit = { Unit = {
PartOf = [ "compositor.target" ]; PartOf = [ "compositor.target" ];
After = [ "compositor.target" "waybar.service" ]; After = [
"compositor.target"
"waybar.service"
];
}; };
}; };
easyeffects = { easyeffects = {

View File

@ -9,7 +9,7 @@
}, },
"locked": { "locked": {
"lastModified": 1, "lastModified": 1,
"narHash": "sha256-w//f0CiJqZtYO1MYA7DzwPnNFZh/dxPx6+ZP9tNoUEs=", "narHash": "sha256-nQ8iqn/VyJJc96TlwtT6SvKcPFZKFA99tnk6pKgxkWE=",
"path": "pkgs/Fmt", "path": "pkgs/Fmt",
"type": "path" "type": "path"
}, },

View File

@ -36,28 +36,37 @@
}; };
}; };
outputs = inputs@{ self, home-manager, nixpkgs, ... }: outputs =
inputs@{
self,
home-manager,
nixpkgs,
...
}:
let let
system = "x86_64-linux"; system = "x86_64-linux";
username = "sam"; username = "sam";
pkgs = nixpkgs.legacyPackages.${system}; pkgs = nixpkgs.legacyPackages.${system};
in { in
{
packages.x86_64-linux.default = home-manager.defaultPackage.x86_64-linux; packages.x86_64-linux.default = home-manager.defaultPackage.x86_64-linux;
checks.${system} = { checks.${system} = {
formatting = pkgs.runCommand "check-dot-file-formatting" { formatting =
pkgs.runCommand "check-dot-file-formatting"
{
buildInputs = with pkgs; [ buildInputs = with pkgs; [
findutils findutils
inputs.Fmt.packages.x86_64-linux.default inputs.Fmt.packages.x86_64-linux.default
]; ];
} '' }
''
set -euo pipefail set -euo pipefail
cd ${self} cd ${self}
Fmt -- $(find . -type f) Fmt -- $(find . -type f)
printf "TEST COMPLETED!\n" > $out printf "TEST COMPLETED!\n" > $out
''; '';
}; };
homeConfigurations.${username} = homeConfigurations.${username} = home-manager.lib.homeManagerConfiguration {
home-manager.lib.homeManagerConfiguration {
inherit pkgs; inherit pkgs;
extraSpecialArgs = { extraSpecialArgs = {
inherit inputs; inherit inputs;
@ -80,8 +89,7 @@
''; '';
}); });
opensnitch-ui = prev.opensnitch-ui.overrideAttrs (oldAttrs: { opensnitch-ui = prev.opensnitch-ui.overrideAttrs (oldAttrs: {
propagatedBuildInputs = oldAttrs.propagatedBuildInputs propagatedBuildInputs = oldAttrs.propagatedBuildInputs ++ [ prev.python311Packages.qt-material ];
++ [ prev.python311Packages.qt-material ];
}); });
}) })
]; ];
@ -94,13 +102,16 @@
./config ./config
]; ];
}; };
} // inputs.flake-utils.lib.eachDefaultSystem (system: }
// inputs.flake-utils.lib.eachDefaultSystem (
system:
let let
pkgs = import nixpkgs { pkgs = import nixpkgs {
inherit system; inherit system;
overlays = [ inputs.agenix.overlays.default ]; overlays = [ inputs.agenix.overlays.default ];
}; };
in { in
{
devShells.default = pkgs.mkShell { devShells.default = pkgs.mkShell {
packages = with pkgs; [ packages = with pkgs; [
age age
@ -113,5 +124,6 @@
export RULES="$PWD/secrets/secrets.nix" export RULES="$PWD/secrets/secrets.nix"
''; '';
}; };
}); }
);
} }

View File

@ -1,31 +1,40 @@
# Some of these functions were taken from https://github.com/NixOS/nixpkgs/blob/master/lib/ # Some of these functions were taken from https://github.com/NixOS/nixpkgs/blob/master/lib/
{ lib ? (import <nixpkgs> { }).lib }: rec { {
hasSuffix = suffix: string: lib ? (import <nixpkgs> { }).lib,
}:
rec {
hasSuffix =
suffix: string:
let let
lenSuffix = builtins.stringLength suffix; lenSuffix = builtins.stringLength suffix;
lenString = builtins.stringLength string; lenString = builtins.stringLength string;
in (lenString >= lenSuffix in
&& (builtins.substring (lenString - lenSuffix) lenString string) (lenString >= lenSuffix && (builtins.substring (lenString - lenSuffix) lenString string) == suffix);
== suffix); recurseDir =
recurseDir = dir: dir:
let dirContents = builtins.readDir dir; let
in (builtins.concatMap (dirItem: dirContents = builtins.readDir dir;
in
(builtins.concatMap (
dirItem:
let let
itemType = builtins.getAttr dirItem dirContents; itemType = builtins.getAttr dirItem dirContents;
itemPath = dir + "/${dirItem}"; itemPath = dir + "/${dirItem}";
in if itemType == "directory" then in
(recurseDir itemPath) if itemType == "directory" then (recurseDir itemPath) else [ itemPath ]
else ) (builtins.attrNames dirContents));
[ itemPath ]) (builtins.attrNames dirContents)); recurseFilesInDir =
recurseFilesInDir = dir: suffix: dir: suffix: (builtins.filter (file: hasSuffix "${suffix}" file) (recurseDir dir));
(builtins.filter (file: hasSuffix "${suffix}" file) (recurseDir dir)); recurseFilesInDirs =
recurseFilesInDirs = dirs: suffix: dirs: suffix: (builtins.concatMap (dir: (recurseFilesInDir dir "${suffix}")) dirs);
(builtins.concatMap (dir: (recurseFilesInDir dir "${suffix}")) dirs);
# Full credit to https://stackoverflow.com/questions/54504685/nix-function-to-merge-attributes-records-recursively-and-concatenate-arrays/54505212#54505212 # Full credit to https://stackoverflow.com/questions/54504685/nix-function-to-merge-attributes-records-recursively-and-concatenate-arrays/54505212#54505212
recursiveMerge = attrList: recursiveMerge =
attrList:
let let
f = attrPath: f =
lib.zipAttrsWith (n: values: attrPath:
lib.zipAttrsWith (
n: values:
if lib.tail values == [ ] then if lib.tail values == [ ] then
lib.head values lib.head values
else if lib.all builtins.isList values then else if lib.all builtins.isList values then
@ -33,6 +42,8 @@
else if lib.all builtins.isAttrs values then else if lib.all builtins.isAttrs values then
f (attrPath ++ [ n ]) values f (attrPath ++ [ n ]) values
else else
lib.last values); lib.last values
in f [ ] attrList; );
in
f [ ] attrList;
} }

View File

@ -6,10 +6,18 @@
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
}; };
outputs = { self, nixpkgs, flake-utils }: outputs =
flake-utils.lib.eachDefaultSystem (system: {
let pkgs = nixpkgs.legacyPackages.${system}; self,
in { nixpkgs,
flake-utils,
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
packages.default = pkgs.writeShellApplication { packages.default = pkgs.writeShellApplication {
name = "Fmt"; name = "Fmt";
runtimeInputs = with pkgs; [ runtimeInputs = with pkgs; [
@ -19,13 +27,16 @@
nodePackages.prettier nodePackages.prettier
shfmt shfmt
]; ];
text = ('' text = (
''
#!${pkgs.bash}/bin/bash #!${pkgs.bash}/bin/bash
'' + builtins.readFile ./fmt.bash); ''
}; + builtins.readFile ./fmt.bash
}) // { );
overlays.default = final: prev: {
Fmt = self.packages.${final.system}.default;
}; };
}
)
// {
overlays.default = final: prev: { Fmt = self.packages.${final.system}.default; };
}; };
} }

View File

@ -10,15 +10,29 @@
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
}; };
outputs = { self, nixpkgs, flake-utils, bob }: outputs =
flake-utils.lib.eachDefaultSystem (system: {
self,
nixpkgs,
flake-utils,
bob,
}:
flake-utils.lib.eachDefaultSystem (
system:
let let
pkgs = nixpkgs.legacyPackages.${system}; pkgs = nixpkgs.legacyPackages.${system};
rust-toolchain = pkgs.symlinkJoin { rust-toolchain = pkgs.symlinkJoin {
name = "rust-toolchain"; name = "rust-toolchain";
paths = with pkgs; [ rustc cargo cargo-watch rust-analyzer rustfmt ]; paths = with pkgs; [
rustc
cargo
cargo-watch
rust-analyzer
rustfmt
];
}; };
in rec { in
rec {
# This builds the blog binary then runs it and collects the output. Once done it throws away the binary and # This builds the blog binary then runs it and collects the output. Once done it throws away the binary and
# shoves the newly created static site into the result. # shoves the newly created static site into the result.
packages.default = pkgs.rustPlatform.buildRustPackage { packages.default = pkgs.rustPlatform.buildRustPackage {
@ -36,9 +50,9 @@
''; '';
nativeBuildInputs = [ rust-toolchain ]; nativeBuildInputs = [ rust-toolchain ];
}; };
}) // { }
overlays.default = final: prev: { )
bob-nvim = self.packages.${final.system}.default; // {
}; overlays.default = final: prev: { bob-nvim = self.packages.${final.system}.default; };
}; };
} }

View File

@ -10,12 +10,20 @@
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
}; };
outputs = { self, nixpkgs, flake-utils, kanagawa-gtk }: outputs =
flake-utils.lib.eachDefaultSystem (system: {
self,
nixpkgs,
flake-utils,
kanagawa-gtk,
}:
flake-utils.lib.eachDefaultSystem (
system:
let let
pkgs = nixpkgs.legacyPackages.${system}; pkgs = nixpkgs.legacyPackages.${system};
lib = nixpkgs.lib; lib = nixpkgs.lib;
in rec { in
rec {
# This builds the blog binary then runs it and collects the output. Once done it throws away the binary and # This builds the blog binary then runs it and collects the output. Once done it throws away the binary and
# shoves the newly created static site into the result. # shoves the newly created static site into the result.
packages.kanagawa-gtk-theme = pkgs.stdenvNoCC.mkDerivation rec { packages.kanagawa-gtk-theme = pkgs.stdenvNoCC.mkDerivation rec {
@ -35,13 +43,11 @@
runHook postInstall runHook postInstall
''; '';
meta = with lib; { meta = with lib; {
description = description = "A GTK theme with the Kanagawa colour palette. Borrowed with from https://github.com/NixOS/nixpkgs/pull/277073.";
"A GTK theme with the Kanagawa colour palette. Borrowed with from https://github.com/NixOS/nixpkgs/pull/277073.";
homepage = "https://github.com/Fausto-Korpsvart/Kanagawa-GKT-Theme"; homepage = "https://github.com/Fausto-Korpsvart/Kanagawa-GKT-Theme";
license = licenses.gpl3Only; license = licenses.gpl3Only;
platforms = platforms.all; platforms = platforms.all;
}; };
}; };
packages.default = packages.kanagawa-gtk-theme; packages.default = packages.kanagawa-gtk-theme;
@ -70,8 +76,7 @@
''; '';
meta = with lib; { meta = with lib; {
description = description = "An icon theme for the Kanagawa colour palette. Borrowed with from https://github.com/NixOS/nixpkgs/pull/277073.";
"An icon theme for the Kanagawa colour palette. Borrowed with from https://github.com/NixOS/nixpkgs/pull/277073.";
homepage = "https://github.com/Fausto-Korpsvart/Kanagawa-GKT-Theme"; homepage = "https://github.com/Fausto-Korpsvart/Kanagawa-GKT-Theme";
license = licenses.gpl3Only; license = licenses.gpl3Only;
platforms = platforms.all; platforms = platforms.all;
@ -79,11 +84,12 @@
}; };
# Rust dev environment # Rust dev environment
}) // { }
)
// {
overlays.default = final: prev: { overlays.default = final: prev: {
kanagawa-gtk-theme = self.packages.${final.system}.kanagawa-gtk-theme; kanagawa-gtk-theme = self.packages.${final.system}.kanagawa-gtk-theme;
kanagawa-gtk-icon-theme = kanagawa-gtk-icon-theme = self.packages.${final.system}.kanagwa-icon-theme;
self.packages.${final.system}.kanagwa-icon-theme;
}; };
}; };
} }

View File

@ -1,16 +1,30 @@
{ agenix ? true, lib ? import ../lib { } }: {
agenix ? true,
lib ? import ../lib { },
}:
let let
keys = [ keys = [
"age1yubikey1qfnj0k4mkzrn8ef5llwh2sv6hd7ckr0qml3n9hzdpz9c59ypvryhyst87k0" "age1yubikey1qfnj0k4mkzrn8ef5llwh2sv6hd7ckr0qml3n9hzdpz9c59ypvryhyst87k0"
"age1ur2lr3z6d2eftgxcalc6s5x9840ew9x43upl9k23wg0ugacrn5as4zl6sj" "age1ur2lr3z6d2eftgxcalc6s5x9840ew9x43upl9k23wg0ugacrn5as4zl6sj"
]; ];
secrets = let dir = "files"; in { }; secrets =
in if agenix then let
(builtins.listToAttrs (builtins.concatMap (secretName: [{ dir = "files";
in
{ };
in
if agenix then
(builtins.listToAttrs (
builtins.concatMap (secretName: [
{
name = builtins.toString secretName; name = builtins.toString secretName;
value.publicKeys = keys; value.publicKeys = keys;
}]) (builtins.attrNames secrets))) }
]) (builtins.attrNames secrets)
))
else else
(lib.recursiveMerge (builtins.map (secretName: { (lib.recursiveMerge (
age.secrets.${secretName}.file = ./${secrets.${secretName}}; builtins.map (secretName: { age.secrets.${secretName}.file = ./${secrets.${secretName}}; }) (
}) (builtins.attrNames secrets))) builtins.attrNames secrets
)
))