Switch to nixpkgs-fmt formatter

This commit is contained in:
Filippo Berto 2023-02-24 09:24:21 +01:00
parent 36f6903639
commit ca59cb8f3c
Signed by: bertof
GPG key ID: 9DBF7E6A1D2CE9ED
45 changed files with 695 additions and 606 deletions

View file

@ -82,13 +82,15 @@ with lib; {
recommendedOptimisation = true;
recommendedGzipSettings = true;
recommendedTlsSettings = true;
virtualHosts = let
virtualHosts =
let
ssl = {
enableACME = true;
forceSSL = true;
};
loki = "172.23.254.55";
in {
in
{
"unimi.bertof.net" = ssl // {
locations."/".extraConfig =
"rewrite ^/(.*)$ https://homes.di.unimi.it/berto/$1 redirect ;";

View file

@ -1,5 +1,10 @@
{ writeShellScriptBin, lib, xclip, coreutils, terminal-command ? "kitty sh -c"
, editor-command ? "hx" }:
{ writeShellScriptBin
, lib
, xclip
, coreutils
, terminal-command ? "kitty sh -c"
, editor-command ? "hx"
}:
# 64 │ function clipcopy() { xclip -in -selection clipboard < "${1:-/dev/stdin}"; }
# 65 │ function clippaste() { xclip -out -selection clipboard; } clip
writeShellScriptBin "clipedit" ''

View file

@ -9,4 +9,5 @@ let
update-background = pkgs.callPackage ./update-background { };
vital-synth = pkgs.callPackage ./vital-synth { };
};
in self
in
self

View file

@ -1,7 +1,15 @@
{ lib, rice, roboto, i3lock-color, writeScriptBin, font ? {
{ lib
, rice
, roboto
, i3lock-color
, writeScriptBin
, font ? {
package = roboto;
name = "Roboto";
}, palette ? rice.palette.palette { }, ... }:
}
, palette ? rice.palette.palette { }
, ...
}:
let strPalette = lib.nix-rice.palette.toRGBAHex palette;
in writeScriptBin "lockscreen" ''
# Using font package ${font.package}

View file

@ -1,10 +1,17 @@
{ feh, glib, findutils, gnugrep, coreutils, writeScriptBin
, backgrounds_directory ? "$HOME/Immagini/Sfondi" }:
{ feh
, glib
, findutils
, gnugrep
, coreutils
, writeScriptBin
, backgrounds_directory ? "$HOME/Immagini/Sfondi"
}:
let
find = "${findutils}/bin/find";
grep = "${gnugrep}/bin/grep";
shuf = "${coreutils}/bin/shuf";
in writeScriptBin "update-background" ''
in
writeScriptBin "update-background" ''
#!/bin/sh
if [ $# -eq 0 ]; then
image=`${find} ${backgrounds_directory} -type f | ${grep} -v "/\." | ${shuf} -n 1`

View file

@ -43,9 +43,20 @@
};
};
outputs = { self, nixpkgs, nixpkgs-u, home-manager, agenix, deploy-rs
, flake-utils, nixos-generators, nixos-hardware, nix-rice, pre-commit-hooks
, tex2nix }:
outputs =
{ self
, nixpkgs
, nixpkgs-u
, home-manager
, agenix
, deploy-rs
, flake-utils
, nixos-generators
, nixos-hardware
, nix-rice
, pre-commit-hooks
, tex2nix
}:
let
config = {
allowUnfree = true;
@ -98,16 +109,14 @@
eachDefaultSystem (system:
let pkgs = import nixpkgs { inherit system config overlays; };
in {
formatter = pkgs.writeShellScriptBin "formatter" ''
${pkgs.findutils}/bin/find . -name '*.nix' -exec ${pkgs.nixfmt}/bin/nixfmt {} \+
'';
formatter = pkgs.nixpkgs-fmt;
checks = {
pre-commit-check = pre-commit-hooks.lib.${system}.run {
src = ./.;
hooks = {
deadnix.enable = true;
nixfmt.enable = true;
nixpkgs-fmt.enable = true;
statix.enable = true;
};
};
@ -235,7 +244,8 @@
};
odinConfig = {
nixosConfigurations = let
nixosConfigurations =
let
odinCommonModules = [
nixos-hardware.nixosModules.common-cpu-intel
nixos-hardware.nixosModules.common-pc-laptop
@ -251,7 +261,8 @@
{ home-manager.users.bertof = import ./odin/hm.nix; }
];
in rec {
in
rec {
odin-nvidia = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = commonModules ++ odinCommonModules
@ -380,7 +391,8 @@
};
});
in builtins.foldl' nixpkgs.lib.recursiveUpdate { } [
in
builtins.foldl' nixpkgs.lib.recursiveUpdate { } [
basic
thorConfig
odinConfig

View file

@ -21,7 +21,8 @@ let
};
};
};
in {
in
{
# Include fonts packages
home.packages = [ pkgs.rice.font.monospace.package ];
programs.alacritty = {

View file

@ -1,14 +1,16 @@
{
programs.autorandr = {
enable = true;
profiles = let
profiles =
let
dell-laptop = {
dpi = 96;
fingerprint =
"00ffffffffffff0030e43f0500000000001a010495221378eaa1c59459578f27205054000000010101010101010101010101010101012e3680a070381f403020350058c21000001a5c2b80a070381f403020350058c21000001a000000fe0034584b3133803135365746360a000000000000413196001000000a010a202000c5";
mode = "1920x1080";
};
in {
in
{
odin-nvidia = {
fingerprint = { "eDP-1-1" = dell-laptop.fingerprint; };
config = {

View file

@ -13,7 +13,8 @@ let
systemctl --user restart kdeconnect-indicator # Restart polybar
'';
strPalette = palette.toRGBHex pkgs.rice.colorPalette;
in {
in
{
xsession.windowManager.bspwm = {
enable = true;
settings = {

View file

@ -2,7 +2,8 @@
let
strPalette = pkgs.lib.nix-rice.palette.toRgbHex pkgs.rice.colorPalette;
fmtString = str: "'${str}'";
in {
in
{
home.packages = [ pkgs.cava ];
xdg.configFile."cava/config".text = lib.generators.toINI { } {

View file

@ -1,6 +1,7 @@
{ pkgs, config, lib, ... }: {
home.packages =
lib.optionals config.programs.helix.enable builtins.attrValues {
lib.optionals config.programs.helix.enable builtins.attrValues
{
inherit (pkgs) clang-tools cmake-language-server;
} ++ lib.optionals config.programs.kakoune.enable builtins.attrValues {
inherit (pkgs) clang-tools cmake-language-server;

View file

@ -1,6 +1,7 @@
{ config, pkgs, lib, ... }: {
home.packages =
lib.optionals config.programs.helix.enable builtins.attrValues {
lib.optionals config.programs.helix.enable builtins.attrValues
{
inherit (pkgs) yaml-language-server taplo-cli;
inherit (pkgs.nodePackages) vscode-langservers-extracted;
} ++ lib.optionals config.programs.kakoune.enable builtins.attrValues {

View file

@ -1,6 +1,7 @@
{ pkgs, lib, config, ... }: {
home.packages =
lib.optionals config.programs.helix.enable builtins.attrValues {
lib.optionals config.programs.helix.enable builtins.attrValues
{
inherit (pkgs.nodePackages) typescript-language-server;
} ++ lib.optionals config.programs.kakoune.enable builtins.attrValues {
inherit (pkgs.nodePackages) typescript-language-server;

View file

@ -1,5 +1,6 @@
{ pkgs, config, lib, ... }: {
home.packages = builtins.attrValues {
home.packages = builtins.attrValues
{
inherit (pkgs) nixpkgs-fmt nixfmt nix-prefetch-scripts nix-review nix-tree;
} ++ lib.optionals config.programs.helix.enable [ pkgs.nil ]
++ lib.optionals config.programs.kakoune.enable [ pkgs.rnix-lsp ];

View file

@ -1,5 +1,6 @@
{ pkgs, lib, config, ... }: {
home.packages = builtins.attrValues {
home.packages = builtins.attrValues
{
inherit (pkgs)
bacon cargo cargo-audit cargo-criterion cargo-deadlinks cargo-expand
cargo-flamegraph cargo-fuzz cargo-hack cargo-hakari cargo-inspect

View file

@ -5,4 +5,5 @@ let
theme = themes.ironhand;
enableFPS = true;
};
in { home.packages = [ package ]; }
in
{ home.packages = [ package ]; }

View file

@ -87,7 +87,8 @@ let
"gup" = "git pull --rebase";
"gupv" = "git pull --rebase -v";
};
in {
in
{
programs.git = {
enable = true;
userName = "Filippo Berto";

View file

@ -28,4 +28,5 @@ let
user-themes
# vitals
];
in { home.packages = [ pkgs.gnome.gnome-tweaks ] ++ gnomeExtensions; }
in
{ home.packages = [ pkgs.gnome.gnome-tweaks ] ++ gnomeExtensions; }

View file

@ -26,7 +26,8 @@ let
"text/x-c++"
];
};
in {
in
{
programs.bash.shellAliases = { x = "hx"; };
programs.zsh.shellAliases = { x = "hx"; };
home.sessionVariables = {
@ -40,20 +41,25 @@ in {
programs.helix = {
enable = true;
package = pkgs.unstable_pkgs.helix;
languages = [ ];
languages = [{
name = "nix";
formatter = { command = "nixpkgs-fmt"; };
# config = { nil = { formatting = { command = "nixpkgs-fmt"; }; }; };
}];
settings = {
theme = "ayu_mirage";
editor.lsp.display-messages = true;
editor.scrolloff = 5;
editor.true-color = true;
editor.soft-wrap.enable = true;
# editor.soft-wrap.enable = true;
keys.normal = {
"C-A-l" = ":format";
"C-A-r" = ":reload";
"C-A-S-r" = ":reload-all";
};
};
themes = let
themes =
let
transparent = "none";
gray = "#665c54";
dark-gray = "#3c3836";
@ -66,7 +72,8 @@ in {
blue = "#83a598";
magenta = "#d3869b";
cyan = "#8ec07c";
in {
in
{
base16 = {
"ui.menu" = transparent;
"ui.menu.selected" = { modifiers = [ "reversed" ]; };

View file

@ -61,7 +61,8 @@ let
inherit desktopItem;
};
in {
in
{
programs.bash.shellAliases = { k = "kak"; };
programs.zsh.shellAliases = { k = "kak"; };
home.packages = packages;

View file

@ -5,7 +5,8 @@ let
background foreground color0 color1 color2 color3 color4 color5 color6
color7 color8 color9 color10 color11 color12 color13 color14 color15;
};
in {
in
{
programs.kitty = {
enable = true;
settings = {

View file

@ -17,7 +17,8 @@ let
${pkgs.pistol}/bin/pistol "$file"
'';
in {
in
{
programs.lf = {
enable = true;
settings = {

View file

@ -2,7 +2,8 @@
let
libinputGesturesCmd = "${pkgs.libinput-gestures}/bin/libinput-gestures";
xdotool = "${pkgs.xdotool}/bin/xdotool";
in {
in
{
systemd.user.services."libinput-gestures" = {
Unit = {
Description = "Touchpad gestures";

View file

@ -109,7 +109,8 @@ let
};
ramp = [ "" "" "" "" "" "" ];
in {
in
{
home.packages = builtins.attrValues {
inherit (pkgs) noto-fonts material-design-icons noto-fonts-cjk-sans;
# emojione
@ -190,13 +191,15 @@ in {
type = "internal/bspwm";
format = "<label-state>";
label = let
label =
let
common = {
padding = 1;
# separator = " ";
text = "%name%";
};
in {
in
{
focused = recursiveUpdate common colors.selected;
occupied = recursiveUpdate common colors.active;
urgent = recursiveUpdate (recursiveUpdate common colors.active) {
@ -298,7 +301,8 @@ in {
open = recursiveUpdate colors.normal { text = ""; };
close = recursiveUpdate colors.normal { text = ""; };
};
menu = [[
menu = [
[
{
text = "";
exec = confirm_command {
@ -331,7 +335,8 @@ in {
text = "Do you want to shutdown?";
};
}
]];
]
];
};
"module/notifications" = {

View file

@ -13,7 +13,8 @@ let
VST_PATH = "$HOME/.vst:${userLibFolder}/vst:${systemLibFolder}/vst";
VST3_PATH = "$HOME/.vst3:${userLibFolder}/vst3:${systemLibFolder}/vst3";
};
in {
in
{
home.packages = builtins.attrValues {
inherit (pkgs)
carla rnnoise ardour

View file

@ -8,7 +8,8 @@
# bc
bsp-layout clipedit lockscreen terminator; # required by bsp-layout
};
services.sxhkd = let
services.sxhkd =
let
primaryTerminal = "kitty";
secondaryTerminal = "terminator";
fileManager = "nautilus";
@ -34,7 +35,8 @@
level=`printf "%.0f" $(${xbacklight} -get)`
${notify} -r 2 -h "int:value:$level" "Luminosità $level"
'';
in {
in
{
enable = true;
keybindings = {
"alt + Tab" = "rofi -show window";

View file

@ -26,7 +26,8 @@ let
bright.cyan
bright.white
];
in {
in
{
home.packages = [ pkgs.terminator ];
xdg.configFile."terminator/config".text = with strPalette; ''

View file

@ -3,7 +3,8 @@ with pkgs.lib.nix-rice;
let
strPalette = palette.toRGBHex pkgs.rice.colorPalette;
font = pkgs.rice.font.normal;
in {
in
{
services.twmn = {
enable = true;
text = {

View file

@ -75,11 +75,17 @@ let
categories = [ "AudioVideo" ];
}
];
webAppBuilder = { desktopName
, name ? builtins.replaceStrings [ " " ] [ "_" ] desktopName, link
, icon ? lib.toLower name, comment ? null, categories ? [ "Network" ] }:
webAppBuilder =
{ desktopName
, name ? builtins.replaceStrings [ " " ] [ "_" ] desktopName
, link
, icon ? lib.toLower name
, comment ? null
, categories ? [ "Network" ]
}:
pkgs.makeDesktopItem {
inherit name icon desktopName comment categories;
exec = cmd link;
};
in { home.packages = map webAppBuilder links; }
in
{ home.packages = map webAppBuilder links; }

View file

@ -19,7 +19,8 @@ let
shutDownScreens = pkgs.writeShellScript "shutdown_screens" ''
${xsetCmd} dpms force off
'';
in {
in
{
services.xidlehook = {
enable = true;
package = pkgs.writeScriptBin "xidlehook" ''

View file

@ -132,7 +132,8 @@ with lib; {
load printers = no
smb encrypt = required
'';
shares = let
shares =
let
common = {
"public" = "no";
"writeable" = "yes";
@ -143,7 +144,8 @@ with lib; {
"read only" = "no";
"force group" = "users";
};
in {
in
{
bertof = recursiveUpdate common {
path = "/home/bertof/";
comment = "Bertof samba share";
@ -239,12 +241,14 @@ with lib; {
};
services.snapper = {
configs = let
configs =
let
commonExtraConfig = ''
TIMELINE_CREATE=yes
TIMELINE_CLEANUP=yes
'';
in {
in
{
bertof_raid0 = {
subvolume = "/home/bertof/raid0";
extraConfig = ''

View file

@ -77,7 +77,8 @@ let
STOP
'';
};
in {
in
{
networking = {
hosts = { "127.0.0.1" = [ "ds.my.engine" "kdc.my.engine" "my.engine" ]; };

View file

@ -6,7 +6,8 @@ let
filterAttrs (_k: v: v.fsType == "btrfs") config.fileSystems;
btrfsDevices =
unique (attrValues (mapAttrs (_: v: v.device) btrfsFileSystems));
in {
in
{
services.btrfs.autoScrub = {
enable = btrfsDevices != [ ];
fileSystems = btrfsDevices;

View file

@ -4,7 +4,8 @@ let
url =
"https://github.com/notracking/hosts-blocklists/raw/master/dnsmasq/dnsmasq.blacklist.txt";
};
in {
in
{
networking.firewall.allowedTCPPorts = [ 53 ];
networking.firewall.allowedUDPPorts = [ 53 ];

View file

@ -4,7 +4,8 @@ let
user_keys = user:
lib.optionals (builtins.hasAttr "bertof" config.users.users)
config.users.users.${user}.openssh.authorizedKeys.keys;
in {
in
{
# nix.buildMachines
nix.distributedBuilds = true;

View file

@ -171,14 +171,16 @@ with lib; {
services.smartd.enable = true;
services.snapper = {
configs = let
configs =
let
bertofExtraConfig = ''
ALLOW_USERS="bertof"
TIMELINE_CREATE=yes
TIMELINE_CLEANUP=yes
'';
common = { extraConfig = bertofExtraConfig; };
in {
in
{
bertof_home = recursiveUpdate common { subvolume = "/home/bertof"; };
bertof_music =
recursiveUpdate common { subvolume = "/home/bertof/Musica"; };

View file

@ -18,7 +18,8 @@ let
loki =
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICeomEH/27XFlOjQ/GTO2mo8qPMHTbzLIsX0dloxXfhb";
systems = [ odin thor baldur loki ];
in {
in
{
# "oauth_proxy_client_credentials.age".publicKeys = users ++ systems;
"spotify_password.age".publicKeys = users ++ systems;
}

View file

@ -122,7 +122,8 @@ with lib; {
power-profiles-daemon.enable = true;
smartd.enable = true;
snapper = {
configs = let
configs =
let
common = {
extraConfig = ''
ALLOW_USERS="bertof"
@ -130,7 +131,8 @@ with lib; {
TIMELINE_CLEANUP=yes
'';
};
in {
in
{
bertof_home = recursiveUpdate common { subvolume = "/home/bertof"; };
};
};