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 += --no-builtin-rules
HOSTAME ?= $(shell hostname)
HOSTNAME ?= $(shell hostname)
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
@@ -19,3 +19,6 @@ switch:
update:
nix flake update
fmt:
alejandra .

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,6 +1,4 @@
{ pkgs, ... }:
{
{pkgs, ...}: {
services.tailscale.enable = true;
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.
environment.systemPackages = with pkgs;
let
common = [
environment.systemPackages = with pkgs; let
common =
[
# essentials
curl
gcc
@@ -119,10 +122,13 @@ in
terraformer
tflint
tfsec
/* tfswitch */
/*
tfswitch
*/
infracost
# nix
alejandra
cachix
nix-diff
nixfmt
@@ -157,8 +163,8 @@ in
# news
srv
] ++ lib.optionals stdenv.isLinux ([
]
++ lib.optionals stdenv.isLinux [
_1password-gui
albert
authy
@@ -202,7 +208,7 @@ in
wireshark-qt
yaru-theme
zoom-us
]);
];
in
common;

View File

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

View File

@@ -1,13 +1,13 @@
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");
in
{
in {
pre-commit-check = nix-pre-commit-hooks.run {
src = ./.;
hooks = {
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: {
nixosConfigurations =
let
outputs = {
self,
darwin,
home-manager,
nixpkgs,
nixos-hardware,
...
} @ inputs: {
nixosConfigurations = let
defaultModules = [
home-manager.nixosModules.home-manager
./common/desktop.nix
./common/fonts.nix
./common/linux.nix
./common/netdata/default.nix
./common/networking.nix
./common/packages.nix
./common/printing.nix
({ config, lib, lib', ... }: {
./services/netdata/default.nix
./services/keyleds/default.nix
({
config,
lib,
lib',
...
}: {
config = {
_module.args = {
lib' = lib // import ./lib {inherit config lib;};
@@ -65,27 +77,29 @@
};
})
];
in
{
in {
hephaestus = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
modules =
[
./machines/hephaestus/configuration.nix
./machines/hephaestus/hardware.nix
] ++ defaultModules;
]
++ defaultModules;
};
};
darwinConfigurations = {
demeter = darwin.lib.darwinSystem {
system = "x86_64-darwin";
modules = [
home-manager.darwinModules.home-manager
./common/darwin.nix
./common/packages.nix
./machines/demeter/configuration.nix
./modules/darwin/default.nix
({config, ...}: {
@@ -106,4 +120,3 @@
};
};
}

View File

@@ -1,6 +1,8 @@
{ lib, pkgs, ... }:
let
{
lib,
pkgs,
...
}: let
hound-nvim = pkgs.vimUtils.buildVimPlugin {
name = "hound-nvim";
nativeBuildInputs = with pkgs; [lua53Packages.luacheck stylua];
@@ -12,9 +14,7 @@ let
};
};
inherit (pkgs) stdenv;
in
{
in {
services = {
gpg-agent = {
enable = stdenv.isLinux;
@@ -27,7 +27,6 @@ in
fonts.fontconfig.enable = true;
programs = {
home-manager.enable = true;
direnv.enable = true;
@@ -50,15 +49,13 @@ in
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";
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";}];
@@ -82,7 +79,6 @@ in
push = {default = "current";};
pull = {rebase = true;};
};
};
starship = {
@@ -162,7 +158,6 @@ in
"tmux"
];
};
};
alacritty = {
@@ -175,13 +170,12 @@ in
mouse.hide_when_typing = true;
font =
if stdenv.isLinux then
{
if stdenv.isLinux
then {
normal.family = "Fira Code";
size = 12;
}
else
{
else {
normal.family = "FiraCode Nerd Font";
size = 18;
};
@@ -330,7 +324,9 @@ in
extraConfig = "lua require('init')";
plugins = with pkgs.vimPlugins; [
/* copilot-vim */
/*
copilot-vim
*/
cmp-nvim-lsp
cmp-path
cmp-treesitter
@@ -355,9 +351,7 @@ in
vim-sneak
vim-surround
];
};
};
home.file.".config/nvim/lua".source = ./nvim/lua;
@@ -374,5 +368,4 @@ in
70 80
80 90
'';
}

View File

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

View File

@@ -1,6 +1,8 @@
{ config, pkgs, ... }:
{
config,
pkgs,
...
}: {
imports = [./hardware.nix];
# Use the systemd-boot EFI boot loader.
@@ -14,12 +16,24 @@
hostName = "hephaestus";
interfaces.enp34s0 = {
useDHCP = true;
/* ipv4.addresses = [ */
/* { */
/* address = "192.168.1.69"; */
/* prefixLength = 24; */
/* } */
/* ]; */
/*
ipv4.addresses = [
*/
/*
{
*/
/*
address = "192.168.1.69";
*/
/*
prefixLength = 24;
*/
/*
}
*/
/*
];
*/
};
defaultGateway = {
address = "192.168.1.2";
@@ -48,6 +62,4 @@
services.udev.extraRules = ''
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")];
boot.initrd.availableKernelModules =
[ "nvme" "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ];
boot.initrd.availableKernelModules = ["nvme" "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod"];
boot.initrd.kernelModules = [];
boot.kernelModules = ["kvm-amd"];
boot.extraModulePackages = [config.boot.kernelPackages.v4l2loopback.out];
@@ -35,13 +38,11 @@
fsType = "vfat";
};
swapDevices =
[{ device = "/dev/disk/by-uuid/aca92a73-2941-40ca-88c4-0dd8607d232a"; }];
swapDevices = [{device = "/dev/disk/by-uuid/aca92a73-2941-40ca-88c4-0dd8607d232a";}];
fileSystems."/mnt/storage" = {
device = "/dev/disk/by-uuid/0f592fca-1d4e-43f7-9bf4-f1c3e19e841f";
fsType = "ext4";
};
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 = {
extraInit = ''
${checkBrew} || >&2 echo "brew is not installed (install it via https://brew.sh)"
@@ -48,6 +50,5 @@ in
"homebrew/core"
"homebrew/services"
];
};
}

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,9 +1,9 @@
{ pkgs
, stdenv
, fetchFromGitHub
,
{
pkgs,
stdenv,
fetchFromGitHub,
...
}:
stdenv.mkDerivation rec {
name = "keyleds";
version = "1.1.1";
@@ -16,6 +16,18 @@ stdenv.mkDerivation rec {
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];
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 }:
let py = python3.override { };
{
lib,
fetchFromGitHub,
python3,
}: let
py = python3.override {};
in
with py.pkgs;
buildPythonApplication rec {

View File

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

View File

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

View File

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

View File

@@ -1,5 +1,8 @@
{ lib, fetchFromGitHub, buildGoModule }:
{
lib,
fetchFromGitHub,
buildGoModule,
}:
buildGoModule rec {
pname = "yar";
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;
netdataConf = ./netdata.conf;
netdataDir = "/var/lib/netdata";
in
{
in {
users.extraGroups.netdata.gid = 220008;
users.users.netdata.group = "netdata";
users.extraUsers.netdata = {
@@ -40,5 +42,4 @@ in
}
}
'';
}