nixpkgs-fmt

This commit is contained in:
Charlotte Van Petegem 2020-02-22 19:33:27 +01:00
parent 0b08e521c8
commit f63699c1cf
17 changed files with 1496 additions and 1258 deletions

View file

@ -7,7 +7,7 @@
# Early KMS start # Early KMS start
boot.initrd.kernelModules = [ "i915" ]; boot.initrd.kernelModules = [ "i915" ];
boot.kernelModules = [ "kvm-intel" ]; boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ]; boot.extraModulePackages = [];
fileSystems."/" = { fileSystems."/" = {
device = "/dev/disk/by-uuid/0eb8b94a-5fc2-4b24-962a-94b3675b6f5b"; device = "/dev/disk/by-uuid/0eb8b94a-5fc2-4b24-962a-94b3675b6f5b";

View file

@ -0,0 +1,36 @@
{ stdenv, pkgs, ... }:
stdenv.mkDerivation rec {
pname = "jdtls";
version = "0.50.0";
src = pkgs.fetchurl {
url = "http://download.eclipse.org/${pname}/milestones/${version}/jdt-language-server-${version}-202002171858.tar.gz";
sha256 = "bf72084dc7988f76e01668d778c826c7490c287ee96a9f82e9e11afb6b722ab7";
};
sourceRoot = ".";
buildPhase = "true";
installPhase = ''
mkdir -p $out/share/java/jdtls
mv config_* features plugins $out/share/java/jdtls
mkdir $out/bin
cat >$out/bin/jdtls <<HERE
#!${pkgs.bash}/bin/bash
tmp_dir=\$(mktemp -d /tmp/jdtls.XXXXX)
cp -R $out/share/java/jdtls/config_linux \$tmp_dir
chmod -R u=rwX \$tmp_dir
trap "{ rm -rf \$tmp_dir; }" 0
${pkgs.jdk11}/bin/java \
-Declipse.application=org.eclipse.jdt.ls.core.id1 \
-Dosgi.bundles.defaultStartLevel=4 \
-Declipse.product=org.eclipse.jdt.ls.core.product \
-noverify \
-Xms1G \
-jar $out/share/java/jdtls/plugins/org.eclipse.equinox.launcher_*.jar \
-configuration "\$tmp_dir/config_linux" \
"\$@"
HERE
chmod +x $out/bin/jdtls
'';
}

View file

@ -1,8 +1,11 @@
# This file has been generated by node2nix 1.7.0. Do not edit! # This file has been generated by node2nix 1.7.0. Do not edit!
{pkgs ? import <nixpkgs> { { pkgs ? import <nixpkgs> {
inherit system; inherit system;
}, system ? builtins.currentSystem, nodejs ? pkgs."nodejs-12_x"}: }
, system ? builtins.currentSystem
, nodejs ? pkgs."nodejs-12_x"
}:
let let
nodeEnv = import ./node-env.nix { nodeEnv = import ./node-env.nix {
@ -14,4 +17,4 @@ in
import ./node-packages.nix { import ./node-packages.nix {
inherit (pkgs) fetchurl fetchgit; inherit (pkgs) fetchurl fetchgit;
inherit nodeEnv; inherit nodeEnv;
} }

View file

@ -1,6 +1,6 @@
# This file originates from node2nix # This file originates from node2nix
{stdenv, nodejs, python2, utillinux, libtool, runCommand, writeTextFile}: { stdenv, nodejs, python2, utillinux, libtool, runCommand, writeTextFile }:
let let
python = if nodejs ? python then nodejs.python else python2; python = if nodejs ? python then nodejs.python else python2;
@ -21,39 +21,42 @@ let
buildNodeSourceDist = buildNodeSourceDist =
{ name, version, src, ... }: { name, version, src, ... }:
stdenv.mkDerivation { stdenv.mkDerivation {
name = "node-tarball-${name}-${version}"; name = "node-tarball-${name}-${version}";
inherit src; inherit src;
buildInputs = [ nodejs ]; buildInputs = [ nodejs ];
buildPhase = '' buildPhase = ''
export HOME=$TMPDIR export HOME=$TMPDIR
tgzFile=$(npm pack | tail -n 1) # Hooks to the pack command will add output (https://docs.npmjs.com/misc/scripts) tgzFile=$(npm pack | tail -n 1) # Hooks to the pack command will add output (https://docs.npmjs.com/misc/scripts)
''; '';
installPhase = '' installPhase = ''
mkdir -p $out/tarballs mkdir -p $out/tarballs
mv $tgzFile $out/tarballs mv $tgzFile $out/tarballs
mkdir -p $out/nix-support mkdir -p $out/nix-support
echo "file source-dist $out/tarballs/$tgzFile" >> $out/nix-support/hydra-build-products echo "file source-dist $out/tarballs/$tgzFile" >> $out/nix-support/hydra-build-products
''; '';
}; };
includeDependencies = {dependencies}: includeDependencies = { dependencies }:
stdenv.lib.optionalString (dependencies != []) stdenv.lib.optionalString (dependencies != [])
(stdenv.lib.concatMapStrings (dependency: (
'' stdenv.lib.concatMapStrings (
# Bundle the dependencies of the package dependency:
mkdir -p node_modules ''
cd node_modules # Bundle the dependencies of the package
mkdir -p node_modules
cd node_modules
# Only include dependencies if they don't exist. They may also be bundled in the package. # Only include dependencies if they don't exist. They may also be bundled in the package.
if [ ! -e "${dependency.name}" ] if [ ! -e "${dependency.name}" ]
then then
${composePackage dependency} ${composePackage dependency}
fi fi
cd .. cd ..
'' ''
) dependencies); ) dependencies
);
# Recursively composes the dependencies of a package # Recursively composes the dependencies of a package
composePackage = { name, packageName, src, dependencies ? [], ... }@args: composePackage = { name, packageName, src, dependencies ? [], ... }@args:
@ -103,7 +106,7 @@ let
${stdenv.lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."} ${stdenv.lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."}
''; '';
pinpointDependencies = {dependencies, production}: pinpointDependencies = { dependencies, production }:
let let
pinpointDependenciesFromPackageJSON = writeTextFile { pinpointDependenciesFromPackageJSON = writeTextFile {
name = "pinpointDependencies.js"; name = "pinpointDependencies.js";
@ -158,10 +161,10 @@ let
''; '';
}; };
in in
'' ''
node ${pinpointDependenciesFromPackageJSON} ${if production then "production" else "development"} node ${pinpointDependenciesFromPackageJSON} ${if production then "production" else "development"}
${stdenv.lib.optionalString (dependencies != []) ${stdenv.lib.optionalString (dependencies != [])
'' ''
if [ -d node_modules ] if [ -d node_modules ]
then then
@ -170,7 +173,7 @@ let
cd .. cd ..
fi fi
''} ''}
''; '';
# Recursively traverses all dependencies of a package and pinpoints all # Recursively traverses all dependencies of a package and pinpoints all
# dependencies in the package.json file to the versions that are actually # dependencies in the package.json file to the versions that are actually
@ -317,11 +320,11 @@ let
''; '';
}; };
prepareAndInvokeNPM = {packageName, bypassCache, reconstructLock, npmFlags, production}: prepareAndInvokeNPM = { packageName, bypassCache, reconstructLock, npmFlags, production }:
let let
forceOfflineFlag = if bypassCache then "--offline" else "--registry http://www.example.com"; forceOfflineFlag = if bypassCache then "--offline" else "--registry http://www.example.com";
in in
'' ''
# Pinpoint the versions of all dependencies to the ones that are actually being used # Pinpoint the versions of all dependencies to the ones that are actually being used
echo "pinpointing versions of dependencies..." echo "pinpointing versions of dependencies..."
source $pinpointDependenciesScriptPath source $pinpointDependenciesScriptPath
@ -345,21 +348,21 @@ let
runHook preRebuild runHook preRebuild
${stdenv.lib.optionalString bypassCache '' ${stdenv.lib.optionalString bypassCache ''
${stdenv.lib.optionalString reconstructLock '' ${stdenv.lib.optionalString reconstructLock ''
if [ -f package-lock.json ] if [ -f package-lock.json ]
then then
echo "WARNING: Reconstruct lock option enabled, but a lock file already exists!" 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!" echo "This will most likely result in version mismatches! We will remove the lock file and regenerate it!"
rm package-lock.json rm package-lock.json
else else
echo "No package-lock.json file found, reconstructing..." echo "No package-lock.json file found, reconstructing..."
fi fi
node ${reconstructPackageLock} node ${reconstructPackageLock}
''} ''}
node ${addIntegrityFieldsScript} node ${addIntegrityFieldsScript}
''} ''}
npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${stdenv.lib.optionalString production "--production"} rebuild npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${stdenv.lib.optionalString production "--production"} rebuild
@ -370,7 +373,7 @@ let
npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${stdenv.lib.optionalString production "--production"} install npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${stdenv.lib.optionalString production "--production"} install
fi fi
''; '';
# Builds and composes an NPM package including all its dependencies # Builds and composes an NPM package including all its dependencies
buildNodePackage = buildNodePackage =
@ -388,60 +391,63 @@ let
, dontStrip ? true , dontStrip ? true
, unpackPhase ? "true" , unpackPhase ? "true"
, buildPhase ? "true" , buildPhase ? "true"
, ... }@args: , ...
}@args:
let let
extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" "dontStrip" "dontNpmInstall" "preRebuild" "unpackPhase" "buildPhase" ]; extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" "dontStrip" "dontNpmInstall" "preRebuild" "unpackPhase" "buildPhase" ];
in in
stdenv.mkDerivation ({ stdenv.mkDerivation (
name = "node_${name}-${version}"; {
buildInputs = [ tarWrapper python nodejs ] name = "node_${name}-${version}";
++ stdenv.lib.optional (stdenv.isLinux) utillinux buildInputs = [ tarWrapper python nodejs ]
++ stdenv.lib.optional (stdenv.isDarwin) libtool ++ stdenv.lib.optional (stdenv.isLinux) utillinux
++ buildInputs; ++ stdenv.lib.optional (stdenv.isDarwin) libtool
++ buildInputs;
inherit dontStrip; # Stripping may fail a build for some package deployments inherit dontStrip; # Stripping may fail a build for some package deployments
inherit dontNpmInstall preRebuild unpackPhase buildPhase; inherit dontNpmInstall preRebuild unpackPhase buildPhase;
compositionScript = composePackage args; compositionScript = composePackage args;
pinpointDependenciesScript = pinpointDependenciesOfPackage args; pinpointDependenciesScript = pinpointDependenciesOfPackage args;
passAsFile = [ "compositionScript" "pinpointDependenciesScript" ]; passAsFile = [ "compositionScript" "pinpointDependenciesScript" ];
installPhase = '' installPhase = ''
# Create and enter a root node_modules/ folder # Create and enter a root node_modules/ folder
mkdir -p $out/lib/node_modules mkdir -p $out/lib/node_modules
cd $out/lib/node_modules cd $out/lib/node_modules
# Compose the package and all its dependencies # Compose the package and all its dependencies
source $compositionScriptPath 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 # Create symlink to the deployed executable folder, if applicable
if [ -d "$out/lib/node_modules/.bin" ] if [ -d "$out/lib/node_modules/.bin" ]
then then
ln -s $out/lib/node_modules/.bin $out/bin ln -s $out/lib/node_modules/.bin $out/bin
fi fi
# Create symlinks to the deployed manual page folders, if applicable # Create symlinks to the deployed manual page folders, if applicable
if [ -d "$out/lib/node_modules/${packageName}/man" ] if [ -d "$out/lib/node_modules/${packageName}/man" ]
then then
mkdir -p $out/share mkdir -p $out/share
for dir in "$out/lib/node_modules/${packageName}/man/"* for dir in "$out/lib/node_modules/${packageName}/man/"*
do do
mkdir -p $out/share/man/$(basename "$dir") mkdir -p $out/share/man/$(basename "$dir")
for page in "$dir"/* for page in "$dir"/*
do do
ln -s $page $out/share/man/$(basename "$dir") ln -s $page $out/share/man/$(basename "$dir")
done done
done done
fi fi
# Run post install hook, if provided # Run post install hook, if provided
runHook postInstall runHook postInstall
''; '';
} // extraArgs); } // extraArgs
);
# Builds a development shell # Builds a development shell
buildNodeShell = buildNodeShell =
@ -459,79 +465,82 @@ let
, dontStrip ? true , dontStrip ? true
, unpackPhase ? "true" , unpackPhase ? "true"
, buildPhase ? "true" , buildPhase ? "true"
, ... }@args: , ...
}@args:
let let
extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" ]; extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" ];
nodeDependencies = stdenv.mkDerivation ({ nodeDependencies = stdenv.mkDerivation (
name = "node-dependencies-${name}-${version}"; {
name = "node-dependencies-${name}-${version}";
buildInputs = [ tarWrapper python nodejs ] buildInputs = [ tarWrapper python nodejs ]
++ stdenv.lib.optional (stdenv.isLinux) utillinux ++ stdenv.lib.optional (stdenv.isLinux) utillinux
++ stdenv.lib.optional (stdenv.isDarwin) libtool ++ stdenv.lib.optional (stdenv.isDarwin) libtool
++ buildInputs; ++ buildInputs;
inherit dontStrip; # Stripping may fail a build for some package deployments inherit dontStrip; # Stripping may fail a build for some package deployments
inherit dontNpmInstall unpackPhase buildPhase; inherit dontNpmInstall unpackPhase buildPhase;
includeScript = includeDependencies { inherit dependencies; }; includeScript = includeDependencies { inherit dependencies; };
pinpointDependenciesScript = pinpointDependenciesOfPackage args; pinpointDependenciesScript = pinpointDependenciesOfPackage args;
passAsFile = [ "includeScript" "pinpointDependenciesScript" ]; passAsFile = [ "includeScript" "pinpointDependenciesScript" ];
installPhase = '' installPhase = ''
mkdir -p $out/${packageName} mkdir -p $out/${packageName}
cd $out/${packageName} cd $out/${packageName}
source $includeScriptPath source $includeScriptPath
# Create fake package.json to make the npm commands work properly # Create fake package.json to make the npm commands work properly
cp ${src}/package.json . cp ${src}/package.json .
chmod 644 package.json chmod 644 package.json
${stdenv.lib.optionalString bypassCache '' ${stdenv.lib.optionalString bypassCache ''
if [ -f ${src}/package-lock.json ] if [ -f ${src}/package-lock.json ]
then then
cp ${src}/package-lock.json . cp ${src}/package-lock.json .
fi fi
''} ''}
# Go to the parent folder to make sure that all packages are pinpointed # Go to the parent folder to make sure that all packages are pinpointed
cd .. cd ..
${stdenv.lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."} ${stdenv.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 # Expose the executables that were installed
cd .. cd ..
${stdenv.lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."} ${stdenv.lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."}
mv ${packageName} lib mv ${packageName} lib
ln -s $out/lib/node_modules/.bin $out/bin ln -s $out/lib/node_modules/.bin $out/bin
''; '';
} // extraArgs); } // extraArgs
in );
stdenv.mkDerivation { in
name = "node-shell-${name}-${version}"; stdenv.mkDerivation {
name = "node-shell-${name}-${version}";
buildInputs = [ python nodejs ] ++ stdenv.lib.optional (stdenv.isLinux) utillinux ++ buildInputs; buildInputs = [ python nodejs ] ++ stdenv.lib.optional (stdenv.isLinux) utillinux ++ buildInputs;
buildCommand = '' buildCommand = ''
mkdir -p $out/bin mkdir -p $out/bin
cat > $out/bin/shell <<EOF cat > $out/bin/shell <<EOF
#! ${stdenv.shell} -e #! ${stdenv.shell} -e
$shellHook $shellHook
exec ${stdenv.shell} exec ${stdenv.shell}
EOF EOF
chmod +x $out/bin/shell chmod +x $out/bin/shell
''; '';
# Provide the dependencies in a development shell through the NODE_PATH environment variable # Provide the dependencies in a development shell through the NODE_PATH environment variable
inherit nodeDependencies; inherit nodeDependencies;
shellHook = stdenv.lib.optionalString (dependencies != []) '' shellHook = stdenv.lib.optionalString (dependencies != []) ''
export NODE_PATH=$nodeDependencies/lib/node_modules export NODE_PATH=$nodeDependencies/lib/node_modules
export PATH="$nodeDependencies/bin:$PATH" export PATH="$nodeDependencies/bin:$PATH"
''; '';
}; };
in in
{ {
buildNodeSourceDist = stdenv.lib.makeOverridable buildNodeSourceDist; buildNodeSourceDist = stdenv.lib.makeOverridable buildNodeSourceDist;

File diff suppressed because it is too large Load diff

View file

@ -11,135 +11,135 @@ let
}; };
}; };
in in
{ {
customRC = '' customRC = ''
set autoread set autoread
"" Theming "" Theming
set background=light set background=light
colorscheme snow colorscheme snow
"" General settings "" General settings
" Undo over sessions " Undo over sessions
set undofile set undofile
set undodir=~/.cache/nvimundo set undodir=~/.cache/nvimundo
" Automatically save sessions on exit and load them on start " Automatically save sessions on exit and load them on start
function! MakeSession() function! MakeSession()
let b:sessiondir = $HOME . "/.config/nvim/sessions" . getcwd() let b:sessiondir = $HOME . "/.config/nvim/sessions" . getcwd()
if (filewritable(b:sessiondir) != 2) if (filewritable(b:sessiondir) != 2)
exe 'silent !mkdir -p ' b:sessiondir exe 'silent !mkdir -p ' b:sessiondir
redraw! redraw!
endif
let b:filename = b:sessiondir . '/session.vim'
exe "mksession! " . b:filename
endfunction
function! LoadSession()
let b:sessiondir = $HOME . "/.config/nvim/sessions" . getcwd()
let b:sessionfile = b:sessiondir . "/session.vim"
if (filereadable(b:sessionfile))
exe 'source ' b:sessionfile
else
echo "No session loaded."
endif
endfunction
if(argc() == 0)
au VimEnter * nested :call LoadSession()
au VimLeave * :call MakeSession()
endif endif
let b:filename = b:sessiondir . '/session.vim'
exe "mksession! " . b:filename
endfunction
"" Filetype configuration function! LoadSession()
let b:sessiondir = $HOME . "/.config/nvim/sessions" . getcwd()
let b:sessionfile = b:sessiondir . "/session.vim"
if (filereadable(b:sessionfile))
exe 'source ' b:sessionfile
else
echo "No session loaded."
endif
endfunction
if(argc() == 0)
au VimEnter * nested :call LoadSession()
au VimLeave * :call MakeSession()
endif
" Base settings for all files "" Filetype configuration
syntax enable " Base settings for all files
set number
set showcmd
set scrolloff=8
set expandtab
set tabstop=4
set shiftwidth=4
set linebreak
set list syntax enable
set listchars=tab:·\ ,trail:· set number
set inccommand=split set showcmd
set clipboard=unnamedplus set scrolloff=8
set expandtab
set tabstop=4
set shiftwidth=4
set linebreak
filetype plugin indent on set list
set listchars=tab:·\ ,trail:·
set inccommand=split
set clipboard=unnamedplus
"" Fuzzy search in vim filetype plugin indent on
function! s:completedFiles(winid, filename, ...) abort "" Fuzzy search in vim
bdelete!
call win_gotoid(a:winid) function! s:completedFiles(winid, filename, ...) abort
if filereadable(a:filename) bdelete!
let lines = readfile(a:filename) call win_gotoid(a:winid)
if !empty(lines) if filereadable(a:filename)
exe ':e ' . lines[0] let lines = readfile(a:filename)
endif if !empty(lines)
call delete(a:filename) exe ':e ' . lines[0]
endif endif
endfunction call delete(a:filename)
endif
endfunction
function! FzyFiles() function! FzyFiles()
let file = tempname() let file = tempname()
let winid = win_getid() let winid = win_getid()
let cmd = split(&shell) + split(&shellcmdflag) + ["${pkgs.ripgrep.out}/bin/rg --files --hidden -g '!/.git' --smart-case | ${pkgs.fzy.out}/bin/fzy > " . file] let cmd = split(&shell) + split(&shellcmdflag) + ["${pkgs.ripgrep.out}/bin/rg --files --hidden -g '!/.git' --smart-case | ${pkgs.fzy.out}/bin/fzy > " . file]
let F = function('s:completedFiles', [winid, file]) let F = function('s:completedFiles', [winid, file])
botright 10 new botright 10 new
call termopen(cmd, {'on_exit': F}) call termopen(cmd, {'on_exit': F})
startinsert startinsert
endfunction endfunction
function! s:completedGrep(winid, filename, ...) abort function! s:completedGrep(winid, filename, ...) abort
bdelete! bdelete!
call win_gotoid(a:winid) call win_gotoid(a:winid)
if filereadable(a:filename) if filereadable(a:filename)
let lines = readfile(a:filename) let lines = readfile(a:filename)
if !empty(lines) if !empty(lines)
let list = split(lines[0], ':') let list = split(lines[0], ':')
let file = list[0] let file = list[0]
let line = list[1] let line = list[1]
exe ':e ' . file exe ':e ' . file
exe line exe line
endif
call delete(a:filename)
endif endif
endfunction call delete(a:filename)
endif
endfunction
function! FzyGrep() function! FzyGrep()
let file = tempname() let file = tempname()
let winid = win_getid() let winid = win_getid()
let cmd = split(&shell) + split(&shellcmdflag) + ["${pkgs.ripgrep.out}/bin/rg --vimgrep --hidden -g '!/.git' '^' | ${pkgs.fzy.out}/bin/fzy > " . file] let cmd = split(&shell) + split(&shellcmdflag) + ["${pkgs.ripgrep.out}/bin/rg --vimgrep --hidden -g '!/.git' '^' | ${pkgs.fzy.out}/bin/fzy > " . file]
let F = function('s:completedGrep', [winid, file]) let F = function('s:completedGrep', [winid, file])
botright 10 new botright 10 new
call termopen(cmd, {'on_exit': F}) call termopen(cmd, {'on_exit': F})
startinsert startinsert
endfunction endfunction
nnoremap <C-f> :call FzyFiles()<CR> nnoremap <C-f> :call FzyFiles()<CR>
nnoremap <C-g> :call FzyGrep()<CR> nnoremap <C-g> :call FzyGrep()<CR>
"" Plugin configuration "" Plugin configuration
let g:ale_fixers = { '*': ['remove_trailing_lines', 'trim_whitespace'] } let g:ale_fixers = { '*': ['remove_trailing_lines', 'trim_whitespace'] }
let g:ale_fix_on_save = 1 let g:ale_fix_on_save = 1
let g:deoplete#enable_at_startup = 1 let g:deoplete#enable_at_startup = 1
''; '';
vam.knownPlugins = pkgs.vimPlugins // customPlugins; vam.knownPlugins = pkgs.vimPlugins // customPlugins;
vam.pluginDictionaries = [ vam.pluginDictionaries = [
{ {
names = [ names = [
"ale" "ale"
"auto-pairs" "auto-pairs"
"deoplete-nvim" "deoplete-nvim"
"editorconfig-vim" "editorconfig-vim"
"snow-color-theme" "snow-color-theme"
"vim-nix" "vim-nix"
]; ];
} }
]; ];
} }

View file

@ -3,11 +3,13 @@ with import <nixpkgs> {};
{ {
home-manager.users.charlotte = { pkgs, ... }: { home-manager.users.charlotte = { pkgs, ... }: {
nixpkgs.overlays = [ nixpkgs.overlays = [
(self: super: { (
neovim = super.neovim.override { self: super: {
configure = (import ./base.nix { pkgs = self; }) ; neovim = super.neovim.override {
}; configure = (import ./base.nix { pkgs = self; });
}) };
}
)
]; ];
home.packages = [ pkgs.neovim ]; home.packages = [ pkgs.neovim ];
}; };

View file

@ -6,294 +6,294 @@ let
color-picker = import ./color-picker.nix { inherit pkgs; }; color-picker = import ./color-picker.nix { inherit pkgs; };
screenshot = import ./screenshot.nix { inherit pkgs; }; screenshot = import ./screenshot.nix { inherit pkgs; };
in in
{ {
imports = [ imports = [
./kanshi.nix ./kanshi.nix
./waybar.nix ./waybar.nix
]; ];
programs = { programs = {
sway = { sway = {
enable = true; enable = true;
extraPackages = [ pkgs.xwayland ]; extraPackages = [ pkgs.xwayland ];
extraSessionCommands = '' extraSessionCommands = ''
export XDG_SESSION_TYPE=wayland export XDG_SESSION_TYPE=wayland
export QT_WAYLAND_DISABLE_WINDOWDECORATION=1 export QT_WAYLAND_DISABLE_WINDOWDECORATION=1
export QT_AUTO_SCREEN_SCALE_FACTOR=0 export QT_AUTO_SCREEN_SCALE_FACTOR=0
export QT_SCALE_FACTOR=1 export QT_SCALE_FACTOR=1
export GDK_SCALE=1 export GDK_SCALE=1
export GDK_DPI_SCALE=1 export GDK_DPI_SCALE=1
export MOZ_ENABLE_WAYLAND=1 export MOZ_ENABLE_WAYLAND=1
export _JAVA_AWT_WM_NONREPARENTING=1 export _JAVA_AWT_WM_NONREPARENTING=1
'';
};
};
home-manager.users.charlotte = { pkgs, ... }: {
home.packages = [ color-picker launcher screenshot ];
xdg.configFile."sway/config".text = ''
# Config for sway
#
# Read `man 5 sway` for a complete reference.
### Variables
#
# Logo key. Use Mod1 for Alt.
set $mod Mod4
# Home row direction keys, like vim
set $left h
set $down j
set $up k
set $right l
# Your preferred terminal emulator
set $term ${pkgs.kitty}/bin/kitty
# Your preferred application launcher
# Note: it's recommended that you pass the final command to sway
set $menu $term --class launcher -e ${launcher}/bin/launcher
### Output configuration
exec_always pkill kanshi; exec ${pkgs.kanshi}/bin/kanshi
workspace 1 output eDP-1
workspace 2 output DP-3 DP-4 DP-5 HDMI-A-1 eDP-1
workspace 3 output DP-3 DP-4 DP-5 HDMI-A-1 eDP-1
workspace 4 output DP-3 DP-4 DP-5 HDMI-A-1 eDP-1
workspace 5 output DP-3 DP-4 DP-5 HDMI-A-1 eDP-1
workspace 6 output DP-3 DP-4 DP-5 HDMI-A-1 eDP-1
workspace 7 output DP-3 DP-4 DP-5 HDMI-A-1 eDP-1
workspace 8 output DP-3 DP-4 DP-5 HDMI-A-1 eDP-1
workspace 9 output DP-3 DP-4 DP-5 HDMI-A-1 eDP-1
workspace 10 output DP-3 DP-4 DP-5 HDMI-A-1 eDP-1
### Idle configuration
#
# This will lock your screen after 300 seconds of inactivity, turn off
# your displays after another 150 seconds, and turn your screens back on when
# resumed. It will also lock your screen before your computer goes to sleep.
exec ${pkgs.swayidle}/bin/swayidle -w \
timeout 300 '${pkgs.swaylock}/bin/swaylock -f -c 000000' \
timeout 150 '${pkgs.sway}/bin/swaymsg "output * dpms off"' \
resume '${pkgs.sway}/bin/swaymsg "output * dpms on"' \
before-sleep '${pkgs.swaylock}/bin/swaylock -f -c 000000'
### Notification daemon
#
exec ${pkgs.mako}/bin/mako
# User services bound to the graphical session
exec "${pkgs.systemd}/bin/systemctl --user import-environment; ${pkgs.systemd}/bin/systemctl --user start graphical-session.target"
### Window rules
#
# Common programs
assign [app_id="firefox"] 1
assign [app_id="thunderbird"] 3
assign [class="rambox"] 4
# Launcher popup
for_window [app_id="launcher"] floating enable
# Start accentor as floating window
for_window [class="accentor.Main"] floating enable
### Startup programs
#
exec ${pkgs.firefox}/bin/firefox
exec ${pkgs.thunderbird}/bin/thunderbird
exec ${pkgs.rambox}/bin/rambox
### Input configuration
#
# Example configuration:
#
# input "2:14:SynPS/2_Synaptics_TouchPad" {
# dwt enabled
# tap enabled
# natural_scroll enabled
# middle_emulation enabled
# }
#
# You can get the names of your inputs by running: swaymsg -t get_inputs
# Read `man 5 sway-input` for more information about this section.
input "1:1:AT_Translated_Set_2_keyboard" {
xkb_layout "us"
xkb_variant "altgr-intl"
xkb_numlock enabled
}
input "3141:30354:SONiX_USB_Keyboard" {
xkb_layout "us"
xkb_variant "altgr-intl"
xkb_numlock enabled
}
input "1241:513:USB-HID_Keyboard" {
xkb_layout "us"
xkb_variant "altgr-intl"
xkb_numlock enabled
}
input "1102:4639:DELL081C:00_044E:121F_Touchpad" {
drag enabled
dwt enabled
scroll_method two_finger
tap enabled
}
input "2:7:SynPS/2_Synaptics_TouchPad" {
drag enabled
dwt enabled
scroll_method two_finger
tap enabled
}
### Key bindings
#
# Basics:
#
# start a terminal
bindsym $mod+Return exec $term
# kill focused window
bindsym $mod+Shift+c kill
# start your launcher
bindsym $mod+d exec $menu
# Drag floating windows by holding down $mod and left mouse button.
# Resize them with right mouse button + $mod.
# Despite the name, also works for non-floating windows.
# Change normal to inverse to use left mouse button for resizing and right
# mouse button for dragging.
floating_modifier $mod normal
# reload the configuration file
bindsym $mod+Shift+r reload
# exit sway (logs you out of your Wayland session)
bindsym $mod+Shift+e exec ${pkgs.sway}/bin/swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' '${pkgs.sway}/bin/swaymsg exit'
# lock screen
bindsym $mod+c exec ${pkgs.swaylock}/bin/swaylock -f -c 000000
# screenshot
bindsym Print exec ${screenshot}/bin/screenshot
bindsym Alt+Print exec ${screenshot}/bin/screenshot -d
bindsym Shift+Print exec ${screenshot}/bin/screenshot -r
bindsym Alt+Shift+Print exec ${screenshot}/bin/screenshot -r -d
# audio
bindsym XF86AudioRaiseVolume exec ${pkgs.pulseaudio}/bin/pactl set-sink-volume $(${pkgs.pulseaudio}/bin/pacmd list-sinks |${pkgs.gawk}/bin/awk '/* index:/{print $3}') +5%
bindsym XF86AudioLowerVolume exec ${pkgs.pulseaudio}/bin/pactl set-sink-volume $(${pkgs.pulseaudio}/bin/pacmd list-sinks |${pkgs.gawk}/bin/awk '/* index:/{print $3}') -5%
bindsym XF86AudioMute exec ${pkgs.pulseaudio}/bin/pactl set-sink-mute $(${pkgs.pulseaudio}/bin/pacmd list-sinks |${pkgs.gawk}/bin/awk '/* index:/{print $3}') toggle
# brightness
bindsym XF86MonBrightnessDown exec ${pkgs.brightnessctl}/bin/brightnessctl set 5%-
bindsym XF86MonBrightnessUp exec ${pkgs.brightnessctl}/bin/brightnessctl set +5%
#
# Moving around:
#
# Move your focus around
bindsym $mod+$left focus left
bindsym $mod+$down focus down
bindsym $mod+$up focus up
bindsym $mod+$right focus right
# or use $mod+[up|down|left|right]
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right
# _move_ the focused window with the same, but add Shift
bindsym $mod+Shift+$left move left
bindsym $mod+Shift+$down move down
bindsym $mod+Shift+$up move up
bindsym $mod+Shift+$right move right
# ditto, with arrow keys
bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right
#
# Workspaces:
#
# switch to workspace
bindsym $mod+1 workspace 1
bindsym $mod+2 workspace 2
bindsym $mod+3 workspace 3
bindsym $mod+4 workspace 4
bindsym $mod+5 workspace 5
bindsym $mod+6 workspace 6
bindsym $mod+7 workspace 7
bindsym $mod+8 workspace 8
bindsym $mod+9 workspace 9
bindsym $mod+0 workspace 10
# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace 1
bindsym $mod+Shift+2 move container to workspace 2
bindsym $mod+Shift+3 move container to workspace 3
bindsym $mod+Shift+4 move container to workspace 4
bindsym $mod+Shift+5 move container to workspace 5
bindsym $mod+Shift+6 move container to workspace 6
bindsym $mod+Shift+7 move container to workspace 7
bindsym $mod+Shift+8 move container to workspace 8
bindsym $mod+Shift+9 move container to workspace 9
bindsym $mod+Shift+0 move container to workspace 10
# move workspace to output
bindsym $mod+Alt+Left move workspace to output left
bindsym $mod+Alt+Right move workspace to output right
# Note: workspaces can have any name you want, not just numbers.
# We just use 1-10 as the default.
#
# Layout stuff:
#
# You can "split" the current object of your focus with
# $mod+b or $mod+v, for horizontal and vertical splits
# respectively.
bindsym $mod+b splith
bindsym $mod+v splitv
# Switch the current container between different layout styles
bindsym $mod+s layout stacking
bindsym $mod+w layout tabbed
bindsym $mod+e layout toggle split
# Make the current focus fullscreen
bindsym $mod+f fullscreen
# Toggle the current focus between tiling and floating mode
bindsym $mod+Shift+space floating toggle
# Swap focus between the tiling area and the floating area
bindsym $mod+space focus mode_toggle
# move focus to the parent container
bindsym $mod+a focus parent
#
# Scratchpad:
#
# Sway has a "scratchpad", which is a bag of holding for windows.
# You can send windows there and get them back later.
# Move the currently focused window to the scratchpad
bindsym $mod+Shift+minus move scratchpad
# Show the next scratchpad window or hide the focused scratchpad window.
# If there are multiple scratchpad windows, this command cycles through them.
bindsym $mod+minus scratchpad show
#
# Status Bar:
#
# Read `man 5 sway-bar` for more information about this section.
bar {
swaybar_command ${pkgs.waybar}/bin/waybar
}
default_border pixel
include /etc/sway/config.d/*
''; '';
}; };
} };
home-manager.users.charlotte = { pkgs, ... }: {
home.packages = [ color-picker launcher screenshot ];
xdg.configFile."sway/config".text = ''
# Config for sway
#
# Read `man 5 sway` for a complete reference.
### Variables
#
# Logo key. Use Mod1 for Alt.
set $mod Mod4
# Home row direction keys, like vim
set $left h
set $down j
set $up k
set $right l
# Your preferred terminal emulator
set $term ${pkgs.kitty}/bin/kitty
# Your preferred application launcher
# Note: it's recommended that you pass the final command to sway
set $menu $term --class launcher -e ${launcher}/bin/launcher
### Output configuration
exec_always pkill kanshi; exec ${pkgs.kanshi}/bin/kanshi
workspace 1 output eDP-1
workspace 2 output DP-3 DP-4 DP-5 HDMI-A-1 eDP-1
workspace 3 output DP-3 DP-4 DP-5 HDMI-A-1 eDP-1
workspace 4 output DP-3 DP-4 DP-5 HDMI-A-1 eDP-1
workspace 5 output DP-3 DP-4 DP-5 HDMI-A-1 eDP-1
workspace 6 output DP-3 DP-4 DP-5 HDMI-A-1 eDP-1
workspace 7 output DP-3 DP-4 DP-5 HDMI-A-1 eDP-1
workspace 8 output DP-3 DP-4 DP-5 HDMI-A-1 eDP-1
workspace 9 output DP-3 DP-4 DP-5 HDMI-A-1 eDP-1
workspace 10 output DP-3 DP-4 DP-5 HDMI-A-1 eDP-1
### Idle configuration
#
# This will lock your screen after 300 seconds of inactivity, turn off
# your displays after another 150 seconds, and turn your screens back on when
# resumed. It will also lock your screen before your computer goes to sleep.
exec ${pkgs.swayidle}/bin/swayidle -w \
timeout 300 '${pkgs.swaylock}/bin/swaylock -f -c 000000' \
timeout 150 '${pkgs.sway}/bin/swaymsg "output * dpms off"' \
resume '${pkgs.sway}/bin/swaymsg "output * dpms on"' \
before-sleep '${pkgs.swaylock}/bin/swaylock -f -c 000000'
### Notification daemon
#
exec ${pkgs.mako}/bin/mako
# User services bound to the graphical session
exec "${pkgs.systemd}/bin/systemctl --user import-environment; ${pkgs.systemd}/bin/systemctl --user start graphical-session.target"
### Window rules
#
# Common programs
assign [app_id="firefox"] 1
assign [app_id="thunderbird"] 3
assign [class="rambox"] 4
# Launcher popup
for_window [app_id="launcher"] floating enable
# Start accentor as floating window
for_window [class="accentor.Main"] floating enable
### Startup programs
#
exec ${pkgs.firefox}/bin/firefox
exec ${pkgs.thunderbird}/bin/thunderbird
exec ${pkgs.rambox}/bin/rambox
### Input configuration
#
# Example configuration:
#
# input "2:14:SynPS/2_Synaptics_TouchPad" {
# dwt enabled
# tap enabled
# natural_scroll enabled
# middle_emulation enabled
# }
#
# You can get the names of your inputs by running: swaymsg -t get_inputs
# Read `man 5 sway-input` for more information about this section.
input "1:1:AT_Translated_Set_2_keyboard" {
xkb_layout "us"
xkb_variant "altgr-intl"
xkb_numlock enabled
}
input "3141:30354:SONiX_USB_Keyboard" {
xkb_layout "us"
xkb_variant "altgr-intl"
xkb_numlock enabled
}
input "1241:513:USB-HID_Keyboard" {
xkb_layout "us"
xkb_variant "altgr-intl"
xkb_numlock enabled
}
input "1102:4639:DELL081C:00_044E:121F_Touchpad" {
drag enabled
dwt enabled
scroll_method two_finger
tap enabled
}
input "2:7:SynPS/2_Synaptics_TouchPad" {
drag enabled
dwt enabled
scroll_method two_finger
tap enabled
}
### Key bindings
#
# Basics:
#
# start a terminal
bindsym $mod+Return exec $term
# kill focused window
bindsym $mod+Shift+c kill
# start your launcher
bindsym $mod+d exec $menu
# Drag floating windows by holding down $mod and left mouse button.
# Resize them with right mouse button + $mod.
# Despite the name, also works for non-floating windows.
# Change normal to inverse to use left mouse button for resizing and right
# mouse button for dragging.
floating_modifier $mod normal
# reload the configuration file
bindsym $mod+Shift+r reload
# exit sway (logs you out of your Wayland session)
bindsym $mod+Shift+e exec ${pkgs.sway}/bin/swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' '${pkgs.sway}/bin/swaymsg exit'
# lock screen
bindsym $mod+c exec ${pkgs.swaylock}/bin/swaylock -f -c 000000
# screenshot
bindsym Print exec ${screenshot}/bin/screenshot
bindsym Alt+Print exec ${screenshot}/bin/screenshot -d
bindsym Shift+Print exec ${screenshot}/bin/screenshot -r
bindsym Alt+Shift+Print exec ${screenshot}/bin/screenshot -r -d
# audio
bindsym XF86AudioRaiseVolume exec ${pkgs.pulseaudio}/bin/pactl set-sink-volume $(${pkgs.pulseaudio}/bin/pacmd list-sinks |${pkgs.gawk}/bin/awk '/* index:/{print $3}') +5%
bindsym XF86AudioLowerVolume exec ${pkgs.pulseaudio}/bin/pactl set-sink-volume $(${pkgs.pulseaudio}/bin/pacmd list-sinks |${pkgs.gawk}/bin/awk '/* index:/{print $3}') -5%
bindsym XF86AudioMute exec ${pkgs.pulseaudio}/bin/pactl set-sink-mute $(${pkgs.pulseaudio}/bin/pacmd list-sinks |${pkgs.gawk}/bin/awk '/* index:/{print $3}') toggle
# brightness
bindsym XF86MonBrightnessDown exec ${pkgs.brightnessctl}/bin/brightnessctl set 5%-
bindsym XF86MonBrightnessUp exec ${pkgs.brightnessctl}/bin/brightnessctl set +5%
#
# Moving around:
#
# Move your focus around
bindsym $mod+$left focus left
bindsym $mod+$down focus down
bindsym $mod+$up focus up
bindsym $mod+$right focus right
# or use $mod+[up|down|left|right]
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right
# _move_ the focused window with the same, but add Shift
bindsym $mod+Shift+$left move left
bindsym $mod+Shift+$down move down
bindsym $mod+Shift+$up move up
bindsym $mod+Shift+$right move right
# ditto, with arrow keys
bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right
#
# Workspaces:
#
# switch to workspace
bindsym $mod+1 workspace 1
bindsym $mod+2 workspace 2
bindsym $mod+3 workspace 3
bindsym $mod+4 workspace 4
bindsym $mod+5 workspace 5
bindsym $mod+6 workspace 6
bindsym $mod+7 workspace 7
bindsym $mod+8 workspace 8
bindsym $mod+9 workspace 9
bindsym $mod+0 workspace 10
# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace 1
bindsym $mod+Shift+2 move container to workspace 2
bindsym $mod+Shift+3 move container to workspace 3
bindsym $mod+Shift+4 move container to workspace 4
bindsym $mod+Shift+5 move container to workspace 5
bindsym $mod+Shift+6 move container to workspace 6
bindsym $mod+Shift+7 move container to workspace 7
bindsym $mod+Shift+8 move container to workspace 8
bindsym $mod+Shift+9 move container to workspace 9
bindsym $mod+Shift+0 move container to workspace 10
# move workspace to output
bindsym $mod+Alt+Left move workspace to output left
bindsym $mod+Alt+Right move workspace to output right
# Note: workspaces can have any name you want, not just numbers.
# We just use 1-10 as the default.
#
# Layout stuff:
#
# You can "split" the current object of your focus with
# $mod+b or $mod+v, for horizontal and vertical splits
# respectively.
bindsym $mod+b splith
bindsym $mod+v splitv
# Switch the current container between different layout styles
bindsym $mod+s layout stacking
bindsym $mod+w layout tabbed
bindsym $mod+e layout toggle split
# Make the current focus fullscreen
bindsym $mod+f fullscreen
# Toggle the current focus between tiling and floating mode
bindsym $mod+Shift+space floating toggle
# Swap focus between the tiling area and the floating area
bindsym $mod+space focus mode_toggle
# move focus to the parent container
bindsym $mod+a focus parent
#
# Scratchpad:
#
# Sway has a "scratchpad", which is a bag of holding for windows.
# You can send windows there and get them back later.
# Move the currently focused window to the scratchpad
bindsym $mod+Shift+minus move scratchpad
# Show the next scratchpad window or hide the focused scratchpad window.
# If there are multiple scratchpad windows, this command cycles through them.
bindsym $mod+minus scratchpad show
#
# Status Bar:
#
# Read `man 5 sway-bar` for more information about this section.
bar {
swaybar_command ${pkgs.waybar}/bin/waybar
}
default_border pixel
include /etc/sway/config.d/*
'';
};
}

View file

@ -29,111 +29,111 @@ let
''; '';
}; };
in in
pkgs.writeScriptBin "launcher" '' pkgs.writeScriptBin "launcher" ''
#!${pkgs.zsh}/bin/zsh #!${pkgs.zsh}/bin/zsh
_sighandler() { _sighandler() {
kill -INT "$child" 2>/dev/null kill -INT "$child" 2>/dev/null
} }
calc_options() { calc_options() {
echo "calc " echo "calc "
} }
calc() { calc() {
if [ -n "$1" ] if [ -n "$1" ]
then
${pkgs.libqalculate}/bin/qalc "$1"
sleep 5
else
${pkgs.libqalculate}/bin/qalc
fi
}
emoji_options() {
cat ${emoji_list} | sed "s/^/emoji /"
}
emoji() {
char=$(echo -n "$1" | sed "s/^\([^ ]*\) .*/\1/")
${pkgs.sway}/bin/swaymsg exec -- "echo -n $char | ${pkgs.wl-clipboard}/bin/wl-copy --foreground"
}
record_options() {
${pkgs.sway}/bin/swaymsg -t get_outputs | ${pkgs.jq}/bin/jq -r '.[]["name"]' | sed "s/^/record /"
echo record select
}
record() {
filename="$(${pkgs.xdg-user-dirs}/bin/xdg-user-dir VIDEOS)/$(date +'screenrecording_%y-%m-%d-%H%M%S.mp4')"
trap _sighandler SIGINT
if [[ "$1" = "select" ]]
then
${pkgs.wf-recorder}/bin/wf-recorder -g "$(${pkgs.slurp}/bin/slurp)" -f "$filename" &
else
wf-recorder -o $! -f "$filename" &
fi
child=$!
wait "$child"
# We wait two times, because the first wait exits when the process receives a signal. The process might have finished though, so we ignore errors.
wait "$child" 2>/dev/null
if [ -f "$filename" ]
then
echo "Saved as $filename"
else
echo "Something went wrong while recording"
fi
sleep 5
}
run_options() {
print -rl -- ''${(ko)commands} | sed "s/^/run /"
}
run() {
${pkgs.sway}/bin/swaymsg exec $1
}
ssh_options() {
cat $HOME/.ssh/config | grep "^Host [a-zA-Z]\+" | sed "s/Host /ssh /"
}
ssh() {
${pkgs.sway}/bin/swaymsg exec "${pkgs.kitty}/bin/kitty -e ssh $1"
}
systemctl_options() {
echo systemctl hibernate
echo systemctl poweroff
echo systemctl reboot
echo systemctl suspend
}
tmuxinator_options() {
ls ~/.config/tmuxinator | sed "s/\.yml$//" | sed "s/^/tmuxinator /"
}
tmuxinator() {
${pkgs.sway}/bin/swaymsg exec "${pkgs.kitty}/bin/kitty -e ${pkgs.tmuxinator}/bin/tmuxinator start $1"
}
windows_options() {
${pkgs.sway}/bin/swaymsg -t get_tree | ${pkgs.jq}/bin/jq -r 'recurse(.nodes[]?)|recurse(.floating_nodes[]?)|select(.layout=="none")|select(.app_id!="launcher")|select(.type=="con"),select(.type=="floating_con")|(if .app_id then .app_id else .window_properties.class end)+": "+.name+" ("+(.id|tostring)+")"' | sed "s/^/windows /"
}
windows() {
window=$(echo $@ | sed 's/.* (\([^)]*\))$/\1/')
${pkgs.sway}/bin/swaymsg \[con_id="$window"\] focus
}
CHOSEN=$(cat <(windows_options) <(tmuxinator_options) <(ssh_options) <(systemctl_options) <(run_options) <(record_options) <(calc_options) <(emoji_options) | ${pkgs.fzy}/bin/fzy --lines 36 | tail -n1)
if [ -n "$CHOSEN" ]
then then
PREFIX=$(echo $CHOSEN | sed "s/^\([^ ]*\) .*/\1/g") ${pkgs.libqalculate}/bin/qalc "$1"
WORD=$(echo $CHOSEN | sed "s/^[^ ]* \(.*\)/\1/g") sleep 5
else
$PREFIX $WORD ${pkgs.libqalculate}/bin/qalc
fi fi
'' }
emoji_options() {
cat ${emoji_list} | sed "s/^/emoji /"
}
emoji() {
char=$(echo -n "$1" | sed "s/^\([^ ]*\) .*/\1/")
${pkgs.sway}/bin/swaymsg exec -- "echo -n $char | ${pkgs.wl-clipboard}/bin/wl-copy --foreground"
}
record_options() {
${pkgs.sway}/bin/swaymsg -t get_outputs | ${pkgs.jq}/bin/jq -r '.[]["name"]' | sed "s/^/record /"
echo record select
}
record() {
filename="$(${pkgs.xdg-user-dirs}/bin/xdg-user-dir VIDEOS)/$(date +'screenrecording_%y-%m-%d-%H%M%S.mp4')"
trap _sighandler SIGINT
if [[ "$1" = "select" ]]
then
${pkgs.wf-recorder}/bin/wf-recorder -g "$(${pkgs.slurp}/bin/slurp)" -f "$filename" &
else
wf-recorder -o $! -f "$filename" &
fi
child=$!
wait "$child"
# We wait two times, because the first wait exits when the process receives a signal. The process might have finished though, so we ignore errors.
wait "$child" 2>/dev/null
if [ -f "$filename" ]
then
echo "Saved as $filename"
else
echo "Something went wrong while recording"
fi
sleep 5
}
run_options() {
print -rl -- ''${(ko)commands} | sed "s/^/run /"
}
run() {
${pkgs.sway}/bin/swaymsg exec $1
}
ssh_options() {
cat $HOME/.ssh/config | grep "^Host [a-zA-Z]\+" | sed "s/Host /ssh /"
}
ssh() {
${pkgs.sway}/bin/swaymsg exec "${pkgs.kitty}/bin/kitty -e ssh $1"
}
systemctl_options() {
echo systemctl hibernate
echo systemctl poweroff
echo systemctl reboot
echo systemctl suspend
}
tmuxinator_options() {
ls ~/.config/tmuxinator | sed "s/\.yml$//" | sed "s/^/tmuxinator /"
}
tmuxinator() {
${pkgs.sway}/bin/swaymsg exec "${pkgs.kitty}/bin/kitty -e ${pkgs.tmuxinator}/bin/tmuxinator start $1"
}
windows_options() {
${pkgs.sway}/bin/swaymsg -t get_tree | ${pkgs.jq}/bin/jq -r 'recurse(.nodes[]?)|recurse(.floating_nodes[]?)|select(.layout=="none")|select(.app_id!="launcher")|select(.type=="con"),select(.type=="floating_con")|(if .app_id then .app_id else .window_properties.class end)+": "+.name+" ("+(.id|tostring)+")"' | sed "s/^/windows /"
}
windows() {
window=$(echo $@ | sed 's/.* (\([^)]*\))$/\1/')
${pkgs.sway}/bin/swaymsg \[con_id="$window"\] focus
}
CHOSEN=$(cat <(windows_options) <(tmuxinator_options) <(ssh_options) <(systemctl_options) <(run_options) <(record_options) <(calc_options) <(emoji_options) | ${pkgs.fzy}/bin/fzy --lines 36 | tail -n1)
if [ -n "$CHOSEN" ]
then
PREFIX=$(echo $CHOSEN | sed "s/^\([^ ]*\) .*/\1/g")
WORD=$(echo $CHOSEN | sed "s/^[^ ]* \(.*\)/\1/g")
$PREFIX $WORD
fi
''

View file

@ -2,9 +2,9 @@
{ {
home-manager.users.charlotte = { pkgs, ... }: { home-manager.users.charlotte = { pkgs, ... }: {
nixpkgs.overlays = [ nixpkgs.overlays = [
(self: super: { waybar = super.waybar.override { pulseSupport = true; mpdSupport = false; }; }) (self: super: { waybar = super.waybar.override { pulseSupport = true; mpdSupport = false; }; })
]; ];
xdg.configFile = { xdg.configFile = {
"waybar/config".text = '' "waybar/config".text = ''
{ {

View file

@ -6,9 +6,9 @@
enable = true; enable = true;
clock24 = true; clock24 = true;
extraConfig = '' extraConfig = ''
bind q kill-session bind q kill-session
bind v run-shell "tmux setw main-pane-width $(($(tmux display -p '#{window_width}') * 70 / 100)); tmux select-layout main-vertical" bind v run-shell "tmux setw main-pane-width $(($(tmux display -p '#{window_width}') * 70 / 100)); tmux select-layout main-vertical"
bind h run-shell "tmux setw main-pane-height $(($(tmux display -p '#{window_height}') * 70 / 100)); tmux select-layout main-horizontal" bind h run-shell "tmux setw main-pane-height $(($(tmux display -p '#{window_height}') * 70 / 100)); tmux select-layout main-horizontal"
''; '';
keyMode = "vi"; keyMode = "vi";
tmuxinator.enable = true; tmuxinator.enable = true;

View file

@ -2,14 +2,15 @@ let
pkgs = import <nixpkgs> {}; pkgs = import <nixpkgs> {};
baseVimConfig = import ../programs/neovim/base.nix { inherit pkgs; }; baseVimConfig = import ../programs/neovim/base.nix { inherit pkgs; };
in in
pkgs.mkShell { pkgs.mkShell {
buildInputs = with pkgs; [ buildInputs = with pkgs; [
ffmpeg ffmpeg
postgresql postgresql
ruby_2_7 ruby_2_7
taglib taglib
zlib zlib
(neovim.override { (
neovim.override {
configure = { configure = {
customRC = baseVimConfig.customRC + '' customRC = baseVimConfig.customRC + ''
" Required for operations modifying multiple buffers like rename " Required for operations modifying multiple buffers like rename
@ -29,23 +30,24 @@ in
} }
]; ];
}; };
}) }
]; )
shellHook = '' ];
export PGDATA=$PWD/tmp/postgres_data shellHook = ''
export PGHOST=$PWD/tmp/postgres export PGDATA=$PWD/tmp/postgres_data
export PGDATABASE=postgres export PGHOST=$PWD/tmp/postgres
export DATABASE_URL="postgresql:///postgres?host=$PGHOST" export PGDATABASE=postgres
if [ ! -d $PGHOST ]; then export DATABASE_URL="postgresql:///postgres?host=$PGHOST"
mkdir -p $PGHOST if [ ! -d $PGHOST ]; then
fi mkdir -p $PGHOST
if [ ! -d $PGDATA ]; then fi
echo 'Initializing postgresql database...' if [ ! -d $PGDATA ]; then
initdb $PGDATA --auth=trust >/dev/null echo 'Initializing postgresql database...'
fi initdb $PGDATA --auth=trust >/dev/null
cat >"$PGDATA/postgresql.conf" <<HERE fi
listen_addresses = ''' cat >"$PGDATA/postgresql.conf" <<HERE
unix_socket_directories = '$PGHOST' listen_addresses = '''
HERE unix_socket_directories = '$PGHOST'
''; HERE
} '';
}

View file

@ -7,8 +7,9 @@ pkgs.mkShell {
buildInputs = with pkgs; [ buildInputs = with pkgs; [
nodejs-12_x nodejs-12_x
yarn yarn
(neovim.override { (
configure = { neovim.override {
configure = {
customRC = baseVimConfig.customRC + '' customRC = baseVimConfig.customRC + ''
" Required for operations modifying multiple buffers like rename " Required for operations modifying multiple buffers like rename
set hidden set hidden
@ -26,7 +27,8 @@ pkgs.mkShell {
]; ];
} }
]; ];
}; };
}) }
)
]; ];
} }

View file

@ -3,14 +3,15 @@ let
baseVimConfig = import ../programs/neovim/base.nix { inherit pkgs; }; baseVimConfig = import ../programs/neovim/base.nix { inherit pkgs; };
nodePackages = import ../packages/node/default.nix { inherit pkgs; }; nodePackages = import ../packages/node/default.nix { inherit pkgs; };
in in
pkgs.mkShell { pkgs.mkShell {
buildInputs = with pkgs; [ buildInputs = with pkgs; [
ruby ruby
yarn yarn
nodejs-12_x nodejs-12_x
libmysqlclient libmysqlclient
zlib zlib
(pkgs.writeScriptBin "start-db" '' (
pkgs.writeScriptBin "start-db" ''
#!${pkgs.zsh}/bin/zsh #!${pkgs.zsh}/bin/zsh
trap "docker stop dodona-db" 0 trap "docker stop dodona-db" 0
@ -18,8 +19,10 @@ in
child=$! child=$!
wait $child wait $child
'') ''
(neovim.override { )
(
neovim.override {
configure = { configure = {
customRC = baseVimConfig.customRC + '' customRC = baseVimConfig.customRC + ''
" Required for operations modifying multiple buffers like rename " Required for operations modifying multiple buffers like rename
@ -42,9 +45,10 @@ in
} }
]; ];
}; };
}) }
]; )
shellHook = '' ];
export DATABASE_URL="mysql2://root:dodona@127.0.0.1:3306/dodona" shellHook = ''
''; export DATABASE_URL="mysql2://root:dodona@127.0.0.1:3306/dodona"
} '';
}

View file

@ -1,9 +1,33 @@
let let
pkgs = import <nixpkgs> {}; pkgs = import <nixpkgs> {};
jdtls = import ../packages/jdtls/default.nix { inherit pkgs; stdenv = pkgs.stdenv; };
in in
pkgs.mkShell { pkgs.mkShell {
buildInputs = with pkgs; [ buildInputs = with pkgs; [
jdk11 jdk11
openjfx11 openjfx11
]; jdtls
} (
neovim.override {
configure = {
customRC = baseVimConfig.customRC + ''
" Required for operations modifying multiple buffers like rename
set hidden
let g:LanguageClient_serverCommands = {
\ 'java': ['${jdtls}/bin/jdtls'],
\ }
'';
vam.knownPlugins = baseVimConfig.vam.knownPlugins;
vam.pluginDictionaries = (baseVimConfig.vam.pluginDictionaries or []) ++ [
{
names = [
"LanguageClient-neovim"
];
}
];
};
}
)
];
}

View file

@ -2,14 +2,16 @@ let
pkgs = import <nixpkgs> {}; pkgs = import <nixpkgs> {};
baseVimConfig = import ../programs/neovim/base.nix { inherit pkgs; }; baseVimConfig = import ../programs/neovim/base.nix { inherit pkgs; };
in in
pkgs.mkShell { pkgs.mkShell {
buildInputs = with pkgs; [ buildInputs = with pkgs; [
(neovim.override { (
neovim.override {
configure = { configure = {
customRC = baseVimConfig.customRC; customRC = baseVimConfig.customRC;
vam.knownPlugins = baseVimConfig.vam.knownPlugins; vam.knownPlugins = baseVimConfig.vam.knownPlugins;
vam.pluginDictionaries = (baseVimConfig.vam.pluginDictionaries or []) ++ [ { name = "vim-ledger"; } ]; vam.pluginDictionaries = (baseVimConfig.vam.pluginDictionaries or []) ++ [ { name = "vim-ledger"; } ];
}; };
}) }
]; )
} ];
}

View file

@ -1,6 +1,8 @@
let let
pkgs = import <nixpkgs> {}; pkgs = import <nixpkgs> {};
in in
pkgs.mkShell { pkgs.mkShell {
buildInputs = with pkgs; []; buildInputs = with pkgs; [
} nixpkgs-fmt
];
}