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
fmt:
alejandra .
nixpkgs-fmt .

View File

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

View File

@@ -2,12 +2,13 @@ let
nix-pre-commit-hooks =
import (builtins.fetchTarball
"https://github.com/cachix/pre-commit-hooks.nix/tarball/master");
in {
in
{
pre-commit-check = nix-pre-commit-hooks.run {
src = ./.;
hooks = {
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; [
dejavu_fonts
fira-code
@@ -14,9 +14,9 @@
];
fonts.fontconfig.defaultFonts = {
sansSerif = ["Noto Sans"];
serif = ["Noto Serif"];
monospace = ["Noto Sans Mono"];
emoji = ["Noto Color Emoji"];
sansSerif = [ "Noto Sans" ];
serif = [ "Noto Serif" ];
monospace = [ "Noto Sans Mono" ];
emoji = [ "Noto Color Emoji" ];
};
}

View File

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

View File

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

View File

@@ -1,11 +1,10 @@
{
config,
lib,
pkgs,
modulesPath,
...
{ config
, lib
, pkgs
, modulesPath
, ...
}: {
imports = [(modulesPath + "/installer/scan/not-detected.nix")];
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
nixpkgs.hostPlatform = "x86_64-linux";
@@ -17,8 +16,8 @@
"usbhid"
"xhci_pci"
];
boot.initrd.kernelModules = [];
boot.kernelModules = ["kvm-amd"];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = with config.boot.kernelPackages; [
xpadneo
];
@@ -73,6 +72,6 @@
};
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;
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;

View File

@@ -1,115 +1,64 @@
{
self,
darwin,
home-manager,
nixpkgs,
nixpkgs-unstable,
nixos-hardware,
nix-ld,
...
{ self
, darwin
, home-manager
, nixpkgs
, nixpkgs-unstable
, nixos-hardware
, nix-ld
, ...
} @ inputs: {
nixosConfigurations = let
modulesDir = ./modules;
unstable = import nixpkgs-unstable {
system = "x86_64-linux";
config.allowUnfree = true;
config.permittedInsecurePackages = [
"electron-25.9.0" # caused by obsidian
];
};
defaultModules = [
home-manager.nixosModules.home-manager
./fonts.nix
./packages.nix
./upgrade-diff.nix
({
config,
lib,
lib',
...
}: {
config = {
_module.args = {
lib' = lib // import ./lib {inherit config lib;};
};
nix = {
settings = {
auto-optimise-store = true;
sandbox = false;
substituters = ["https://davegallant.cachix.org"];
trusted-users = ["root" "dave"];
trusted-public-keys = [
"davegallant.cachix.org-1:SsUMqL4+tF2R3/G6X903E9laLlY1rES2QKFfePegF08="
];
};
registry = {nixpkgs.flake = nixpkgs;};
gc = {
automatic = true;
dates = "daily";
options = "--delete-older-than 14d";
};
};
nixpkgs.overlays = [
(import ./overlays)
];
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
users.dave.imports = [
./home/default.nix
inputs.nixvim.homeManagerModules.nixvim
];
extraSpecialArgs = {
inherit unstable;
};
};
};
})
];
in {
hephaestus = nixpkgs.lib.nixosSystem {
specialArgs = {inherit unstable;};
modules =
[
./machines/hephaestus/configuration.nix
./machines/hephaestus/hardware.nix
./services/netdata/default.nix
]
++ defaultModules;
};
};
darwinConfigurations = let
system = "aarch64-darwin";
unstable = import nixpkgs-unstable {
config.allowUnfree = true;
inherit system;
};
in {
zelus = darwin.lib.darwinSystem {
inherit system;
specialArgs = {inherit unstable;};
modules = [
home-manager.darwinModules.home-manager
./darwin.nix
./machines/zelus/configuration.nix
nixosConfigurations =
let
modulesDir = ./modules;
unstable = import nixpkgs-unstable {
system = "x86_64-linux";
config.allowUnfree = true;
config.permittedInsecurePackages = [
"electron-25.9.0" # caused by obsidian
];
};
defaultModules = [
home-manager.nixosModules.home-manager
./fonts.nix
./packages.nix
./upgrade-diff.nix
({config, ...}: {
({ config
, lib
, lib'
, ...
}: {
config = {
_module.args = {
lib' = lib // import ./lib { inherit config lib; };
};
nix = {
settings = {
auto-optimise-store = true;
sandbox = false;
substituters = [ "https://davegallant.cachix.org" ];
trusted-users = [ "root" "dave" ];
trusted-public-keys = [
"davegallant.cachix.org-1:SsUMqL4+tF2R3/G6X903E9laLlY1rES2QKFfePegF08="
];
};
registry = { nixpkgs.flake = nixpkgs; };
gc = {
automatic = true;
dates = "daily";
options = "--delete-older-than 14d";
};
};
nixpkgs.overlays = [
(import ./overlays)
];
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
users."dave.gallant".imports = [
users.dave.imports = [
./home/default.nix
inputs.nixvim.homeManagerModules.nixvim
];
@@ -120,6 +69,59 @@
};
})
];
in
{
hephaestus = nixpkgs.lib.nixosSystem {
specialArgs = { inherit unstable; };
modules =
[
./machines/hephaestus/configuration.nix
./machines/hephaestus/hardware.nix
./services/netdata/default.nix
]
++ defaultModules;
};
};
darwinConfigurations =
let
system = "aarch64-darwin";
unstable = import nixpkgs-unstable {
config.allowUnfree = true;
inherit system;
};
in
{
zelus = darwin.lib.darwinSystem {
inherit system;
specialArgs = { inherit unstable; };
modules = [
home-manager.darwinModules.home-manager
./darwin.nix
./machines/zelus/configuration.nix
./packages.nix
./upgrade-diff.nix
({ config, ... }: {
config = {
nixpkgs.overlays = [
(import ./overlays)
];
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
users."dave.gallant".imports = [
./home/default.nix
inputs.nixvim.homeManagerModules.nixvim
];
extraSpecialArgs = {
inherit unstable;
};
};
};
})
];
};
};
};
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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