feat: add nix code formatter

This commit is contained in:
matt1432 2023-11-22 15:33:16 -05:00
parent 231fd16756
commit 1fae0a73d3
52 changed files with 725 additions and 617 deletions

View file

@ -1,4 +1,4 @@
{ ... }: {
{...}: {
nix = {
settings = {
substituters = [

View file

@ -1,16 +1,17 @@
{ config
, home-manager
, lib
, nixpkgs
, nixpkgs-wayland
, nix-index-database
, nh
, nur
, nix-melt
, nurl
, coc-stylelintplus
, pkgs
, ...
{
config,
home-manager,
lib,
nixpkgs,
nixpkgs-wayland,
nix-index-database,
nh,
nur,
nix-melt,
nurl,
coc-stylelintplus,
pkgs,
...
}: {
imports = [
./cachix.nix
@ -29,7 +30,7 @@
nix = {
# Edit nix.conf
settings = {
experimental-features = [ "nix-command" "flakes" ];
experimental-features = ["nix-command" "flakes"];
keep-outputs = true;
keep-derivations = true;
auto-optimise-store = true;
@ -83,36 +84,34 @@
./home/tmux.nix
./device-vars.nix
({ osConfig, ... }: {
({osConfig, ...}: {
services.device-vars = osConfig.services.device-vars;
})
];
home.packages = [
nix-melt.packages.x86_64-linux.default
nurl.packages.x86_64-linux.default
] ++
(with config.nur.repos.rycee; [
mozilla-addons-to-nix
]) ++
(with pkgs.nodePackages; [
undollar
]) ++
(with pkgs; [
dracula-theme
neofetch
progress
wget
tree
mosh
rsync
killall
imagemagick
usbutils
]);
home.packages =
[
nix-melt.packages.x86_64-linux.default
nurl.packages.x86_64-linux.default
]
++ (with config.nur.repos.rycee; [
mozilla-addons-to-nix
])
++ (with pkgs.nodePackages; [
undollar
])
++ (with pkgs; [
dracula-theme
neofetch
progress
wget
tree
mosh
rsync
killall
imagemagick
usbutils
]);
home.stateVersion = lib.mkDefault "23.05";
};

View file

@ -1,10 +1,10 @@
{ lib, ... }: {
{lib, ...}: {
options.services.device-vars = with lib; {
username = mkOption {
description = ''
Username that was defined at the initial setup process
'';
type = types.nullOr types.str;
type = types.nullOr types.str;
};
configDir = mkOption {

View file

@ -1,15 +1,18 @@
{ config, lib, ... }: {
{
config,
lib,
...
}: {
imports = [
./programs.nix
];
programs = {
starship = let
textColor = "#e3e5e5";
firstColor = "#bd93f9";
textColor = "#e3e5e5";
firstColor = "#bd93f9";
secondColor = "#715895";
thirdColor = "#382c4a";
thirdColor = "#382c4a";
fourthColor = "#120e18";
in {
enable = true;
@ -93,10 +96,10 @@
enable = true;
enableCompletion = true;
historyFile = "\$HOME/.cache/.bash_history";
historyFile = "\$HOME/.cache/.bash_history";
historyFileSize = 100000; # default
historySize = 10000; # default
historyControl = [
historySize = 10000; # default
historyControl = [
"erasedups"
"ignorespace"
];
@ -119,29 +122,29 @@
];
shellAliases = {
sudo = "sudo ";
sudo = "sudo ";
frick = "sudo $(fc -ln -1)";
nivm = "nvim";
nivm = "nvim";
nivim = "nvim";
tmux = "tmux -2";
ls = "ls -lah --color=auto";
tree = "tree -a -I node_modules";
cp = "cp -r";
tmux = "tmux -2";
ls = "ls -lah --color=auto";
tree = "tree -a -I node_modules";
cp = "cp -r";
chore = "(cd ~/.nix; git add flake.lock; git commit -m 'chore: update flake.lock'; git push)";
tup = "tailscale up --login-server https://headscale.nelim.org";
tup = "tailscale up --login-server https://headscale.nelim.org";
pc = "mosh matt@binto -- tmux -2u new -At laptop";
pc = "mosh matt@binto -- tmux -2u new -At laptop";
oksys = "mosh matt@oksys -- tmux -2u new -At laptop";
pve = "mosh matt@pve -- tmux -2u new -At laptop";
pve = "mosh matt@pve -- tmux -2u new -At laptop";
mc = "mosh mc@mc -- tmux -2u new -At laptop";
pod = "mosh matt@pve -- ssh -t -p 6768 matt@10.0.0.122 'tmux -2u new -At laptop'";
mc = "mosh mc@mc -- tmux -2u new -At laptop";
pod = "mosh matt@pve -- ssh -t -p 6768 matt@10.0.0.122 'tmux -2u new -At laptop'";
jelly = "mosh matt@pve -- ssh -t matt@10.0.0.123 'tmux -2u new -At laptop'";
qbit = "mosh matt@pve -- ssh -t matt@10.0.0.128 'tmux -2u new -At laptop'";
qbit = "mosh matt@pve -- ssh -t matt@10.0.0.128 'tmux -2u new -At laptop'";
};
sessionVariables = {
# FIXME: why is this not set by home-manager?

View file

@ -1,4 +1,4 @@
{ pkgs, ... }: {
{pkgs, ...}: {
programs = {
fzf = {
enable = true;

View file

@ -1,6 +1,5 @@
{ pkgs, ... }: {
{pkgs, ...}: {
programs = {
git = {
enable = true;
lfs.enable = true;
@ -9,7 +8,7 @@
userEmail = "matt@nelim.org";
includes = [
{ path = "${pkgs.dracula-theme}/git-colors"; }
{path = "${pkgs.dracula-theme}/git-colors";}
];
delta = {
@ -24,11 +23,11 @@
extraConfig.pager = let
cmd = "LESS='LRc --mouse' ${pkgs.delta}/bin/delta";
in {
diff = cmd;
show = cmd;
stash = cmd;
log = cmd;
reflog = cmd;
diff = cmd;
show = cmd;
stash = cmd;
log = cmd;
reflog = cmd;
};
};
};

View file

@ -0,0 +1,2 @@
-- Add `:Format` command to format current buffer
vim.api.nvim_create_user_command("Format", "call CocAction('format')", {})

View file

@ -1,28 +1,32 @@
{ pkgs, lib, ... }: let
{
pkgs,
lib,
...
}: let
# installs a vim plugin from git with a given tag / branch
plugin = owner: repo: rev: hash: pkgs.vimUtils.buildVimPlugin {
pname = "${lib.strings.sanitizeDerivationName repo}";
version = rev;
src = pkgs.fetchFromGitHub {
inherit rev owner repo hash;
plugin = owner: repo: rev: hash:
pkgs.vimUtils.buildVimPlugin {
pname = "${lib.strings.sanitizeDerivationName repo}";
version = rev;
src = pkgs.fetchFromGitHub {
inherit rev owner repo hash;
};
};
};
fileContents = lib.strings.fileContents;
in {
# TODO: make a gradle module and have java in device-vars.nix
xdg.dataFile = {
".gradle/gradle.properties".source =
pkgs.writeText "gradle.properties" ''
org.gradle.java.home = ${pkgs.temurin-bin-17}
'';
".gradle/gradle.properties".source = pkgs.writeText "gradle.properties" ''
org.gradle.java.home = ${pkgs.temurin-bin-17}
'';
};
home.packages = with pkgs; [
gradle
gradle-completion # FIXME: not working
alejandra
];
programs = {
java = {
enable = true;
package = pkgs.temurin-bin-17;
@ -95,8 +99,13 @@ in {
languageserver = {
nix = {
command = "nil";
filetypes = [ "nix" ];
rootPatterns = [ "flake.nix" ];
filetypes = ["nix"];
rootPatterns = ["flake.nix"];
settings = {
nil = {
formatting = {command = ["alejandra"];};
};
};
};
};
@ -107,6 +116,7 @@ in {
};
extraConfig = fileContents ./base.vim;
extraLuaConfig = fileContents ./base.lua;
plugins = with pkgs.vimPlugins; [
# Coc configured
@ -173,9 +183,10 @@ in {
config = fileContents ./plugins/treesitter.vim;
}
{
plugin = (plugin "lukas-reineke" "indent-blankline.nvim"
"046e2cf04e08ece927bacbfb87c5b35c0b636546"
"sha256-bhoep8aTYje5K/dZ/XmpwBPn4PBEMPrmw33QJdfFe6M=");
plugin =
plugin "lukas-reineke" "indent-blankline.nvim"
"046e2cf04e08ece927bacbfb87c5b35c0b636546"
"sha256-bhoep8aTYje5K/dZ/XmpwBPn4PBEMPrmw33QJdfFe6M=";
type = "lua";
config = fileContents ./plugins/indent.lua;
}

View file

@ -1,4 +1,4 @@
{ pkgs, ... }: {
{pkgs, ...}: {
programs = {
tmux = {
enable = true;

View file

@ -1,25 +1,27 @@
{ pkgs, ... }: {
{pkgs, ...}: {
fonts = {
fontconfig = {
enable = true;
defaultFonts = {
emoji = [ "Noto Color Emoji" ];
monospace = [ "Noto Nerd Font" ];
sansSerif = [ "Noto Nerd Font" ];
serif = [ "Noto Nerd Font" ];
emoji = ["Noto Color Emoji"];
monospace = ["Noto Nerd Font"];
sansSerif = ["Noto Nerd Font"];
serif = ["Noto Nerd Font"];
};
};
packages = with pkgs; [
(nerdfonts.override { fonts = [
"JetBrainsMono"
"Go-Mono"
"Iosevka"
"NerdFontsSymbolsOnly"
"SpaceMono"
"Ubuntu"
"Noto"
]; })
(nerdfonts.override {
fonts = [
"JetBrainsMono"
"Go-Mono"
"Iosevka"
"NerdFontsSymbolsOnly"
"SpaceMono"
"Ubuntu"
"Noto"
];
})
noto-fonts
noto-fonts-cjk
noto-fonts-emoji

View file

@ -1,6 +1,5 @@
{ pkgs, ... }: {
{pkgs, ...}: {
services = {
fwupd.enable = true;
upower.enable = true;

View file

@ -1,10 +1,14 @@
final: prev: {
blueberry = prev.blueberry.overrideAttrs (o: {
patches = (o.patches or [ ]) ++ [
./patches/wayland.patch
];
buildInputs = (o.buildInputs or [ ]) ++ [
prev.libappindicator
];
patches =
(o.patches or [])
++ [
./patches/wayland.patch
];
buildInputs =
(o.buildInputs or [])
++ [
prev.libappindicator
];
});
}

View file

@ -1,4 +1,4 @@
{ neovim-flake, ... }: {
{neovim-flake, ...}: {
imports = [
./dracula-theme.nix
./regreet.nix

View file

@ -1,4 +1,4 @@
{ pkgs, ... }: let
{pkgs, ...}: let
plymouth = pkgs.fetchFromGitHub {
owner = "dracula";
repo = "plymouth";
@ -27,74 +27,75 @@
hash = "sha256-f9FwSOSvqTeDj4bOjYUQ6TM+/carCD9o5dhg/MnP/lk=";
};
in {
nixpkgs.overlays = [ (final: prev: {
dracula-theme = prev.dracula-theme.overrideAttrs (oldAttrs: rec {
nixpkgs.overlays = [
(final: prev: {
dracula-theme = prev.dracula-theme.overrideAttrs (oldAttrs: rec {
src = prev.fetchFromGitHub {
owner = "dracula";
repo = "gtk";
rev = "84dd7a3021938ceec8a0ee292a8561f8a6d47ebe";
hash = "sha256-xHf+f0RGMtbprJX+3c0cmp5LKkf0V7BHKcoiAW60du8=";
};
src = prev.fetchFromGitHub {
owner = "dracula";
repo = "gtk";
rev = "84dd7a3021938ceec8a0ee292a8561f8a6d47ebe";
hash = "sha256-xHf+f0RGMtbprJX+3c0cmp5LKkf0V7BHKcoiAW60du8=";
};
installPhase = ''
runHook preInstall
installPhase = ''
runHook preInstall
# Git colors
cp -a ${git-colors}/config/gitconfig ./git-colors
chmod 777 ./git-colors
# Git colors
cp -a ${git-colors}/config/gitconfig ./git-colors
chmod 777 ./git-colors
line=$(grep -n 'Dracula Dark Theme' ./git-colors | cut -d: -f1)
sed -i "1,$((line-1))d" ./git-colors
line=$(grep -n 'Dracula Dark Theme' ./git-colors | cut -d: -f1)
sed -i "1,$((line-1))d" ./git-colors
mkdir -p $out
cp -a ./git-colors $out
mkdir -p $out
cp -a ./git-colors $out
# Bat colors
mkdir -p ./bat $out/bat
cp -a ${bat-theme}/Dracula.tmTheme ./bat/dracula-bat.tmTheme
chmod 777 ./bat/dracula-bat.tmTheme
# Bat colors
mkdir -p ./bat $out/bat
cp -a ${bat-theme}/Dracula.tmTheme ./bat/dracula-bat.tmTheme
chmod 777 ./bat/dracula-bat.tmTheme
cp -a ./bat/dracula-bat.tmTheme $out/bat
cp -a ./bat/dracula-bat.tmTheme $out/bat
# Plymouth
cp -a ${plymouth}/dracula ./dracula
chmod 777 ./dracula
# Plymouth
cp -a ${plymouth}/dracula ./dracula
chmod 777 ./dracula
rm ./dracula/dracula.script
cp -a ${dracula-script} ./dracula/dracula.script
rm ./dracula/dracula.script
cp -a ${dracula-script} ./dracula/dracula.script
sed -i "s@\/usr\/@$out\/@" ./dracula/dracula.plymouth
sed -i "s@\/usr\/@$out\/@" ./dracula/dracula.plymouth
mkdir -p $out/share/plymouth/themes
cp -a ./dracula $out/share/plymouth/themes/
mkdir -p $out/share/plymouth/themes
cp -a ./dracula $out/share/plymouth/themes/
# Wallpapers
cp -a ${wallpaper} ./waves.png
# Wallpapers
cp -a ${wallpaper} ./waves.png
mkdir -p $out/wallpapers
cp -a ./waves.png $out/wallpapers/
mkdir -p $out/wallpapers
cp -a ./waves.png $out/wallpapers/
# -------------------------------------------
mkdir -p $out/share/themes/Dracula
cp -a {assets,cinnamon,gnome-shell,gtk-2.0,gtk-3.0,gtk-3.20,gtk-4.0,index.theme,metacity-1,unity,xfwm4} $out/share/themes/Dracula
# -------------------------------------------
mkdir -p $out/share/themes/Dracula
cp -a {assets,cinnamon,gnome-shell,gtk-2.0,gtk-3.0,gtk-3.20,gtk-4.0,index.theme,metacity-1,unity,xfwm4} $out/share/themes/Dracula
cp -a kde/{color-schemes,plasma} $out/share/
cp -a kde/kvantum $out/share/Kvantum
cp -a kde/{color-schemes,plasma} $out/share/
cp -a kde/kvantum $out/share/Kvantum
mkdir -p $out/share/aurorae/themes
cp -a kde/aurorae/* $out/share/aurorae/themes/
mkdir -p $out/share/aurorae/themes
cp -a kde/aurorae/* $out/share/aurorae/themes/
mkdir -p $out/share/sddm/themes
cp -a kde/sddm/* $out/share/sddm/themes/
mkdir -p $out/share/sddm/themes
cp -a kde/sddm/* $out/share/sddm/themes/
mkdir -p $out/share/icons/Dracula-cursors
mv kde/cursors/Dracula-cursors/index.theme $out/share/icons/Dracula-cursors/cursor.theme
mv kde/cursors/Dracula-cursors/cursors $out/share/icons/Dracula-cursors/cursors
mkdir -p $out/share/icons/Dracula-cursors
mv kde/cursors/Dracula-cursors/index.theme $out/share/icons/Dracula-cursors/cursor.theme
mv kde/cursors/Dracula-cursors/cursors $out/share/icons/Dracula-cursors/cursors
runHook postInstall
'';
});
}) ];
runHook postInstall
'';
});
})
];
}

View file

@ -1,12 +1,11 @@
{ python3Packages }:
{python3Packages}:
python3Packages.buildPythonPackage rec {
pname = "coloryou";
version = "0.0.1";
src = ./.;
propagatedBuildInputs = with python3Packages; [ utils material-color-utilities ];
propagatedBuildInputs = with python3Packages; [utils material-color-utilities];
postInstall = ''
mv -v $out/bin/coloryou.py $out/bin/coloryou

View file

@ -1,8 +1,7 @@
with import <nixpkgs> {};
with pkgs.python311Packages;
buildPythonPackage rec {
name = "coloryou";
src = ./.;
propagatedBuildInputs = [ material-color-utilities utils ];
}
buildPythonPackage rec {
name = "coloryou";
src = ./.;
propagatedBuildInputs = [material-color-utilities utils];
}

View file

@ -1,12 +1,12 @@
{ stdenv
, meson
, ninja
, pkg-config
, cmake
, bash-completion
, fetchFromGitHub
{
stdenv,
meson,
ninja,
pkg-config,
cmake,
bash-completion,
fetchFromGitHub,
}:
stdenv.mkDerivation rec {
pname = "input-emulator";
version = "6c35040e6fc4f65ce0519ee76d00d60490bcb987";

View file

@ -1,17 +1,17 @@
{ stdenv
, meson
, ninja
, pkg-config
, glib
, libfprint
, polkit
, dbus
, systemd
, pam
, libpam-wrapper
, fetchFromGitLab
{
stdenv,
meson,
ninja,
pkg-config,
glib,
libfprint,
polkit,
dbus,
systemd,
pam,
libpam-wrapper,
fetchFromGitLab,
}:
stdenv.mkDerivation rec {
pname = "pam-fprint-grosshack";
version = "v0.3.0";

View file

@ -1,5 +1,4 @@
# https://github.com/NixOS/nixpkgs/blob/77b27fdb6a9ba01f60b8f5c48038938cf14b7d2f/pkgs/applications/audio/spotifywm/default.nix
{
lib,
stdenv,
@ -8,8 +7,7 @@
makeBinaryWrapper,
spotify,
symlinkJoin,
}:
let
}: let
spotifywm = stdenv.mkDerivation {
pname = "spotifywm";
version = "unstable-2022-10-25";
@ -34,31 +32,31 @@ let
'';
};
in
symlinkJoin {
inherit (spotifywm) name;
symlinkJoin {
inherit (spotifywm) name;
nativeBuildInputs = [
makeBinaryWrapper
];
nativeBuildInputs = [
makeBinaryWrapper
];
paths = [
spotify
spotifywm
];
paths = [
spotify
spotifywm
];
postBuild = ''
wrapProgram $out/bin/spotify \
--suffix LD_PRELOAD : "$out/lib/spotifywm.so"
postBuild = ''
wrapProgram $out/bin/spotify \
--suffix LD_PRELOAD : "$out/lib/spotifywm.so"
ln -sf $out/bin/spotify $out/bin/spotifywm
'';
ln -sf $out/bin/spotify $out/bin/spotifywm
'';
meta = {
homepage = "https://github.com/dasJ/spotifywm";
description = "Wrapper around Spotify that correctly sets class name before opening the window";
license = lib.licenses.mit;
platforms = lib.platforms.linux;
maintainers = with lib.maintainers; [ jqueiroz the-argus ];
mainProgram = "spotify";
};
}
meta = {
homepage = "https://github.com/dasJ/spotifywm";
description = "Wrapper around Spotify that correctly sets class name before opening the window";
license = lib.licenses.mit;
platforms = lib.platforms.linux;
maintainers = with lib.maintainers; [jqueiroz the-argus];
mainProgram = "spotify";
};
}

View file

@ -1,4 +1,4 @@
{ pkgs, ... }: {
{pkgs, ...}: {
programs.regreet = {
package = pkgs.greetd.regreet.overrideAttrs (self: super: rec {
version = "0.1.1-patched";

View file

@ -1,7 +1,9 @@
final: prev: {
squeekboard = prev.squeekboard.overrideAttrs (o: {
patches = (o.patches or [ ]) ++ [
./patches/remove-panel.patch
];
patches =
(o.patches or [])
++ [
./patches/remove-panel.patch
];
});
}