Format with alejandra

This commit is contained in:
Sam W 2022-06-14 02:00:46 +01:00
parent 500bcd20eb
commit 35d07641b6
17 changed files with 125 additions and 96 deletions

View File

@ -63,8 +63,8 @@
extraModules = [./home/docker.nix ./home/aws.nix]; extraModules = [./home/docker.nix ./home/aws.nix];
}; };
zinc = lib.mkHome { zinc = lib.mkHome {
profile = profiles.laptop;
system = "aarch64-darwin"; system = "aarch64-darwin";
profile = profiles.laptop;
}; };
}; };
} }
@ -81,9 +81,7 @@
# `overrideDerivation`) so we filter out anything that isn't a derivation # `overrideDerivation`) so we filter out anything that isn't a derivation
# - We also filter out any packages that aren't supported on the current # - We also filter out any packages that aren't supported on the current
# platform. # platform.
packages = with pkgs; (lib.filterAttrs (_: v: (lib.isDerivation v packages = with pkgs.lib; (filterAttrs (_: v: (isDerivation v && meta.availableOn platform v)) pkgs.mypkgs);
&& lib.meta.availableOn platform v))
pkgs.mypkgs);
formatter = pkgs.alejandra; formatter = pkgs.alejandra;
# A devshell with useful utils # A devshell with useful utils
devShells.default = pkgs.devshell.mkShell { devShells.default = pkgs.devshell.mkShell {

View File

@ -1 +1 @@
{ pkgs, ... }: { home.packages = with pkgs; [ awscli2 ]; } {pkgs, ...}: {home.packages = with pkgs; [awscli2];}

View File

@ -1,6 +1,9 @@
{ pkgs, lib, ... }: {
pkgs,
let packages = pkgs.callPackage ./packages.nix {}; lib,
...
}: let
packages = pkgs.callPackage ./packages.nix {};
in { in {
home.packages = packages.all; home.packages = packages.all;
home.sessionVariables = { home.sessionVariables = {
@ -74,11 +77,10 @@ in {
enable = true; enable = true;
settings = { settings = {
add_newline = false; add_newline = false;
format = format = "$username$hostname$shlvl$directory$git_branch$git_commit$git_state$git_metrics$git_status$hg_branch$docker_context$golang$kotlin$nodejs$python$rust$terraform$nix_shell$memory_usage$aws$gcloud$openstack$azure$env_var$crystal$custom$sudo$cmd_duration$line_break$jobs$status$shell$character";
"$username$hostname$shlvl$directory$git_branch$git_commit$git_state$git_metrics$git_status$hg_branch$docker_context$golang$kotlin$nodejs$python$rust$terraform$nix_shell$memory_usage$aws$gcloud$openstack$azure$env_var$crystal$custom$sudo$cmd_duration$line_break$jobs$status$shell$character";
username.format = "[$user]($style) "; username.format = "[$user]($style) ";
hostname.format = "[$hostname]($style) "; hostname.format = "[$hostname]($style) ";
directory = { truncation_length = -1; }; directory = {truncation_length = -1;};
git_branch.format = "[$symbol$branch]($style) "; git_branch.format = "[$symbol$branch]($style) ";
python.format = "[py \${pyenv_prefix}(\${version} )(\\($virtualenv\\) )]($style)"; python.format = "[py \${pyenv_prefix}(\${version} )(\\($virtualenv\\) )]($style)";
nodejs.format = "[js ($version )]($style)"; nodejs.format = "[js ($version )]($style)";
@ -98,9 +100,8 @@ in {
ssh = { ssh = {
enable = true; enable = true;
includes = [ "~/.ssh/config.local" ]; includes = ["~/.ssh/config.local"];
matchBlocks."*".user = "samw"; matchBlocks."*".user = "samw";
}; };
}; };
} }

View File

@ -1 +1 @@
{ pkgs, ... }: { home.packages = with pkgs; [ docker colima ]; } {pkgs, ...}: {home.packages = with pkgs; [docker colima];}

View File

@ -1,12 +1,13 @@
{ ... }: { {...}: {
programs.git = { programs.git = {
enable = true; enable = true;
userName = "Sam Willcocks"; userName = "Sam Willcocks";
userEmail = "sam@wlcx.cc"; userEmail = "sam@wlcx.cc";
delta = { # Better diffs delta = {
# Better diffs
enable = true; enable = true;
options = { line-numbers = true; }; options = {line-numbers = true;};
}; };
aliases = { aliases = {

View File

@ -1,4 +1,4 @@
{ pkgs, ... }: { {pkgs, ...}: {
programs.gpg = { programs.gpg = {
enable = true; enable = true;
mutableKeys = false; mutableKeys = false;
@ -19,6 +19,6 @@
]; ];
# make yubikey work on macos? lolgpg # make yubikey work on macos? lolgpg
# https://github.com/NixOS/nixpkgs/issues/155629 # https://github.com/NixOS/nixpkgs/issues/155629
scdaemonSettings = { disable-ccid = true; }; scdaemonSettings = {disable-ccid = true;};
}; };
} }

View File

@ -1,12 +1,15 @@
{ pkgs, lib, ... }: { {
pkgs,
lib,
...
}: {
# Mac specific packages. # Mac specific packages.
# TODO: have this in a central packages place rather than here # TODO: have this in a central packages place rather than here
home.packages = with pkgs; [ pngpaste mypkgs.qrclip ]; home.packages = with pkgs; [pngpaste mypkgs.qrclip];
# Use secretive for SSH agent # Use secretive for SSH agent
programs.ssh.matchBlocks.all = lib.mkIf pkgs.stdenv.isDarwin { programs.ssh.matchBlocks.all = lib.mkIf pkgs.stdenv.isDarwin {
host = "*"; host = "*";
extraOptions."IdentityAgent" = extraOptions."IdentityAgent" = "~/Library/Containers/com.maxgoedjen.Secretive.SecretAgent/Data/socket.ssh";
"~/Library/Containers/com.maxgoedjen.Secretive.SecretAgent/Data/socket.ssh";
}; };
programs.zsh.initExtra = "eval $(/opt/homebrew/bin/brew shellenv)"; programs.zsh.initExtra = "eval $(/opt/homebrew/bin/brew shellenv)";
} }

View File

@ -1,4 +1,4 @@
{ pkgs }: {pkgs}:
with pkgs; rec { with pkgs; rec {
# The stuff you want installed everywhere. The necessities. # The stuff you want installed everywhere. The necessities.
base = [ base = [
@ -15,10 +15,10 @@ with pkgs; rec {
]; ];
# Networking shit # Networking shit
net = [ iperf3 nmap socat tcpdump ]; net = [iperf3 nmap socat tcpdump];
# development tools # development tools
dev = [ jq nixfmt gh glab hexyl ]; dev = [jq nixfmt gh glab hexyl];
all = (base ++ net ++ dev); all = base ++ net ++ dev;
} }

View File

@ -1,9 +1,9 @@
{ pkgs, ... }: { {pkgs, ...}: {
home.packages = with pkgs; [ yubikey-manager ]; home.packages = with pkgs; [yubikey-manager];
programs.password-store = { programs.password-store = {
enable = true; enable = true;
settings = { PASSWORD_STORE_DIR = "$HOME/.password-store"; }; settings = {PASSWORD_STORE_DIR = "$HOME/.password-store";};
package = pkgs.pass.withExtensions (exts: [ exts.pass-otp ]); package = pkgs.pass.withExtensions (exts: [exts.pass-otp]);
}; };
programs.zsh.shellAliases = { programs.zsh.shellAliases = {
p = "pass"; p = "pass";

View File

@ -1,8 +1,8 @@
{ {
dev = { ... }: { dev = {...}: {
imports = [ ./default.nix ./git.nix ./rust.nix ./vim.nix ./vim-dev.nix ]; imports = [./default.nix ./git.nix ./rust.nix ./vim.nix ./vim-dev.nix];
}; };
laptop = { ... }: { laptop = {...}: {
imports = [ imports = [
./default.nix ./default.nix
./git.nix ./git.nix
@ -14,5 +14,5 @@
./gpg.nix ./gpg.nix
]; ];
}; };
server = { ... }: { imports = [ ./default.nix ./git.nix ./vim.nix ]; }; server = {...}: {imports = [./default.nix ./git.nix ./vim.nix];};
} }

View File

@ -1 +1 @@
{ pkgs, ... }: { home.packages = [ pkgs.rustup pkgs.rust-analyzer ]; } {pkgs, ...}: {home.packages = [pkgs.rustup pkgs.rust-analyzer];}

View File

@ -1,5 +1,9 @@
{ pkgs, lib, system, ... }: {
let pkgs,
lib,
system,
...
}: let
vim-vue-plugin = pkgs.vimUtils.buildVimPlugin { vim-vue-plugin = pkgs.vimUtils.buildVimPlugin {
name = "vim-vue-plugin"; name = "vim-vue-plugin";
src = pkgs.fetchFromGitHub { src = pkgs.fetchFromGitHub {
@ -26,7 +30,7 @@ in {
] ]
# delve is unsupported on aarch64-linux and golangci-lint is broken on darwin # delve is unsupported on aarch64-linux and golangci-lint is broken on darwin
# (see https://github.com/NixOS/nixpkgs/issues/168984). # (see https://github.com/NixOS/nixpkgs/issues/168984).
++ lib.optionals (system != "aarch64-linux" && !pkgs.stdenv.isDarwin ) [ vim-go ]; ++ lib.optionals (system != "aarch64-linux" && !pkgs.stdenv.isDarwin) [vim-go];
programs.neovim.extraConfig = '' programs.neovim.extraConfig = ''
lua <<EOF lua <<EOF
${builtins.readFile ./dev.lua} ${builtins.readFile ./dev.lua}

View File

@ -1,8 +1,13 @@
# This module sets up a "full" neovim install with plugins and unicorns. It # This module sets up a "full" neovim install with plugins and unicorns. It
# also makes neovim the default editor and aliases vim to nvim. # also makes neovim the default editor and aliases vim to nvim.
{ pkgs, lib, strings, ... }: { {
home.sessionVariables = { "EDITOR" = "nvim"; }; pkgs,
home.packages = with pkgs; [ rnix-lsp ripgrep ]; lib,
strings,
...
}: {
home.sessionVariables = {"EDITOR" = "nvim";};
home.packages = with pkgs; [rnix-lsp ripgrep];
programs.neovim = { programs.neovim = {
enable = true; enable = true;
viAlias = true; viAlias = true;

1
me.nix
View File

@ -8,4 +8,3 @@
"ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBG97EFzrTE5jI0P5CP5/y/thCzGNHt74u2mpXpdrB25URrn3ABDJcbmO/tGtNR8uhM3n/kUpr6Ax27orjmIOQtA= boron-se-main@secretive.boron.local" "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBG97EFzrTE5jI0P5CP5/y/thCzGNHt74u2mpXpdrB25URrn3ABDJcbmO/tGtNR8uhM3n/kUpr6Ax27orjmIOQtA= boron-se-main@secretive.boron.local"
]; ];
} }

View File

@ -1,6 +1,6 @@
# TODO: auto import everything # TODO: auto import everything
{ pkgs, ... }: { {pkgs, ...}: {
qrclip = pkgs.callPackage ./qrclip { }; qrclip = pkgs.callPackage ./qrclip {};
zbar = pkgs.callPackage ./zbar { }; zbar = pkgs.callPackage ./zbar {};
yubikey-manager = pkgs.callPackage ./yubikey-manager { }; yubikey-manager = pkgs.callPackage ./yubikey-manager {};
} }

View File

@ -1,5 +1,12 @@
{ python3Packages, fetchFromGitHub, lib, yubikey-personalization, libu2f-host, libusb1, procps }: {
python3Packages,
fetchFromGitHub,
lib,
yubikey-personalization,
libu2f-host,
libusb1,
procps,
}:
python3Packages.buildPythonPackage rec { python3Packages.buildPythonPackage rec {
pname = "yubikey-manager"; pname = "yubikey-manager";
version = "4.0.8"; version = "4.0.8";
@ -12,7 +19,7 @@ python3Packages.buildPythonPackage rec {
sha256 = "sha256-OszXOu/NhoX4WutsT4Z1LsY54KTOWRKt13yDo2fzDbA="; sha256 = "sha256-OszXOu/NhoX4WutsT4Z1LsY54KTOWRKt13yDo2fzDbA=";
}; };
patches = [ ./lol.patch ]; patches = [./lol.patch];
doCheck = false; doCheck = false;
postPatch = '' postPatch = ''
@ -22,25 +29,28 @@ python3Packages.buildPythonPackage rec {
--replace 'pkill' '${procps}/bin/pkill' --replace 'pkill' '${procps}/bin/pkill'
''; '';
nativeBuildInputs = with python3Packages; [ poetry-core ]; nativeBuildInputs = with python3Packages; [poetry-core];
propagatedBuildInputs = propagatedBuildInputs = with python3Packages;
with python3Packages; [ [
click click
cryptography cryptography
pyscard pyscard
pyusb pyusb
six six
fido2 fido2
] ++ [ ]
++ [
libu2f-host libu2f-host
libusb1 libusb1
yubikey-personalization yubikey-personalization
]; ];
makeWrapperArgs = [ makeWrapperArgs = [
"--prefix" "LD_LIBRARY_PATH" ":" "--prefix"
(lib.makeLibraryPath [ libu2f-host libusb1 yubikey-personalization ]) "LD_LIBRARY_PATH"
":"
(lib.makeLibraryPath [libu2f-host libusb1 yubikey-personalization])
]; ];
postInstall = '' postInstall = ''
@ -55,7 +65,7 @@ python3Packages.buildPythonPackage rec {
--replace 'compdef _ykman_completion ykman;' '_ykman_completion "$@"' --replace 'compdef _ykman_completion ykman;' '_ykman_completion "$@"'
''; '';
checkInputs = with python3Packages; [ pytestCheckHook makefun ]; checkInputs = with python3Packages; [pytestCheckHook makefun];
meta = with lib; { meta = with lib; {
homepage = "https://developers.yubico.com/yubikey-manager"; homepage = "https://developers.yubico.com/yubikey-manager";
@ -63,6 +73,6 @@ python3Packages.buildPythonPackage rec {
license = licenses.bsd2; license = licenses.bsd2;
platforms = platforms.unix; platforms = platforms.unix;
maintainers = with maintainers; [ benley lassulus pinpox ]; maintainers = with maintainers; [benley lassulus pinpox];
}; };
} }

View File

@ -1,35 +1,35 @@
{ stdenv {
, lib stdenv,
, fetchFromGitHub lib,
, imagemagickBig fetchFromGitHub,
, pkg-config imagemagickBig,
, libX11 pkg-config,
, libv4l libX11,
, libiconv libv4l,
, qtbase ? null libiconv,
, darwin qtbase ? null,
, qtx11extras ? null darwin,
, wrapQtAppsHook ? null qtx11extras ? null,
, wrapGAppsHook wrapQtAppsHook ? null,
, gtk3 wrapGAppsHook,
, xmlto gtk3,
, docbook_xsl xmlto,
, autoreconfHook docbook_xsl,
, dbus autoreconfHook,
, enableVideo ? stdenv.isLinux dbus,
enableVideo ? stdenv.isLinux,
# The implementation is buggy and produces an error like # The implementation is buggy and produces an error like
# Name Error (Connection ":1.4380" is not allowed to own the service "org.linuxtv.Zbar" due to security policies in the configuration file) # Name Error (Connection ":1.4380" is not allowed to own the service "org.linuxtv.Zbar" due to security policies in the configuration file)
# for every scanned code. # for every scanned code.
# see https://github.com/mchehab/zbar/issues/104 # see https://github.com/mchehab/zbar/issues/104
, enableDbus ? false enableDbus ? false,
, libintl libintl,
}: }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "zbar"; pname = "zbar";
version = "0.23.90"; version = "0.23.90";
outputs = [ "out" "lib" "dev" "doc" "man" ]; outputs = ["out" "lib" "dev" "doc" "man"];
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "mchehab"; owner = "mchehab";
@ -39,25 +39,33 @@ stdenv.mkDerivation rec {
}; };
nativeBuildInputs = nativeBuildInputs =
[ pkg-config xmlto autoreconfHook docbook_xsl ] ++ lib.optionals enableVideo [ wrapQtAppsHook wrapGAppsHook ]; [pkg-config xmlto autoreconfHook docbook_xsl] ++ lib.optionals enableVideo [wrapQtAppsHook wrapGAppsHook];
buildInputs = [ imagemagickBig libX11 libintl ] ++ lib.optionals enableDbus [ dbus ] buildInputs =
++ lib.optionals enableVideo [ libv4l gtk3 qtbase qtx11extras ] [imagemagickBig libX11 libintl]
++ lib.optionals stdenv.isDarwin [ libiconv darwin.apple_sdk.frameworks.Foundation ]; ++ lib.optionals enableDbus [dbus]
++ lib.optionals enableVideo [libv4l gtk3 qtbase qtx11extras]
++ lib.optionals stdenv.isDarwin [libiconv darwin.apple_sdk.frameworks.Foundation];
# Disable assertions which include -dev QtBase file paths. # Disable assertions which include -dev QtBase file paths.
NIX_CFLAGS_COMPILE = "-DQT_NO_DEBUG"; NIX_CFLAGS_COMPILE = "-DQT_NO_DEBUG";
configureFlags = [ "--without-python" ] ++ (if enableDbus then configureFlags =
[ "--with-dbusconfdir=${placeholder "out"}/share" ] ["--without-python"]
else ++ (
[ "--without-dbus" ]) ++ (if enableVideo then if enableDbus
[ "--with-gtk=gtk3" ] then ["--with-dbusconfdir=${placeholder "out"}/share"]
else [ else ["--without-dbus"]
"--disable-video" )
"--without-gtk" ++ (
"--without-qt" if enableVideo
]); then ["--with-gtk=gtk3"]
else [
"--disable-video"
"--without-gtk"
"--without-qt"
]
);
dontWrapQtApps = true; dontWrapQtApps = true;
dontWrapGApps = true; dontWrapGApps = true;
@ -78,7 +86,7 @@ stdenv.mkDerivation rec {
EAN-13/UPC-A, UPC-E, EAN-8, Code 128, Code 39, Interleaved 2 of 5 and QR EAN-13/UPC-A, UPC-E, EAN-8, Code 128, Code 39, Interleaved 2 of 5 and QR
Code. Code.
''; '';
maintainers = with maintainers; [ delroth raskin ]; maintainers = with maintainers; [delroth raskin];
platforms = platforms.unix; platforms = platforms.unix;
license = licenses.lgpl21; license = licenses.lgpl21;
homepage = "https://github.com/mchehab/zbar"; homepage = "https://github.com/mchehab/zbar";