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

View File

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

View File

@ -36,28 +36,37 @@
};
};
outputs = inputs@{ self, home-manager, nixpkgs, ... }:
outputs =
inputs@{
self,
home-manager,
nixpkgs,
...
}:
let
system = "x86_64-linux";
username = "sam";
pkgs = nixpkgs.legacyPackages.${system};
in {
in
{
packages.x86_64-linux.default = home-manager.defaultPackage.x86_64-linux;
checks.${system} = {
formatting = pkgs.runCommand "check-dot-file-formatting" {
formatting =
pkgs.runCommand "check-dot-file-formatting"
{
buildInputs = with pkgs; [
findutils
inputs.Fmt.packages.x86_64-linux.default
];
} ''
}
''
set -euo pipefail
cd ${self}
Fmt -- $(find . -type f)
printf "TEST COMPLETED!\n" > $out
'';
};
homeConfigurations.${username} =
home-manager.lib.homeManagerConfiguration {
homeConfigurations.${username} = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
extraSpecialArgs = {
inherit inputs;
@ -80,8 +89,7 @@
'';
});
opensnitch-ui = prev.opensnitch-ui.overrideAttrs (oldAttrs: {
propagatedBuildInputs = oldAttrs.propagatedBuildInputs
++ [ prev.python311Packages.qt-material ];
propagatedBuildInputs = oldAttrs.propagatedBuildInputs ++ [ prev.python311Packages.qt-material ];
});
})
];
@ -94,13 +102,16 @@
./config
];
};
} // inputs.flake-utils.lib.eachDefaultSystem (system:
}
// inputs.flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ inputs.agenix.overlays.default ];
};
in {
in
{
devShells.default = pkgs.mkShell {
packages = with pkgs; [
age
@ -113,5 +124,6 @@
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/
{ lib ? (import <nixpkgs> { }).lib }: rec {
hasSuffix = suffix: string:
{
lib ? (import <nixpkgs> { }).lib,
}:
rec {
hasSuffix =
suffix: string:
let
lenSuffix = builtins.stringLength suffix;
lenString = builtins.stringLength string;
in (lenString >= lenSuffix
&& (builtins.substring (lenString - lenSuffix) lenString string)
== suffix);
recurseDir = dir:
let dirContents = builtins.readDir dir;
in (builtins.concatMap (dirItem:
in
(lenString >= lenSuffix && (builtins.substring (lenString - lenSuffix) lenString string) == suffix);
recurseDir =
dir:
let
dirContents = builtins.readDir dir;
in
(builtins.concatMap (
dirItem:
let
itemType = builtins.getAttr dirItem dirContents;
itemPath = dir + "/${dirItem}";
in if itemType == "directory" then
(recurseDir itemPath)
else
[ itemPath ]) (builtins.attrNames dirContents));
recurseFilesInDir = dir: suffix:
(builtins.filter (file: hasSuffix "${suffix}" file) (recurseDir dir));
recurseFilesInDirs = dirs: suffix:
(builtins.concatMap (dir: (recurseFilesInDir dir "${suffix}")) dirs);
in
if itemType == "directory" then (recurseDir itemPath) else [ itemPath ]
) (builtins.attrNames dirContents));
recurseFilesInDir =
dir: suffix: (builtins.filter (file: hasSuffix "${suffix}" file) (recurseDir dir));
recurseFilesInDirs =
dirs: suffix: (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
recursiveMerge = attrList:
recursiveMerge =
attrList:
let
f = attrPath:
lib.zipAttrsWith (n: values:
f =
attrPath:
lib.zipAttrsWith (
n: values:
if lib.tail values == [ ] then
lib.head values
else if lib.all builtins.isList values then
@ -33,6 +42,8 @@
else if lib.all builtins.isAttrs values then
f (attrPath ++ [ n ]) values
else
lib.last values);
in f [ ] attrList;
lib.last values
);
in
f [ ] attrList;
}

View File

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

View File

@ -10,15 +10,29 @@
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils, bob }:
flake-utils.lib.eachDefaultSystem (system:
outputs =
{
self,
nixpkgs,
flake-utils,
bob,
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
rust-toolchain = pkgs.symlinkJoin {
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
# shoves the newly created static site into the result.
packages.default = pkgs.rustPlatform.buildRustPackage {
@ -36,9 +50,9 @@
'';
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";
};
outputs = { self, nixpkgs, flake-utils, kanagawa-gtk }:
flake-utils.lib.eachDefaultSystem (system:
outputs =
{
self,
nixpkgs,
flake-utils,
kanagawa-gtk,
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
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
# shoves the newly created static site into the result.
packages.kanagawa-gtk-theme = pkgs.stdenvNoCC.mkDerivation rec {
@ -35,13 +43,11 @@
runHook postInstall
'';
meta = with lib; {
description =
"A GTK theme with the Kanagawa colour palette. Borrowed with from https://github.com/NixOS/nixpkgs/pull/277073.";
description = "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";
license = licenses.gpl3Only;
platforms = platforms.all;
};
};
packages.default = packages.kanagawa-gtk-theme;
@ -70,8 +76,7 @@
'';
meta = with lib; {
description =
"An icon theme for the Kanagawa colour palette. Borrowed with from https://github.com/NixOS/nixpkgs/pull/277073.";
description = "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";
license = licenses.gpl3Only;
platforms = platforms.all;
@ -79,11 +84,12 @@
};
# Rust dev environment
}) // {
}
)
// {
overlays.default = final: prev: {
kanagawa-gtk-theme = self.packages.${final.system}.kanagawa-gtk-theme;
kanagawa-gtk-icon-theme =
self.packages.${final.system}.kanagwa-icon-theme;
kanagawa-gtk-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
keys = [
"age1yubikey1qfnj0k4mkzrn8ef5llwh2sv6hd7ckr0qml3n9hzdpz9c59ypvryhyst87k0"
"age1ur2lr3z6d2eftgxcalc6s5x9840ew9x43upl9k23wg0ugacrn5as4zl6sj"
];
secrets = let dir = "files"; in { };
in if agenix then
(builtins.listToAttrs (builtins.concatMap (secretName: [{
secrets =
let
dir = "files";
in
{ };
in
if agenix then
(builtins.listToAttrs (
builtins.concatMap (secretName: [
{
name = builtins.toString secretName;
value.publicKeys = keys;
}]) (builtins.attrNames secrets)))
}
]) (builtins.attrNames secrets)
))
else
(lib.recursiveMerge (builtins.map (secretName: {
age.secrets.${secretName}.file = ./${secrets.${secretName}};
}) (builtins.attrNames secrets)))
(lib.recursiveMerge (
builtins.map (secretName: { age.secrets.${secretName}.file = ./${secrets.${secretName}}; }) (
builtins.attrNames secrets
)
))