refactor :)

This commit is contained in:
Rachel Lambda Samuelsson 2024-06-24 21:53:35 +02:00
parent 242ec70992
commit fac169231c
26 changed files with 750 additions and 657 deletions

View File

@ -5,6 +5,7 @@
[ # Include the results of the hardware scan.
./hardware-configuration.nix
];
hardware.opengl = {
enable = true;
driSupport = true;

View File

@ -93,6 +93,24 @@
"type": "github"
}
},
"flake-utils_3": {
"inputs": {
"systems": "systems_2"
},
"locked": {
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
@ -146,19 +164,26 @@
"type": "github"
}
},
"nixpkgs_2": {
"plasma-manager": {
"inputs": {
"home-manager": [
"home-manager"
],
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1711703276,
"narHash": "sha256-iMUFArF0WCatKK6RzfUJknjem0H9m4KgorO/p3Dopkk=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "d8fe5e6c92d0d190646fb9f1056741a229980089",
"lastModified": 1719241096,
"narHash": "sha256-36De9zA7fp976ZPxATQ2LHcQohUUISCGlAcCKJqRC/0=",
"owner": "nix-community",
"repo": "plasma-manager",
"rev": "d67f2f550a26da44554f239c7043112e0cfbb231",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"owner": "nix-community",
"repo": "plasma-manager",
"type": "github"
}
},
@ -166,9 +191,11 @@
"inputs": {
"agda": "agda",
"cornelis": "cornelis",
"flake-utils": "flake-utils_3",
"home-manager": "home-manager",
"nixpkgs": "nixpkgs",
"nixpkgs-unstable": "nixpkgs-unstable",
"plasma-manager": "plasma-manager",
"ssbm-nix": "ssbm-nix"
}
},
@ -190,7 +217,9 @@
},
"ssbm-nix": {
"inputs": {
"nixpkgs": "nixpkgs_2",
"nixpkgs": [
"nixpkgs-unstable"
],
"slippi-desktop": "slippi-desktop"
},
"locked": {
@ -221,6 +250,21 @@
"repo": "default",
"type": "github"
}
},
"systems_2": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",

103
flake.nix
View File

@ -5,71 +5,102 @@
inputs = {
nixpkgs.url = "github:NixOs/nixpkgs/nixos-24.05";
nixpkgs-unstable.url = "github:NixOs/nixpkgs/nixos-unstable";
home-manager.url = "github:nix-community/home-manager/release-24.05";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
agda.url = "github:agda/agda/v2.6.4.1";
agda.inputs.nixpkgs.follows = "nixpkgs";
cornelis.url = "github:isovector/cornelis/";
cornelis.inputs.nixpkgs.follows = "nixpkgs";
ssbm-nix.url = "github:lytedev/ssbm-nix";
flake-utils.url = "github:numtide/flake-utils";
home-manager = {
url = "github:nix-community/home-manager/release-24.05";
inputs.nixpkgs.follows = "nixpkgs";
};
agda = {
url = "github:agda/agda/v2.6.4.1";
inputs.nixpkgs.follows = "nixpkgs";
};
cornelis = {
url = "github:isovector/cornelis/";
inputs.nixpkgs.follows = "nixpkgs";
};
ssbm-nix = {
url = "github:lytedev/ssbm-nix";
inputs.nixpkgs.follows = "nixpkgs-unstable";
};
plasma-manager = {
url = "github:nix-community/plasma-manager";
inputs.nixpkgs.follows = "nixpkgs";
inputs.home-manager.follows = "home-manager";
};
};
outputs = { self, nixpkgs, nixpkgs-unstable, home-manager, agda, cornelis, ssbm-nix }:
outputs = { self, nixpkgs, nixpkgs-unstable, home-manager, agda, cornelis, ssbm-nix, plasma-manager, flake-utils }:
let nix-config-module =
{
nix.registry.nixpkgs.flake = nixpkgs;
nix.registry.unstable.flake = nixpkgs-unstable;
system.configurationRevision = nixpkgs.lib.mkIf (self ? rev) self.rev;
};
rachel-home-module =
({ pkgs, ... }:
let system = pkgs.stdenv.system;
in {
rachel-home-module =
system: {
home-manager = {
sharedModules = [ plasma-manager.homeManagerModules.plasma-manager ];
useGlobalPkgs = true;
useUserPackages = true;
users.rachel = import ./home/rachel.nix {
pkgs = pkgs;
users.rachel = import ./home/all.nix {
pkgs = import nixpkgs {
system = system;
config.allowUnfree = true;
};
unstable = import nixpkgs-unstable {
system = system;
config.allowUnfree = true;
};
agda = agda.packages.${system}.Agda;
cornelis = cornelis.packages.${system}.cornelis;
cornelis-vim = cornelis.packages.${system}.cornelis-vim;
slippi-netplay = ssbm-nix.packages.${system}.slippi-netplay;
extra = {
agda = agda.packages.${system}.Agda;
cornelis = cornelis.packages.${system}.cornelis;
cornelis-vim = cornelis.packages.${system}.cornelis-vim;
slippi-netplay = ssbm-nix.packages.${system}.slippi-netplay;
sax2nf = self.packages.${system}.sax2nf;
bqn-vim = self.packages.${system}.bqn-vim;
bqn-nvim = self.packages.${system}.bqn-nvim;
shell-menu = self.packages.${system}.bqn-nvim;
};
};
};
}
);
};
base-modules = [
nix-config-module
ssbm-nix.nixosModule
home-manager.nixosModules.home-manager
];
in {
nixosConfigurations.lambda = nixpkgs.lib.nixosSystem {
nixosConfigurations.lambda = nixpkgs.lib.nixosSystem rec {
system = "x86_64-linux";
modules = [
nix-config-module
ssbm-nix.nixosModule
modules = base-modules ++ [
./lambda/configuration.nix
./shared/desktop.nix
home-manager.nixosModules.home-manager
rachel-home-module
./shared/user-system.nix
./shared/graphical.nix
(rachel-home-module system)
];
};
nixosConfigurations.computational = nixpkgs.lib.nixosSystem {
nixosConfigurations.computational = nixpkgs.lib.nixosSystem rec {
system = "x86_64-linux";
modules = [
nix-config-module
ssbm-nix.nixosModule
modules = base-modules ++ [
./computational/configuration.nix
./shared/desktop.nix
home-manager.nixosModules.home-manager
rachel-home-module
./shared/user-system.nix
./shared/graphical.nix
(rachel-home-module system)
];
};
keyboardLayouts.fox = ./shared/fox.xkb;
fonts.sax2nf = import ./shared/sax2nf.nix { pkgs = nixpkgs.legacyPackages.x86_64-linux; };
};
} // flake-utils.lib.eachDefaultSystem (system:
let pkgs = nixpkgs.legacyPackages.${system};
in {
packages = {
bqn-vim = import ./pkgs/bqn-vim.nix { inherit pkgs; };
bqn-nvim = import ./pkgs/bqn-nvim.nix { inherit pkgs; };
sax2nf = import ./pkgs/sax2nf.nix { inherit pkgs; };
shell-menu = import ./pkgs/shell-menu.nix { inherit pkgs; };
};
});
}

22
home/all.nix Normal file
View File

@ -0,0 +1,22 @@
{ pkgs, unstable, extra, ... }:
let common = rec {
username = "rachel";
homeDir = "/home/${username}";
};
in {
imports = builtins.map (x: import x { inherit pkgs unstable extra common; }) [
./applications.nix
./fetch.nix
./git.nix
./gpg.nix
./hm-settings.nix
./launcher.nix
./media.nix
./neovim.nix
./shell.nix
./ssh.nix
./terminal.nix
./tmux.nix
./xdg-dirs.nix
];
}

74
home/applications.nix Normal file
View File

@ -0,0 +1,74 @@
{ pkgs, unstable, extra, ... }:
{
home.packages = (with pkgs; [
unzip
zip
xz
gzip
bzip2
p7zip
usbutils
pciutils
nettools
nmap
arp-scan
julia-bin
(python3.withPackages (ps: with ps; [
ipython
matplotlib
numpy
scipy
]))
ghc
firefox
gnupg
discord
dig
xxd
slack
imagemagick
ffmpeg
yt-dlp
libreoffice
protonmail-bridge
pass
protonvpn-gui
thunderbird
tidal-hifi
signal-desktop
transmission-gtk
xclip
clinfo
glxinfo
vulkan-tools
obs-studio
file
gimp
bat
steam
steam-run
rmapi
lutris
texlive.combined.scheme-full
zulip
rink
typst
ttyper
idris2
prismlauncher
vimv
whalebird
lean4
remmina
git-crypt
vcv-rack
]) ++ [
extra.agda
unstable.zoom-us
extra.sax2nf
extra.cornelis
extra.slippi-netplay
unstable.kicad
unstable.renoise
];
}

13
home/fetch.nix Normal file
View File

@ -0,0 +1,13 @@
{ ... }:
{
programs.hyfetch = {
enable = true;
settings = {
preset = "lesbian";
mode = "rgb";
color_align = {
mode = "horizontal";
};
};
};
}

11
home/git.nix Normal file
View File

@ -0,0 +1,11 @@
{ ... }:
{
programs.git = {
enable = true;
userName = "Rachel Lambda Samuelsson";
userEmail = "depsterr@protonmail.com";
extraConfig = {
init.defaultBranch = "master";
};
};
}

7
home/gpg.nix Normal file
View File

@ -0,0 +1,7 @@
{ pkgs, ... }:
{
services.gpg-agent = {
enable = true;
pinentryPackage = pkgs.pinentry-qt;
};
}

8
home/hm-settings.nix Normal file
View File

@ -0,0 +1,8 @@
{ common, ... }:
{
home = {
username = common.username;
homeDirectory = common.homeDir;
stateVersion = "24.05";
};
}

7
home/launcher.nix Normal file
View File

@ -0,0 +1,7 @@
{ ... }:
{
programs.rofi = {
enable = true;
theme = "gruvbox-dark-soft";
};
}

11
home/media.nix Normal file
View File

@ -0,0 +1,11 @@
{ ... }:
{
programs.mpv = {
enable = true;
config = {
hwdec = "auto-safe";
vo = "gpu";
profile = "gpu-hq";
};
};
}

176
home/neovim.nix Normal file
View File

@ -0,0 +1,176 @@
{ pkgs, extra, ... }:
{
programs.neovim = {
defaultEditor = true;
enable = true;
vimAlias = true;
extraLuaConfig = ''
require('tmux').setup({ copy_sync = { redirect_to_clipboard = true } });
require('Comment').setup()
require('nvim-surround').setup()
require('numb').setup()
local lspcfg = require('lspconfig')
lspcfg.typst_lsp.setup({
cmd = { '${pkgs.typst-lsp}/bin/typst-lsp' },
})
lspcfg.rust_analyzer.setup({})
lspcfg.hls.setup({})
lspcfg.pyright.setup({
cmd = { '${pkgs.nodePackages.pyright}/bin/pyright-langserver', '--stdio' },
})
lspcfg.nixd.setup({
cmd = { '${pkgs.nixd}/bin/nixd' },
})
lspcfg.ltex.setup({
cmd = { '${pkgs.ltex-ls}/bin/ltex-ls' },
filetypes = { 'bib', 'gitcommit', 'markdown', 'plaintext', 'tex', 'pandoc', 'typst' },
settings = {
ltex = {
language = 'auto'
}
}
})
lspcfg.clangd.setup({
cmd = { '${pkgs.clang-tools}/bin/clangd' },
})
lspcfg.ocamllsp.setup({})
lspcfg.purescriptls.setup({})
require('orgmode').setup({})
require('lean').setup({
mappings = true,
})
require('lualine').setup {
options = {
icons_enabled = true,
theme = 'gruvbox',
component_separators = { left = "", right = ""},
section_separators = { left = "", right = ""},
always_divide_middle = true,
globalstatus = false,
refresh = {
statusline = 1000,
tabline = 1000,
winbar = 1000,
}
},
sections = {
lualine_a = {'mode'},
lualine_b = { {
'diagnostics',
always_visible = true,
on_click = function(n,b,m)
vim.diagnostic.goto_next()
end
} },
lualine_c = {'filename'},
lualine_x = {'encoding', 'filetype'},
lualine_y = {'progress'},
lualine_z = {'location'}
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = {'filename'},
lualine_x = {'location'},
lualine_y = {},
lualine_z = {}
},
}
vim.api.nvim_create_autocmd('LspAttach', {
callback = function(args)
local opts = { buffer = args.buf }
vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts)
vim.keymap.set('n', '<localleader>r', vim.lsp.buf.rename, opts)
vim.keymap.set('n', '<localleader>a', vim.lsp.buf.code_action, opts)
vim.keymap.set('n', '<localleader>gd', vim.lsp.buf.definition, opts)
vim.keymap.set('n', '<localleader>gi', vim.lsp.buf.implementation, opts)
vim.keymap.set('n', '<localleader>gr', vim.lsp.buf.references, opts)
vim.keymap.set('n', '<localleader>e', vim.diagnostic.open_float, opts)
vim.keymap.set('n', '<localleader>n', vim.diagnostic.goto_next, opts)
vim.keymap.set('n', '<localleader>N', vim.diagnostic.goto_prev, opts)
vim.keymap.set('i', '<C-n>', vim.lsp.omnifunc, opts)
end,
})
vim.api.nvim_create_autocmd({ "BufNew"
, "TextChanged"
, "TextChangedI"
, "TextChangedP"
, "TextChangedT"
}, {
callback = function(args)
vim.diagnostic.disable(args.buf)
end
})
vim.api.nvim_create_autocmd({"BufWrite"}, {
callback = function(args)
vim.diagnostic.enable(args.buf)
end
})
'';
extraConfig = ''
set rnu nu
set ts=2 sw=2 expandtab
set clipboard=unnamedplus
set laststatus=3 noshowmode
set signcolumn=no
set linebreak
let g:cornelis_use_global_binary = 1
set conceallevel=2 concealcursor=nc
colorscheme gruvbox
hi Normal guibg=NONE ctermbg=NONE
let maplocalleader="!"
let g:bqn_prefix_key="!"
runtime agda-input.vim
call cornelis#bind_input(" ", "!")
call cornelis#bind_input("exc", "!")
inoremap <C-Space> <Esc>
nnoremap j gj
nnoremap k gk
nnoremap gj j
nnoremap gk k
au BufRead,BufNewFile *.agda call AgdaFiletype()
au BufRead,BufNewFile *.lagda.* call AgdaFiletype()
function! AgdaFiletype()
nnoremap <buffer> <C-c><C-l> :CornelisLoad<CR>
nnoremap <buffer> <C-c><C-r> :CornelisRefine<CR>
nnoremap <buffer> <C-c><C-c> :CornelisMakeCase<CR>
nnoremap <buffer> <C-c>, :CornelisTypeContext<CR>
nnoremap <buffer> <C-c>. :CornelisTypeContextInfer<CR>
nnoremap <buffer> <C-c><C-d> :CornelisTypeInfer<CR>
nnoremap <buffer> <C-c><C-s> :CornelisSolve<CR>
nnoremap <buffer> <C-c><C-a> :CornelisAuto<CR>
nnoremap <buffer> gd :CornelisGoToDefinition<CR>
nnoremap <buffer> <C-c><C-b> :CornelisPrevGoal<CR>
nnoremap <buffer> <C-c><C-f> :CornelisNextGoal<CR>
nnoremap <buffer> <C-c><C-u> :CornelisIgnoreAbstract<CR>
nnoremap <buffer> <C-c><space> :CornelisGive<CR>
endfunction
'';
plugins = (with pkgs.vimPlugins; [
nvim-surround
comment-nvim
vimtex
gruvbox-nvim
tmux-nvim
nvim-lspconfig
idris2-vim
numb-nvim
typst-vim
orgmode
vim-obsession
lean-nvim
lualine-nvim
]) ++ [
extra.cornelis-vim
extra.bqn-vim
extra.bqn-nvim
];
};
}

View File

@ -1,511 +0,0 @@
{ pkgs, unstable, cornelis, cornelis-vim, agda, slippi-netplay, ... }:
let username = "rachel";
homeDir = "/home/${username}";
SAX2NF = import ../shared/sax2nf.nix { inherit pkgs; };
hpkgs = pkgs.haskellPackages;
hls_wrapper = pkgs.writeScript "hls" ''
export PATH="${hpkgs.haskell-language-server}/bin:$PATH"
exec ${hpkgs.haskell-language-server}/bin/haskell-language-server-wrapper "$@"
'';
in
{
home = {
username = username;
homeDirectory = homeDir;
packages = with pkgs; [
unzip
zip
xz
gzip
bzip2
p7zip
usbutils
pciutils
nettools
nmap
arp-scan
julia-bin
(python3.withPackages (ps: with ps; [
ipython
matplotlib
numpy
scipy
]))
hpkgs.ghc
firefox
gnupg
agda
discord
dig
xxd
unstable.zoom-us
slack
imagemagick
ffmpeg
sl
cowsay
lolcat
fortune
banner
yt-dlp
libreoffice
protonmail-bridge
pass
protonvpn-cli_2
thunderbird
tidal-hifi
signal-desktop
transmission-gtk
xclip
clinfo
glxinfo
vulkan-tools
obs-studio
file
gimp
SAX2NF
twemoji-color-font
bat
steam
steam-run
rmapi
lutris
texlive.combined.scheme-full
cornelis
zulip
rink
sage
typst
ttyper
idris2
prismlauncher
vimv
whalebird
lean4
slippi-netplay
unstable.kicad
remmina
unstable.renoise
git-crypt
vcv-rack
];
stateVersion = "24.05";
};
xdg.userDirs = {
enable = true;
createDirectories = true;
desktop = "${homeDir}";
documents = "${homeDir}/doc";
download = "${homeDir}/dwn";
music = "${homeDir}/music";
pictures = "${homeDir}/img";
publicShare = "${homeDir}/srv";
templates = "${homeDir}/doc/templates";
videos = "${homeDir}/vid";
};
programs = {
bash = {
enable = true;
enableCompletion = false;
historyFile = "/dev/null";
sessionVariables = {
PS1 ="\\033[1m\\u\\033[0m@\\033[1m\\h\\033[0m: \\w\nλ ";
BROWSER = "firefox";
XINITRC = "${homeDir}/bin/xinitrc";
XAUTHORITY = "${homeDir}/.local/share/Xauthority";
PASH_KEYID = "3E4A909C8FEF6E3783699C79DFC26EF8EDAD6D71";
QT_AUTO_SCREEN_FACTOR = 1;
PATH = "${homeDir}/bin:$PATH";
};
shellAliases = {
x = "startx";
rm = "rm -i";
cal = "cal -m";
};
initExtra = ''
source ~/.profile
set -o vi
'';
};
mpv = {
enable = true;
config = {
hwdec = "auto-safe";
vo = "gpu";
profile = "gpu-hq";
};
};
rofi = {
enable = true;
theme = "gruvbox-dark-soft";
};
git = {
enable = true;
userName = "Rachel Lambda Samuelsson";
userEmail = "depsterr@protonmail.com";
extraConfig = {
init.defaultBranch = "master";
};
};
neovim = {
defaultEditor = true;
enable = true;
vimAlias = true;
extraLuaConfig = ''
require('tmux').setup({ copy_sync = { redirect_to_clipboard = true } });
require('Comment').setup()
require('nvim-surround').setup()
require('numb').setup()
local lspcfg = require('lspconfig')
lspcfg.typst_lsp.setup({
cmd = { '${pkgs.typst-lsp}/bin/typst-lsp' },
})
lspcfg.rust_analyzer.setup({})
lspcfg.hls.setup({
cmd = { '${hls_wrapper}', 'lsp' },
})
lspcfg.pyright.setup({
cmd = { '${pkgs.nodePackages.pyright}/bin/pyright-langserver', '--stdio' },
})
lspcfg.nixd.setup({
cmd = { '${pkgs.nixd}/bin/nixd' },
})
lspcfg.ltex.setup({
cmd = { '${pkgs.ltex-ls}/bin/ltex-ls' },
filetypes = { 'bib', 'gitcommit', 'markdown', 'plaintext', 'tex', 'pandoc', 'typst' },
settings = {
ltex = {
language = 'en-US'
}
}
})
lspcfg.clangd.setup({
cmd = { '${pkgs.clang-tools}/bin/clangd' },
})
lspcfg.ocamllsp.setup({})
lspcfg.purescriptls.setup({})
require('orgmode').setup({})
require('lean').setup({
mappings = true,
})
require('lualine').setup {
options = {
icons_enabled = true,
theme = 'gruvbox',
component_separators = { left = "", right = ""},
section_separators = { left = "", right = ""},
always_divide_middle = true,
globalstatus = false,
refresh = {
statusline = 1000,
tabline = 1000,
winbar = 1000,
}
},
sections = {
lualine_a = {'mode'},
lualine_b = { {
'diagnostics',
always_visible = true,
on_click = function(n,b,m)
vim.diagnostic.goto_next()
end
} },
lualine_c = {'filename'},
lualine_x = {'encoding', 'filetype'},
lualine_y = {'progress'},
lualine_z = {'location'}
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = {'filename'},
lualine_x = {'location'},
lualine_y = {},
lualine_z = {}
},
}
vim.api.nvim_create_autocmd('LspAttach', {
callback = function(args)
local opts = { buffer = args.buf }
vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts)
vim.keymap.set('n', '<localleader>r', vim.lsp.buf.rename, opts)
vim.keymap.set('n', '<localleader>a', vim.lsp.buf.code_action, opts)
vim.keymap.set('n', '<localleader>gd', vim.lsp.buf.definition, opts)
vim.keymap.set('n', '<localleader>gi', vim.lsp.buf.implementation, opts)
vim.keymap.set('n', '<localleader>gr', vim.lsp.buf.references, opts)
vim.keymap.set('n', '<localleader>e', vim.diagnostic.open_float, opts)
vim.keymap.set('n', '<localleader>n', vim.diagnostic.goto_next, opts)
vim.keymap.set('n', '<localleader>N', vim.diagnostic.goto_prev, opts)
vim.keymap.set('i', '<C-n>', vim.lsp.omnifunc, opts)
end,
})
vim.api.nvim_create_autocmd({ "BufNew"
, "TextChanged"
, "TextChangedI"
, "TextChangedP"
, "TextChangedT"
}, {
callback = function(args)
vim.diagnostic.disable(args.buf)
end
})
vim.api.nvim_create_autocmd({"BufWrite"}, {
callback = function(args)
vim.diagnostic.enable(args.buf)
end
})
'';
extraConfig = ''
set rnu nu
set ts=2 sw=2 expandtab
set clipboard=unnamedplus
set laststatus=3 noshowmode
set signcolumn=no
set linebreak
let g:cornelis_use_global_binary = 1
set conceallevel=2 concealcursor=nc
colorscheme gruvbox
hi Normal guibg=NONE ctermbg=NONE
let maplocalleader="!"
let g:bqn_prefix_key="!"
runtime agda-input.vim
call cornelis#bind_input(" ", "!")
call cornelis#bind_input("exc", "!")
inoremap <C-Space> <Esc>
nnoremap j gj
nnoremap k gk
nnoremap gj j
nnoremap gk k
au BufRead,BufNewFile *.agda call AgdaFiletype()
au BufRead,BufNewFile *.lagda.* call AgdaFiletype()
function! AgdaFiletype()
nnoremap <buffer> <C-c><C-l> :CornelisLoad<CR>
nnoremap <buffer> <C-c><C-r> :CornelisRefine<CR>
nnoremap <buffer> <C-c><C-c> :CornelisMakeCase<CR>
nnoremap <buffer> <C-c>, :CornelisTypeContext<CR>
nnoremap <buffer> <C-c>. :CornelisTypeContextInfer<CR>
nnoremap <buffer> <C-c><C-d> :CornelisTypeInfer<CR>
nnoremap <buffer> <C-c><C-s> :CornelisSolve<CR>
nnoremap <buffer> <C-c><C-a> :CornelisAuto<CR>
nnoremap <buffer> gd :CornelisGoToDefinition<CR>
nnoremap <buffer> <C-c><C-b> :CornelisPrevGoal<CR>
nnoremap <buffer> <C-c><C-f> :CornelisNextGoal<CR>
nnoremap <buffer> <C-c><C-u> :CornelisIgnoreAbstract<CR>
nnoremap <buffer> <C-c><space> :CornelisGive<CR>
endfunction
'';
plugins = let
bqn-vim = pkgs.vimUtils.buildVimPlugin {
name = "bqn-vim";
src = "${pkgs.fetchFromGitHub {
owner = "mlochbaum";
repo = "BQN";
rev = "f4b09b675386c789c8296c96874871916a3abdcf";
hash = "sha256-rvsageS5sYF9QvWuoRutjx5i0ngrfhGvIPRO834pwwM=";
}}/editors/vim";
};
bqn-nvim = pkgs.vimUtils.buildVimPlugin {
name = "bqn-nvim";
src = pkgs.fetchFromSourcehut {
owner = "~detegr";
repo = "nvim-bqn";
rev = "52d8b49f3ebc32d340e2e2b8dba1f6bbd1873b78";
hash = "sha256-5wITedTuUn9BKLqmQtPWeFNOa8dXfPIRpUvPSkNJcas=";
};
};
in
with pkgs.vimPlugins; [
nvim-surround
comment-nvim
vimtex
gruvbox-nvim
tmux-nvim
cornelis-vim
nvim-lspconfig
idris2-vim
numb-nvim
typst-vim
orgmode
vim-obsession
lean-nvim
bqn-vim
bqn-nvim
lualine-nvim
];
};
tmux = {
enable = true;
clock24 = true;
escapeTime = 0;
keyMode = "vi";
mouse = false;
shortcut = "a";
extraConfig = ''
bind h split -hb -c '#{pane_current_path}'
bind j split -v -c '#{pane_current_path}'
bind k split -vb -c '#{pane_current_path}'
bind l split -h -c '#{pane_current_path}'
is_vim="ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?\.?(view|n?vim?x?)(-wrapped)?(diff)?$'"
bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' 'select-pane -L'
bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' 'select-pane -D'
bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' 'select-pane -U'
bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-l' 'select-pane -R'
bind-key -T copy-mode-vi 'C-h' select-pane -L
bind-key -T copy-mode-vi 'C-j' select-pane -D
bind-key -T copy-mode-vi 'C-k' select-pane -U
bind-key -T copy-mode-vi 'C-l' select-pane -R
bind -n 'M-h' if-shell "$is_vim" 'send-keys M-h' 'resize-pane -L 1'
bind -n 'M-j' if-shell "$is_vim" 'send-keys M-j' 'resize-pane -D 1'
bind -n 'M-k' if-shell "$is_vim" 'send-keys M-k' 'resize-pane -U 1'
bind -n 'M-l' if-shell "$is_vim" 'send-keys M-l' 'resize-pane -R 1'
bind-key -T copy-mode-vi M-h resize-pane -L 1
bind-key -T copy-mode-vi M-j resize-pane -D 1
bind-key -T copy-mode-vi M-k resize-pane -U 1
bind-key -T copy-mode-vi M-l resize-pane -R 1
set -g pane-border-style bg=default
set -g pane-border-style fg="#1D1F21"
set -g pane-active-border-style bg=default
set -g pane-active-border-style fg="#333333"
set-option -g status on
set-option -g status-style bg=default
set-option -g status-style fg="#ef7627"
set-option -g status-interval 2
set-option -g status-justify "centre"
set-option -g status-right " λ "
set -g status-interval 1
set-window-option -g window-status-separator "-"
set-window-option -g window-status-current-format " #[fg=#b55690 bold]!![ #{b:pane_current_path}/ ] #{b:window_index} $ #{b:pane_current_command}!! "
set-window-option -g window-status-format " #{b:window_index} [ #{b:pane_current_path}/ ] #{b:pane_current_command} "
set -g @resurrect-strategy-nvim 'session'
set -g @resurrect-capture-pane-contents 'on'
'';
plugins = with pkgs.tmuxPlugins; [
resurrect
];
};
hyfetch = {
enable = true;
settings = {
preset = "lesbian";
mode = "rgb";
color_align = {
mode = "horizontal";
};
};
};
direnv = {
enable = true;
nix-direnv.enable = true;
};
alacritty = {
enable = true;
settings = {
window = {
padding.x = 5;
padding.y = 5;
decorations = "None";
dynamic_title = false;
};
mouse.hide_when_typing = true;
scrolling.history = 0;
font = {
normal.family = "SAX2 Nerd Font";
size = 11;
};
colors = {
draw_bold_text_with_bright_colors = false;
primary = {
background = "#1d1f21";
foreground = "#c5c8c6";
};
};
shell.program =
let tmux-menu = pkgs.writeScript "tmux-menu" ''
s="$(tmux ls 2>/dev/null)"
[ "$s" ] && s="$s
"
c=$(${pkgs.fzf}/bin/fzf -1 <<-EOF
''${s}New Session
Raw Shell
EOF
) || exit
case "$c" in
"New Session")
read -p "Name? " -r n
${pkgs.tmux}/bin/tmux new -s "$n" ;;
"Raw Shell")
${pkgs.bashInteractive}/bin/bash --login ;;
*)
${pkgs.tmux}/bin/tmux attach-session -t "''${c%%:*}" ;;
esac
''; in "${tmux-menu}";
};
};
ssh = {
enable = true;
matchBlocks = {
remarkable = {
hostname = "10.11.99.1";
user = "root";
};
lazarus = {
hostname = "rachel.cafe";
user = "deppy";
};
zelda = {
hostname = "zelda.dhack.se";
user = "dhack";
};
link = {
hostname = "link.dhack.se";
user = "dhack";
};
medli = {
hostname = "pub.dhack.se";
user = "hacke";
port = 222;
};
ganon = {
hostname = "ganon.dhack.se";
user = "lambda";
port = 222;
};
};
};
};
services = {
gpg-agent = {
enable = true;
pinentryPackage = pkgs.pinentry-qt;
};
};
}

30
home/shell.nix Normal file
View File

@ -0,0 +1,30 @@
{ common, ... }:
{
programs.bash = {
enable = true;
enableCompletion = false;
historyFile = "/dev/null";
sessionVariables = {
PS1 ="\\033[1m\\u\\033[0m@\\033[1m\\h\\033[0m: \\w\nλ ";
BROWSER = "firefox";
XINITRC = "${common.homeDir}/bin/xinitrc";
XAUTHORITY = "${common.homeDir}/.local/share/Xauthority";
PASH_KEYID = "3E4A909C8FEF6E3783699C79DFC26EF8EDAD6D71";
QT_AUTO_SCREEN_FACTOR = 1;
PATH = "${common.homeDir}/bin:$PATH";
};
shellAliases = {
x = "startx";
rm = "rm -i";
cal = "cal -m";
};
initExtra = ''
source ~/.profile
set -o vi
'';
};
programs.direnv = {
enable = true;
nix-direnv.enable = true;
};
}

34
home/ssh.nix Normal file
View File

@ -0,0 +1,34 @@
{ ... }:
{
programs.ssh = {
enable = true;
matchBlocks = {
remarkable = {
hostname = "10.11.99.1";
user = "root";
};
lazarus = {
hostname = "rachel.cafe";
user = "deppy";
};
zelda = {
hostname = "zelda.dhack.se";
user = "dhack";
};
link = {
hostname = "link.dhack.se";
user = "dhack";
};
medli = {
hostname = "pub.dhack.se";
user = "hacke";
port = 222;
};
ganon = {
hostname = "ganon.dhack.se";
user = "lambda";
port = 222;
};
};
};
}

28
home/terminal.nix Normal file
View File

@ -0,0 +1,28 @@
{ extra, ... }:
{
programs.alacritty = {
enable = true;
settings = {
window = {
padding.x = 5;
padding.y = 5;
decorations = "None";
dynamic_title = false;
};
mouse.hide_when_typing = true;
scrolling.history = 0;
font = {
normal.family = "SAX2 Nerd Font";
size = 11;
};
colors = {
draw_bold_text_with_bright_colors = false;
primary = {
background = "#1d1f21";
foreground = "#c5c8c6";
};
};
shell.program = extra.shell-menu;
};
};
}

62
home/tmux.nix Normal file
View File

@ -0,0 +1,62 @@
{ pkgs, ... }:
{
programs.tmux = {
enable = true;
clock24 = true;
escapeTime = 0;
keyMode = "vi";
mouse = false;
shortcut = "a";
extraConfig = ''
bind h split -hb -c '#{pane_current_path}'
bind j split -v -c '#{pane_current_path}'
bind k split -vb -c '#{pane_current_path}'
bind l split -h -c '#{pane_current_path}'
is_vim="ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?\.?(view|n?vim?x?)(-wrapped)?(diff)?$'"
bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' 'select-pane -L'
bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' 'select-pane -D'
bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' 'select-pane -U'
bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-l' 'select-pane -R'
bind-key -T copy-mode-vi 'C-h' select-pane -L
bind-key -T copy-mode-vi 'C-j' select-pane -D
bind-key -T copy-mode-vi 'C-k' select-pane -U
bind-key -T copy-mode-vi 'C-l' select-pane -R
bind -n 'M-h' if-shell "$is_vim" 'send-keys M-h' 'resize-pane -L 1'
bind -n 'M-j' if-shell "$is_vim" 'send-keys M-j' 'resize-pane -D 1'
bind -n 'M-k' if-shell "$is_vim" 'send-keys M-k' 'resize-pane -U 1'
bind -n 'M-l' if-shell "$is_vim" 'send-keys M-l' 'resize-pane -R 1'
bind-key -T copy-mode-vi M-h resize-pane -L 1
bind-key -T copy-mode-vi M-j resize-pane -D 1
bind-key -T copy-mode-vi M-k resize-pane -U 1
bind-key -T copy-mode-vi M-l resize-pane -R 1
set -g pane-border-style bg=default
set -g pane-border-style fg="#1D1F21"
set -g pane-active-border-style bg=default
set -g pane-active-border-style fg="#333333"
set-option -g status on
set-option -g status-style bg=default
set-option -g status-style fg="#ef7627"
set-option -g status-interval 2
set-option -g status-justify "centre"
set-option -g status-right " λ "
set -g status-interval 1
set-window-option -g window-status-separator "-"
set-window-option -g window-status-current-format " #[fg=#b55690 bold]!![ #{b:pane_current_path}/ ] #{b:window_index} $ #{b:pane_current_command}!! "
set-window-option -g window-status-format " #{b:window_index} [ #{b:pane_current_path}/ ] #{b:pane_current_command} "
set -g @resurrect-strategy-nvim 'session'
set -g @resurrect-capture-pane-contents 'on'
'';
plugins = with pkgs.tmuxPlugins; [
resurrect
];
};
}

15
home/xdg-dirs.nix Normal file
View File

@ -0,0 +1,15 @@
{ common, ... }:
{
xdg.userDirs = {
enable = true;
createDirectories = true;
desktop = "${common.homeDir}";
documents = "${common.homeDir}/doc";
download = "${common.homeDir}/dwn";
music = "${common.homeDir}/music";
pictures = "${common.homeDir}/img";
publicShare = "${common.homeDir}/srv";
templates = "${common.homeDir}/doc/templates";
videos = "${common.homeDir}/vid";
};
}

View File

@ -5,6 +5,7 @@
[ # Include the results of the hardware scan.
./hardware-configuration.nix
];
hardware.opengl = {
enable = true;
driSupport = true;

10
pkgs/bqn-nvim.nix Normal file
View File

@ -0,0 +1,10 @@
{ pkgs, ... }:
pkgs.vimUtils.buildVimPlugin {
name = "bqn-nvim";
src = pkgs.fetchFromSourcehut {
owner = "~detegr";
repo = "nvim-bqn";
rev = "52d8b49f3ebc32d340e2e2b8dba1f6bbd1873b78";
hash = "sha256-5wITedTuUn9BKLqmQtPWeFNOa8dXfPIRpUvPSkNJcas=";
};
}

10
pkgs/bqn-vim.nix Normal file
View File

@ -0,0 +1,10 @@
{ pkgs, ... }:
pkgs.vimUtils.buildVimPlugin {
name = "bqn-vim";
src = "${pkgs.fetchFromGitHub {
owner = "mlochbaum";
repo = "BQN";
rev = "f4b09b675386c789c8296c96874871916a3abdcf";
hash = "sha256-rvsageS5sYF9QvWuoRutjx5i0ngrfhGvIPRO834pwwM=";
}}/editors/vim";
}

20
pkgs/shell-menu.nix Normal file
View File

@ -0,0 +1,20 @@
{ pkgs, ... }:
pkgs.writeScript "tmux-menu" ''
s="$(${pkgs.tmux}/bin/tmux ls 2>/dev/null)"
[ "$s" ] && s="$s
"
c=$(${pkgs.fzf}/bin/fzf -1 <<-EOF
''${s}New Session
Raw Shell
EOF
) || exit
case "$c" in
"New Session")
read -p "Name? " -r n
${pkgs.tmux}/bin/tmux new -s "$n" ;;
"Raw Shell")
${pkgs.bashInteractive}/bin/bash --login ;;
*)
${pkgs.tmux}/bin/tmux attach-session -t "''${c%%:*}" ;;
esac
''

46
shared/graphical.nix Normal file
View File

@ -0,0 +1,46 @@
{ pkgs, ... }:
{
# [DESKTOP / XORG / WAYLAND]
services.libinput = {
enable = true;
touchpad = {
naturalScrolling = true;
accelProfile = "flat" ;
tapping = false;
};
};
services.xserver = {
enable = true;
desktopManager.plasma5.enable = true;
displayManager.startx.enable = true;
};
# [SOUND]
sound.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa = {
enable = true;
support32Bit = true;
};
pulse.enable = true;
jack.enable = true;
wireplumber.enable = true;
};
programs.gamemode = {
enable = true;
settings.general.renice = 20;
};
nixpkgs.config.allowUnfree = true;
programs.steam.enable = true;
ssbm.gcc = {
rules.enable = true;
oc-kmod.enable = true;
};
}

View File

@ -1,4 +0,0 @@
{
etaUser = "user";
etaPass = "pass";
}

View File

@ -1,10 +1,33 @@
{ pkgs, ... }:
{
services.openssh = {
enable = true;
# [LOCALE]
time.timeZone = "Europe/Stockholm";
i18n.defaultLocale = "en_GB.UTF-8";
i18n.supportedLocales = [ "sv_SE.UTF-8/UTF-8" "en_GB.UTF-8/UTF-8" "en_US.UTF-8/UTF-8" ];
# [NIX]
nix = {
settings = {
PasswordAuthentication = false;
PermitRootLogin = "no";
bash-prompt = "\\033[1m\\u\\033[0m@\\033[1m\\h\\033[0m: \\w\\n\\040";
experimental-features = [ "nix-command" "flakes" ];
auto-optimise-store = true;
};
gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 7d";
};
registry = {
templates = {
from = {
type = "indirect";
id = "templates";
};
to = {
type = "git";
url = "https://githug.xyz/xenchel/templates";
};
};
};
};
@ -23,55 +46,7 @@
options = [ "username=${secrets.etaUser}" "password=${secrets.etaPass}" "uid=1000" "gid=1000" "x-systemd.automount" "noauto" "x-systemd.idle-timeout=60" ];
};
# [LOCALE]
time.timeZone = "Europe/Stockholm";
i18n.defaultLocale = "en_GB.UTF-8";
i18n.supportedLocales = [ "sv_SE.UTF-8/UTF-8" "en_GB.UTF-8/UTF-8" "en_US.UTF-8/UTF-8" ];
# [NIX]
nix = {
settings = {
bash-prompt = "\\033[1m\\u\\033[0m@\\033[1m\\h\\033[0m: \\w\\n\\040";
experimental-features = [ "nix-command" "flakes" ];
auto-optimise-store = true;
};
gc = {
automatic = true;
dates = "monthly";
options = "--delete-older-than 30d";
};
registry = {
templates = {
from = {
type = "indirect";
id = "templates";
};
to = {
type = "git";
url = "https://githug.xyz/xenchel/templates";
};
};
};
};
nixpkgs.config.allowUnfree = true;
nixpkgs.config.permittedInsecurePackages = [
"electron-21.4.4" # needed for whalebird
];
# [DESKTOP / XORG / WAYLAND]
services.libinput = {
enable = true;
touchpad = {
naturalScrolling = true;
accelProfile = "flat" ;
tapping = false;
};
};
services.xserver = {
enable = true;
desktopManager.plasma5.enable = true;
displayManager.startx.enable = true;
xkb = {
layout = "fox,sus";
options = "ctrl:nocaps,grp:alt_shift_toggle";
@ -88,57 +63,18 @@
};
};
# [TTY]
console = {
useXkbConfig = true;
font = "LatGrkCyr-12x22";
};
# [SOUND]
sound.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa = {
enable = true;
support32Bit = true;
};
pulse.enable = true;
jack.enable = true;
wireplumber.enable = true;
};
# [PACKAGES / PROGRAMS]
environment.systemPackages = with pkgs; [
git
git-crypt
neovim
];
programs.gamemode = {
enable = true;
settings.general.renice = 20;
# [TTY]
console = {
useXkbConfig = true;
font = "LatGrkCyr-12x22";
};
programs.steam.enable = true;
ssbm.gcc = {
rules.enable = true;
oc-kmod.enable = true;
};
# [SERVICES]
services.printing.enable = true;
virtualisation.docker.enable = true;
services.mullvad-vpn.enable = true;
# [SECURITY / FIREWALL]
networking.firewall.enable = true;
networking.firewall.allowedTCPPorts = [ 22 ];
networking.firewall.allowedUDPPorts = [ ];
security.doas = {
enable = true;
@ -166,4 +102,15 @@
{ domain = "rachel"; item = "nice"; "type" = "soft"; value = "-20"; }
{ domain = "rachel"; item = "nice"; "type" = "hard"; value = "-20"; }
];
# [SERVICES]
services.printing.enable = true;
virtualisation.docker.enable = true;
services.mullvad-vpn.enable = true;
# [SECURITY / FIREWALL]
networking.firewall.enable = true;
networking.firewall.allowedTCPPorts = [ 22 ];
networking.firewall.allowedUDPPorts = [ ];
}