Add alejandra

This commit is contained in:
Dave Gallant
2022-05-28 10:30:29 -04:00
parent 80e7729ab4
commit d2aaa3920f
31 changed files with 334 additions and 323 deletions

View File

@@ -4,7 +4,7 @@ SHELL := bash
MAKEFLAGS += --warn-undefined-variables MAKEFLAGS += --warn-undefined-variables
MAKEFLAGS += --no-builtin-rules MAKEFLAGS += --no-builtin-rules
HOSTAME ?= $(shell hostname) HOSTNAME ?= $(shell hostname)
UNAME_S := $(shell uname -s) UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux) ifeq ($(UNAME_S),Linux)
@@ -19,3 +19,6 @@ switch:
update: update:
nix flake update nix flake update
fmt:
alejandra .

View File

@@ -1,5 +1,3 @@
{ pkgs, ... }: {pkgs, ...}: {
{
nix.extraOptions = "experimental-features = nix-command flakes"; nix.extraOptions = "experimental-features = nix-command flakes";
} }

View File

@@ -1,7 +1,4 @@
{ ... }: {...}: {
{
services.xserver = { services.xserver = {
enable = true; enable = true;
displayManager = { displayManager = {

View File

@@ -1,6 +1,4 @@
{ pkgs, ... }: {pkgs, ...}: {
{
# Set system-wide fonts. # Set system-wide fonts.
fonts.fonts = with pkgs; [ fonts.fonts = with pkgs; [
dejavu_fonts dejavu_fonts

View File

@@ -1,6 +1,4 @@
{ pkgs, ... }: {pkgs, ...}: {
{
boot.kernelPackages = pkgs.linuxPackages; boot.kernelPackages = pkgs.linuxPackages;
boot.supportedFilesystems = ["ntfs"]; boot.supportedFilesystems = ["ntfs"];
@@ -47,5 +45,4 @@
enable = true; enable = true;
enableSSHSupport = true; enableSSHSupport = true;
}; };
} }

View File

@@ -1,6 +1,4 @@
{ pkgs, ... }: {pkgs, ...}: {
{
services.tailscale.enable = true; services.tailscale.enable = true;
networking = { networking = {

View File

@@ -1,12 +1,15 @@
{ config, lib, pkgs, ... }:
let inherit (pkgs) stdenv;
in
{ {
config,
lib,
pkgs,
...
}: let
inherit (pkgs) stdenv;
in {
# System-wide packages to install. # System-wide packages to install.
environment.systemPackages = with pkgs; environment.systemPackages = with pkgs; let
let common =
common = [ [
# essentials # essentials
curl curl
gcc gcc
@@ -119,10 +122,13 @@ in
terraformer terraformer
tflint tflint
tfsec tfsec
/* tfswitch */ /*
tfswitch
*/
infracost infracost
# nix # nix
alejandra
cachix cachix
nix-diff nix-diff
nixfmt nixfmt
@@ -157,8 +163,8 @@ in
# news # news
srv srv
]
] ++ lib.optionals stdenv.isLinux ([ ++ lib.optionals stdenv.isLinux [
_1password-gui _1password-gui
albert albert
authy authy
@@ -202,7 +208,7 @@ in
wireshark-qt wireshark-qt
yaru-theme yaru-theme
zoom-us zoom-us
]); ];
in in
common; common;

View File

@@ -1,5 +1,3 @@
{ pkgs, ... }: {pkgs, ...}: {
{
services.printing.enable = true; services.printing.enable = true;
} }

View File

@@ -1,13 +1,13 @@
let let
nix-pre-commit-hooks = import (builtins.fetchTarball nix-pre-commit-hooks =
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;
nixpkgs-fmt.enable = true; alejandra.enable = true;
}; };
}; };
} }

View File

@@ -19,21 +19,33 @@
}; };
}; };
outputs = { self, darwin, home-manager, nixpkgs, nixos-hardware, ... }@inputs: { outputs = {
self,
nixosConfigurations = darwin,
let home-manager,
nixpkgs,
nixos-hardware,
...
} @ inputs: {
nixosConfigurations = let
defaultModules = [ defaultModules = [
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager
./common/desktop.nix ./common/desktop.nix
./common/fonts.nix ./common/fonts.nix
./common/linux.nix ./common/linux.nix
./common/netdata/default.nix
./common/networking.nix ./common/networking.nix
./common/packages.nix ./common/packages.nix
./common/printing.nix ./common/printing.nix
({ config, lib, lib', ... }: { ./services/netdata/default.nix
./services/keyleds/default.nix
({
config,
lib,
lib',
...
}: {
config = { config = {
_module.args = { _module.args = {
lib' = lib // import ./lib {inherit config lib;}; lib' = lib // import ./lib {inherit config lib;};
@@ -65,27 +77,29 @@
}; };
}) })
]; ];
in in {
{
hephaestus = nixpkgs.lib.nixosSystem { hephaestus = nixpkgs.lib.nixosSystem {
system = "x86_64-linux"; system = "x86_64-linux";
modules = [ modules =
[
./machines/hephaestus/configuration.nix ./machines/hephaestus/configuration.nix
./machines/hephaestus/hardware.nix ./machines/hephaestus/hardware.nix
] ++ defaultModules; ]
++ defaultModules;
}; };
}; };
darwinConfigurations = { darwinConfigurations = {
demeter = darwin.lib.darwinSystem { demeter = darwin.lib.darwinSystem {
system = "x86_64-darwin"; system = "x86_64-darwin";
modules = [ modules = [
home-manager.darwinModules.home-manager home-manager.darwinModules.home-manager
./common/darwin.nix ./common/darwin.nix
./common/packages.nix ./common/packages.nix
./machines/demeter/configuration.nix ./machines/demeter/configuration.nix
./modules/darwin/default.nix ./modules/darwin/default.nix
({config, ...}: { ({config, ...}: {
@@ -106,4 +120,3 @@
}; };
}; };
} }

View File

@@ -1,6 +1,8 @@
{ lib, pkgs, ... }: {
lib,
let pkgs,
...
}: let
hound-nvim = pkgs.vimUtils.buildVimPlugin { hound-nvim = pkgs.vimUtils.buildVimPlugin {
name = "hound-nvim"; name = "hound-nvim";
nativeBuildInputs = with pkgs; [lua53Packages.luacheck stylua]; nativeBuildInputs = with pkgs; [lua53Packages.luacheck stylua];
@@ -12,9 +14,7 @@ let
}; };
}; };
inherit (pkgs) stdenv; inherit (pkgs) stdenv;
in in {
{
services = { services = {
gpg-agent = { gpg-agent = {
enable = stdenv.isLinux; enable = stdenv.isLinux;
@@ -27,7 +27,6 @@ in
fonts.fontconfig.enable = true; fonts.fontconfig.enable = true;
programs = { programs = {
home-manager.enable = true; home-manager.enable = true;
direnv.enable = true; direnv.enable = true;
@@ -50,15 +49,13 @@ in
dc = "diff --cached"; dc = "diff --cached";
dcn = "diff --cached --name-only"; dcn = "diff --cached --name-only";
ds = "! git diff origin | sed -r 's/value: (.*)/value: \"************\"/'"; ds = "! git diff origin | sed -r 's/value: (.*)/value: \"************\"/'";
l = l = "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit";
"log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit";
ms = "merge --squash"; ms = "merge --squash";
p = "push origin"; p = "push origin";
pf = "push -f"; pf = "push -f";
pl = "! git pull origin $(git rev-parse --abbrev-ref HEAD)"; pl = "! git pull origin $(git rev-parse --abbrev-ref HEAD)";
st = "status"; st = "status";
wip = wip = "for-each-ref --sort='authordate:iso8601' --format=' %(color:green)%(authordate:relative)%09%(color:white)%(refname:short)' refs/heads";
"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";}];
@@ -82,7 +79,6 @@ in
push = {default = "current";}; push = {default = "current";};
pull = {rebase = true;}; pull = {rebase = true;};
}; };
}; };
starship = { starship = {
@@ -162,7 +158,6 @@ in
"tmux" "tmux"
]; ];
}; };
}; };
alacritty = { alacritty = {
@@ -175,13 +170,12 @@ in
mouse.hide_when_typing = true; mouse.hide_when_typing = true;
font = font =
if stdenv.isLinux then if stdenv.isLinux
{ then {
normal.family = "Fira Code"; normal.family = "Fira Code";
size = 12; size = 12;
} }
else else {
{
normal.family = "FiraCode Nerd Font"; normal.family = "FiraCode Nerd Font";
size = 18; size = 18;
}; };
@@ -330,7 +324,9 @@ in
extraConfig = "lua require('init')"; extraConfig = "lua require('init')";
plugins = with pkgs.vimPlugins; [ plugins = with pkgs.vimPlugins; [
/* copilot-vim */ /*
copilot-vim
*/
cmp-nvim-lsp cmp-nvim-lsp
cmp-path cmp-path
cmp-treesitter cmp-treesitter
@@ -355,9 +351,7 @@ in
vim-sneak vim-sneak
vim-surround vim-surround
]; ];
}; };
}; };
home.file.".config/nvim/lua".source = ./nvim/lua; home.file.".config/nvim/lua".source = ./nvim/lua;
@@ -374,5 +368,4 @@ in
70 80 70 80
80 90 80 90
''; '';
} }

View File

@@ -1,6 +1,4 @@
{ pkgs, ... }: {pkgs, ...}: {
{
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;
environment = {variables = {LANG = "en_US.UTF-8";};}; environment = {variables = {LANG = "en_US.UTF-8";};};

View File

@@ -1,6 +1,8 @@
{ config, pkgs, ... }:
{ {
config,
pkgs,
...
}: {
imports = [./hardware.nix]; imports = [./hardware.nix];
# Use the systemd-boot EFI boot loader. # Use the systemd-boot EFI boot loader.
@@ -14,12 +16,24 @@
hostName = "hephaestus"; hostName = "hephaestus";
interfaces.enp34s0 = { interfaces.enp34s0 = {
useDHCP = true; useDHCP = true;
/* ipv4.addresses = [ */ /*
/* { */ ipv4.addresses = [
/* address = "192.168.1.69"; */ */
/* prefixLength = 24; */ /*
/* } */ {
/* ]; */ */
/*
address = "192.168.1.69";
*/
/*
prefixLength = 24;
*/
/*
}
*/
/*
];
*/
}; };
defaultGateway = { defaultGateway = {
address = "192.168.1.2"; address = "192.168.1.2";
@@ -48,6 +62,4 @@
services.udev.extraRules = '' services.udev.extraRules = ''
KERNEL=="hidraw*", SUBSYSTEM=="hidraw", MODE="0666" KERNEL=="hidraw*", SUBSYSTEM=="hidraw", MODE="0666"
''; '';
} }

View File

@@ -1,10 +1,13 @@
{ config, lib, pkgs, modulesPath, ... }:
{ {
config,
lib,
pkgs,
modulesPath,
...
}: {
imports = [(modulesPath + "/installer/scan/not-detected.nix")]; imports = [(modulesPath + "/installer/scan/not-detected.nix")];
boot.initrd.availableKernelModules = boot.initrd.availableKernelModules = ["nvme" "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod"];
[ "nvme" "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ];
boot.initrd.kernelModules = []; boot.initrd.kernelModules = [];
boot.kernelModules = ["kvm-amd"]; boot.kernelModules = ["kvm-amd"];
boot.extraModulePackages = [config.boot.kernelPackages.v4l2loopback.out]; boot.extraModulePackages = [config.boot.kernelPackages.v4l2loopback.out];
@@ -35,13 +38,11 @@
fsType = "vfat"; fsType = "vfat";
}; };
swapDevices = swapDevices = [{device = "/dev/disk/by-uuid/aca92a73-2941-40ca-88c4-0dd8607d232a";}];
[{ device = "/dev/disk/by-uuid/aca92a73-2941-40ca-88c4-0dd8607d232a"; }];
fileSystems."/mnt/storage" = { fileSystems."/mnt/storage" = {
device = "/dev/disk/by-uuid/0f592fca-1d4e-43f7-9bf4-f1c3e19e841f"; device = "/dev/disk/by-uuid/0f592fca-1d4e-43f7-9bf4-f1c3e19e841f";
fsType = "ext4"; fsType = "ext4";
}; };
hardware.video.hidpi.enable = lib.mkDefault true; hardware.video.hidpi.enable = lib.mkDefault true;
} }

View File

@@ -1,9 +1,11 @@
{ config, lib, pkgs, ... }:
let
checkBrew = "command -v brew > /dev/null";
in
{ {
config,
lib,
pkgs,
...
}: let
checkBrew = "command -v brew > /dev/null";
in {
environment = { environment = {
extraInit = '' extraInit = ''
${checkBrew} || >&2 echo "brew is not installed (install it via https://brew.sh)" ${checkBrew} || >&2 echo "brew is not installed (install it via https://brew.sh)"
@@ -48,6 +50,5 @@ in
"homebrew/core" "homebrew/core"
"homebrew/services" "homebrew/services"
]; ];
}; };
} }

View File

@@ -1,5 +1,8 @@
{ config, pkgs, ... }: { {
config,
pkgs,
...
}: {
system.defaults = { system.defaults = {
loginwindow = { loginwindow = {
GuestEnabled = false; GuestEnabled = false;
@@ -51,5 +54,4 @@
AppleShowScrollBars = "Automatic"; AppleShowScrollBars = "Automatic";
}; };
}; };
} }

View File

@@ -1,5 +1,8 @@
{ stdenv, lib, fetchFromGitHub }: {
stdenv,
lib,
fetchFromGitHub,
}:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "aws-connect"; pname = "aws-connect";
version = "1.0.19"; version = "1.0.19";

View File

@@ -1,6 +1,8 @@
{ lib, fetchFromGitHub, python3 }: {
lib,
let fetchFromGitHub,
python3,
}: let
py = python3.override { py = python3.override {
packageOverrides = self: super: { packageOverrides = self: super: {
prettycolors = super.buildPythonPackage rec { prettycolors = super.buildPythonPackage rec {

View File

@@ -1,13 +1,10 @@
final: prev: { final: prev: {
aws-connect = prev.callPackage ./aws-connect {}; aws-connect = prev.callPackage ./aws-connect {};
aws-role-play = prev.callPackage ./aws-role-play {}; aws-role-play = prev.callPackage ./aws-role-play {};
keyleds = prev.callPackage ./keyleds {}; keyleds = prev.callPackage ./keyleds {};
lpass = prev.callPackage ./lastpass { };
rfd = prev.callPackage ./rfd {}; rfd = prev.callPackage ./rfd {};
srv = prev.callPackage ./srv {}; srv = prev.callPackage ./srv {};
tmux-sessionizer = prev.callPackage ./tmux-sessionizer {}; tmux-sessionizer = prev.callPackage ./tmux-sessionizer {};
vpngate = prev.callPackage ./vpngate {}; vpngate = prev.callPackage ./vpngate {};
yar = prev.callPackage ./yar {}; yar = prev.callPackage ./yar {};
} }

View File

@@ -1,9 +1,9 @@
{ pkgs {
, stdenv pkgs,
, fetchFromGitHub stdenv,
, fetchFromGitHub,
...
}: }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "keyleds"; name = "keyleds";
version = "1.1.1"; version = "1.1.1";
@@ -16,6 +16,18 @@ stdenv.mkDerivation rec {
sha256 = "sha256-KCWmaRmJTmZgTt7HW9o6Jt1u4x6+G2j6T9EqVt21U18="; sha256 = "sha256-KCWmaRmJTmZgTt7HW9o6Jt1u4x6+G2j6T9EqVt21U18=";
}; };
postInstall = ''
cat <<EOF >> $out/bin/set-leds.sh
#!/usr/bin/env bash
for d in \$($out/bin/keyledsctl list); do
$out/bin/keyledsctl set-leds -d \$d all=black|| true;
done
EOF
chmod +x $out/bin/set-leds.sh
'';
nativeBuildInputs = with pkgs; [cmake pkgconfig]; nativeBuildInputs = with pkgs; [cmake pkgconfig];
buildInputs = with pkgs; [xlibsWrapper xorg.libXi libuv systemd luajit libyaml]; buildInputs = with pkgs; [xlibsWrapper xorg.libXi libuv systemd luajit libyaml];
} }

View File

@@ -1,46 +0,0 @@
{ stdenv
, lib
, fetchFromGitHub
, asciidoc
, cmake
, docbook_xsl
, pkgconfig
, bash-completion
, curl
, openssl
, libxml2
, libxslt
}:
stdenv.mkDerivation rec {
pname = "lpass";
version = "1.3.4-unreleased";
src = fetchFromGitHub {
owner = "lastpass";
repo = "lastpass-cli";
rev = "8767b5e53192ad4e72d1352db4aa9218e928cbe1";
sha256 = "sha256:1d4m5h9byq5cccdg98m8d8457rbvp28q821d8rpglykgrfgnknwp";
};
nativeBuildInputs = [ asciidoc cmake docbook_xsl pkgconfig ];
buildInputs = [ bash-completion curl openssl libxml2 libxslt ];
enableParallelBuilding = true;
installTargets = [ "install" "install-doc" ];
postInstall = ''
install -Dm644 -T ../contrib/lpass_zsh_completion $out/share/zsh/site-functions/_lpass
install -Dm644 -T ../contrib/completions-lpass.fish $out/share/fish/vendor_completions.d/lpass.fish
'';
meta = with lib; {
description =
"Stores, retrieves, generates, and synchronizes passwords securely";
homepage = "https://github.com/lastpass/lastpass-cli";
license = licenses.gpl2Plus;
platforms = platforms.unix;
};
}

View File

@@ -1,7 +1,9 @@
{ lib, fetchFromGitHub, python3 }: {
lib,
let py = python3.override { }; fetchFromGitHub,
python3,
}: let
py = python3.override {};
in in
with py.pkgs; with py.pkgs;
buildPythonApplication rec { buildPythonApplication rec {

View File

@@ -1,5 +1,8 @@
{ lib, fetchFromGitHub, buildGoModule }: {
lib,
fetchFromGitHub,
buildGoModule,
}:
buildGoModule rec { buildGoModule rec {
pname = "srv"; pname = "srv";
version = "v0.1.2"; version = "v0.1.2";

View File

@@ -1,5 +1,8 @@
{ stdenv, lib, fetchurl }: {
stdenv,
lib,
fetchurl,
}:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "tmux-sessionizer"; pname = "tmux-sessionizer";
version = "0.0.0"; version = "0.0.0";
@@ -19,4 +22,3 @@ stdenv.mkDerivation rec {
platforms = platforms.unix; platforms = platforms.unix;
}; };
} }

View File

@@ -1,7 +1,9 @@
{ lib, fetchFromGitHub, buildGoModule }: {
lib,
fetchFromGitHub,
buildGoModule,
}:
buildGoModule rec { buildGoModule rec {
pname = "vpngate"; pname = "vpngate";
version = "v0.1.1"; version = "v0.1.1";

View File

@@ -1,5 +1,8 @@
{ lib, fetchFromGitHub, buildGoModule }: {
lib,
fetchFromGitHub,
buildGoModule,
}:
buildGoModule rec { buildGoModule rec {
pname = "yar"; pname = "yar";
version = "master"; version = "master";

View File

@@ -0,0 +1,15 @@
{
config,
pkgs,
...
}: let
in {
systemd.services.keyleds = {
description = "Logitech Keyboard animation for Linux G410, G513, G610, G810, G910, GPro";
wantedBy = ["multi-user.target"];
serviceConfig = {
ExecStart = "${pkgs.keyleds}/bin/set-leds.sh";
};
};
}

View File

@@ -1,10 +1,12 @@
{ config, pkgs, ... }: {
let config,
pkgs,
...
}: 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 = {
@@ -40,5 +42,4 @@ in
} }
} }
''; '';
} }