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
boot.initrd.kernelModules = [ "i915" ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
boot.extraModulePackages = [];
fileSystems."/" = {
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!
{pkgs ? import <nixpkgs> {
{ pkgs ? import <nixpkgs> {
inherit system;
}, system ? builtins.currentSystem, nodejs ? pkgs."nodejs-12_x"}:
}
, system ? builtins.currentSystem
, nodejs ? pkgs."nodejs-12_x"
}:
let
nodeEnv = import ./node-env.nix {
@ -14,4 +17,4 @@ in
import ./node-packages.nix {
inherit (pkgs) fetchurl fetchgit;
inherit nodeEnv;
}
}

View file

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

File diff suppressed because it is too large Load diff

View file

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

View file

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

View file

@ -6,294 +6,294 @@ let
color-picker = import ./color-picker.nix { inherit pkgs; };
screenshot = import ./screenshot.nix { inherit pkgs; };
in
{
imports = [
./kanshi.nix
./waybar.nix
];
programs = {
sway = {
enable = true;
extraPackages = [ pkgs.xwayland ];
extraSessionCommands = ''
export XDG_SESSION_TYPE=wayland
export QT_WAYLAND_DISABLE_WINDOWDECORATION=1
export QT_AUTO_SCREEN_SCALE_FACTOR=0
export QT_SCALE_FACTOR=1
export GDK_SCALE=1
export GDK_DPI_SCALE=1
export MOZ_ENABLE_WAYLAND=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/*
{
imports = [
./kanshi.nix
./waybar.nix
];
programs = {
sway = {
enable = true;
extraPackages = [ pkgs.xwayland ];
extraSessionCommands = ''
export XDG_SESSION_TYPE=wayland
export QT_WAYLAND_DISABLE_WINDOWDECORATION=1
export QT_AUTO_SCREEN_SCALE_FACTOR=0
export QT_SCALE_FACTOR=1
export GDK_SCALE=1
export GDK_DPI_SCALE=1
export MOZ_ENABLE_WAYLAND=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/*
'';
};
}

View file

@ -29,111 +29,111 @@ let
'';
};
in
pkgs.writeScriptBin "launcher" ''
#!${pkgs.zsh}/bin/zsh
pkgs.writeScriptBin "launcher" ''
#!${pkgs.zsh}/bin/zsh
_sighandler() {
kill -INT "$child" 2>/dev/null
}
_sighandler() {
kill -INT "$child" 2>/dev/null
}
calc_options() {
echo "calc "
}
calc_options() {
echo "calc "
}
calc() {
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" ]
calc() {
if [ -n "$1" ]
then
PREFIX=$(echo $CHOSEN | sed "s/^\([^ ]*\) .*/\1/g")
WORD=$(echo $CHOSEN | sed "s/^[^ ]* \(.*\)/\1/g")
$PREFIX $WORD
${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
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, ... }: {
nixpkgs.overlays = [
(self: super: { waybar = super.waybar.override { pulseSupport = true; mpdSupport = false; }; })
];
nixpkgs.overlays = [
(self: super: { waybar = super.waybar.override { pulseSupport = true; mpdSupport = false; }; })
];
xdg.configFile = {
"waybar/config".text = ''
{

View file

@ -6,9 +6,9 @@
enable = true;
clock24 = true;
extraConfig = ''
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 h run-shell "tmux setw main-pane-height $(($(tmux display -p '#{window_height}') * 70 / 100)); tmux select-layout main-horizontal"
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 h run-shell "tmux setw main-pane-height $(($(tmux display -p '#{window_height}') * 70 / 100)); tmux select-layout main-horizontal"
'';
keyMode = "vi";
tmuxinator.enable = true;

View file

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

View file

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

View file

@ -3,14 +3,15 @@ let
baseVimConfig = import ../programs/neovim/base.nix { inherit pkgs; };
nodePackages = import ../packages/node/default.nix { inherit pkgs; };
in
pkgs.mkShell {
buildInputs = with pkgs; [
ruby
yarn
nodejs-12_x
libmysqlclient
zlib
(pkgs.writeScriptBin "start-db" ''
pkgs.mkShell {
buildInputs = with pkgs; [
ruby
yarn
nodejs-12_x
libmysqlclient
zlib
(
pkgs.writeScriptBin "start-db" ''
#!${pkgs.zsh}/bin/zsh
trap "docker stop dodona-db" 0
@ -18,8 +19,10 @@ in
child=$!
wait $child
'')
(neovim.override {
''
)
(
neovim.override {
configure = {
customRC = baseVimConfig.customRC + ''
" 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
pkgs = import <nixpkgs> {};
jdtls = import ../packages/jdtls/default.nix { inherit pkgs; stdenv = pkgs.stdenv; };
in
pkgs.mkShell {
buildInputs = with pkgs; [
jdk11
openjfx11
];
}
pkgs.mkShell {
buildInputs = with pkgs; [
jdk11
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> {};
baseVimConfig = import ../programs/neovim/base.nix { inherit pkgs; };
in
pkgs.mkShell {
buildInputs = with pkgs; [
(neovim.override {
pkgs.mkShell {
buildInputs = with pkgs; [
(
neovim.override {
configure = {
customRC = baseVimConfig.customRC;
vam.knownPlugins = baseVimConfig.vam.knownPlugins;
vam.pluginDictionaries = (baseVimConfig.vam.pluginDictionaries or []) ++ [ { name = "vim-ledger"; } ];
};
})
];
}
}
)
];
}

View file

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