alejandra: initial repo format
This commit is contained in:
parent
180d6bc1a5
commit
584f00ed86
|
@ -1,18 +1,20 @@
|
|||
# Configuration common to all JFDIC Linode VMs
|
||||
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
# Import the NixOS Qemu guest settings
|
||||
<nixpkgs/nixos/modules/profiles/qemu-guest.nix>
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules = [ "virtio_pci" "ahci" "sd_mod" ];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ ];
|
||||
boot.extraModulePackages = [ ];
|
||||
boot.kernelParams = [ "console=ttyS0,19200n8" ];
|
||||
boot.initrd.availableKernelModules = ["virtio_pci" "ahci" "sd_mod"];
|
||||
boot.initrd.kernelModules = [];
|
||||
boot.kernelModules = [];
|
||||
boot.extraModulePackages = [];
|
||||
boot.kernelParams = ["console=ttyS0,19200n8"];
|
||||
boot.loader = {
|
||||
grub = {
|
||||
extraConfig = ''
|
||||
|
@ -26,10 +28,10 @@
|
|||
};
|
||||
|
||||
# File systems configuration for the Linode VMs
|
||||
fileSystems."/" =
|
||||
{ device = "/dev/sda";
|
||||
fsType = "ext4";
|
||||
};
|
||||
fileSystems."/" = {
|
||||
device = "/dev/sda";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
swapDevices = [
|
||||
{
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
# NixOps configuration common to Linode VMs
|
||||
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
{
|
||||
imports =
|
||||
[
|
||||
../profiles/host_common.nix
|
||||
../profiles/server_common.nix
|
||||
];
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
../profiles/host_common.nix
|
||||
../profiles/server_common.nix
|
||||
];
|
||||
|
||||
# Ensure the right package architecture is used
|
||||
nixpkgs.localSystem = {
|
||||
|
@ -29,9 +30,8 @@
|
|||
interfaces.eth0.useDHCP = true;
|
||||
firewall = {
|
||||
enable = true;
|
||||
allowedTCPPorts = [ 80 443 ];
|
||||
trustedInterfaces = [ "lo" ];
|
||||
allowedTCPPorts = [80 443];
|
||||
trustedInterfaces = ["lo"];
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
# NixOps configuration for the Linode VMs
|
||||
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
{
|
||||
imports =
|
||||
[
|
||||
../hardware/linode_vm.nix
|
||||
./linode-common.nix
|
||||
];
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
../hardware/linode_vm.nix
|
||||
./linode-common.nix
|
||||
];
|
||||
}
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
# Configuration common to all JFDIC servers
|
||||
|
||||
{ config, ... }:
|
||||
|
||||
{
|
||||
|
||||
{config, ...}: {
|
||||
# Program defaults for all hosts
|
||||
programs.bash = {
|
||||
interactiveShellInit = ''
|
||||
|
@ -15,5 +11,4 @@
|
|||
'';
|
||||
vteIntegration = true;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
# NixOps configuration for the hosts running a Chrony service
|
||||
|
||||
{ config, ... }:
|
||||
|
||||
{
|
||||
|
||||
{config, ...}: {
|
||||
services.chrony = {
|
||||
enable = true; # Enable Chrony
|
||||
enable = true; # Enable Chrony
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -1,26 +1,27 @@
|
|||
# NixOps configuration for the hosts running Gitea
|
||||
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
{
|
||||
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
services.gitea = {
|
||||
enable = true; # Enable Gitea
|
||||
appName = "JFDI Collective: Gitea Service"; # Give the site a name
|
||||
enable = true; # Enable Gitea
|
||||
appName = "JFDI Collective: Gitea Service"; # Give the site a name
|
||||
database = {
|
||||
type = "postgres"; # Database type
|
||||
passwordFile = "/run/keys/gitea-dbpass"; # Where to find the password
|
||||
type = "postgres"; # Database type
|
||||
passwordFile = "/run/keys/gitea-dbpass"; # Where to find the password
|
||||
};
|
||||
disableRegistration = true;
|
||||
domain = "source.jfdic.org"; # Domain name
|
||||
rootUrl = "https://source.jfdic.org/"; # Root web URL
|
||||
httpPort = 3002; # Provided unique port
|
||||
domain = "source.jfdic.org"; # Domain name
|
||||
rootUrl = "https://source.jfdic.org/"; # Root web URL
|
||||
httpPort = 3002; # Provided unique port
|
||||
settings = let
|
||||
docutils =
|
||||
pkgs.python37.withPackages (ps: with ps; [
|
||||
docutils # Provides rendering of ReStructured Text files
|
||||
pygments # Provides syntax highlighting
|
||||
]);
|
||||
docutils = pkgs.python37.withPackages (ps:
|
||||
with ps; [
|
||||
docutils # Provides rendering of ReStructured Text files
|
||||
pygments # Provides syntax highlighting
|
||||
]);
|
||||
in {
|
||||
mailer = {
|
||||
ENABLED = true;
|
||||
|
@ -39,25 +40,27 @@
|
|||
IS_INPUT_FILE = false;
|
||||
};
|
||||
ui = {
|
||||
DEFAULT_THEME = "gitea"; # Set the default theme
|
||||
DEFAULT_THEME = "gitea"; # Set the default theme
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
services.postgresql = {
|
||||
enable = true; # Ensure postgresql is enabled
|
||||
enable = true; # Ensure postgresql is enabled
|
||||
authentication = ''
|
||||
local gitea all ident map=gitea-users
|
||||
'';
|
||||
identMap = # Map the gitea user to postgresql
|
||||
identMap =
|
||||
# Map the gitea user to postgresql
|
||||
''
|
||||
gitea-users gitea gitea
|
||||
'';
|
||||
ensureDatabases = [ "gitea" ]; # Ensure the database persists
|
||||
ensureDatabases = ["gitea"]; # Ensure the database persists
|
||||
ensureUsers = [
|
||||
{
|
||||
name = "gitea"; # Ensure the database user persists
|
||||
ensurePermissions = { # Ensure the database permissions persist
|
||||
name = "gitea"; # Ensure the database user persists
|
||||
ensurePermissions = {
|
||||
# Ensure the database permissions persist
|
||||
"DATABASE gitea" = "ALL PRIVILEGES";
|
||||
"ALL TABLES IN SCHEMA public" = "ALL PRIVILEGES";
|
||||
};
|
||||
|
@ -66,15 +69,16 @@
|
|||
};
|
||||
|
||||
services.nginx = {
|
||||
enable = true; # Enable Nginx
|
||||
enable = true; # Enable Nginx
|
||||
recommendedGzipSettings = true;
|
||||
recommendedOptimisation = true;
|
||||
recommendedProxySettings = true;
|
||||
recommendedTlsSettings = true;
|
||||
virtualHosts."source.jfdic.org" = { # Gitea hostname
|
||||
enableACME = true; # Use ACME certs
|
||||
forceSSL = true; # Force SSL
|
||||
locations."/".proxyPass = "http://localhost:3002/"; # Proxy Gitea
|
||||
virtualHosts."source.jfdic.org" = {
|
||||
# Gitea hostname
|
||||
enableACME = true; # Use ACME certs
|
||||
forceSSL = true; # Force SSL
|
||||
locations."/".proxyPass = "http://localhost:3002/"; # Proxy Gitea
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -85,6 +89,5 @@
|
|||
};
|
||||
};
|
||||
|
||||
users.groups.keys.members = [ "gitea" ]; # Required due to NixOps issue #1204
|
||||
|
||||
users.groups.keys.members = ["gitea"]; # Required due to NixOps issue #1204
|
||||
}
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
# Configuration common to all JFDIC servers
|
||||
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
{
|
||||
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
../profiles/bash.nix
|
||||
../profiles/chrony.nix
|
||||
|
@ -17,22 +18,22 @@
|
|||
|
||||
# Common boot settings
|
||||
boot = {
|
||||
cleanTmpDir = true; # Clean /tmp on reboot
|
||||
cleanTmpDir = true; # Clean /tmp on reboot
|
||||
};
|
||||
|
||||
# Select internationalisation properties.
|
||||
i18n = {
|
||||
defaultLocale = "en_AU.UTF-8"; # Set the default locale
|
||||
defaultLocale = "en_AU.UTF-8"; # Set the default locale
|
||||
};
|
||||
|
||||
# Set the defaul console properties
|
||||
console = {
|
||||
keyMap = "us"; # Set the default console key map
|
||||
font = "ter-powerline-v16Rv"; # Set the default console font
|
||||
keyMap = "us"; # Set the default console key map
|
||||
font = "ter-powerline-v16Rv"; # Set the default console font
|
||||
};
|
||||
|
||||
time.timeZone = "Etc/UTC";
|
||||
documentation.nixos.enable = false; # Disable documentation, save space
|
||||
documentation.nixos.enable = false; # Disable documentation, save space
|
||||
|
||||
# Set security options:
|
||||
security.sudo.enable = true;
|
||||
|
@ -42,7 +43,7 @@
|
|||
fonts.enableDefaultFonts = true;
|
||||
fonts.fontDir.enable = true;
|
||||
fonts.fonts = with pkgs; [
|
||||
powerline-fonts # Required for Powerline prompts
|
||||
powerline-fonts # Required for Powerline prompts
|
||||
];
|
||||
fonts.fontconfig.includeUserConf = false;
|
||||
|
||||
|
@ -52,7 +53,8 @@
|
|||
# Ruin the config so we don't accidentally run
|
||||
# nixos-rebuild switch on the host
|
||||
(let
|
||||
cfg = pkgs.writeText "configuration.nix"
|
||||
cfg =
|
||||
pkgs.writeText "configuration.nix"
|
||||
''
|
||||
assert builtins.trace "This system is managed by NixOps." false;
|
||||
{}
|
||||
|
@ -63,7 +65,7 @@
|
|||
"nixpkgs=/run/current-system/nixpkgs"
|
||||
];
|
||||
gc = {
|
||||
automatic = true; # Enable Nix garbage collection:
|
||||
automatic = true; # Enable Nix garbage collection:
|
||||
dates = "weekly";
|
||||
options = "--delete-older-than 90d";
|
||||
};
|
||||
|
@ -81,29 +83,29 @@
|
|||
environment.etc.host-nix-channel.source = pkgs.path;
|
||||
|
||||
environment.variables = {
|
||||
BAT_THEME="Dracula";
|
||||
BAT_THEME = "Dracula";
|
||||
};
|
||||
|
||||
# Set the system-wide environment
|
||||
environment = {
|
||||
systemPackages = with pkgs; [
|
||||
bat # cat clone with syntax highlighting & Git integration
|
||||
byobu # text-based window manager and terminal multiplexer.
|
||||
dnsutils # Bind DNS utilities
|
||||
fd # A simple, fast and user-friendly alternative to find
|
||||
git # Distributed version control system
|
||||
htop # interactive process viewer
|
||||
hwinfo # Hardware detection tool
|
||||
killall # kill processes by name
|
||||
lshw # Detailed information on the hardware configuration
|
||||
lsof # list open files
|
||||
mosh # Mobile shell (ssh replacement)
|
||||
ncdu # Disk usage analyzer with an ncurses interface
|
||||
nix-index # A files database for nixpkgs
|
||||
ripgrep # Utility that provides usability of The Silver Searcher with the raw speed of grep
|
||||
bat # cat clone with syntax highlighting & Git integration
|
||||
byobu # text-based window manager and terminal multiplexer.
|
||||
dnsutils # Bind DNS utilities
|
||||
fd # A simple, fast and user-friendly alternative to find
|
||||
git # Distributed version control system
|
||||
htop # interactive process viewer
|
||||
hwinfo # Hardware detection tool
|
||||
killall # kill processes by name
|
||||
lshw # Detailed information on the hardware configuration
|
||||
lsof # list open files
|
||||
mosh # Mobile shell (ssh replacement)
|
||||
ncdu # Disk usage analyzer with an ncurses interface
|
||||
nix-index # A files database for nixpkgs
|
||||
ripgrep # Utility that provides usability of The Silver Searcher with the raw speed of grep
|
||||
];
|
||||
};
|
||||
|
||||
# Users common across JFDIC Ops:
|
||||
users.mutableUsers = false; # Remove any users not defined in here
|
||||
users.mutableUsers = false; # Remove any users not defined in here
|
||||
}
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
# logrotate configuration for NixOS / NixOps
|
||||
|
||||
{ config, ... }:
|
||||
|
||||
{
|
||||
|
||||
{config, ...}: {
|
||||
services.logrotate = {
|
||||
enable = true; # Enable the logrotate service
|
||||
enable = true; # Enable the logrotate service
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -1,300 +1,301 @@
|
|||
{ pkgs, ... }:
|
||||
{
|
||||
environment.variables = { EDITOR = "vim"; };
|
||||
{pkgs, ...}: {
|
||||
environment.variables = {EDITOR = "vim";};
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
(neovim.override {
|
||||
vimAlias = true;
|
||||
configure = {
|
||||
packages.myPlugins = with pkgs.vimPlugins; {
|
||||
start = [
|
||||
airline # Lean & mean status/tabline for vim that's light as air
|
||||
dracula-vim # Dracula theme for vim
|
||||
fugitive # Vim Git wrapper
|
||||
fzf-vim # Full path fuzzy file, buffer, mru, tag, finder for Vim
|
||||
haskell-vim # Syntax Highlighting and Indentation for Haskell
|
||||
indentLine # Display thin vertical lines at each indentation level
|
||||
neocomplete-vim # Keyword completion system
|
||||
nerdcommenter # Comment functions so powerful—no comment necessary
|
||||
nerdtree # File system explorer
|
||||
nerdtree-git-plugin # Plugin for nerdtree showing git status
|
||||
supertab # Allows you to use <Tab> for all your insert completion
|
||||
syntastic # Syntax checking hacks
|
||||
vim-addon-nix # Scripts assisting writing .nix files
|
||||
vim-autoformat # Automatically format code
|
||||
vim-cue # Cue filetype plugin for Vim
|
||||
vim-lastplace
|
||||
vim-markdown-toc # Generate table of contents for Markdown files
|
||||
vim-nix # Support for writing Nix expressions in vim
|
||||
vim-numbertoggle # Toggle between relative / absolute line numbers automatically
|
||||
vim-one
|
||||
];
|
||||
opt = [];
|
||||
(
|
||||
neovim.override {
|
||||
vimAlias = true;
|
||||
configure = {
|
||||
packages.myPlugins = with pkgs.vimPlugins; {
|
||||
start = [
|
||||
airline # Lean & mean status/tabline for vim that's light as air
|
||||
dracula-vim # Dracula theme for vim
|
||||
fugitive # Vim Git wrapper
|
||||
fzf-vim # Full path fuzzy file, buffer, mru, tag, finder for Vim
|
||||
haskell-vim # Syntax Highlighting and Indentation for Haskell
|
||||
indentLine # Display thin vertical lines at each indentation level
|
||||
neocomplete-vim # Keyword completion system
|
||||
nerdcommenter # Comment functions so powerful—no comment necessary
|
||||
nerdtree # File system explorer
|
||||
nerdtree-git-plugin # Plugin for nerdtree showing git status
|
||||
supertab # Allows you to use <Tab> for all your insert completion
|
||||
syntastic # Syntax checking hacks
|
||||
vim-addon-nix # Scripts assisting writing .nix files
|
||||
vim-autoformat # Automatically format code
|
||||
vim-cue # Cue filetype plugin for Vim
|
||||
vim-lastplace
|
||||
vim-markdown-toc # Generate table of contents for Markdown files
|
||||
vim-nix # Support for writing Nix expressions in vim
|
||||
vim-numbertoggle # Toggle between relative / absolute line numbers automatically
|
||||
vim-one
|
||||
];
|
||||
opt = [];
|
||||
};
|
||||
customRC = ''
|
||||
" Preferred global default settings:
|
||||
set nocompatible
|
||||
set backspace=indent,eol,start
|
||||
set number relativenumber " Enable relative line numbers by default
|
||||
set cursorline " Highlight the current line number
|
||||
set smartindent " Automatically insert extra level of indentation
|
||||
set tabstop=4 " Default tabstop
|
||||
set shiftwidth=4 " Default indent spacing
|
||||
set expandtab " Expand [TABS] to spaces
|
||||
packadd! dracula-vim
|
||||
syntax on " Enable syntax highlighting
|
||||
set t_Co=256 " Use 265 colors in vim
|
||||
set background=dark " Set the default background scheme
|
||||
colorscheme dracula " Set the default colour scheme
|
||||
"let g:one_allow_italics = 1 " I love italic for comments
|
||||
set spell spelllang=en_au " Defaul spell checking language
|
||||
set spellfile=~/.vim-spell.en.utf-8.add " Add the spellfile
|
||||
hi clear SpellBad " Clear any unwanted default settings
|
||||
hi SpellBad cterm=underline " Set the spell checking highlight style
|
||||
hi SpellBad ctermbg=NONE " Set the spell checking highlight background
|
||||
match ErrorMsg '\s\+$' "
|
||||
|
||||
nnoremap <silent> <C-p> :Files<CR>
|
||||
nnoremap <silent> <Leader>f :Rg<CR>
|
||||
set grepprg=rg\ --vimgrep\ --smart-case\ --follow
|
||||
|
||||
let g:airline_powerline_fonts = 1 " Use powerline fonts
|
||||
let g:airline_theme='dracula' " Set the airline theme
|
||||
|
||||
"call togglebg#map("<F10>") " Toggle background colour between dark|light
|
||||
|
||||
set laststatus=2 " Set up the status line so it's coloured and always on
|
||||
|
||||
" Removes trailing spaces:
|
||||
function! TrimWhiteSpace()
|
||||
%s/\s\+$//e
|
||||
endfunction
|
||||
|
||||
" Trigger for numbertoggle to switch modes
|
||||
nnoremap <silent> <C-n> :set relativenumber!<CR>
|
||||
|
||||
" Tab settings
|
||||
let g:SuperTabDefaultCompletionType = 'context'
|
||||
let g:SuperTabContextTextOmniPrecedence = ['&omnifunc','&completefunc']
|
||||
let g:SuperTabRetainCompletionType=2
|
||||
|
||||
inoremap <expr><Enter> pumvisible() ? "\<C-Y>" : "\<Enter>"
|
||||
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
|
||||
|
||||
nnoremap <silent> <Leader>RemoveTrailingWhiteSpace :call TrimWhiteSpace()<CR>
|
||||
autocmd FileWritePre * :call TrimWhiteSpace()
|
||||
autocmd FileAppendPre * :call TrimWhiteSpace()
|
||||
autocmd FilterWritePre * :call TrimWhiteSpace()
|
||||
autocmd BufWritePre * :call TrimWhiteSpace()
|
||||
"autocmd BufWrite * :Autoformat
|
||||
|
||||
" FIXME: Currently always set to dark due to issues with Termonad Solarized theme
|
||||
" Light during the day, dark during the night
|
||||
let hour = strftime("%H")
|
||||
if 7 <= hour && hour < 17
|
||||
"set background=dark
|
||||
"hi Normal ctermbg=none " Set a transparent background
|
||||
"let g:airline_solarized_bg='dark' " Set the airline background
|
||||
else
|
||||
"set background=dark
|
||||
"hi Normal ctermbg=none " Set a transparent background
|
||||
"let g:airline_solarized_bg='dark' " Set the airline background
|
||||
endif
|
||||
|
||||
" Transparent editing of gpg encrypted files.
|
||||
" By Wouter Hanegraaff <wouter@blub.net>
|
||||
augroup encrypted
|
||||
au!
|
||||
|
||||
" First make sure nothing is written to ~/.viminfo while editing an encrypted file.
|
||||
autocmd BufReadPre,FileReadPre *.gpg set viminfo=
|
||||
" We don't want a swap file, as it writes unencrypted data to disk
|
||||
autocmd BufReadPre,FileReadPre *.gpg set noswapfile
|
||||
" Switch to binary mode to read the encrypted file
|
||||
autocmd BufReadPre,FileReadPre *.gpg set bin
|
||||
autocmd BufReadPre,FileReadPre *.gpg let ch_save = &ch|set ch=2
|
||||
autocmd BufReadPost,FileReadPost *.gpg '[,']!gpg --decrypt 2> /dev/null
|
||||
" Switch to normal mode for editing
|
||||
autocmd BufReadPost,FileReadPost *.gpg set nobin
|
||||
autocmd BufReadPost,FileReadPost *.gpg let &ch = ch_save|unlet ch_save
|
||||
autocmd BufReadPost,FileReadPost *.gpg execute ":doautocmd BufReadPost " . expand("%:r")
|
||||
|
||||
" Convert all text to encrypted text before writing
|
||||
autocmd BufWritePre,FileWritePre *.gpg '[,']!gpg --default-key=A4122FF3971B6865 --default-recipient-self -ae 2>/dev/null
|
||||
" Undo the encryption so we are back in the normal text, directly
|
||||
" after the file has been written.
|
||||
autocmd BufWritePost,FileWritePost *.gpg u
|
||||
augroup END
|
||||
|
||||
" Manage ISO files
|
||||
augroup iso
|
||||
au!
|
||||
|
||||
" First make sure nothing is written to ~/.viminfo while editing an encrypted file.
|
||||
autocmd BufReadPre,FileReadPre *.iso set viminfo=
|
||||
" We don't want a swap file, as it writes unencrypted data to disk
|
||||
autocmd BufReadPre,FileReadPre *.iso set noswapfile
|
||||
" Switch to binary mode to read the encrypted file
|
||||
autocmd BufReadPre,FileReadPre *.iso set bin
|
||||
autocmd BufReadPre,FileReadPre *.iso let ch_save = &ch|set ch=2
|
||||
autocmd BufReadPost,FileReadPost *.iso '[,']!gpg --decrypt 2> /dev/null
|
||||
" Switch to normal mode for editing
|
||||
autocmd BufReadPost,FileReadPost *.iso set nobin
|
||||
autocmd BufReadPost,FileReadPost *.iso let &ch = ch_save|unlet ch_save
|
||||
autocmd BufReadPost,FileReadPost *.iso execute ":doautocmd BufReadPost " . expand("%:r")
|
||||
|
||||
" Convert all text to encrypted text before writing
|
||||
autocmd BufWritePre,FileWritePre *.iso '[,']!gpg --default-key=A4122FF3971B6865 --default-recipient-self -ae 2>/dev/null
|
||||
" Undo the encryption so we are back in the normal text, directly
|
||||
" after the file has been written.
|
||||
autocmd BufWritePost,FileWritePost *.iso u
|
||||
augroup END
|
||||
|
||||
" Use persistent history.
|
||||
if !isdirectory("/tmp/.vim-undo-dir")
|
||||
call mkdir("/tmp/.vim-undo-dir", "", 0700)
|
||||
endif
|
||||
set undodir=/tmp/.vim-undo-dir
|
||||
set undofile
|
||||
|
||||
" JFDIC Markdown environment
|
||||
function! MarkdownSettings()
|
||||
set textwidth=79
|
||||
set spell spelllang=en_au
|
||||
endfunction
|
||||
autocmd BufNewFile,BufFilePre,BufRead *.mdwn :call MarkdownSettings()
|
||||
autocmd BufNewFile,BufFilePre,BufRead *.md :call MarkdownSettings()
|
||||
|
||||
" JFDIC ReStructured Text environment
|
||||
function! ReStructuredSettings()
|
||||
set textwidth=79
|
||||
set spell spelllang=en_au
|
||||
hi clear SpellBad " Clear any unwanted default settings
|
||||
hi SpellBad cterm=underline " Set the spell checking highlight style
|
||||
hi SpellBad ctermbg=NONE " Set the spell checking highlight background
|
||||
endfunction
|
||||
autocmd BufNewFile,BufFilePre,BufRead *.rst :call ReStructuredSettings()
|
||||
autocmd BufNewFile,BufFilePre,BufRead *.txt :call ReStructuredSettings()
|
||||
|
||||
" JFDIC LaTeX environment:
|
||||
function! LaTeXSettings()
|
||||
set textwidth=79
|
||||
set spell spelllang=en_au
|
||||
endfunction
|
||||
autocmd BufNewFile,BufFilePre,BufRead *.tex :call LaTeXSettings()
|
||||
|
||||
" Settings for JFDIC Haskell environment:
|
||||
function! HaskellSettings()
|
||||
set tabstop=2
|
||||
set shiftwidth=2
|
||||
set expandtab
|
||||
set textwidth=79
|
||||
endfunction
|
||||
autocmd BufNewFile,BufFilePre,BufRead *.hs :call HaskellSettings()
|
||||
|
||||
" Settings for JFDIC Nix environment:
|
||||
function! NixSettings()
|
||||
set tabstop=2
|
||||
set shiftwidth=2
|
||||
set expandtab
|
||||
set textwidth=79
|
||||
set filetype=nix
|
||||
endfunction
|
||||
autocmd BufNewFile,BufFilePre,BufRead *.nix :call NixSettings()
|
||||
|
||||
" Settings for JFDIC Cue environment:
|
||||
function! CueSettings()
|
||||
set noexpandtab
|
||||
set tabstop=2
|
||||
set shiftwidth=2
|
||||
set textwidth=79
|
||||
let g:cue_fmt_on_save = 1
|
||||
endfunction
|
||||
autocmd BufNewFile,BufFilePre,BufRead *.cue :call CueSettings()
|
||||
|
||||
" Settings for JFDIC Rust environment:
|
||||
function! RustSettings()
|
||||
set tabstop=4
|
||||
set shiftwidth=4
|
||||
set expandtab
|
||||
set textwidth=79
|
||||
let g:rustfmt_autosave = 1
|
||||
endfunction
|
||||
autocmd BufNewFile,BufFilePre,BufRead *.rs :call RustSettings()
|
||||
|
||||
" Settings for JFDIC Crystal environment:
|
||||
function! CrystalSettings()
|
||||
set tabstop=2
|
||||
set shiftwidth=2
|
||||
set expandtab
|
||||
set textwidth=79
|
||||
set filetype=crystal
|
||||
endfunction
|
||||
autocmd BufNewFile,BufFilePre,BufRead *.cr :call CrystalSettings()
|
||||
|
||||
" Settings for JFDIC Golang environment:
|
||||
function! GoSettings()
|
||||
set tabstop=7
|
||||
set shiftwidth=7
|
||||
set noexpandtab
|
||||
endfunction
|
||||
autocmd BufNewFile,BufFilePre,BufRead *.go :call GoSettings()
|
||||
|
||||
" Settings for JFDIC Python environment:
|
||||
function! PythonSettings()
|
||||
set tabstop=4
|
||||
set shiftwidth=4
|
||||
set expandtab
|
||||
set textwidth=79
|
||||
set spell!
|
||||
endfunction
|
||||
autocmd BufNewFile,BufFilePre,BufRead *.py :call PythonSettings()
|
||||
|
||||
" JFDIC Mutt environment
|
||||
function! MuttSettings()
|
||||
set textwidth=79
|
||||
set spell spelllang=en_au
|
||||
hi clear SpellBad " Clear any unwanted default settings
|
||||
hi SpellBad cterm=underline " Set the spell checking highlight style
|
||||
hi SpellBad ctermbg=NONE " Set the spell checking highlight background
|
||||
endfunction
|
||||
autocmd BufNewFile,BufFilePre,BufRead mutt-* :call MuttSettings()
|
||||
autocmd BufNewFile,BufFilePre,BufRead neomutt-* :call MuttSettings()
|
||||
|
||||
" Settings for JFDIC C environment:
|
||||
function! CSettings()
|
||||
set tabstop=2
|
||||
set shiftwidth=2
|
||||
set expandtab
|
||||
set textwidth=79
|
||||
endfunction
|
||||
autocmd BufNewFile,BufFilePre,BufRead *.c :call CSettings()
|
||||
|
||||
" Settings for JFDIC YAML environment:
|
||||
function! YAMLSettings()
|
||||
set tabstop=2
|
||||
set shiftwidth=2
|
||||
set expandtab
|
||||
set textwidth=79
|
||||
set spell spelllang=en_au
|
||||
hi clear SpellBad " Clear any unwanted default settings
|
||||
hi SpellBad cterm=underline " Set the spell checking highlight style
|
||||
hi SpellBad ctermbg=NONE " Set the spell checking highlight background
|
||||
endfunction
|
||||
autocmd BufNewFile,BufFilePre,BufRead *.yaml :call YAMLSettings()
|
||||
autocmd BufNewFile,BufFilePre,BufRead *.yml :call YAMLSettings()
|
||||
|
||||
" Settings for JFDIC Bash environment:
|
||||
function! BashSettings()
|
||||
set tabstop=4
|
||||
set shiftwidth=4
|
||||
set expandtab
|
||||
set textwidth=79
|
||||
set spell!
|
||||
endfunction
|
||||
autocmd BufNewFile,BufFilePre,BufRead *.sh :call BashSettings()
|
||||
'';
|
||||
};
|
||||
customRC = ''
|
||||
" Preferred global default settings:
|
||||
set nocompatible
|
||||
set backspace=indent,eol,start
|
||||
set number relativenumber " Enable relative line numbers by default
|
||||
set cursorline " Highlight the current line number
|
||||
set smartindent " Automatically insert extra level of indentation
|
||||
set tabstop=4 " Default tabstop
|
||||
set shiftwidth=4 " Default indent spacing
|
||||
set expandtab " Expand [TABS] to spaces
|
||||
packadd! dracula-vim
|
||||
syntax on " Enable syntax highlighting
|
||||
set t_Co=256 " Use 265 colors in vim
|
||||
set background=dark " Set the default background scheme
|
||||
colorscheme dracula " Set the default colour scheme
|
||||
"let g:one_allow_italics = 1 " I love italic for comments
|
||||
set spell spelllang=en_au " Defaul spell checking language
|
||||
set spellfile=~/.vim-spell.en.utf-8.add " Add the spellfile
|
||||
hi clear SpellBad " Clear any unwanted default settings
|
||||
hi SpellBad cterm=underline " Set the spell checking highlight style
|
||||
hi SpellBad ctermbg=NONE " Set the spell checking highlight background
|
||||
match ErrorMsg '\s\+$' "
|
||||
|
||||
nnoremap <silent> <C-p> :Files<CR>
|
||||
nnoremap <silent> <Leader>f :Rg<CR>
|
||||
set grepprg=rg\ --vimgrep\ --smart-case\ --follow
|
||||
|
||||
let g:airline_powerline_fonts = 1 " Use powerline fonts
|
||||
let g:airline_theme='dracula' " Set the airline theme
|
||||
|
||||
"call togglebg#map("<F10>") " Toggle background colour between dark|light
|
||||
|
||||
set laststatus=2 " Set up the status line so it's coloured and always on
|
||||
|
||||
" Removes trailing spaces:
|
||||
function! TrimWhiteSpace()
|
||||
%s/\s\+$//e
|
||||
endfunction
|
||||
|
||||
" Trigger for numbertoggle to switch modes
|
||||
nnoremap <silent> <C-n> :set relativenumber!<CR>
|
||||
|
||||
" Tab settings
|
||||
let g:SuperTabDefaultCompletionType = 'context'
|
||||
let g:SuperTabContextTextOmniPrecedence = ['&omnifunc','&completefunc']
|
||||
let g:SuperTabRetainCompletionType=2
|
||||
|
||||
inoremap <expr><Enter> pumvisible() ? "\<C-Y>" : "\<Enter>"
|
||||
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
|
||||
|
||||
nnoremap <silent> <Leader>RemoveTrailingWhiteSpace :call TrimWhiteSpace()<CR>
|
||||
autocmd FileWritePre * :call TrimWhiteSpace()
|
||||
autocmd FileAppendPre * :call TrimWhiteSpace()
|
||||
autocmd FilterWritePre * :call TrimWhiteSpace()
|
||||
autocmd BufWritePre * :call TrimWhiteSpace()
|
||||
"autocmd BufWrite * :Autoformat
|
||||
|
||||
" FIXME: Currently always set to dark due to issues with Termonad Solarized theme
|
||||
" Light during the day, dark during the night
|
||||
let hour = strftime("%H")
|
||||
if 7 <= hour && hour < 17
|
||||
"set background=dark
|
||||
"hi Normal ctermbg=none " Set a transparent background
|
||||
"let g:airline_solarized_bg='dark' " Set the airline background
|
||||
else
|
||||
"set background=dark
|
||||
"hi Normal ctermbg=none " Set a transparent background
|
||||
"let g:airline_solarized_bg='dark' " Set the airline background
|
||||
endif
|
||||
|
||||
" Transparent editing of gpg encrypted files.
|
||||
" By Wouter Hanegraaff <wouter@blub.net>
|
||||
augroup encrypted
|
||||
au!
|
||||
|
||||
" First make sure nothing is written to ~/.viminfo while editing an encrypted file.
|
||||
autocmd BufReadPre,FileReadPre *.gpg set viminfo=
|
||||
" We don't want a swap file, as it writes unencrypted data to disk
|
||||
autocmd BufReadPre,FileReadPre *.gpg set noswapfile
|
||||
" Switch to binary mode to read the encrypted file
|
||||
autocmd BufReadPre,FileReadPre *.gpg set bin
|
||||
autocmd BufReadPre,FileReadPre *.gpg let ch_save = &ch|set ch=2
|
||||
autocmd BufReadPost,FileReadPost *.gpg '[,']!gpg --decrypt 2> /dev/null
|
||||
" Switch to normal mode for editing
|
||||
autocmd BufReadPost,FileReadPost *.gpg set nobin
|
||||
autocmd BufReadPost,FileReadPost *.gpg let &ch = ch_save|unlet ch_save
|
||||
autocmd BufReadPost,FileReadPost *.gpg execute ":doautocmd BufReadPost " . expand("%:r")
|
||||
|
||||
" Convert all text to encrypted text before writing
|
||||
autocmd BufWritePre,FileWritePre *.gpg '[,']!gpg --default-key=A4122FF3971B6865 --default-recipient-self -ae 2>/dev/null
|
||||
" Undo the encryption so we are back in the normal text, directly
|
||||
" after the file has been written.
|
||||
autocmd BufWritePost,FileWritePost *.gpg u
|
||||
augroup END
|
||||
|
||||
" Manage ISO files
|
||||
augroup iso
|
||||
au!
|
||||
|
||||
" First make sure nothing is written to ~/.viminfo while editing an encrypted file.
|
||||
autocmd BufReadPre,FileReadPre *.iso set viminfo=
|
||||
" We don't want a swap file, as it writes unencrypted data to disk
|
||||
autocmd BufReadPre,FileReadPre *.iso set noswapfile
|
||||
" Switch to binary mode to read the encrypted file
|
||||
autocmd BufReadPre,FileReadPre *.iso set bin
|
||||
autocmd BufReadPre,FileReadPre *.iso let ch_save = &ch|set ch=2
|
||||
autocmd BufReadPost,FileReadPost *.iso '[,']!gpg --decrypt 2> /dev/null
|
||||
" Switch to normal mode for editing
|
||||
autocmd BufReadPost,FileReadPost *.iso set nobin
|
||||
autocmd BufReadPost,FileReadPost *.iso let &ch = ch_save|unlet ch_save
|
||||
autocmd BufReadPost,FileReadPost *.iso execute ":doautocmd BufReadPost " . expand("%:r")
|
||||
|
||||
" Convert all text to encrypted text before writing
|
||||
autocmd BufWritePre,FileWritePre *.iso '[,']!gpg --default-key=A4122FF3971B6865 --default-recipient-self -ae 2>/dev/null
|
||||
" Undo the encryption so we are back in the normal text, directly
|
||||
" after the file has been written.
|
||||
autocmd BufWritePost,FileWritePost *.iso u
|
||||
augroup END
|
||||
|
||||
" Use persistent history.
|
||||
if !isdirectory("/tmp/.vim-undo-dir")
|
||||
call mkdir("/tmp/.vim-undo-dir", "", 0700)
|
||||
endif
|
||||
set undodir=/tmp/.vim-undo-dir
|
||||
set undofile
|
||||
|
||||
" JFDIC Markdown environment
|
||||
function! MarkdownSettings()
|
||||
set textwidth=79
|
||||
set spell spelllang=en_au
|
||||
endfunction
|
||||
autocmd BufNewFile,BufFilePre,BufRead *.mdwn :call MarkdownSettings()
|
||||
autocmd BufNewFile,BufFilePre,BufRead *.md :call MarkdownSettings()
|
||||
|
||||
" JFDIC ReStructured Text environment
|
||||
function! ReStructuredSettings()
|
||||
set textwidth=79
|
||||
set spell spelllang=en_au
|
||||
hi clear SpellBad " Clear any unwanted default settings
|
||||
hi SpellBad cterm=underline " Set the spell checking highlight style
|
||||
hi SpellBad ctermbg=NONE " Set the spell checking highlight background
|
||||
endfunction
|
||||
autocmd BufNewFile,BufFilePre,BufRead *.rst :call ReStructuredSettings()
|
||||
autocmd BufNewFile,BufFilePre,BufRead *.txt :call ReStructuredSettings()
|
||||
|
||||
" JFDIC LaTeX environment:
|
||||
function! LaTeXSettings()
|
||||
set textwidth=79
|
||||
set spell spelllang=en_au
|
||||
endfunction
|
||||
autocmd BufNewFile,BufFilePre,BufRead *.tex :call LaTeXSettings()
|
||||
|
||||
" Settings for JFDIC Haskell environment:
|
||||
function! HaskellSettings()
|
||||
set tabstop=2
|
||||
set shiftwidth=2
|
||||
set expandtab
|
||||
set textwidth=79
|
||||
endfunction
|
||||
autocmd BufNewFile,BufFilePre,BufRead *.hs :call HaskellSettings()
|
||||
|
||||
" Settings for JFDIC Nix environment:
|
||||
function! NixSettings()
|
||||
set tabstop=2
|
||||
set shiftwidth=2
|
||||
set expandtab
|
||||
set textwidth=79
|
||||
set filetype=nix
|
||||
endfunction
|
||||
autocmd BufNewFile,BufFilePre,BufRead *.nix :call NixSettings()
|
||||
|
||||
" Settings for JFDIC Cue environment:
|
||||
function! CueSettings()
|
||||
set noexpandtab
|
||||
set tabstop=2
|
||||
set shiftwidth=2
|
||||
set textwidth=79
|
||||
let g:cue_fmt_on_save = 1
|
||||
endfunction
|
||||
autocmd BufNewFile,BufFilePre,BufRead *.cue :call CueSettings()
|
||||
|
||||
" Settings for JFDIC Rust environment:
|
||||
function! RustSettings()
|
||||
set tabstop=4
|
||||
set shiftwidth=4
|
||||
set expandtab
|
||||
set textwidth=79
|
||||
let g:rustfmt_autosave = 1
|
||||
endfunction
|
||||
autocmd BufNewFile,BufFilePre,BufRead *.rs :call RustSettings()
|
||||
|
||||
" Settings for JFDIC Crystal environment:
|
||||
function! CrystalSettings()
|
||||
set tabstop=2
|
||||
set shiftwidth=2
|
||||
set expandtab
|
||||
set textwidth=79
|
||||
set filetype=crystal
|
||||
endfunction
|
||||
autocmd BufNewFile,BufFilePre,BufRead *.cr :call CrystalSettings()
|
||||
|
||||
" Settings for JFDIC Golang environment:
|
||||
function! GoSettings()
|
||||
set tabstop=7
|
||||
set shiftwidth=7
|
||||
set noexpandtab
|
||||
endfunction
|
||||
autocmd BufNewFile,BufFilePre,BufRead *.go :call GoSettings()
|
||||
|
||||
" Settings for JFDIC Python environment:
|
||||
function! PythonSettings()
|
||||
set tabstop=4
|
||||
set shiftwidth=4
|
||||
set expandtab
|
||||
set textwidth=79
|
||||
set spell!
|
||||
endfunction
|
||||
autocmd BufNewFile,BufFilePre,BufRead *.py :call PythonSettings()
|
||||
|
||||
" JFDIC Mutt environment
|
||||
function! MuttSettings()
|
||||
set textwidth=79
|
||||
set spell spelllang=en_au
|
||||
hi clear SpellBad " Clear any unwanted default settings
|
||||
hi SpellBad cterm=underline " Set the spell checking highlight style
|
||||
hi SpellBad ctermbg=NONE " Set the spell checking highlight background
|
||||
endfunction
|
||||
autocmd BufNewFile,BufFilePre,BufRead mutt-* :call MuttSettings()
|
||||
autocmd BufNewFile,BufFilePre,BufRead neomutt-* :call MuttSettings()
|
||||
|
||||
" Settings for JFDIC C environment:
|
||||
function! CSettings()
|
||||
set tabstop=2
|
||||
set shiftwidth=2
|
||||
set expandtab
|
||||
set textwidth=79
|
||||
endfunction
|
||||
autocmd BufNewFile,BufFilePre,BufRead *.c :call CSettings()
|
||||
|
||||
" Settings for JFDIC YAML environment:
|
||||
function! YAMLSettings()
|
||||
set tabstop=2
|
||||
set shiftwidth=2
|
||||
set expandtab
|
||||
set textwidth=79
|
||||
set spell spelllang=en_au
|
||||
hi clear SpellBad " Clear any unwanted default settings
|
||||
hi SpellBad cterm=underline " Set the spell checking highlight style
|
||||
hi SpellBad ctermbg=NONE " Set the spell checking highlight background
|
||||
endfunction
|
||||
autocmd BufNewFile,BufFilePre,BufRead *.yaml :call YAMLSettings()
|
||||
autocmd BufNewFile,BufFilePre,BufRead *.yml :call YAMLSettings()
|
||||
|
||||
" Settings for JFDIC Bash environment:
|
||||
function! BashSettings()
|
||||
set tabstop=4
|
||||
set shiftwidth=4
|
||||
set expandtab
|
||||
set textwidth=79
|
||||
set spell!
|
||||
endfunction
|
||||
autocmd BufNewFile,BufFilePre,BufRead *.sh :call BashSettings()
|
||||
'';
|
||||
};
|
||||
}
|
||||
)];
|
||||
}
|
||||
)
|
||||
];
|
||||
}
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
# NixOps configuration nix-direnv
|
||||
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
{
|
||||
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
nix = {
|
||||
extraOptions = ''
|
||||
keep-outputs = true
|
||||
|
@ -14,16 +15,15 @@
|
|||
# Set the environment
|
||||
environment = {
|
||||
systemPackages = with pkgs; [
|
||||
direnv # A shell extension that manages your environment
|
||||
nix-direnv # A fast, persistent use_nix implementation for direnv
|
||||
direnv # A shell extension that manages your environment
|
||||
nix-direnv # A fast, persistent use_nix implementation for direnv
|
||||
];
|
||||
pathsToLink = [
|
||||
"/share/nix-direnv"
|
||||
"/share/nix-direnv"
|
||||
];
|
||||
};
|
||||
|
||||
nixpkgs.overlays = [
|
||||
(self: super: { nix-direnv = super.nix-direnv.override { enableFlakes = true; }; } )
|
||||
(self: super: {nix-direnv = super.nix-direnv.override {enableFlakes = true;};})
|
||||
];
|
||||
|
||||
}
|
||||
|
|
|
@ -1,19 +1,18 @@
|
|||
# Configuration common to all JFDIC servers
|
||||
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
{
|
||||
|
||||
imports =
|
||||
[
|
||||
../profiles/openssh.nix
|
||||
../secrets/user-fiscalvelvetpoet.nix
|
||||
../secrets/user-root.nix
|
||||
];
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
../profiles/openssh.nix
|
||||
../secrets/user-fiscalvelvetpoet.nix
|
||||
../secrets/user-root.nix
|
||||
];
|
||||
|
||||
programs.mosh = {
|
||||
enable = true;
|
||||
withUtempter = true;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
{pkgs, ...}: {
|
||||
environment.systemPackages = with pkgs; [
|
||||
starship # A minimal, blazing fast, and extremely customizable prompt for any shell
|
||||
starship # A minimal, blazing fast, and extremely customizable prompt for any shell
|
||||
];
|
||||
}
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
# Configuration common to all JFDIC servers
|
||||
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
{
|
||||
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
# Program defaults for all hosts
|
||||
programs.zsh = {
|
||||
enable = true; # Also enables & installs nix-zsh-completions
|
||||
enable = true; # Also enables & installs nix-zsh-completions
|
||||
autosuggestions.enable = true;
|
||||
interactiveShellInit = ''
|
||||
export TERM="xterm-256color"
|
||||
|
@ -37,6 +38,5 @@
|
|||
fzf
|
||||
];
|
||||
|
||||
users.defaultUserShell = pkgs.zsh; # Set the default shell for all users
|
||||
|
||||
users.defaultUserShell = pkgs.zsh; # Set the default shell for all users
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue