format everything with nixpkgs-fmt

main
Brian Hicks 2022-12-22 13:25:52 -06:00
parent 501773ed13
commit cc6a13c9c6
Signed by: brian
GPG Key ID: C4F324B9CAAB0D50
25 changed files with 417 additions and 306 deletions

View File

@ -11,7 +11,6 @@
];
changeDirWidgetCommand = "${pkgs.fd}/bin/fd --type d";
changeDirWidgetOptions =
[ "--preview '${pkgs.tree}/bin/tree -C {} | head -200'" ];
changeDirWidgetOptions = [ "--preview '${pkgs.tree}/bin/tree -C {} | head -200'" ];
};
}

View File

@ -1,10 +1,11 @@
{ pkgs, ... }:
let
lazygit-config = if pkgs.stdenv.isDarwin then
"Library/Application Support/jesseduffield/lazygit/config.yml"
else
".config/jesseduffield/lazygit/config.yml";
in {
lazygit-config =
if pkgs.stdenv.isDarwin
then "Library/Application Support/jesseduffield/lazygit/config.yml"
else ".config/jesseduffield/lazygit/config.yml";
in
{
programs.git = {
enable = true;

View File

@ -42,7 +42,8 @@ let
};
};
};
in {
in
{
# for non-work contexts, I use a version of k9s that uses the macOS system
# directories, but in work contexts I use an (older) version that uses
# ~/.k9s. Gotta have both for my skins to work!

View File

@ -1,13 +1,17 @@
{ pkgs, ... }:
let
copyCommand =
if pkgs.stdenv.isDarwin then "pbcopy" else "${pkgs.xclip}/bin/xclip -in";
if pkgs.stdenv.isDarwin
then "pbcopy"
else "${pkgs.xclip}/bin/xclip -in";
pasteCommand =
if pkgs.stdenv.isDarwin then "pbpaste" else "${pkgs.xclip}/bin/xclip -out";
if pkgs.stdenv.isDarwin
then "pbpaste"
else "${pkgs.xclip}/bin/xclip -out";
similar-sort-files-cmd = arg:
"git ls-files --others --cached --exclude-standard | ${pkgs.similar-sort}/bin/similar-sort ${arg} | grep -v ${arg} | fzf --tiebreak index";
in {
similar-sort-files-cmd = arg: "git ls-files --others --cached --exclude-standard | ${pkgs.similar-sort}/bin/similar-sort ${arg} | grep -v ${arg} | fzf --tiebreak index";
in
{
home.packages = [
# there's no configuration option for shellcheck.kak; it has to be in the PATH
# to work!
@ -343,7 +347,7 @@ in {
hook global WinSetOption filetype=terraform %{
expandtab-with-width 2
evaluate-commands %sh{
if which terraform > /dev/null; then
echo 'set-option buffer formatcmd "terraform fmt -"'

View File

@ -16,7 +16,8 @@ let
${pkgs.git}/bin/git rev-parse --abbrev-ref HEAD
fi
'';
in {
in
{
home.packages = [ pkgs.tmux-session ];
programs.tmux = {

View File

@ -17,8 +17,9 @@ let
extraInitExtra =
builtins.foldl' (soFar: new: soFar + "\n" + builtins.readFile new) ""
extras;
in {
extras;
in
{
programs.zsh = {
enable = true;
@ -27,37 +28,41 @@ in {
enableAutosuggestions = true;
enableCompletion = true;
plugins = [{
name = "fzf-tab";
src = pkgs.fzf-tab;
}];
plugins = [
{
name = "fzf-tab";
src = pkgs.fzf-tab;
}
];
initExtra = ''
EDITOR=hx
export EDITOR
initExtra =
''
EDITOR=hx
export EDITOR
alias ready='gh pr create --reviewer NoRedInk/team-kraken'
alias ready='gh pr create --reviewer NoRedInk/team-kraken'
# see `man zshoptions`
setopt PROMPT_SUBST # do parameter, command, and arithmetic expansion in prompts
setopt PROMPT_SP # preserve partial lines, adding inverse-colored % after a line
# see `man zshoptions`
setopt PROMPT_SUBST # do parameter, command, and arithmetic expansion in prompts
setopt PROMPT_SP # preserve partial lines, adding inverse-colored % after a line
EMOJI_NEUTRAL=(😃 🤓 👾 🤖 💯 🐵 🦍 🐺 🐈 🦄 🦅 🦉 🐬 🐋 🐙 🌲 🌳 🍀 🍁 🍇 🍍 🍩 🌍 🌎 🌏 🚄 🚍 🚲 🛴 🚡 🚠 🚀)
EMOJI_UNHAPPY=(😵 😲 🤡 👹 😿 💔 💢)
EMOJI_PROMPT="''${EMOJI_NEUTRAL[$RANDOM % ''${#EMOJI_NEUTRAL[@]}]}"
EMOJI_PROMPT_ERROR="''${EMOJI_UNHAPPY[$RANDOM % ''${#EMOJI_UNHAPPY[@]}]}"
EMOJI_NEUTRAL=(😃 🤓 👾 🤖 💯 🐵 🦍 🐺 🐈 🦄 🦅 🦉 🐬 🐋 🐙 🌲 🌳 🍀 🍁 🍇 🍍 🍩 🌍 🌎 🌏 🚄 🚍 🚲 🛴 🚡 🚠 🚀)
EMOJI_UNHAPPY=(😵 😲 🤡 👹 😿 💔 💢)
EMOJI_PROMPT="''${EMOJI_NEUTRAL[$RANDOM % ''${#EMOJI_NEUTRAL[@]}]}"
EMOJI_PROMPT_ERROR="''${EMOJI_UNHAPPY[$RANDOM % ''${#EMOJI_UNHAPPY[@]}]}"
PROMPT="%(?.$EMOJI_PROMPT .$EMOJI_PROMPT_ERROR [%F{red}%?%f] )%B%F{blue}%c%f%b %F{blue}»%f "
RPROMPT=
PROMPT="%(?.$EMOJI_PROMPT .$EMOJI_PROMPT_ERROR [%F{red}%?%f] )%B%F{blue}%c%f%b %F{blue}»%f "
RPROMPT=
# 1password plugins
alias gh="op plugin run -- gh"
# 1password plugins
alias gh="op plugin run -- gh"
# grab Homebrew binaries if needed
if test -d /opt/homebrew/bin; then
export PATH="$PATH:/opt/homebrew/bin"
fi
'' + extraInitExtra;
# grab Homebrew binaries if needed
if test -d /opt/homebrew/bin; then
export PATH="$PATH:/opt/homebrew/bin"
fi
''
+ extraInitExtra;
history = {
save = 10000;

118
flake.nix
View File

@ -126,7 +126,8 @@
# up in this package. I'd love to move it to a real flake, though,
# so things would be all in one place!
kak-tree = final.callPackage ./pkgs/kak-tree { inherit naersk; };
in {
in
{
comma = final.callPackage inputs.comma { };
# is this going to cause problems by not actually being a package?
@ -152,56 +153,58 @@
kak-tree = kak-tree.kak-tree;
kakounePlugins = let
buildKakounePlugin = name: input:
final.kakouneUtils.buildKakounePlugin {
pname = name;
version = input.rev;
src = input;
kakounePlugins =
let
buildKakounePlugin = name: input:
final.kakouneUtils.buildKakounePlugin {
pname = name;
version = input.rev;
src = input;
};
in
prev.kakounePlugins // {
active-window =
buildKakounePlugin "active-window" inputs.active-window;
auto-pairs = final.kakouneUtils.buildKakounePlugin {
pname = "auto-pairs";
version = "vendored";
src = ./vendor/auto-pairs.kak;
};
in prev.kakounePlugins // {
active-window =
buildKakounePlugin "active-window" inputs.active-window;
auto-pairs = final.kakouneUtils.buildKakounePlugin {
pname = "auto-pairs";
version = "vendored";
src = ./vendor/auto-pairs.kak;
kak-ayu = final.callPackage ./pkgs/kak-ayu { };
kak-tmux-command = final.kakouneUtils.buildKakounePlugin {
pname = "kak-tmux-command";
version = "source";
src = ./pkgs/kak-tmux-command;
};
kak-tree = kak-tree.kakounePlugins.kak-tree;
kakoune-auto-percent = buildKakounePlugin "kakoune-auto-percent"
inputs.kakoune-auto-percent;
kakoune-find =
buildKakounePlugin "kakoune-find" inputs.kakoune-find;
kakoune-idris =
buildKakounePlugin "kakoune-idris" inputs.kakoune-idris;
kakoune-surround =
buildKakounePlugin "kakoune-surround" inputs.kakoune-surround;
prelude-kak = buildKakounePlugin "prelude.kak" inputs.prelude-kak;
shellcheck-kak =
buildKakounePlugin "shellcheck.kak" inputs.shellcheck-kak;
smarttab-kak =
buildKakounePlugin "smarttab.kak" inputs.smarttab-kak;
tug = buildKakounePlugin "tug" inputs.tug;
};
kak-ayu = final.callPackage ./pkgs/kak-ayu { };
kak-tmux-command = final.kakouneUtils.buildKakounePlugin {
pname = "kak-tmux-command";
version = "source";
src = ./pkgs/kak-tmux-command;
};
kak-tree = kak-tree.kakounePlugins.kak-tree;
kakoune-auto-percent = buildKakounePlugin "kakoune-auto-percent"
inputs.kakoune-auto-percent;
kakoune-find =
buildKakounePlugin "kakoune-find" inputs.kakoune-find;
kakoune-idris =
buildKakounePlugin "kakoune-idris" inputs.kakoune-idris;
kakoune-surround =
buildKakounePlugin "kakoune-surround" inputs.kakoune-surround;
prelude-kak = buildKakounePlugin "prelude.kak" inputs.prelude-kak;
shellcheck-kak =
buildKakounePlugin "shellcheck.kak" inputs.shellcheck-kak;
smarttab-kak =
buildKakounePlugin "smarttab.kak" inputs.smarttab-kak;
tug = buildKakounePlugin "tug" inputs.tug;
};
k9s-skins = final.stdenv.mkDerivation {
pname = "k9s-skins";
version = inputs.k9s.rev;
@ -219,13 +222,15 @@
${final.pandoc}/bin/pandoc -s -f markdown -t man $1 | ${final.groff}/bin/groff -T utf8 -man | ${final.less}/bin/less
'';
niv = let
nivSources = import "${inputs.niv}/nix/sources.nix" { };
nivNixpkgs = import nivSources.nixpkgs {
sources = nivSources;
inherit system;
};
in (nivNixpkgs.callPackage inputs.niv { }).niv;
niv =
let
nivSources = import "${inputs.niv}/nix/sources.nix" { };
nivNixpkgs = import nivSources.nixpkgs {
sources = nivSources;
inherit system;
};
in
(nivNixpkgs.callPackage inputs.niv { }).niv;
nix-index = inputs.nix-index.packages.${system}.nix-index;
@ -254,7 +259,10 @@
prev.tree-grepper.overrideAttrs (attrs: { doCheck = false; });
})
];
in {
in
{
formatter.aarch64-darwin = inputs.nixpkgs.legacyPackages.aarch64-darwin.nixpkgs-fmt;
nixosConfigurations.torch = inputs.nixpkgs.lib.nixosSystem rec {
system = "x86_64-linux";
modules = [

View File

@ -1,6 +1,7 @@
{ config, pkgs, ... }:
{
{ config
, pkgs
, ...
}: {
# List packages installed in system profile. To search by name, run:
# $ nix-env -qaP | grep wget
environment.systemPackages = [
@ -33,12 +34,14 @@
# /etc/nix/nix.conf. github.com/nix-community/linuxkit-nix seems to do the
# rest just fine.
nix.distributedBuilds = true;
nix.buildMachines = [{
hostName = "nix-docker";
system = "x86_64-linux";
maxJobs = 4;
sshKey = "/etc/nix/docker_rsa";
}];
nix.buildMachines = [
{
hostName = "nix-docker";
system = "x86_64-linux";
maxJobs = 4;
sshKey = "/etc/nix/docker_rsa";
}
];
# dotfiles
home-manager = {

View File

@ -1,6 +1,4 @@
{ ... }:
{
{ ... }: {
system.keyboard = {
enableKeyMapping = true;

View File

@ -1,6 +1,7 @@
{ config, pkgs, ... }:
{
{ config
, pkgs
, ...
}: {
# List packages installed in system profile. To search by name, run:
# $ nix-env -qaP | grep wget
@ -25,12 +26,14 @@
# use nixbuild.net for distributed builds
nix.distributedBuilds = true;
nix.buildMachines = [{
hostName = "eu.nixbuild.net";
system = "x86_64-linux";
maxJobs = 100;
supportedFeatures = [ "benchmark" "big-parallel" ];
}];
nix.buildMachines = [
{
hostName = "eu.nixbuild.net";
system = "x86_64-linux";
maxJobs = 100;
supportedFeatures = [ "benchmark" "big-parallel" ];
}
];
nix.extraOptions = ''
builders-use-substitutes = true
experimental-features = nix-command flakes
@ -38,8 +41,7 @@
programs.ssh.knownHosts = {
nixBuild = {
hostNames = [ "eu.nixbuild.net" ];
publicKey =
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPIQCZc54poJ8vqawd8TraNryQeJnvH1eLpIDgbiqymM";
publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPIQCZc54poJ8vqawd8TraNryQeJnvH1eLpIDgbiqymM";
};
};

View File

@ -1,10 +1,10 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help).
inputs:
{ config, pkgs, ... }:
{
inputs: { config
, pkgs
, ...
}: {
imports = [
# hardware
./hardware-configuration.nix

View File

@ -1,16 +1,18 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
{ config
, lib
, pkgs
, modulesPath
, ...
}: {
imports = [
(modulesPath + "/hardware/network/broadcom-43xx.nix")
(modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules =
[ "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ];
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
@ -25,8 +27,7 @@
fsType = "vfat";
};
swapDevices =
[{ device = "/dev/disk/by-uuid/1dbbf463-6dc4-46a1-8686-1647374bcc84"; }];
swapDevices = [{ device = "/dev/disk/by-uuid/1dbbf463-6dc4-46a1-8686-1647374bcc84"; }];
# high-resolution display
hardware.video.hidpi.enable = lib.mkDefault true;

View File

@ -1,11 +1,12 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help).
inputs:
{ config, pkgs, ... }:
{
imports = [ # Include the results of the hardware scan.
inputs: { config
, pkgs
, ...
}: {
imports = [
# Include the results of the hardware scan.
./hardware-configuration.nix
(import ../../nixos/nix inputs)
@ -91,6 +92,4 @@ inputs:
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "21.05"; # Did you read the comment?
}

View File

@ -1,13 +1,15 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
{ config
, lib
, pkgs
, modulesPath
, ...
}: {
imports = [ ];
boot.initrd.availableKernelModules =
[ "ata_piix" "ohci_pci" "sd_mod" "sr_mod" ];
boot.initrd.availableKernelModules = [ "ata_piix" "ohci_pci" "sd_mod" "sr_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];

View File

@ -1,4 +1,7 @@
{ pkgs, config, ... }: {
{ pkgs
, config
, ...
}: {
environment.shells = [ pkgs.zsh ];
users.users.brian = {
@ -36,8 +39,7 @@
compression = "auto,zlib,6";
encryption.mode = "repokey-blake2";
encryption.passCommand =
"cat /home/brian/.ssh/borgbase-brian-home-encryption-key";
encryption.passCommand = "cat /home/brian/.ssh/borgbase-brian-home-encryption-key";
environment.BORG_RSH = "ssh -i /home/brian/.ssh/borgbase_ed25519";

View File

@ -187,9 +187,7 @@
# this to work!
${pkgs.polybarFull}/bin/polybar-msg cmd quit
${pkgs.polybarFull}/bin/polybar --config=${
./polybar.ini
} top 2>&1 | tee -a /tmp/polybar-top.log & disown
${pkgs.polybarFull}/bin/polybar --config=${./polybar.ini} top 2>&1 | tee -a /tmp/polybar-top.log & disown
''
}/bin/launch-polybar.sh

View File

@ -1,5 +1,4 @@
inputs:
{ pkgs, ... }: {
inputs: { pkgs, ... }: {
nix = {
package = pkgs.nixUnstable;
extraOptions = ''

View File

@ -8,8 +8,7 @@ pkgs.stdenv.mkDerivation {
mkdir -p $out/bin
cp ./git-gclone.sh $out/bin/git-gclone
wrapProgram $out/bin/git-gclone --prefix PATH : ${
pkgs.lib.makeBinPath [ pkgs.git ]
pkgs.lib.makeBinPath [pkgs.git]
}
'';
}

View File

@ -1,8 +1,11 @@
{ pkgs ? import <nixpkgs> { inherit system; }, system ? builtins.currentSystem
{ pkgs ? import <nixpkgs> { inherit system; }
, system ? builtins.currentSystem
,
}:
let builder = (import ./node.nix { inherit pkgs system; }).package;
in with pkgs;
let
builder = (import ./node.nix { inherit pkgs system; }).package;
in
with pkgs;
stdenv.mkDerivation {
name = "kak-ayu";
src = ./fakesrc;

View File

@ -1,15 +1,29 @@
# This file originates from node2nix
{lib, stdenv, nodejs, python2, pkgs, libtool, runCommand, writeTextFile, writeShellScript}:
{ lib
, stdenv
, nodejs
, python2
, pkgs
, libtool
, runCommand
, writeTextFile
, writeShellScript
,
}:
let
# Workaround to cope with utillinux in Nixpkgs 20.09 and util-linux in Nixpkgs master
utillinux = if pkgs ? utillinux then pkgs.utillinux else pkgs.util-linux;
utillinux =
if pkgs ? utillinux
then pkgs.utillinux
else pkgs.util-linux;
python = if nodejs ? python then nodejs.python else python2;
python =
if nodejs ? python
then nodejs.python
else python2;
# Create a tar wrapper that filters all the 'Ignoring unknown extended header keyword' noise
tarWrapper = runCommand "tarWrapper" {} ''
tarWrapper = runCommand "tarWrapper" { } ''
mkdir -p $out/bin
cat > $out/bin/tar <<EOF
@ -22,8 +36,11 @@ let
# Function that generates a TGZ file from a NPM project
buildNodeSourceDist =
{ name, version, src, ... }:
{ name
, version
, src
, ...
}:
stdenv.mkDerivation {
name = "node-tarball-${name}-${version}";
inherit src;
@ -90,34 +107,46 @@ let
# Bundle the dependencies of the package
#
# Only include dependencies if they don't exist. They may also be bundled in the package.
includeDependencies = {dependencies}:
lib.optionalString (dependencies != []) (
includeDependencies = { dependencies }:
lib.optionalString (dependencies != [ ]) (
''
mkdir -p node_modules
cd node_modules
''
+ (lib.concatMapStrings (dependency:
''
if [ ! -e "${dependency.packageName}" ]; then
${composePackage dependency}
fi
''
) dependencies)
+ (lib.concatMapStrings
(
dependency: ''
if [ ! -e "${dependency.packageName}" ]; then
${composePackage dependency}
fi
''
)
dependencies)
+ ''
cd ..
''
);
# Recursively composes the dependencies of a package
composePackage = { name, packageName, src, dependencies ? [], ... }@args:
composePackage =
{ name
, packageName
, src
, dependencies ? [ ]
, ...
} @ args:
builtins.addErrorContext "while evaluating node package '${packageName}'" ''
installPackage "${packageName}" "${src}"
${includeDependencies { inherit dependencies; }}
${includeDependencies {inherit dependencies;}}
cd ..
${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."}
'';
pinpointDependencies = {dependencies, production}:
pinpointDependencies =
{ dependencies
, production
,
}:
let
pinpointDependenciesFromPackageJSON = writeTextFile {
name = "pinpointDependencies.js";
@ -173,7 +202,11 @@ let
};
in
''
node ${pinpointDependenciesFromPackageJSON} ${if production then "production" else "development"}
node ${pinpointDependenciesFromPackageJSON} ${
if production
then "production"
else "development"
}
${lib.optionalString (dependencies != [])
''
@ -190,12 +223,16 @@ let
# dependencies in the package.json file to the versions that are actually
# being used.
pinpointDependenciesOfPackage = { packageName, dependencies ? [], production ? true, ... }@args:
''
pinpointDependenciesOfPackage =
{ packageName
, dependencies ? [ ]
, production ? true
, ...
} @ args: ''
if [ -d "${packageName}" ]
then
cd "${packageName}"
${pinpointDependencies { inherit dependencies production; }}
${pinpointDependencies {inherit dependencies production;}}
cd ..
${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."}
fi
@ -203,7 +240,7 @@ let
# Extract the Node.js source code which is used to compile packages with
# native bindings
nodeSources = runCommand "node-sources" {} ''
nodeSources = runCommand "node-sources" { } ''
tar --no-same-owner --no-same-permissions -xf ${nodejs.src}
mv node-* $out
'';
@ -331,59 +368,69 @@ let
'';
};
prepareAndInvokeNPM = {packageName, bypassCache, reconstructLock, npmFlags, production}:
prepareAndInvokeNPM =
{ packageName
, bypassCache
, reconstructLock
, npmFlags
, production
,
}:
let
forceOfflineFlag = if bypassCache then "--offline" else "--registry http://www.example.com";
forceOfflineFlag =
if bypassCache
then "--offline"
else "--registry http://www.example.com";
in
''
# Pinpoint the versions of all dependencies to the ones that are actually being used
echo "pinpointing versions of dependencies..."
source $pinpointDependenciesScriptPath
# Pinpoint the versions of all dependencies to the ones that are actually being used
echo "pinpointing versions of dependencies..."
source $pinpointDependenciesScriptPath
# Patch the shebangs of the bundled modules to prevent them from
# calling executables outside the Nix store as much as possible
patchShebangs .
# Patch the shebangs of the bundled modules to prevent them from
# calling executables outside the Nix store as much as possible
patchShebangs .
# Deploy the Node.js package by running npm install. Since the
# dependencies have been provided already by ourselves, it should not
# attempt to install them again, which is good, because we want to make
# it Nix's responsibility. If it needs to install any dependencies
# anyway (e.g. because the dependency parameters are
# incomplete/incorrect), it fails.
#
# The other responsibilities of NPM are kept -- version checks, build
# steps, postprocessing etc.
# Deploy the Node.js package by running npm install. Since the
# dependencies have been provided already by ourselves, it should not
# attempt to install them again, which is good, because we want to make
# it Nix's responsibility. If it needs to install any dependencies
# anyway (e.g. because the dependency parameters are
# incomplete/incorrect), it fails.
#
# The other responsibilities of NPM are kept -- version checks, build
# steps, postprocessing etc.
export HOME=$TMPDIR
cd "${packageName}"
runHook preRebuild
export HOME=$TMPDIR
cd "${packageName}"
runHook preRebuild
${lib.optionalString bypassCache ''
${lib.optionalString reconstructLock ''
if [ -f package-lock.json ]
then
echo "WARNING: Reconstruct lock option enabled, but a lock file already exists!"
echo "This will most likely result in version mismatches! We will remove the lock file and regenerate it!"
rm package-lock.json
else
echo "No package-lock.json file found, reconstructing..."
fi
${lib.optionalString bypassCache ''
${lib.optionalString reconstructLock ''
if [ -f package-lock.json ]
then
echo "WARNING: Reconstruct lock option enabled, but a lock file already exists!"
echo "This will most likely result in version mismatches! We will remove the lock file and regenerate it!"
rm package-lock.json
else
echo "No package-lock.json file found, reconstructing..."
fi
node ${reconstructPackageLock}
''}
node ${addIntegrityFieldsScript}
node ${reconstructPackageLock}
''}
npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${lib.optionalString production "--production"} rebuild
node ${addIntegrityFieldsScript}
''}
if [ "''${dontNpmInstall-}" != "1" ]
then
# NPM tries to download packages even when they already exist if npm-shrinkwrap is used.
rm -f npm-shrinkwrap.json
npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${lib.optionalString production "--production"} rebuild
npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${lib.optionalString production "--production"} install
fi
if [ "''${dontNpmInstall-}" != "1" ]
then
# NPM tries to download packages even when they already exist if npm-shrinkwrap is used.
rm -f npm-shrinkwrap.json
npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${lib.optionalString production "--production"} install
fi
'';
# Builds and composes an NPM package including all its dependencies
@ -391,8 +438,8 @@ let
{ name
, packageName
, version ? null
, dependencies ? []
, buildInputs ? []
, dependencies ? [ ]
, buildInputs ? [ ]
, production ? true
, npmFlags ? ""
, dontNpmInstall ? false
@ -402,18 +449,23 @@ let
, dontStrip ? true
, unpackPhase ? "true"
, buildPhase ? "true"
, meta ? {}
, ... }@args:
, meta ? { }
, ...
} @ args:
let
extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" "dontStrip" "dontNpmInstall" "preRebuild" "unpackPhase" "buildPhase" "meta" ];
in
stdenv.mkDerivation ({
name = "${name}${if version == null then "" else "-${version}"}";
buildInputs = [ tarWrapper python nodejs ]
++ lib.optional (stdenv.isLinux) utillinux
++ lib.optional (stdenv.isDarwin) libtool
++ buildInputs;
name = "${name}${
if version == null
then ""
else "-${version}"
}";
buildInputs =
[ tarWrapper python nodejs ]
++ lib.optional (stdenv.isLinux) utillinux
++ lib.optional (stdenv.isDarwin) libtool
++ buildInputs;
inherit nodejs;
@ -435,7 +487,7 @@ let
# Compose the package and all its dependencies
source $compositionScriptPath
${prepareAndInvokeNPM { inherit packageName bypassCache reconstructLock npmFlags production; }}
${prepareAndInvokeNPM {inherit packageName bypassCache reconstructLock npmFlags production;}}
# Create symlink to the deployed executable folder, if applicable
if [ -d "$out/lib/node_modules/.bin" ]
@ -469,11 +521,14 @@ let
runHook postInstall
'';
meta = {
# default to Node.js' platforms
platforms = nodejs.meta.platforms;
} // meta;
} // extraArgs);
meta =
{
# default to Node.js' platforms
platforms = nodejs.meta.platforms;
}
// meta;
}
// extraArgs);
# Builds a node environment (a node_modules folder and a set of binaries)
buildNodeDependencies =
@ -481,8 +536,8 @@ let
, packageName
, version ? null
, src
, dependencies ? []
, buildInputs ? []
, dependencies ? [ ]
, buildInputs ? [ ]
, production ? true
, npmFlags ? ""
, dontNpmInstall ? false
@ -491,60 +546,66 @@ let
, dontStrip ? true
, unpackPhase ? "true"
, buildPhase ? "true"
, ... }@args:
, ...
} @ args:
let
extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" ];
in
stdenv.mkDerivation ({
name = "node-dependencies-${name}${if version == null then "" else "-${version}"}";
stdenv.mkDerivation ({
name = "node-dependencies-${name}${
if version == null
then ""
else "-${version}"
}";
buildInputs = [ tarWrapper python nodejs ]
buildInputs =
[ tarWrapper python nodejs ]
++ lib.optional (stdenv.isLinux) utillinux
++ lib.optional (stdenv.isDarwin) libtool
++ buildInputs;
inherit dontStrip; # Stripping may fail a build for some package deployments
inherit dontNpmInstall unpackPhase buildPhase;
inherit dontStrip; # Stripping may fail a build for some package deployments
inherit dontNpmInstall unpackPhase buildPhase;
includeScript = includeDependencies { inherit dependencies; };
pinpointDependenciesScript = pinpointDependenciesOfPackage args;
includeScript = includeDependencies { inherit dependencies; };
pinpointDependenciesScript = pinpointDependenciesOfPackage args;
passAsFile = [ "includeScript" "pinpointDependenciesScript" ];
passAsFile = [ "includeScript" "pinpointDependenciesScript" ];
installPhase = ''
source ${installPackage}
installPhase = ''
source ${installPackage}
mkdir -p $out/${packageName}
cd $out/${packageName}
mkdir -p $out/${packageName}
cd $out/${packageName}
source $includeScriptPath
source $includeScriptPath
# Create fake package.json to make the npm commands work properly
cp ${src}/package.json .
chmod 644 package.json
${lib.optionalString bypassCache ''
if [ -f ${src}/package-lock.json ]
then
cp ${src}/package-lock.json .
chmod 644 package-lock.json
fi
''}
# Create fake package.json to make the npm commands work properly
cp ${src}/package.json .
chmod 644 package.json
${lib.optionalString bypassCache ''
if [ -f ${src}/package-lock.json ]
then
cp ${src}/package-lock.json .
chmod 644 package-lock.json
fi
''}
# Go to the parent folder to make sure that all packages are pinpointed
cd ..
${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."}
# Go to the parent folder to make sure that all packages are pinpointed
cd ..
${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."}
${prepareAndInvokeNPM { inherit packageName bypassCache reconstructLock npmFlags production; }}
${prepareAndInvokeNPM {inherit packageName bypassCache reconstructLock npmFlags production;}}
# Expose the executables that were installed
cd ..
${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."}
# Expose the executables that were installed
cd ..
${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."}
mv ${packageName} lib
ln -s $out/lib/node_modules/.bin $out/bin
'';
} // extraArgs);
mv ${packageName} lib
ln -s $out/lib/node_modules/.bin $out/bin
'';
}
// extraArgs);
# Builds a development shell
buildNodeShell =
@ -552,8 +613,8 @@ let
, packageName
, version ? null
, src
, dependencies ? []
, buildInputs ? []
, dependencies ? [ ]
, buildInputs ? [ ]
, production ? true
, npmFlags ? ""
, dontNpmInstall ? false
@ -562,14 +623,18 @@ let
, dontStrip ? true
, unpackPhase ? "true"
, buildPhase ? "true"
, ... }@args:
, ...
} @ args:
let
nodeDependencies = buildNodeDependencies args;
extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" "dontStrip" "dontNpmInstall" "unpackPhase" "buildPhase" ];
in
stdenv.mkDerivation ({
name = "node-shell-${name}${if version == null then "" else "-${version}"}";
name = "node-shell-${name}${
if version == null
then ""
else "-${version}"
}";
buildInputs = [ python nodejs ] ++ lib.optional (stdenv.isLinux) utillinux ++ buildInputs;
buildCommand = ''
@ -584,11 +649,12 @@ let
# Provide the dependencies in a development shell through the NODE_PATH environment variable
inherit nodeDependencies;
shellHook = lib.optionalString (dependencies != []) ''
shellHook = lib.optionalString (dependencies != [ ]) ''
export NODE_PATH=${nodeDependencies}/lib/node_modules
export PATH="${nodeDependencies}/bin:$PATH"
'';
} // extraArgs);
}
// extraArgs);
in
{
buildNodeSourceDist = lib.makeOverridable buildNodeSourceDist;

View File

@ -1,7 +1,13 @@
# This file has been generated by node2nix 1.11.1. Do not edit!
{nodeEnv, fetchurl, fetchgit, nix-gitignore, stdenv, lib, globalBuildInputs ? []}:
{ nodeEnv
, fetchurl
, fetchgit
, nix-gitignore
, stdenv
, lib
, globalBuildInputs ? [ ]
,
}:
let
sources = {
"@types/chroma-js-1.4.3" = {
@ -141,11 +147,13 @@ in
nodeDependencies = nodeEnv.buildNodeDependencies (lib.overrideExisting args {
src = stdenv.mkDerivation {
name = args.name + "-package-json";
src = nix-gitignore.gitignoreSourcePure [
"*"
"!package.json"
"!package-lock.json"
] args.src;
src =
nix-gitignore.gitignoreSourcePure [
"*"
"!package.json"
"!package-lock.json"
]
args.src;
dontBuild = true;
installPhase = "mkdir -p $out; cp -r ./* $out;";
};

View File

@ -1,14 +1,19 @@
# This file has been generated by node2nix 1.11.1. Do not edit!
{pkgs ? import <nixpkgs> {
{ pkgs ? import <nixpkgs> {
inherit system;
}, system ? builtins.currentSystem, nodejs ? pkgs."nodejs-16_x"}:
}
, system ? builtins.currentSystem
, nodejs ? pkgs."nodejs-16_x"
,
}:
let
nodeEnv = import ./node-env.nix {
inherit (pkgs) stdenv lib python2 runCommand writeTextFile writeShellScript;
inherit pkgs nodejs;
libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null;
libtool =
if pkgs.stdenv.isDarwin
then pkgs.darwin.cctools
else null;
};
in
import ./node-packages.nix {

View File

@ -1,4 +1,7 @@
{ pkgs, naersk, ... }:
{ pkgs
, naersk
, ...
}:
let
src = pkgs.fetchgit {
url = "https://github.com/ul/kak-tree.git";
@ -6,7 +9,8 @@ let
sha256 = "1xd5qa8im0rjplp23v2fymh80kp1z25r7fd1v65s5wndxd49c0cs";
fetchSubmodules = true;
};
in {
in
{
kakounePlugins.kak-tree = pkgs.kakouneUtils.buildKakounePlugin {
pname = "kak-tree";
version = src.rev;
@ -15,9 +19,10 @@ in {
kak-tree = naersk.buildPackage {
root = src;
cargoBuildOptions = (defaults:
defaults ++ [
cargoBuildOptions = defaults:
defaults
++ [
''--features "bash css elm haskell html javascript json python ruby"''
]);
];
};
}

View File

@ -10,8 +10,7 @@ pkgs.stdenv.mkDerivation {
mkdir -p $out/bin
cp ./lazygit-window.sh $out/bin/lazygit-window
wrapProgram $out/bin/lazygit-window --prefix PATH : ${
pkgs.lib.makeBinPath [ pkgs.tmux pkgs.lazygit ]
pkgs.lib.makeBinPath [pkgs.tmux pkgs.lazygit]
}
'';
}

View File

@ -1,4 +1,7 @@
{ sources ? import ../../nix/sources.nix, pkgs ? import sources.nixpkgs { } }:
{ sources ? import ../../nix/sources.nix
, pkgs ? import sources.nixpkgs { }
,
}:
pkgs.stdenv.mkDerivation {
name = "tmux-session";
src = ./.;
@ -8,12 +11,12 @@ pkgs.stdenv.mkDerivation {
mkdir -p $out/bin
cp ./tmux-session $out/bin/tmux-session
wrapProgram $out/bin/tmux-session --prefix PATH : ${
pkgs.lib.makeBinPath [ pkgs.tmux ]
pkgs.lib.makeBinPath [pkgs.tmux]
}
cp ./tmux-jump $out/bin/tmux-jump
wrapProgram $out/bin/tmux-jump --prefix PATH : ${
pkgs.lib.makeBinPath [ pkgs.findutils pkgs.fzf ]
pkgs.lib.makeBinPath [pkgs.findutils pkgs.fzf]
}
'';
}