Use nixpkgs-fmt

This commit is contained in:
Dave Gallant
2024-03-05 16:03:33 -05:00
parent b05d25845c
commit 2b6fa6d5b2
17 changed files with 202 additions and 195 deletions

View File

@@ -24,4 +24,4 @@ update:
@./nix-flake-update.sh @./nix-flake-update.sh
fmt: fmt:
alejandra . nixpkgs-fmt .

View File

@@ -1,11 +1,12 @@
{ { config
config, , lib
lib, , pkgs
pkgs, , ...
... }:
}: let let
checkBrew = "command -v brew > /dev/null"; checkBrew = "command -v brew > /dev/null";
in { in
{
users.users."dave.gallant".home = "/Users/dave.gallant"; users.users."dave.gallant".home = "/Users/dave.gallant";
environment = { environment = {
extraInit = '' extraInit = ''

View File

@@ -2,12 +2,13 @@ let
nix-pre-commit-hooks = nix-pre-commit-hooks =
import (builtins.fetchTarball import (builtins.fetchTarball
"https://github.com/cachix/pre-commit-hooks.nix/tarball/master"); "https://github.com/cachix/pre-commit-hooks.nix/tarball/master");
in { in
{
pre-commit-check = nix-pre-commit-hooks.run { pre-commit-check = nix-pre-commit-hooks.run {
src = ./.; src = ./.;
hooks = { hooks = {
shellcheck.enable = true; shellcheck.enable = true;
alejandra.enable = true; nixpkgs-fmt.enable = true;
}; };
}; };
} }

View File

@@ -23,5 +23,5 @@
}; };
}; };
outputs = {...} @ args: import ./outputs.nix args; outputs = { ... } @ args: import ./outputs.nix args;
} }

View File

@@ -1,4 +1,4 @@
{pkgs, ...}: { { pkgs, ... }: {
fonts.packages = with pkgs; [ fonts.packages = with pkgs; [
dejavu_fonts dejavu_fonts
fira-code fira-code
@@ -14,9 +14,9 @@
]; ];
fonts.fontconfig.defaultFonts = { fonts.fontconfig.defaultFonts = {
sansSerif = ["Noto Sans"]; sansSerif = [ "Noto Sans" ];
serif = ["Noto Serif"]; serif = [ "Noto Serif" ];
monospace = ["Noto Sans Mono"]; monospace = [ "Noto Sans Mono" ];
emoji = ["Noto Color Emoji"]; emoji = [ "Noto Color Emoji" ];
}; };
} }

View File

@@ -1,11 +1,12 @@
{ { lib
lib, , pkgs
pkgs, , unstable
unstable, , ...
... }:
}: let let
inherit (pkgs) stdenv; inherit (pkgs) stdenv;
in { in
{
home.stateVersion = "23.11"; home.stateVersion = "23.11";
services = { services = {
@@ -53,7 +54,7 @@ in {
wip = "for-each-ref --sort='authordate:iso8601' --format=' %(color:green)%(authordate:relative)%09%(color:white)%(refname:short)' refs/heads"; wip = "for-each-ref --sort='authordate:iso8601' --format=' %(color:green)%(authordate:relative)%09%(color:white)%(refname:short)' refs/heads";
}; };
includes = [{path = "~/.gitconfig-work";}]; includes = [{ path = "~/.gitconfig-work"; }];
delta = { delta = {
enable = true; enable = true;
@@ -71,8 +72,8 @@ in {
}; };
extraConfig = { extraConfig = {
push = {default = "current";}; push = { default = "current"; };
pull = {rebase = true;}; pull = { rebase = true; };
}; };
}; };
@@ -83,7 +84,7 @@ in {
settings = { settings = {
add_newline = false; add_newline = false;
scan_timeout = 10; scan_timeout = 10;
character = {error_symbol = "[](bold red)";}; character = { error_symbol = "[](bold red)"; };
gcloud = { gcloud = {
format = "[$symbol($project) ~ $region]($style)"; format = "[$symbol($project) ~ $region]($style)";
}; };
@@ -212,7 +213,7 @@ in {
shell = { shell = {
program = "zsh"; program = "zsh";
args = ["-l" "-c" "tmux" "u"]; args = [ "-l" "-c" "tmux" "u" ];
}; };
colors = { colors = {
@@ -347,7 +348,7 @@ in {
rofi = { rofi = {
enable = stdenv.isLinux; enable = stdenv.isLinux;
plugins = [pkgs.rofi-emoji]; plugins = [ pkgs.rofi-emoji ];
terminal = "${pkgs.alacritty}/bin/alacritty"; terminal = "${pkgs.alacritty}/bin/alacritty";
font = "Fira Font Mono 24"; font = "Fira Font Mono 24";
theme = "gruvbox-dark"; theme = "gruvbox-dark";
@@ -369,7 +370,7 @@ in {
keymaps = [ keymaps = [
{ {
key = "<C-n>"; key = "<C-n>";
mode = ["n"]; mode = [ "n" ];
action = "<cmd>tabnew<cr>"; action = "<cmd>tabnew<cr>";
options = { options = {
silent = true; silent = true;
@@ -378,22 +379,22 @@ in {
# copy to OS clipboard # copy to OS clipboard
{ {
key = "<leader>y"; key = "<leader>y";
mode = ["v"]; mode = [ "v" ];
action = "\"+y"; action = "\"+y";
} }
{ {
key = "gD"; key = "gD";
mode = ["n"]; mode = [ "n" ];
action = "<cmd>lua vim.lsp.buf.declaration()<CR>"; action = "<cmd>lua vim.lsp.buf.declaration()<CR>";
} }
{ {
key = "gd"; key = "gd";
mode = ["n"]; mode = [ "n" ];
action = "<cmd>lua vim.lsp.buf.definition()<CR>"; action = "<cmd>lua vim.lsp.buf.definition()<CR>";
} }
{ {
key = "gr"; key = "gr";
mode = ["n"]; mode = [ "n" ];
action = "<cmd>lua vim.lsp.buf.references()<CR>"; action = "<cmd>lua vim.lsp.buf.references()<CR>";
} }
]; ];
@@ -424,9 +425,9 @@ in {
lsp-format = { lsp-format = {
enable = true; enable = true;
setup = { setup = {
terraform = {}; terraform = { };
nix = {}; nix = { };
go = {}; go = { };
}; };
}; };
nvim-cmp.enable = true; nvim-cmp.enable = true;

View File

@@ -1,9 +1,9 @@
{ { config
config, , pkgs
pkgs, , unstable
unstable, , ...
... }:
}: let let
gnomeExtensions = with pkgs.gnomeExtensions; [ gnomeExtensions = with pkgs.gnomeExtensions; [
appindicator appindicator
bluetooth-quick-connect bluetooth-quick-connect
@@ -17,8 +17,9 @@
tailscale-status tailscale-status
tray-icons-reloaded tray-icons-reloaded
]; ];
in { in
imports = [./hardware.nix]; {
imports = [ ./hardware.nix ];
hardware.opengl.enable = true; hardware.opengl.enable = true;
@@ -34,14 +35,14 @@ in {
allowPing = false; allowPing = false;
enable = true; enable = true;
checkReversePath = "loose"; checkReversePath = "loose";
trustedInterfaces = ["tailscale0"]; trustedInterfaces = [ "tailscale0" ];
}; };
}; };
systemd.services.NetworkManager-wait-online.enable = false; systemd.services.NetworkManager-wait-online.enable = false;
boot.kernelPackages = pkgs.linuxPackages; boot.kernelPackages = pkgs.linuxPackages;
boot.supportedFilesystems = ["ntfs"]; boot.supportedFilesystems = [ "ntfs" ];
system = { system = {
autoUpgrade.enable = true; autoUpgrade.enable = true;
@@ -55,7 +56,7 @@ in {
users.users.dave = { users.users.dave = {
isNormalUser = true; isNormalUser = true;
extraGroups = ["docker" "wheel" "libvirtd" "corectrl"]; extraGroups = [ "docker" "wheel" "libvirtd" "corectrl" ];
shell = pkgs.zsh; shell = pkgs.zsh;
}; };
@@ -74,7 +75,7 @@ in {
hardware.opengl.driSupport32Bit = true; hardware.opengl.driSupport32Bit = true;
# Steam # Steam
hardware.opengl.extraPackages32 = with pkgs.pkgsi686Linux; [libva]; hardware.opengl.extraPackages32 = with pkgs.pkgsi686Linux; [ libva ];
hardware.pulseaudio.support32Bit = true; hardware.pulseaudio.support32Bit = true;
programs.steam = { programs.steam = {
enable = true; enable = true;
@@ -116,7 +117,7 @@ in {
resolved.enable = true; resolved.enable = true;
sshd.enable = true; sshd.enable = true;
tailscale.enable = true; tailscale.enable = true;
xserver.videoDrivers = ["amdgpu"]; xserver.videoDrivers = [ "amdgpu" ];
xserver = { xserver = {
enable = true; enable = true;
displayManager = { displayManager = {

View File

@@ -1,11 +1,10 @@
{ { config
config, , lib
lib, , pkgs
pkgs, , modulesPath
modulesPath, , ...
...
}: { }: {
imports = [(modulesPath + "/installer/scan/not-detected.nix")]; imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
nixpkgs.hostPlatform = "x86_64-linux"; nixpkgs.hostPlatform = "x86_64-linux";
@@ -17,8 +16,8 @@
"usbhid" "usbhid"
"xhci_pci" "xhci_pci"
]; ];
boot.initrd.kernelModules = []; boot.initrd.kernelModules = [ ];
boot.kernelModules = ["kvm-amd"]; boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = with config.boot.kernelPackages; [ boot.extraModulePackages = with config.boot.kernelPackages; [
xpadneo xpadneo
]; ];
@@ -73,6 +72,6 @@
}; };
swapDevices = [ swapDevices = [
{device = "/dev/disk/by-uuid/5d6d0388-2b15-4ff1-9f0f-391818a76090";} { device = "/dev/disk/by-uuid/5d6d0388-2b15-4ff1-9f0f-391818a76090"; }
]; ];
} }

View File

@@ -1,9 +1,9 @@
{pkgs, ...}: { { pkgs, ... }: {
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;
environment = {variables = {LANG = "en_US.UTF-8";};}; environment = { variables = { LANG = "en_US.UTF-8"; }; };
networking = {hostName = "zelus";}; networking = { hostName = "zelus"; };
services.nix-daemon.enable = true; services.nix-daemon.enable = true;

View File

@@ -1,14 +1,14 @@
{ { self
self, , darwin
darwin, , home-manager
home-manager, , nixpkgs
nixpkgs, , nixpkgs-unstable
nixpkgs-unstable, , nixos-hardware
nixos-hardware, , nix-ld
nix-ld, , ...
...
} @ inputs: { } @ inputs: {
nixosConfigurations = let nixosConfigurations =
let
modulesDir = ./modules; modulesDir = ./modules;
unstable = import nixpkgs-unstable { unstable = import nixpkgs-unstable {
system = "x86_64-linux"; system = "x86_64-linux";
@@ -23,28 +23,27 @@
./packages.nix ./packages.nix
./upgrade-diff.nix ./upgrade-diff.nix
({ ({ config
config, , lib
lib, , lib'
lib', , ...
...
}: { }: {
config = { config = {
_module.args = { _module.args = {
lib' = lib // import ./lib {inherit config lib;}; lib' = lib // import ./lib { inherit config lib; };
}; };
nix = { nix = {
settings = { settings = {
auto-optimise-store = true; auto-optimise-store = true;
sandbox = false; sandbox = false;
substituters = ["https://davegallant.cachix.org"]; substituters = [ "https://davegallant.cachix.org" ];
trusted-users = ["root" "dave"]; trusted-users = [ "root" "dave" ];
trusted-public-keys = [ trusted-public-keys = [
"davegallant.cachix.org-1:SsUMqL4+tF2R3/G6X903E9laLlY1rES2QKFfePegF08=" "davegallant.cachix.org-1:SsUMqL4+tF2R3/G6X903E9laLlY1rES2QKFfePegF08="
]; ];
}; };
registry = {nixpkgs.flake = nixpkgs;}; registry = { nixpkgs.flake = nixpkgs; };
gc = { gc = {
automatic = true; automatic = true;
dates = "daily"; dates = "daily";
@@ -70,9 +69,10 @@
}; };
}) })
]; ];
in { in
{
hephaestus = nixpkgs.lib.nixosSystem { hephaestus = nixpkgs.lib.nixosSystem {
specialArgs = {inherit unstable;}; specialArgs = { inherit unstable; };
modules = modules =
[ [
./machines/hephaestus/configuration.nix ./machines/hephaestus/configuration.nix
@@ -83,16 +83,18 @@
}; };
}; };
darwinConfigurations = let darwinConfigurations =
let
system = "aarch64-darwin"; system = "aarch64-darwin";
unstable = import nixpkgs-unstable { unstable = import nixpkgs-unstable {
config.allowUnfree = true; config.allowUnfree = true;
inherit system; inherit system;
}; };
in { in
{
zelus = darwin.lib.darwinSystem { zelus = darwin.lib.darwinSystem {
inherit system; inherit system;
specialArgs = {inherit unstable;}; specialArgs = { inherit unstable; };
modules = [ modules = [
home-manager.darwinModules.home-manager home-manager.darwinModules.home-manager
@@ -101,7 +103,7 @@
./packages.nix ./packages.nix
./upgrade-diff.nix ./upgrade-diff.nix
({config, ...}: { ({ config, ... }: {
config = { config = {
nixpkgs.overlays = [ nixpkgs.overlays = [
(import ./overlays) (import ./overlays)

View File

@@ -1,4 +1,4 @@
final: prev: { final: prev: {
tmux-sessionizer = prev.callPackage ./tmux-sessionizer {}; tmux-sessionizer = prev.callPackage ./tmux-sessionizer { };
vpngate = prev.callPackage ./vpngate {}; vpngate = prev.callPackage ./vpngate { };
} }

View File

@@ -1,7 +1,7 @@
{ { stdenv
stdenv, , lib
lib, , fetchurl
fetchurl, ,
}: }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "tmux-sessionizer"; pname = "tmux-sessionizer";
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
executable = ./tmux-sessionizer; executable = ./tmux-sessionizer;
phases = ["unpackPhase"]; # Remove all other phases phases = [ "unpackPhase" ]; # Remove all other phases
unpackPhase = '' unpackPhase = ''
mkdir -p $out/bin mkdir -p $out/bin

View File

@@ -1,7 +1,7 @@
{ { lib
lib, , fetchFromGitHub
fetchFromGitHub, , buildGoModule
buildGoModule, ,
}: }:
buildGoModule rec { buildGoModule rec {
pname = "vpngate"; pname = "vpngate";
@@ -22,7 +22,7 @@ buildGoModule rec {
homepage = "https://www.vpngate.net"; homepage = "https://www.vpngate.net";
description = "a client for vpngate.net"; description = "a client for vpngate.net";
license = licenses.gpl3; license = licenses.gpl3;
maintainers = with maintainers; [davegallant]; maintainers = with maintainers; [ davegallant ];
platforms = platforms.linux ++ platforms.darwin; platforms = platforms.linux ++ platforms.darwin;
}; };
} }

View File

@@ -1,12 +1,13 @@
{ { config
config, , lib
lib, , pkgs
pkgs, , unstable
unstable, , ...
... }:
}: let let
inherit (pkgs) stdenv; inherit (pkgs) stdenv;
in { in
{
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
# essentials # essentials
curl curl

View File

@@ -1,12 +1,13 @@
{ { config
config, , pkgs
pkgs, , ...
... }:
}: let let
netdata = pkgs.netdata; netdata = pkgs.netdata;
netdataConf = ./netdata.conf; netdataConf = ./netdata.conf;
netdataDir = "/var/lib/netdata"; netdataDir = "/var/lib/netdata";
in { in
{
users.extraGroups.netdata.gid = 220008; users.extraGroups.netdata.gid = 220008;
users.users.netdata.group = "netdata"; users.users.netdata.group = "netdata";
users.extraUsers.netdata = { users.extraUsers.netdata = {
@@ -16,8 +17,8 @@ in {
uid = 200008; uid = 200008;
}; };
systemd.services.netdata = { systemd.services.netdata = {
wantedBy = ["multi-user.target"]; wantedBy = [ "multi-user.target" ];
after = ["network.target"]; after = [ "network.target" ];
preStart = '' preStart = ''
mkdir -p ${netdataDir}/config mkdir -p ${netdataDir}/config
mkdir -p ${netdataDir}/logs mkdir -p ${netdataDir}/logs

View File

@@ -1,4 +1,4 @@
(import <nixpkgs> {}).mkShell { (import <nixpkgs> { }).mkShell {
shellHook = '' shellHook = ''
${(import ./default.nix).pre-commit-check.shellHook} ${(import ./default.nix).pre-commit-check.shellHook}
''; '';

View File

@@ -1,4 +1,4 @@
{pkgs, ...}: { { pkgs, ... }: {
system.activationScripts.diff = { system.activationScripts.diff = {
supportsDryActivation = true; supportsDryActivation = true;
text = '' text = ''