Switch up organization of nix shells
This commit is contained in:
parent
9212f3a380
commit
ef53da0380
17 changed files with 1656 additions and 173 deletions
|
@ -1,9 +0,0 @@
|
|||
# Setting up a new dev environment
|
||||
|
||||
* Create a new `*.nix` file in the shells directory that describes the environment (this is the hard part).
|
||||
|
||||
* Execute `lorri init` in the base directory of your project. This will create a `.envrc` file and `shell.nix` file.
|
||||
|
||||
* Edit the `shell.nix` file to just `import /home/charlotte/.local/share/nix-shells/your-new-file.nix`
|
||||
|
||||
* Execute `direnv allow` to load the `.envrc` file which in turn uses `lorri` to load your `shell.nix` file.
|
|
@ -12,6 +12,5 @@
|
|||
};
|
||||
};
|
||||
services.lorri.enable = true;
|
||||
xdg.dataFile.nix-shells.source = ./shells;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
let
|
||||
pkgs = import <nixpkgs> {};
|
||||
in
|
||||
pkgs.mkShell {
|
||||
buildInputs = [
|
||||
pkgs.ffmpeg
|
||||
pkgs.postgresql
|
||||
pkgs.ruby_2_7
|
||||
pkgs.taglib
|
||||
pkgs.zlib
|
||||
];
|
||||
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
|
||||
'';
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
let
|
||||
pkgs = import <nixpkgs> {};
|
||||
in
|
||||
pkgs.mkShell {
|
||||
buildInputs = [
|
||||
pkgs.nodejs-12_x
|
||||
pkgs.yarn
|
||||
];
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
let
|
||||
pkgs = import <nixpkgs> {};
|
||||
in
|
||||
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
|
||||
docker run --name dodona-db -p 3306:3306 --rm -v $(git rev-parse --show-toplevel)/tmp/db:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=dodona mariadb:latest &
|
||||
|
||||
child=$!
|
||||
wait $child
|
||||
'')
|
||||
];
|
||||
shellHook = ''
|
||||
export DATABASE_URL="mysql2://root:dodona@127.0.0.1:3306/dodona"
|
||||
'';
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
let
|
||||
pkgs = import <nixpkgs> {};
|
||||
in
|
||||
pkgs.mkShell {
|
||||
buildInputs = with pkgs; [
|
||||
jdk11
|
||||
openjfx11
|
||||
];
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
let
|
||||
pkgs = import <nixpkgs> {};
|
||||
nixpkgs-master = import <nixpkgs-master> {};
|
||||
baseVimConfig = import ./vim-base.nix { inherit pkgs; };
|
||||
in
|
||||
pkgs.mkShell {
|
||||
buildInputs = with nixpkgs-master; [
|
||||
(neovim.override {
|
||||
configure = {
|
||||
customRC = baseVimConfig.customRC;
|
||||
vam.pluginDictionaries = (baseVimConfig.vam.pluginDictionaries or []) ++ [ { name = "vim-ledger"; } ];
|
||||
};
|
||||
})
|
||||
];
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
let
|
||||
pkgs = import <nixpkgs> {};
|
||||
in
|
||||
pkgs.mkShell {
|
||||
buildInputs = with pkgs; [];
|
||||
}
|
|
@ -1,116 +0,0 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
customRC = ''
|
||||
set autoread
|
||||
"" Theming
|
||||
|
||||
set background=light
|
||||
|
||||
"" General settings
|
||||
|
||||
" 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()
|
||||
endif
|
||||
au VimLeave * :call MakeSession()
|
||||
|
||||
"" Filetype configuration
|
||||
|
||||
" Base settings for all files
|
||||
|
||||
syntax enable
|
||||
set number
|
||||
set showcmd
|
||||
set scrolloff=8
|
||||
set expandtab
|
||||
set tabstop=4
|
||||
set shiftwidth=4
|
||||
set linebreak
|
||||
|
||||
set list
|
||||
set listchars=tab:·\ ,trail:·
|
||||
set inccommand=split
|
||||
set clipboard=unnamedplus
|
||||
|
||||
filetype plugin indent on
|
||||
|
||||
"" Plugin configuration
|
||||
|
||||
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)
|
||||
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! 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)
|
||||
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
|
||||
|
||||
nnoremap <C-f> :call FzyFiles()<CR>
|
||||
nnoremap <C-g> :call FzyGrep()<CR>
|
||||
'';
|
||||
vam.knownPlugins = pkgs.vimPlugins;
|
||||
vam.pluginDictionaries = [ { name = "vim-nix"; } ];
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue