Switch to nixfmt

This commit is contained in:
Dave Gallant
2024-07-28 08:26:07 -04:00
parent a009dd5fe4
commit 1bfd747ebb
13 changed files with 168 additions and 271 deletions

View File

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

36
flake.lock generated
View File

@@ -143,11 +143,11 @@
]
},
"locked": {
"lastModified": 1717408969,
"narHash": "sha256-Q0OEFqe35fZbbRPPRdrjTUUChKVhhWXz3T9ZSKmaoVY=",
"lastModified": 1721902368,
"narHash": "sha256-noQ5SghRPe0jzQEbFQb3fYbV6LZEzr7lIRQoxlU7fyI=",
"owner": "numtide",
"repo": "devshell",
"rev": "1ebbe68d57457c8cae98145410b164b5477761f4",
"rev": "cf8c7405479cfde7ea4dc815e195391d2328df10",
"type": "github"
},
"original": {
@@ -271,11 +271,11 @@
]
},
"locked": {
"lastModified": 1721038330,
"narHash": "sha256-DyIGJ+DEnKeGd346YJCwjmp9hXwiYq8wqGtikgbDqSc=",
"lastModified": 1721042469,
"narHash": "sha256-6FPUl7HVtvRHCCBQne7Ylp4p+dpP3P/OYuzjztZ4s70=",
"owner": "cachix",
"repo": "git-hooks.nix",
"rev": "622291c026190caf13cb26f5136616b1ff0a07aa",
"rev": "f451c19376071a90d8c58ab1a953c6e9840527fd",
"type": "github"
},
"original": {
@@ -395,11 +395,11 @@
]
},
"locked": {
"lastModified": 1720845312,
"narHash": "sha256-yPhAsJTpyoIPQZJGC8Fw8W2lAXyhLoTn+HP20bmfkfk=",
"lastModified": 1721719500,
"narHash": "sha256-nnkqjv4Y37Hydjh6HE9wW4kSkV5Q7q4iIXlL5lwUFOw=",
"owner": "lnl7",
"repo": "nix-darwin",
"rev": "5ce8503cf402cf76b203eba4b7e402bea8e44abc",
"rev": "884f3fe6d9bf056ba0017c132c39c1f0d07d4fec",
"type": "github"
},
"original": {
@@ -441,11 +441,11 @@
},
"nixpkgs-unstable": {
"locked": {
"lastModified": 1721782431,
"narHash": "sha256-UNDpwjYxNXQet/g3mgRLsQ9zxrbm9j2JEvP4ijF3AWs=",
"lastModified": 1721933792,
"narHash": "sha256-zYVwABlQnxpbaHMfX6Wt9jhyQstFYwN2XjleOJV3VVg=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "4f02464258baaf54992debfd010a7a3662a25536",
"rev": "2122a9b35b35719ad9a395fe783eabb092df01b1",
"type": "github"
},
"original": {
@@ -485,11 +485,11 @@
"treefmt-nix": "treefmt-nix"
},
"locked": {
"lastModified": 1721045803,
"narHash": "sha256-dQGvOK+t45unF7DTp5bfO37hY0NkDUw6X3MH5CCTEAs=",
"lastModified": 1721923172,
"narHash": "sha256-IWjuOYLf2wKD0mS8FkiM1n2d1PrkTRJPP+UAIOFgWCQ=",
"owner": "nix-community",
"repo": "nixvim",
"rev": "eef2f4c6b190d92e296e47e5fe10e7ced65fd959",
"rev": "551fc42d2aab63bcf3709aa20ebfd7269128642d",
"type": "github"
},
"original": {
@@ -562,11 +562,11 @@
]
},
"locked": {
"lastModified": 1720930114,
"narHash": "sha256-VZK73b5hG5bSeAn97TTcnPjXUXtV7j/AtS4KN8ggCS0=",
"lastModified": 1721769617,
"narHash": "sha256-6Pqa0bi5nV74IZcENKYRToRNM5obo1EQ+3ihtunJ014=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "b92afa1501ac73f1d745526adc4f89b527595f14",
"rev": "8db8970be1fb8be9c845af7ebec53b699fe7e009",
"type": "github"
},
"original": {

194
flake.nix
View File

@@ -20,120 +20,96 @@
stylix.url = "github:danth/stylix/release-24.05";
};
outputs =
{ self
, darwin
, home-manager
, nixpkgs
, nixpkgs-unstable
, nixos-hardware
, stylix
, ...
} @ inputs: {
nixosConfigurations =
let
unstable = import nixpkgs-unstable {
system = "x86_64-linux";
config.allowUnfree = true;
};
in
{
hephaestus = nixpkgs.lib.nixosSystem {
specialArgs = { inherit unstable; };
modules =
[
./fonts.nix
./machines/hephaestus/configuration.nix
./packages.nix
./services/netdata/default.nix
./upgrade-diff.nix
home-manager.nixosModules.home-manager
stylix.nixosModules.stylix
({ config
, lib
, ...
}: {
config = {
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;
};
};
};
})
];
};
outputs = { self, darwin, home-manager, nixpkgs, nixpkgs-unstable
, nixos-hardware, stylix, ... }@inputs: {
nixosConfigurations = let
unstable = import nixpkgs-unstable {
system = "x86_64-linux";
config.allowUnfree = true;
};
in {
hephaestus = nixpkgs.lib.nixosSystem {
specialArgs = { inherit unstable; };
modules = [
./fonts.nix
./machines/hephaestus/configuration.nix
./packages.nix
./services/netdata/default.nix
./upgrade-diff.nix
home-manager.nixosModules.home-manager
stylix.nixosModules.stylix
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
stylix.darwinModules.stylix
./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
({ config, lib, ... }: {
config = {
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="
];
extraSpecialArgs = {
inherit unstable;
};
};
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; };
};
};
})
];
};
};
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
stylix.darwinModules.stylix
./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,12 +1,6 @@
{ lib
, pkgs
, unstable
, ...
}:
let
inherit (pkgs) stdenv;
in
{
{ lib, pkgs, unstable, ... }:
let inherit (pkgs) stdenv;
in {
home.stateVersion = "24.05";
home.packages = with pkgs; [ just ];
@@ -23,13 +17,7 @@ in
opacity.terminal = 1.0;
fonts.sizes =
if stdenv.isLinux
then {
terminal = 20;
}
else {
terminal = 16;
};
if stdenv.isLinux then { terminal = 20; } else { terminal = 16; };
fonts.monospace = {
name = "FiraCode Nerd Font Mono";
@@ -77,14 +65,17 @@ in
d = "diff";
dc = "diff --cached";
dcn = "diff --cached --name-only";
ds = "! git diff origin | sed -r 's/value: (.*)/value: \"************\"/'";
l = "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit";
ds =
"! git diff origin | sed -r 's/value: (.*)/value: \"************\"/'";
l =
"log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit";
ms = "merge --squash";
p = "push origin";
pf = "push -f";
pl = "! git pull origin $(git rev-parse --abbrev-ref HEAD)";
st = "status";
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"; }];
@@ -118,9 +109,7 @@ in
add_newline = false;
scan_timeout = 10;
character = { error_symbol = "[](bold red)"; };
gcloud = {
format = "";
};
gcloud = { format = ""; };
kubernetes = {
disabled = false;
context_aliases = {
@@ -212,9 +201,7 @@ in
v = "nvim";
};
"oh-my-zsh" = {
enable = true;
};
"oh-my-zsh" = { enable = true; };
};
alacritty = {
@@ -233,9 +220,7 @@ in
};
};
go = {
enable = true;
};
go = { enable = true; };
tmux = {
enable = true;
@@ -327,9 +312,7 @@ in
'';
};
fzf = {
enable = true;
};
fzf = { enable = true; };
nixvim = {
enable = true;
@@ -340,14 +323,12 @@ in
key = "<C-n>";
mode = [ "n" ];
action = "<cmd>tabnew<cr>";
options = {
silent = true;
};
options = { silent = true; };
}
{
key = "<leader>y";
mode = [ "v" ];
action = "\"+y"; # copy to OS clipboard
action = ''"+y''; # copy to OS clipboard
}
{
key = "<leader>t";
@@ -425,11 +406,7 @@ in
enable = true;
settings.defaults = {
layout_strategy = "vertical";
layout_config = {
vertical = {
width = 0.9;
};
};
layout_config = { vertical = { width = 0.9; }; };
};
package = pkgs.vimPlugins.telescope-fzy-native-nvim;
};
@@ -438,10 +415,7 @@ in
autoindent = true;
backup = false;
belloff = "all";
completeopt = [
"menuone"
"noselect"
];
completeopt = [ "menuone" "noselect" ];
cursorline = true;
expandtab = true;
fillchars = {
@@ -527,8 +501,7 @@ in
ms-dotnettools.csharp
ms-kubernetes-tools.vscode-kubernetes-tools
redhat.vscode-yaml
]
++ lib.optionals stdenv.isLinux [
] ++ lib.optionals stdenv.isLinux [
ms-vsliveshare.vsliveshare
ms-python.python
];
@@ -549,7 +522,8 @@ in
"dom.push.enabled" = false;
"geo.enabled" = false;
"intl.regional_prefs.use_os_locales" = true;
"services.sync.prefs.sync.intl.regional._prefs.use_os_locates" = false;
"services.sync.prefs.sync.intl.regional._prefs.use_os_locates" =
false;
};
name = "dev-edition-default";
path = "6b7pm104.dev-edition-default";

View File

@@ -21,7 +21,7 @@ update:
@./nix-flake-update.sh
fmt:
nixpkgs-fmt .
nixfmt .
clean:
echo 'Cleaning user...'

View File

@@ -1,10 +1,4 @@
{ config
, lib
, modulesPath
, pkgs
, unstable
, ...
}:
{ config, lib, modulesPath, pkgs, unstable, ... }:
let
gnomeExtensions = with pkgs.gnomeExtensions; [
appindicator
@@ -18,16 +12,17 @@ let
tailscale-status
tray-icons-reloaded
];
in
{
in {
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
stylix = {
enable = true;
base16Scheme = "${unstable.base16-schemes}/share/themes/tokyo-night-dark.yaml";
base16Scheme =
"${unstable.base16-schemes}/share/themes/tokyo-night-dark.yaml";
image = pkgs.fetchurl {
url = "https://github.com/davegallant/nix-config/blob/main/nixos-wallpaper.png?raw=true";
url =
"https://github.com/davegallant/nix-config/blob/main/nixos-wallpaper.png?raw=true";
sha256 = "Ztqn9+CHslr6wZdnOTeo/YNi/ICerpcFLyMArsZ/PIY=";
};
polarity = "dark";
@@ -35,9 +30,7 @@ in
};
boot = {
extraModulePackages = with config.boot.kernelPackages; [
xpadneo
];
extraModulePackages = with config.boot.kernelPackages; [ xpadneo ];
kernelModules = [ "kvm-amd" ];
kernelPackages = pkgs.linuxPackages;
@@ -55,23 +48,15 @@ in
supportedFilesystems = [ "ntfs" ];
initrd = {
availableKernelModules = [
"ahci"
"nvme"
"sd_mod"
"usb_storage"
"usbhid"
"xhci_pci"
];
availableKernelModules =
[ "ahci" "nvme" "sd_mod" "usb_storage" "usbhid" "xhci_pci" ];
luks.devices."root" = {
allowDiscards = true;
device = "/dev/disk/by-uuid/21cd166c-1528-49a4-b31b-0d408d48aa80";
preLVM = true;
keyFile = "./keyfile0.bin";
};
secrets = {
"keyfile0.bin" = "/etc/secrets/initrd/keyfile0.bin";
};
secrets = { "keyfile0.bin" = "/etc/secrets/initrd/keyfile0.bin"; };
};
};
@@ -123,8 +108,7 @@ in
wine64
wireshark-qt
zoom-us
]
++ gnomeExtensions;
] ++ gnomeExtensions;
fileSystems = {
"/" = {
@@ -149,9 +133,8 @@ in
};
};
swapDevices = [
{ device = "/dev/disk/by-uuid/5d6d0388-2b15-4ff1-9f0f-391818a76090"; }
];
swapDevices =
[{ device = "/dev/disk/by-uuid/5d6d0388-2b15-4ff1-9f0f-391818a76090"; }];
nixpkgs = {
hostPlatform = "x86_64-linux";
@@ -164,9 +147,7 @@ in
networking = {
iproute2.enable = true;
hostName = "hephaestus";
interfaces.enp34s0 = {
useDHCP = true;
};
interfaces.enp34s0 = { useDHCP = true; };
firewall = {
allowPing = false;
enable = true;
@@ -175,18 +156,14 @@ in
};
};
systemd.services = {
NetworkManager-wait-online.enable = false;
};
systemd.services = { NetworkManager-wait-online.enable = false; };
system = {
autoUpgrade.enable = true;
stateVersion = "24.05";
};
nix = {
extraOptions = "experimental-features = nix-command flakes";
};
nix = { extraOptions = "experimental-features = nix-command flakes"; };
users.users.dave = {
isNormalUser = true;
@@ -200,7 +177,8 @@ in
hardware = {
opengl.enable = true;
cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
cpu.amd.updateMicrocode =
lib.mkDefault config.hardware.enableRedistributableFirmware;
pulseaudio.enable = true;
# Vulkan
opengl.driSupport = true;

View File

@@ -1,8 +1,6 @@
{ pkgs, ... }:
let
checkBrew = "command -v brew > /dev/null";
in
{
let checkBrew = "command -v brew > /dev/null";
in {
nixpkgs = {
config = {
allowUnfree = true;
@@ -58,7 +56,7 @@ in
NSGlobalDomain = {
"com.apple.sound.beep.feedback" = 0;
"com.apple.sound.beep.volume" = 0.000;
"com.apple.sound.beep.volume" = 0.0;
ApplePressAndHoldEnabled = false;
InitialKeyRepeat = 10;
KeyRepeat = 2;
@@ -71,9 +69,7 @@ in
enable = true;
onActivation.autoUpdate = false;
onActivation.upgrade = false;
global = {
brewfile = true;
};
global = { brewfile = true; };
brews = [
"azure-cli"

View File

@@ -1,9 +1,4 @@
{ lib
, fetchFromGitHub
, pkgs
, stdenv
,
}:
{ lib, fetchFromGitHub, pkgs, stdenv, }:
stdenv.mkDerivation rec {
pname = "sbx-h6-rgb";
version = "95b4ef9788ef94e557a4d1e815079d5ea8a70943";
@@ -15,9 +10,7 @@ stdenv.mkDerivation rec {
sha256 = "sha256-tKKNdzijloBiGBHf5C604824B/BbxBxvCL/ms4orT9M=";
};
buildInputs = with pkgs; [
hidapi
];
buildInputs = with pkgs; [ hidapi ];
buildPhase = ''
make
@@ -35,4 +28,3 @@ stdenv.mkDerivation rec {
};
}

View File

@@ -1,8 +1,4 @@
{ stdenv
, lib
, fetchurl
,
}:
{ stdenv, lib, fetchurl, }:
stdenv.mkDerivation rec {
pname = "tmux-sessionizer";
version = "0.0.0";
@@ -17,8 +13,8 @@ stdenv.mkDerivation rec {
'';
meta = with lib; {
description = "
Tmux sessionizer adapted from https://sourcegraph.com/github.com/ThePrimeagen/.dotfiles@5cd09f06d6683b91c26822a73b40e3d7fb9af57a/-/blob/bin/.local/bin/tmux-sessionizer";
description =
"\n Tmux sessionizer adapted from https://sourcegraph.com/github.com/ThePrimeagen/.dotfiles@5cd09f06d6683b91c26822a73b40e3d7fb9af57a/-/blob/bin/.local/bin/tmux-sessionizer";
platforms = platforms.unix;
};
}

View File

@@ -1,8 +1,4 @@
{ lib
, fetchFromGitHub
, buildGoModule
,
}:
{ lib, fetchFromGitHub, buildGoModule, }:
buildGoModule rec {
pname = "vpngate";
version = "v0.2.0";

View File

@@ -1,13 +1,6 @@
{ config
, lib
, pkgs
, unstable
, ...
}:
let
inherit (pkgs) stdenv;
in
{
{ config, lib, pkgs, unstable, ... }:
let inherit (pkgs) stdenv;
in {
environment.systemPackages = with pkgs; [
# essentials
curl
@@ -93,7 +86,7 @@ in
# nix
nix-tree
nixpkgs-fmt
nixfmt-rfc-style
nixpkgs-review
# python

View File

@@ -1,13 +1,9 @@
{ config
, pkgs
, ...
}:
{ 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 = {

View File

@@ -1,9 +1,11 @@
let
nixpkgs = fetchTarball "https://github.com/NixOS/nixpkgs/tarball/nixos-24.05";
pkgs = import nixpkgs { config = { }; overlays = [ ]; };
in
pkgs = import nixpkgs {
config = { };
overlays = [ ];
};
pkgs.mkShell {
in pkgs.mkShell {
shellHook = ''
${(import ./default.nix).pre-commit-check.shellHook}
'';