6TJTI7RQ5QVCBPW6BKPUL6XUFWUIMXH774UAFCHACDJQWDMPSZNQC
SNCOKBGW5XHTOI72EPWGTUZI4FZK6O6CLNTNY3LH2D2QT6BZM5BAC
4J5GC67QDL4YO5PEF3FHLWGAIWBSHKZ4S3WG255ZRX4ZIB53534QC
7OOABPHKCQBCIB6YUMETOR6KVYJONJ5JAJX4ZDIZISRGRDY3WSVQC
B6YZNQS2YX5UMPWDEYGNC52JTO6MRUDPTBC5S75J2XOKXELS3YVAC
WLLPOYIUYNE3OKZQC5TLIY65ST3V7GE7RS4IYDNB7ZOAP3HTC4JQC
64KRRITXAUNELXLHWGAUJVTVJ6WLT7T6BGUCLZ3BGDPSMBZB4FOAC
6DJMGNUZH6GRTMHKGTGO4NSD76GXLSHZYSCW5RQVZTVBV2NEYSZAC
GSZ2E4PT47MZ575HYODAJ2YM53MAMZDXMEGASNUG7UZSNIZ4ZDPQC
YDNYI6EHTQXMT336HEKVLUUAIONHONFEQW6QVCNMGV3L3ZAEH5QQC
QZMI2QSXRMEMD5QVE3ITSCOB43J7AMBQV3XUNXOSVUV34UTU6ZWQC
3QADNAEY3XETROQD3FVNLGAZH2KBYQPN2RV5FVRKBUYAYKR75E3AC
PH6PUMEIGNEYYHP7UTZOQE7J2SOYXJVLY4WAMRCH4R75XBVTMHWAC
FLHMG3HM4LJFW4UPX4NVUXMENQTWUXDILTXVB3UAE4Q6X7I7WUZAC
J33BXYY54CWVXK2PGHJFSJWACVIZKNSKDPVZ5F22TEBIFRP3LZTAC
V6RGMA3WJZROMZR3BMLOGUG5M3K7DHGVIOSH7QFR23OUUNFP7ESAC
RVUY33442OJ27DP6JUYUD6AXFTPUSKLTKRK5HXAO33JDLMJONAUQC
GGKSPLOM4NMOFIKWY5DUIYUL7QFU4UQ54GWS2ER7Z3R3YW4SKVRQC
XWDYSQGRZY2ALY4IS7RJNLNDAKKTLSPMHJTRNQ4NAPVTCCVQOKRAC
MOVQVOTH2V43VZF7OVQ4MB2KN47YBAZ4KTPH7L4COKGFH5T7SQ3AC
AG6NZ2XYXP73NZLHV6LTAS3SKERCWGHV25KOF6NYHWJGUH5QJ6KAC
754YTU7I36EMCIJM5HYFKQUMQSC4S2CIBBZIN7QTJ7KGHEKIGY2QC
U3RGONZCT7H3NP2S3R3J4ABWDNSJMFT3RRFZKK2PMWQMMICIV7KAC
KNX4AWHRZH53FW6ME7AYJ425QX7GG3UKB2LER7ZPSX2BFAODAFKAC
POHY75757KMHNN7QRU72S4WL5TJJ7QQORFWJ7GHW7CRPF4WKX5IAC
O5XDU5KPK72PHTH2JTZWQS7MIVYCWID7PTE54KS4QW2KDZJCCAJAC
NID74IBESPTJUVIH7G6VBVJXUY7GBX654AMIG2MWFHFRMI7RZXAQC
2BXRWYE2ZSSO6G5GEVUHMX2MR2HDWJMSXCQEZDSXVYTPOYVGKEJAC
F2MVE4TY5BDP4DULREZSJVPB4GEGV72LASYSMUDBQQO56NSV7ZXAC
DCGSYC422QB66HGE5M2BBNRFTUOVDYUVLBHULDSEUM42SAPON3WQC
JXVZMI5QUFMXRE4IMUN23P3OJSPG64BILE3NGKZHG7FXOJWVBJIQC
NTFTD777J7E4TZ4YKR2EXL56IRDEPAHARARVUGDTRX7OHMXWA7OAC
GESPFUP5JB2WKOV3T4MRCRUPQLZDLYXLHGXZUY22XU7NBRZXXNGAC
FSMV4EXZUCFBJ5D7ZD4DBQ7VW6OP32UFUNU3KJ44SY635AYYZTDAC
UX5O22STSSTOVB3RI4XAZFFW34HXAZFU3SZG32PKSQRWTZWFCE7AC
UQE4JKJAQYAV5TAAB2CMJSEF72DEOAQDN3LH3RUNOOHH6CQ6WKGAC
LWJLYBQOQONVNSVFUO23FAAP3MF6XIWU23UKIAIPYOILKHEWSFMQC
DVAYYZXBNNEQ2UNGHYYOQ4R7A66AMME62F2I7RT2BBBS5GKLWT7AC
EQIYV4GQF2HJB6AGRGBCSBZSETC7EZ2SOZOMYFRNNN7RODZ5EQ3QC
AK3JQHSUO5LSFMNIIGANP7WPBKF6JDFNHRTT6RJHIRFGWFD5AOKQC
W54OS46MUCHZQJ4ZPV5PKB5LEJ76Y35R7KX5G5MAHKQZNWZLVYYQC
Z2GVGCFGXTKED56MKN2RZ4XN7JZR4PGCQFY2WKTT77OC4V54TV2QC
JB324YVUIGIJPM2BUXD5MLYRHL223R2YZQDR6KTNHYG7LYFRIFHAC
PS7LDKAZVPMMA3PABPPEF4IFMTTZRHOM2E3472L2SOQUCYVF7U4AC
I25MEXARE4V66FEQ5PM2O6GYQWFH6YB5CUAB76ZJSZAJLDUP47RAC
H6CBBPN6H6PBCGACZVB4JKMEFZVFWS7AXN6VQNHGRVNVY4CWA5HQC
FDRAOWKYU7YPUTTTO2XNYJI2YSXDT3H3Y3QWK5AYC5EZ7Q3TROZAC
VDKCTFS4SJKJNMWX4R56TMAV4CY7P3X7GRCNCX22M33AFYSL5VSAC
ZUC2XEHFVGOKVCVLXIO4R3MSLH3PIYMOVN3UOUCNSPRPZVDK7FKAC
736ULOPNTH26YEXM5HWM2J4XZPXC52IGKQH5ARAS5ID55B4253QAC
UCC6KWKXYJSZHLJ67RWHPOXBOI3PUHD6RXOW5ZP574WAEJE4BONAC
5U2VM4AB42255KJAFRVNOWHZ4MFVU3BNHH6SCOGWSBAEOJ7BITAQC
M5RWEN2I7CNKLRZ3CCCRHNRKX5TUQNIXN3QUMDLFXRVK34DZIHLQC
5SSIJYGUSTMINGPKXWM444A4FHL66MW45NWOKIIODXZBFDSMM2EQC
6D5SIXKDY2S73NU3ZTVST5JFET3CS637VKYRTXYGATMRKFYCHJCQC
76DOBVJ3FUERL2SQQ5ONCMY6VOT2FBFMQSLZ2WASKFDM26D6AFVAC
3RR5DRIEGCCDE7JJBUKMUUPZQYYAIMP5RLRLZGVPI2KTIAWSS6UAC
WJJ3NYDZDHTDVSU6FT7JKWATKX3S6ES5KU3BB7TXN5U7PV4RC5TAC
# Make this an overlay.
{ config, pkgs, ... }:
let
extensions = with pkgs.vscode-extensions;
{
name = "pretty-formatter";
publisher = "mblode";
version = "0.2.2";
sha256 = "1kdcxdvccf1fhg8lr8zwi5v7l2ja02p1kxq871jgakq2y42fclpy";
}
{
name = "rust-analyzer";
publisher = "matklad";
version = "0.2.297";
sha256 = "0pj29k5pm1p7f987x9rjd0pks552fxvjv72dscxsk84svl132s0f";
}
{
name = "cmake-tools";
publisher = "ms-vscode";
version = "1.4.2";
sha256 = "1azjqd5w14q1h8z6cib4lwyk3h9hl1lzzrnc150inn0c7v195qcl";
}
{
name = "CMake";
publisher = "twxs";
version = "0.0.17";
sha256 = "11hzjd0gxkq37689rrr2aszxng5l9fwpgs9nnglq3zhfa1msyn08";
}
];
vscode =
pkgs.vscode-with-extensions.override { vscodeExtensions = extensions; };
in { home.packages = [ vscode ]; }
}
{
name = "nix-env-selector";
publisher = "arrterian";
version = "1.0.7";
sha256 = "0mralimyzhyp4x9q98x3ck64ifbjqdp8cxcami7clvdvkmf8hxhf";
}
{
name = "vsliveshare";
publisher = "ms-vsliveshare";
version = "1.0.4272";
sha256 = "0dhs9lkprz2q79kpkj2d22d09lvhl77n38vj0rsz80g9vj41jzwh";
[ bbenoist.Nix ms-vscode.cpptools ms-python.python vscodevim.vim ]
++ pkgs.vscode-utils.extensionsFromVscodeMarketplace [
# A lot of this is gotten from https://github.com/alexarice/dotfiles/blob/18557c8e0bdd1c564ea68f8bb25a1894973d254d/dotfiles/sway.nix
{ config, pkgs, lib, ... }:
let inherit (config) dots scripts modifier;
in {
wayland.windowManager.sway = {
enable = true;
config = {
bars = [ ];
colors = {
focused = {
border = "#81c1e4";
background = "#81c1e4";
text = "#FFFFFF";
indicator = "#2e9ef4";
childBorder = "#81c1e4";
};
focusedInactive = {
border = "#282a36";
background = "#282a36";
text = "#999999";
indicator = "#484e50";
childBorder = "#282a36";
};
unfocused = {
border = "#282a36";
background = "#282a36";
text = "#999999";
indicator = "#282a36";
childBorder = "#282a36";
};
urgent = {
border = "#FF0000";
background = "#8C5665";
text = "#FF0000";
indicator = "#900000";
childBorder = "#FF0000";
};
};
output = {
"*" = { bg = ''"${dots + "/wallpaper.png"}" fill''; };
"eDP-1" = {
pos = "0 0";
res = "1920x1080";
};
"HDMI-A-1" = {
pos = "1920 0";
res = "1920x1080";
};
};
input = {
"1133:16489:Logitech_MX_Master_2S" = {
#disable mouse acceleration
pointer_accel = "-1";
};
};
gaps = {
inner = 5;
outer = 10;
bottom = 0;
smartBorders = "on";
};
inherit modifier;
terminal = "alacritty";
workspaceAutoBackAndForth = true;
keybindings = lib.mkOptionDefault {
"${modifier}+p" = "exec grim -g $(slurp) - | wl-copy";
"${modifier}+Shift+p" =
"exec grim -o $(swaymsg --pretty -t get_outputs | awk '/focused/ {print $2}') - | wl-copy";
"${modifier}+Ctrl+d" = ''exec "shutdown -h now"'';
};
window = {
border = 1;
titlebar = false;
};
};
};
}
startup = [
#{ command = "dropbox start"; always = true; }
{
command = "mako";
always = true;
}
{
command = "waybar";
always = true;
}
];
let
pkgs = import <nixos> { };
unstable = import <unstable> { };
inherit (config) dots;
home.packages = with pkgs; [
bat # required by my nixconfig
fzf # required by my nixconfig
];
enable = true;
vimAlias = true;
viAlias = true;
withNodeJs = true;
withRuby = true;
};
}
extraConfig = "lua require('config')";
plugins = [ ]
++ (builtins.map (plugin: { inherit plugin; }) startupPlugins);
home.file.".config/nvim/lua".source = dots + "/nvim/lua";
programs.neovim = let
startupPlugins = with pkgs.vimPlugins; [
unstable.vimPlugins.coc-nvim # coc needs to stay up to date.
auto-pairs
vim-highlightedyank
vim-rooter
fzf-vim
base16-vim
yats-vim
vim-gitgutter
vimtex
vim-airline
vim-sensible
vim-nix
(buildVimPlugin {
pname = "vimpeccable";
version = "10-31-2020";
src = (pkgs.fetchFromGitHub {
owner = "svermeulen";
repo = "vimpeccable";
rev = "00300b311de64d91b3facc1e4a6fe11463735e68";
sha256 = "0mb8a7ypd6pvbjpa46h9hmc8isvxfmn7dq5gcpdg6h2wmkgrv4c4";
});
})
];
in {
in let buildVimPlugin = pkgs.vimUtils.buildVimPlugin;
in {
{ config, ... }:
{ ... }: {
programs.alacritty = {
enable = true;
settings = {
colors = {
primary = {
background = "0x1b2b34";
foreground = "0xc0c5ce";
};
cursor = {
text = "0x1b2b34";
cursor = "0xc0c5ce";
};
normal = {
black = "0x1b2b34";
red = "0xec5f67";
green = "0x99c794";
yellow = "0xfac863";
blue = "0x6699cc";
magenta = "0xc594c5";
cyan = "0x5fb3b3";
white = "0xc0c5ce";
};
bright = {
black = "0x65737e";
red = "0xec5f67";
green = "0x99c794";
yellow = "0xfac863";
blue = "0x6699cc";
magenta = "0xc594c5";
cyan = "0x5fb3b3";
white = "0xd8dee9";
};
};
};
};
}
shell = "ion";
font = {
size = 12;
normal = {
family = "Fira Code Nerd Font";
style = "Mono";
};
};
{ config, ... }:
let inherit (config) dots;
in {
xdg.configFile."waybar/style.css".text =
builtins.readFile (dots + "/waybar/style.css");
xdg.configFile."waybar/config".text =
builtins.readFile (dots + "/waybar/config");
}
{ config, pkgs, ... }: {
programs.git = {
enable = true;
userName = "awesomearvinder";
userEmail = "ArvinderDhan@gmail.com";
};
}
let unstable = import <unstable> { };
in unstable.rustPlatform.buildRustPackage rec {
pname = "buzz";
version = "04-29-21";
nativeBuildInputs = [
pkgconfig
openssl
glib
pango
atk
gdk-pixbuf
gtk3
libappindicator
llvmPackages.libclang
clang
];
buildInputs = [
pkgconfig
openssl
glib
cairo
pango
atk
gdk-pixbuf
gtk3
libappindicator
llvmPackages.libclang
];
src = fetchFromGitHub {
owner = "jonhoo";
repo = pname;
rev = "02479643ed1b0325050245dbb3b70411b8cffb7a";
sha256 = "1spklfv02qlinlail5rmhh1c4926gyrkr2ydd9g6z919rxkl0ywk";
};
LIBCLANG_PATH = "${llvmPackages.libclang}/lib";
cargoSha256 = "1saj2r337jmy0fzyriyk7xk6q30d0hzl8zdl06f9xbmvdmmjddjy";
}
{ fetchFromGitHub, pkgconfig, openssl, glib, pango, atk, gdk-pixbuf, gtk3
, libappindicator, llvmPackages, clang, cairo, ... }:
* {
border: none;
border-radius: 0;
font-family: sans-serif;
font-size: 14px;
}
window {
background: rgba(0, 0, 0, 0.4);
color: white;
}
#workspaces button {
padding: 5px 10px;
background: transparent;
color: white;
border-bottom: 3px solid transparent;
}
#workspaces button.icon label {
font-size: 10px;
}
#workspaces button.focused {
background: rgba(200, 200, 200, 0.1);
border-bottom: 3px solid white;
}
#clock,
#battery,
#cpu,
#memory,
#network,
#pulseaudio,
#backlight,
#temperature,
#tray {
padding: 0 6px;
margin: 0 2px;
}
@keyframes blink {
to {
background-color: #ffffff;
color: black;
}
}
#battery.warning {
background: #f53c3c;
color: white;
animation-name: blink;
animation-duration: 0.5s;
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-direction: alternate;
}
{
// "layer": "top", // Waybar at top layer
// "position": "bottom", // Waybar position (top|bottom|left|right)
"height": 30, // Waybar height (to be removed for auto height)
// "width": 1280, // Waybar width
// Choose the order of the modules
"modules-left": ["sway/workspaces", "sway/mode", "custom/media"],
//"modules-center": ["sway/window"],
"modules-right": ["pulseaudio", "battery", "backlight", "temperature", "network", "clock", "tray"],
// Modules configuration
// "sway/workspaces": {
// "disable-scroll": true,
// "all-outputs": true,
// "format": "{name}: {icon}",
// "format-icons": {
// "1": "",
// "2": "",
// "3": "",
// "4": "",
// "5": "",
// "urgent": "",
// "focused": "",
// "default": ""
// }
// },
"sway/mode": {
"format": "<span style=\"italic\">{}</span>"
},
"mpd": {
"format": "{stateIcon} {consumeIcon}{randomIcon}{repeatIcon}{singleIcon}{artist} - {album} - {title} ({elapsedTime:%M:%S}/{totalTime:%M:%S}) ",
"format-disconnected": "Disconnected ",
"format-stopped": "{consumeIcon}{randomIcon}{repeatIcon}{singleIcon}Stopped ",
"unknown-tag": "N/A",
"interval": 2,
"consume-icons": {
"on": " "
},
"random-icons": {
"off": "<span color=\"#f53c3c\"></span> ",
"on": " "
},
"repeat-icons": {
"on": " "
},
"single-icons": {
"on": "1 "
},
"state-icons": {
"paused": "",
"playing": ""
},
"tooltip-format": "MPD (connected)",
"tooltip-format-disconnected": "MPD (disconnected)"
},
"idle_inhibitor": {
"format": "{icon}",
"format-icons": {
"activated": "",
"deactivated": ""
}
},
"tray": {
// "icon-size": 21,
"spacing": 10
},
"clock": {
// "timezone": "America/New_York",
"tooltip-format": "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>",
"format-alt": "{:%Y-%m-%d}"
},
"cpu": {
"format": "{usage}% ",
"tooltip": false
},
"memory": {
"format": "{}% "
},
"temperature": {
// "thermal-zone": 2,
// "hwmon-path": "/sys/class/hwmon/hwmon2/temp1_input",
"critical-threshold": 80,
// "format-critical": "{temperatureC}°C {icon}",
"format": "{temperatureC}°C {icon}",
"format-icons": ["", "", ""]
},
"backlight": {
// "device": "acpi_video1",
"format": "{percent}% {icon}",
"format-icons": ["", ""]
},
"battery": {
"states": {
// "good": 95,
"warning": 30,
"critical": 15
},
"format": "{capacity}% {icon}",
"format-charging": "{capacity}% ",
"format-plugged": "{capacity}% ",
"format-alt": "{time} {icon}",
// "format-good": "", // An empty format will hide the module
// "format-full": "",
"format-icons": ["", "", "", "", ""]
},
"battery#bat2": {
"bat": "BAT2"
},
"network": {
// "interface": "wlp2*", // (Optional) To force the use of this interface
"format-wifi": "{essid} ({signalStrength}%) ",
"format-ethernet": "{ifname}: {ipaddr}/{cidr} ",
"format-linked": "{ifname} (No IP) ",
"format-disconnected": "Disconnected ⚠",
"format-alt": "{ifname}: {ipaddr}/{cidr}"
},
"pulseaudio": {
// "scroll-step": 1, // %, can be a float
"format": "{volume}% {icon} {format_source}",
"format-bluetooth": "{volume}% {icon} {format_source}",
"format-bluetooth-muted": " {icon} {format_source}",
"format-muted": " {format_source}",
"format-sorce": "{volume}% ",
"format-source-muted": "",
"format-icons": {
"headphone": "",
"hands-free": "",
"headset": "",
"phone": "",
"portable": "",
"car": "",
"default": ["", "", ""]
},
"on-click": "pavucontrol"
},
"custom/media": {
"format": "{icon} {}",
"return-type": "json",
"max-length": 40,
"format-icons": {
"spotify": "",
"default": "🎜"
},
"escape": true,
"exec": "$HOME/.config/waybar/mediaplayer.py 2> /dev/null" // Script in resources folder
// "exec": "$HOME/.config/waybar/mediaplayer.py --player spotify 2> /dev/null" // Filter player based on name
}
}
add_newline = false
[line_break]
disabled = true
[cmd_duration]
disabled = true
[username]
show_always = true
format = "[$user]($style)"
[aws]
symbol = " "
[battery]
disabled = true
[conda]
symbol = " "
[dart]
symbol = " "
[directory]
format = "[$path](bg:#0578fc fg:#141414)"
[docker]
symbol = " "
[elixir]
symbol = " "
disabled = true
[elm]
symbol = " "
disabled = true
[git_commit]
disabled = true
[git_branch]
symbol = " "
format = "[on $branch]($style)"
[golang]
symbol = " "
[haskell]
symbol = " "
[hg_branch]
symbol = " "
[java]
symbol = " "
[julia]
symbol = " "
[memory_usage]
symbol = " "
[nim]
symbol = " "
[nix_shell]
symbol = " "
[nodejs]
symbol = " "
[package]
symbol = " "
disabled = true
[perl]
symbol = " "
[php]
symbol = " "
[python]
symbol = " "
[ruby]
symbol = " "
[rust]
symbol = " "
[swift]
symbol = "ﯣ "
local setOptions = function()
local scopes = {o = vim.o, b = vim.bo, w = vim.wo}
local opt = function(scope, key, value)
scopes[scope][key] = value
if scope ~= 'o' then scopes['o'][key] = value end
end
vim.wo.relativenumber = true
vim.wo.number = true
vim.bo.shiftwidth = 4
vim.bo.tabstop = 4
vim.bo.expandtab = true
vim.o.updatetime = 300
vim.o.splitbelow = true
vim.o.termguicolors = true
vim.o.showcmd = true
end
local latexSetUp = function()
vim.g.tex_flavor = 'latex'
vim.g.vimtex_view_general_viewer = 'zathura'
end
local cocSetUp = function()
end
local gitgutterSetUp = function()
vim.g.gitgutter_sign_added = '✚'
vim.g.gitgutter_sign_modified = '✹'
vim.g.gitgutter_sign_removed = '-'
vim.g.gitgutter_sign_removed_first_line = '-'
vim.g.gitgutter_sign_modified_removed = '-'
end
local setUpAll = function()
setOptions()
gitgutterSetUp()
latexSetUp()
cocSetUp()
end
local setKeybindings = function()
--keybindings (would love to get vimp working)
vim.api.nvim_set_keymap('', '<c-n>', ':lua require(\'plugins/Terminal\').open(0.8, 0.8) <CR>', {silent = true})
vim.api.nvim_set_keymap('', '<c-t>', ':lua require(\'plugins/FZF\').open(\'vert new\', 0.8, 0.8) <CR>', {silent = true})
vim.api.nvim_set_keymap('', '<c-r>', ':lua require(\'plugins/FZF\').open(\'e\', 0.8, 0.8) <CR>', {silent = true})
vim.api.nvim_set_keymap('', '<A-h>', ':wincmd h <CR>', {})
vim.api.nvim_set_keymap('', '<A-j>', ':wincmd j <CR>', {})
vim.api.nvim_set_keymap('', '<A-k>', ':wincmd k <CR>', {})
vim.api.nvim_set_keymap('', '<A-l>', ':wincmd l <CR>', {})
end
-- entry point
local main = function()
--set color
vim.cmd('colorscheme base16-gruvbox-dark-hard')
setKeybindings()
setUpAll()
end
main()
vim.api.nvim_set_keymap('n', 'gd', '<Plug>(coc-definition)', {})
vim.api.nvim_set_keymap('n', 'gy', '<Plug>(coc-type-definition)', {})
vim.api.nvim_set_keymap('n', 'ga', '<Plug>(coc-codeaction)', {})
vim.api.nvim_command('autocmd BufWritePre * :silent! call CocAction(\'format\')')
vim.g.coc_global_extensions = { 'coc-omnisharp', 'coc-rust-analyzer', 'coc-go', 'coc-actions', 'coc-emmet', 'coc-css', 'coc-tsserver', 'coc-prettier', 'coc-deno','coc-html', 'coc-eslint', 'coc-texlab', 'coc-pyright'}
local r = {
-- Makes a window and returns it's buffer.
make_window = function(width, height, x, y, style, relative)
local buf = vim.api.nvim_create_buf(false, true)
local opts = {
style = style,
relative = relative,
width = width,
height = height,
row = x,
col = y
}
local win = vim.api.nvim_open_win(buf, true, opts)
return buf
end
}
return r
--Opens a terminal in a floating window.
local OpenTerminal = function(size_x_percent, size_y_percent)
local utils = require('plugins/utils')
local width = vim.api.nvim_get_option("columns")
local height = vim.api.nvim_get_option("lines")
local win_height = math.ceil(height * size_x_percent)
local win_width = math.ceil(width * size_y_percent)
local col_pos = math.floor(width * (1-size_y_percent)/2)
local row_pos = math.floor(height * (1-size_x_percent)/2)
local buffer = utils.make_window(win_width, win_height, row_pos, col_pos, "minimal", "editor")
vim.api.nvim_command('term')
end
local r = {
-- Takes a x and y as percentage size of the screen.
open = function(x, y) OpenTerminal(x, y) end
}
return r
--Make a new fzf window.
local OpenFZF = function(action, size_x_percent, size_y_percent)
--vim.g.fzf_colors = {
-- ["fg"]= {'fg', 'Normal'},
-- ["bg"]= {'bg', 'Normal'},
-- ["hl"]= {'fg', 'Comment'},
-- ["fg+"]= {'fg', 'CursorLine', 'CursorColumn', 'Normal'},
-- ["bg+"]= {'bg', 'CursorLine', 'CursorColumn'},
-- ["hl+"]= {'fg', 'Statement'},
-- ["info"]= {'fg', 'PreProc'},
-- ["border"]= {'fg', 'Ignore'},
-- ["prompt"]= {'fg', 'Conditional'},
-- ["pointer"]= {'fg', 'Exception'},
-- ["marker"]= {'fg', 'Keyword'},
-- ["spinner"]= {'fg', 'Label'},
-- ["header"]= {'fg', 'Comment'}
--}
local cmd = ":call fzf#run(fzf#wrap({"..
string.format("'sink': '%s',", action)..
"'source': 'rg --files',"..
[['options': '--preview-window=50% --preview="bat {} --color=always --style=plain"',]]..
string.format("'window': {'width': %f, 'height': %f, 'border': 'no'},", size_x_percent, size_y_percent)..
"}))"
vim.api.nvim_command(cmd)
end
local r = {
open = function(action, x, y) OpenFZF(action, x, y) end
}
return r
{
"python.linting.pylintEnabled": true,
"python.formatting.provider": "black",
}
"python.formatting.blackPath": "/home/bender/.nix-profile/bin/black",
"rust-analyzer.server.path": "rust-analyzer"
Preamp: -7.6 dB
Filter 1: ON PK Fc 34 Hz Gain 6.9 dB Q 0.65
Filter 2: ON PK Fc 1599 Hz Gain 5.3 dB Q 4.10
Filter 3: ON PK Fc 3679 Hz Gain 5.4 dB Q 5.27
Filter 4: ON PK Fc 4828 Hz Gain 3.8 dB Q 4.02
Filter 5: ON PK Fc 18660 Hz Gain 7.1 dB Q 0.91
Filter 6: ON PK Fc 74 Hz Gain 2.4 dB Q 1.73
Filter 7: ON PK Fc 245 Hz Gain -3.2 dB Q 0.64
Filter 8: ON PK Fc 801 Hz Gain -2.3 dB Q 3.15
Filter 9: ON PK Fc 7300 Hz Gain -3.8 dB Q 4.24
Filter 10: ON PK Fc 18712 Hz Gain -0.4 dB Q 2.75
alias ls = exa -a
alias lsl = exa -al
let active_theme = "base16-oceanicnext"
keybindings vi
#status -i is currently broken ( to check if in interactive mode )
#fixed upstream a month back, but not updated to a new release.
#need to make a nix package with new release too (and upstream to nixpkgs?)
#if status -i
let home = "${env::HOME}"
export BASE16_SHELL = "$home/.config/base16-shell"
export BASE16_THEME = "$active_theme"
# setup base16 oceanicnext theme.
cat "${env::BASE16_SHELL}/scripts/$active_theme.sh" | sh
#end
eval $(starship init ion)
export PATH = "$PATH:/home/$USER/.cargo/bin"
alias fucking = sudo -E
# from https://github.com/mozilla/nixpkgs-mozilla/blob/master/rust-overlay.nix
# This file provide a Rust overlay, which provides pre-packaged bleeding edge versions of rustc
# and cargo.
self: super:
let
fromTOML =
# nix 2.1 added the fromTOML builtin
if builtins ? fromTOML then
builtins.fromTOML
else
(import ./lib/parseTOML.nix).fromTOML;
# Function that takes in a file, and
# returns an empty set if file is null, or
# returns a set with channel and date.
parseRustToolchain = file:
with builtins;
if file == null then
{ }
else
let
# matches toolchain descriptions of type "nightly" or "nightly-2020-01-01"
channel_by_name =
match "([a-z]+)(-([0-9]{4}-[0-9]{2}-[0-9]{2}))?.*" (readFile file);
# matches toolchain descriptions of type "1.34.0" or "1.34.0-2019-04-10"
channel_by_version =
match "([0-9]+\\.[0-9]+\\.[0-9]+)(-([0-9]{4}-[0-9]{2}-[0-9]{2}))?.*"
(readFile file);
in (x: {
channel = head x;
date = (head (tail (tail x)));
})
(if channel_by_name != null then channel_by_name else channel_by_version);
# See https://github.com/rust-lang-nursery/rustup.rs/blob/master/src/dist/src/dist.rs
defaultDistRoot = "https://static.rust-lang.org";
manifest_v1_url = { dist_root ? defaultDistRoot + "/dist", date ? null
, staging ? false,
# A channel can be "nightly", "beta", "stable", or "\d{1}\.\d{1,3}\.\d{1,2}".
channel ? "nightly",
# A path that points to a rust-toolchain file, typically ./rust-toolchain.
rustToolchain ? null, ... }:
let args = { inherit channel date; } // parseRustToolchain rustToolchain;
in let inherit (args) date channel;
in if date == null && staging == false then
"${dist_root}/channel-rust-${channel}"
else if date != null && staging == false then
"${dist_root}/${date}/channel-rust-${channel}"
else if date == null && staging == true then
"${dist_root}/staging/channel-rust-${channel}"
else
throw "not a real-world case";
manifest_v2_url = args: (manifest_v1_url args) + ".toml";
getComponentsWithFixedPlatform = pkgs: pkgname: stdenv:
let
pkg = pkgs.${pkgname};
srcInfo = pkg.target.${
super.rust.toRustTarget stdenv.targetPlatform
} or pkg.target."*";
components = srcInfo.components or [ ];
componentNamesList = builtins.map (pkg: pkg.pkg)
(builtins.filter (pkg: (pkg.target != "*")) components);
in componentNamesList;
getExtensions = pkgs: pkgname: stdenv:
let
inherit (super.lib) unique;
pkg = pkgs.${pkgname};
srcInfo = pkg.target.${
super.rust.toRustTarget stdenv.targetPlatform
} or pkg.target."*";
extensions = srcInfo.extensions or [ ];
extensionNamesList = unique (builtins.map (pkg: pkg.pkg) extensions);
in extensionNamesList;
hasTarget = pkgs: pkgname: target: pkgs ? ${pkgname}.target.${target};
getTuples = pkgs: name: targets:
builtins.map (target: { inherit name target; })
(builtins.filter (target: hasTarget pkgs name target) targets);
# In the manifest, a package might have different components which are bundled with it, as opposed as the extensions which can be added.
# By default, a package will include the components for the same architecture, and offers them as extensions for other architectures.
#
# This functions returns a list of { name, target } attribute sets, which includes the current system package, and all its components for the selected targets.
# The list contains the package for the pkgTargets as well as the packages for components for all compTargets
getTargetPkgTuples = pkgs: pkgname: pkgTargets: compTargets: stdenv:
let
inherit (builtins) elem;
inherit (super.lib) intersectLists;
components = getComponentsWithFixedPlatform pkgs pkgname stdenv;
extensions = getExtensions pkgs pkgname stdenv;
compExtIntersect = intersectLists components extensions;
tuples = (getTuples pkgs pkgname pkgTargets)
++ (builtins.map (name: getTuples pkgs name compTargets)
compExtIntersect);
in tuples;
getFetchUrl = pkgs: pkgname: target: stdenv: fetchurl:
let
pkg = pkgs.${pkgname};
srcInfo = pkg.target.${target};
in (super.fetchurl {
url = srcInfo.xz_url;
sha256 = srcInfo.xz_hash;
});
checkMissingExtensions = pkgs: pkgname: stdenv: extensions:
let
inherit (builtins) head;
inherit (super.lib) concatStringsSep subtractLists;
availableExtensions = getExtensions pkgs pkgname stdenv;
missingExtensions = subtractLists availableExtensions extensions;
extensionsToInstall = if missingExtensions == [ ] then
extensions
else
throw ''
While compiling ${pkgname}: the extension ${
head missingExtensions
} is not available.
Select extensions from the following list:
${concatStringsSep "\n" availableExtensions}'';
in extensionsToInstall;
getComponents =
pkgs: pkgname: targets: extensions: targetExtensions: stdenv: fetchurl:
let
inherit (builtins) head map;
inherit (super.lib) flatten remove subtractLists unique;
targetExtensionsToInstall =
checkMissingExtensions pkgs pkgname stdenv targetExtensions;
extensionsToInstall =
checkMissingExtensions pkgs pkgname stdenv extensions;
hostTargets = [
"*"
(super.rust.toRustTarget stdenv.hostPlatform)
(super.rust.toRustTarget stdenv.targetPlatform)
];
pkgTuples =
flatten (getTargetPkgTuples pkgs pkgname hostTargets targets stdenv);
extensionTuples = flatten
(map (name: getTargetPkgTuples pkgs name hostTargets targets stdenv)
extensionsToInstall);
targetExtensionTuples = flatten
(map (name: getTargetPkgTuples pkgs name targets targets stdenv)
targetExtensionsToInstall);
pkgsTuples = pkgTuples ++ extensionTuples ++ targetExtensionTuples;
missingTargets = subtractLists (map (tuple: tuple.target) pkgsTuples)
(remove "*" targets);
pkgsTuplesToInstall = if missingTargets == [ ] then
pkgsTuples
else
throw "While compiling ${pkgname}: the target ${
head missingTargets
} is not available for any package.";
in map (tuple: {
name = tuple.name;
src = (getFetchUrl pkgs tuple.name tuple.target stdenv fetchurl);
}) pkgsTuplesToInstall;
installComponents = stdenv: namesAndSrcs:
let
inherit (builtins) map;
installComponent = name: src:
stdenv.mkDerivation {
inherit name;
inherit src;
# No point copying src to a build server, then copying back the
# entire unpacked contents after just a little twiddling.
preferLocalBuild = true;
# (@nbp) TODO: Check on Windows and Mac.
# This code is inspired by patchelf/setup-hook.sh to iterate over all binaries.
installPhase = ''
patchShebangs install.sh
CFG_DISABLE_LDCONFIG=1 ./install.sh --prefix=$out --verbose
setInterpreter() {
local dir="$1"
[ -e "$dir" ] || return 0
header "Patching interpreter of ELF executables and libraries in $dir"
local i
while IFS= read -r -d $'\0' i; do
if [[ "$i" =~ .build-id ]]; then continue; fi
if ! isELF "$i"; then continue; fi
echo "setting interpreter of $i"
if [[ -x "$i" ]]; then
# Handle executables
patchelf \
--set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
--set-rpath "${
super.lib.makeLibraryPath [ self.zlib ]
}:$out/lib" \
"$i" || true
else
# Handle libraries
patchelf \
--set-rpath "${
super.lib.makeLibraryPath [ self.zlib ]
}:$out/lib" \
"$i" || true
fi
done < <(find "$dir" -type f -print0)
}
setInterpreter $out
'';
postFixup = ''
# Function moves well-known files from etc/
handleEtc() {
local oldIFS="$IFS"
# Directories we are aware of, given as substitution lists
for paths in \
"etc/bash_completion.d","share/bash_completion/completions","etc/bash_completions.d","share/bash_completions/completions";
do
# Some directoties may be missing in some versions. If so we just skip them.
# See https://github.com/mozilla/nixpkgs-mozilla/issues/48 for more infomation.
if [ ! -e $paths ]; then continue; fi
IFS=","
set -- $paths
IFS="$oldIFS"
local orig_path="$1"
local wanted_path="$2"
# Rename the files
if [ -d ./"$orig_path" ]; then
mkdir -p "$(dirname ./"$wanted_path")"
fi
mv -v ./"$orig_path" ./"$wanted_path"
# Fail explicitly if etc is not empty so we can add it to the list and/or report it upstream
rmdir ./etc || {
echo Installer tries to install to /etc:
find ./etc
exit 1
}
done
}
if [ -d "$out"/etc ]; then
pushd "$out"
handleEtc
popd
fi
'';
dontStrip = true;
};
in map (nameAndSrc: (installComponent nameAndSrc.name nameAndSrc.src))
namesAndSrcs;
# Manifest files are organized as follow:
# { date = "2017-03-03";
# pkg.cargo.version= "0.18.0-nightly (5db6d64 2017-03-03)";
# pkg.cargo.target.x86_64-unknown-linux-gnu = {
# available = true;
# hash = "abce..."; # sha256
# url = "https://static.rust-lang.org/dist/....tar.gz";
# xz_hash = "abce..."; # sha256
# xz_url = "https://static.rust-lang.org/dist/....tar.xz";
# };
# }
#
# The packages available usually are:
# cargo, rust-analysis, rust-docs, rust-src, rust-std, rustc, and
# rust, which aggregates them in one package.
#
# For each package the following options are available:
# extensions - The extensions that should be installed for the package.
# For example, install the package rust and add the extension rust-src.
# targets - The package will always be installed for the host system, but with this option
# extra targets can be specified, e.g. "mips-unknown-linux-musl". The target
# will only apply to components of the package that support being installed for
# a different architecture. For example, the rust package will install rust-std
# for the host system and the targets.
# targetExtensions - If you want to force extensions to be installed for the given targets, this is your option.
# All extensions in this list will be installed for the target architectures.
# *Attention* If you want to install an extension like rust-src, that has no fixed architecture (arch *),
# you will need to specify this extension in the extensions options or it will not be installed!
fromManifestFile = manifest:
{ stdenv, fetchurl, patchelf }:
let
inherit (builtins) elemAt;
inherit (super) makeOverridable;
inherit (super.lib) flip mapAttrs;
pkgs = fromTOML (builtins.readFile manifest);
in flip mapAttrs pkgs.pkg (name: pkg:
makeOverridable ({ extensions, targets, targetExtensions }:
let
version' = builtins.match "([^ ]*) [(]([^ ]*) ([^ ]*)[)]" pkg.version;
version =
"${elemAt version' 0}-${elemAt version' 2}-${elemAt version' 1}";
namesAndSrcs =
getComponents pkgs.pkg name targets extensions targetExtensions
stdenv fetchurl;
components = installComponents stdenv namesAndSrcs;
componentsOuts = builtins.map (comp:
(super.lib.strings.escapeNixString
(super.lib.getOutput "out" comp))) components;
in super.pkgs.symlinkJoin {
name = name + "-" + version;
paths = components;
postBuild = ''
# If rustc or rustdoc is in the derivation, we need to copy their
# executable into the final derivation. This is required
# for making them find the correct SYSROOT.
for target in $out/bin/{rustc,rustdoc}; do
if [ -e $target ]; then
cp --remove-destination "$(realpath -e $target)" $target
fi
done
'';
# Add the compiler as part of the propagated build inputs in order
# to run:
#
# $ nix-shell -p rustChannels.stable.rust
#
# And get a fully working Rust compiler, with the stdenv linker.
propagatedBuildInputs = [ stdenv.cc ];
meta.platforms = stdenv.lib.platforms.all;
}) {
extensions = [ ];
targets = [ ];
targetExtensions = [ ];
});
fromManifest = sha256: manifest:
{ stdenv, fetchurl, patchelf }:
let
manifestFile = if sha256 == null then
builtins.fetchurl manifest
else
fetchurl {
url = manifest;
inherit sha256;
};
in fromManifestFile manifestFile { inherit stdenv fetchurl patchelf; };
in rec {
lib = super.lib // {
inherit fromTOML;
rustLib = { inherit fromManifest fromManifestFile manifest_v2_url; };
};
rustChannelOf = { sha256 ? null, ... }@manifest_args:
fromManifest sha256 (manifest_v2_url manifest_args) {
inherit (self) stdenv fetchurl patchelf;
};
# Set of packages which are automagically updated. Do not rely on these for
# reproducible builds.
latest = (super.latest or { }) // {
rustChannels = {
nightly = rustChannelOf { channel = "nightly"; };
beta = rustChannelOf { channel = "beta"; };
stable = rustChannelOf { channel = "stable"; };
};
};
# Helper builder
rustChannelOfTargets = channel: date: targets:
(rustChannelOf { inherit channel date; }).rust.override {
inherit targets;
};
# For backward compatibility
rustChannels = latest.rustChannels;
# For each channel:
# latest.rustChannels.nightly.cargo
# latest.rustChannels.nightly.rust # Aggregate all others. (recommended)
# latest.rustChannels.nightly.rustc
# latest.rustChannels.nightly.rust-analysis
# latest.rustChannels.nightly.rust-docs
# latest.rustChannels.nightly.rust-src
# latest.rustChannels.nightly.rust-std
# For a specific date:
# (rustChannelOf { date = "2017-06-06"; channel = "beta"; }).rust
}
version = "01-27-2021";
src = self.fetchFromGitHub {
owner = "neovim";
repo = "neovim";
};
buildInputs = (oldAttrs.buildInputs ++ ([ unstable.tree-sitter ]));
});
}
cmakeFlags = oldAttrs.cmakeFlags ++ [ "-DUSE_BUNDLED=OFF" ];
rev = "52ca7f1a26e4da95f3b3b00670252cfdf788a011";
sha256 = "1970c4yrbfcwa2nnf3wjzaic7n6dplz786ns40sf5saj0nkqp7hj";
self: super:
let unstable = import <unstable> { };
in {
neovim-unwrapped = super.neovim-unwrapped.overrideAttrs (oldAttrs: {
self: super: {
discord = super.discord.overrideAttrs (_: {
src = builtins.fetchTarball
"https://discordapp.com/api/download?platform=linux&format=tar.gz";
});
}
{ config, lib, pkgs, ... }:
let unstable = import <unstable> { configuration = { allowUnfree = true; }; };
in {
imports = [
./applications/waybar.nix
./applications/vscode.nix
./applications/sway.nix
./applications/mako.nix
./applications/alacritty.nix
];
#enable these
programs.firefox.enable = true;
home.packages = with pkgs; [
#Sway.
waybar
dolphin
breeze-icons
mako # notification daemon.
grim
slurp
wl-clipboard
#CLI stuff.
alacritty
konsole
#pdf viewer
zathura
#chat clients
discord
element-desktop
#osu - need I say more?
osu-lazer
#general
xournalpp
#Audio
pulseeffects
#until I setup something with pactl.
pavucontrol
spotify
#fonts
font-awesome
fira-code
(nerdfonts.override { fonts = [ "FiraCode" ]; })
];
fonts.fontconfig = { enable = true; };
}
#Video editing
kdenlive
#Gnome
gnome3.gnome-tweaks
{ config, lib, pkgs, ... }:
with lib;
let
unstable = import <unstable> { configuration = { allowUnfree = true; }; };
user_configuration = import ./configuration.nix;
custom_packages = [
];
# (import ./custom_pkgs/buzz.nix pkgs) # buzz for email notifiactions...
in {
imports = [
./applications/git.nix
./applications/ion.nix
./applications/starship.nix
./applications/neovim.nix
] ++ (if user_configuration.gui_support then
[ ./gui_supported.nix ]
else
[ ]);
options = {
dots = mkOption { type = types.path; };
modifier = mkOption { type = types.str; };
scripts = mkOption { type = types.path; };
gui_support = mkOption { type = types.boolean; };
};
config = {
nixpkgs.config = { allowUnfree = true; };
inherit (user_configuration) dots modifier scripts gui_support;
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
# Home Manager needs a bit of information about you and the
# paths it should manage.
home.username = builtins.getEnv "USER";
home.homeDirectory = builtins.getEnv "HOME";
home.sessionVariables = {
};
home.packages = with pkgs;
[
#this is making me want to cry, I can't make an overlay with a new version
#without a stack overflow for some reason.
ion
exa
git
ripgrep
bat
unstable.bottom # top sucks.
RUST_SRC_PATH =
"${unstable.rust.packages.stable.rustPlatform.rustLibSrc}";
# This value determines the Home Manager release that your
# configuration is compatible with. This helps avoid breakage
# when a new Home Manager release introduces backwards
# incompatible changes.
#
# You can update Home Manager without changing this value. See
# the Home Manager release notes for a list of state version
# changes in each release.
home.stateVersion = "20.09";
};
}
starship
] ++ custom_packages;
#development stuff
mutt
lynx
nixfmt
nodejs
unstable.deno
python39
unstable.black
python3.pkgs.pylint
unstable.cargo
unstable.rustc
texlive.combined.scheme-full
gdb
notify-desktop
{ ... }: {
programs.alacritty = {
enable = true;
settings = {
shell = "ion";
font = {
size = 12;
normal = {
family = "Fira Code Nerd Font";
style = "Mono";
};
};
colors = {
primary = {
background = "0x1b2b34";
foreground = "0xc0c5ce";
};
cursor = {
text = "0x1b2b34";
cursor = "0xc0c5ce";
};
normal = {
black = "0x1b2b34";
red = "0xec5f67";
green = "0x99c794";
yellow = "0xfac863";
blue = "0x6699cc";
magenta = "0xc594c5";
cyan = "0x5fb3b3";
white = "0xc0c5ce";
};
bright = {
black = "0x65737e";
red = "0xec5f67";
green = "0x99c794";
yellow = "0xfac863";
blue = "0x6699cc";
magenta = "0xc594c5";
cyan = "0x5fb3b3";
white = "0xd8dee9";
};
};
};
};
}
{ config, pkgs, ... }: {
programs.git = {
enable = true;
userName = "awesomearvinder";
userEmail = "ArvinderDhan@gmail.com";
};
}
{ config, ... }:
let inherit (config) dots;
in {
xdg.configFile."ion/initrc".text = builtins.readFile (dots + "/init.ion");
}
{ config, ... }:
let inherit (config) dots;
in {
xdg.configFile."mako/config".text = builtins.readFile (dots + "/mako.conf");
}
{ config, pkgs, ... }:
let
inherit (config) dots;
in let buildVimPlugin = pkgs.vimUtils.buildVimPlugin;
in {
home.packages = with pkgs; [
bat # required by my nixconfig
fzf # required by my nixconfig
];
home.file.".config/nvim/lua".source = dots + "/nvim/lua";
programs.neovim = let
startupPlugins = with pkgs.vimPlugins; [
coc-nvim
auto-pairs
vim-highlightedyank
vim-rooter
fzf-vim
base16-vim
yats-vim
vim-gitgutter
vimtex
vim-airline
vim-sensible
vim-nix
(buildVimPlugin {
pname = "vimpeccable";
version = "10-31-2020";
src = (pkgs.fetchFromGitHub {
owner = "svermeulen";
repo = "vimpeccable";
rev = "00300b311de64d91b3facc1e4a6fe11463735e68";
sha256 = "0mb8a7ypd6pvbjpa46h9hmc8isvxfmn7dq5gcpdg6h2wmkgrv4c4";
});
})
];
in {
enable = true;
vimAlias = true;
viAlias = true;
withNodeJs = true;
withRuby = true;
extraConfig = "lua require('config')";
plugins = [ ]
++ (builtins.map (plugin: { inherit plugin; }) startupPlugins);
};
}
{ config, ... }:
let inherit (config) dots;
in {
xdg.configFile."starship.toml".text =
builtins.readFile (dots + "/starship.toml");
}
# A lot of this is gotten from https://github.com/alexarice/dotfiles/blob/18557c8e0bdd1c564ea68f8bb25a1894973d254d/dotfiles/sway.nix
{ config, pkgs, lib, ... }:
let inherit (config) dots scripts modifier;
in {
wayland.windowManager.sway = {
enable = true;
config = {
bars = [ ];
colors = {
focused = {
border = "#81c1e4";
background = "#81c1e4";
text = "#FFFFFF";
indicator = "#2e9ef4";
childBorder = "#81c1e4";
};
focusedInactive = {
border = "#282a36";
background = "#282a36";
text = "#999999";
indicator = "#484e50";
childBorder = "#282a36";
};
unfocused = {
border = "#282a36";
background = "#282a36";
text = "#999999";
indicator = "#282a36";
childBorder = "#282a36";
};
urgent = {
border = "#FF0000";
background = "#8C5665";
text = "#FF0000";
indicator = "#900000";
childBorder = "#FF0000";
};
};
output = {
"*" = { bg = ''"${dots + "/wallpaper.png"}" fill''; };
"eDP-1" = {
pos = "0 0";
res = "1920x1080";
};
"HDMI-A-1" = {
pos = "1920 0";
res = "1920x1080";
};
};
input = {
"1133:16489:Logitech_MX_Master_2S" = {
#disable mouse acceleration
pointer_accel = "-1";
};
};
gaps = {
inner = 5;
outer = 10;
bottom = 0;
smartBorders = "on";
};
inherit modifier;
terminal = "alacritty";
workspaceAutoBackAndForth = true;
keybindings = lib.mkOptionDefault {
"${modifier}+p" = "exec grim -g $(slurp) - | wl-copy";
"${modifier}+Shift+p" =
"exec grim -o $(swaymsg --pretty -t get_outputs | awk '/focused/ {print $2}') - | wl-copy";
"${modifier}+Ctrl+d" = ''exec "shutdown -h now"'';
};
window = {
border = 1;
titlebar = false;
};
startup = [
#{ command = "dropbox start"; always = true; }
{
command = "mako";
always = true;
}
{
command = "waybar";
always = true;
}
];
};
};
}
# Make this an overlay.
{ config, pkgs, ... }:
let
extensions = with pkgs.vscode-extensions;
[ bbenoist.Nix ms-vscode.cpptools ms-python.python vscodevim.vim ]
++ pkgs.vscode-utils.extensionsFromVscodeMarketplace [
{
name = "pretty-formatter";
publisher = "mblode";
version = "0.2.2";
sha256 = "1kdcxdvccf1fhg8lr8zwi5v7l2ja02p1kxq871jgakq2y42fclpy";
}
{
name = "rust-analyzer";
publisher = "matklad";
version = "0.2.297";
sha256 = "0pj29k5pm1p7f987x9rjd0pks552fxvjv72dscxsk84svl132s0f";
}
{
name = "cmake-tools";
publisher = "ms-vscode";
version = "1.4.2";
sha256 = "1azjqd5w14q1h8z6cib4lwyk3h9hl1lzzrnc150inn0c7v195qcl";
}
{
name = "CMake";
publisher = "twxs";
version = "0.0.17";
sha256 = "11hzjd0gxkq37689rrr2aszxng5l9fwpgs9nnglq3zhfa1msyn08";
}
{
name = "nix-env-selector";
publisher = "arrterian";
version = "1.0.7";
sha256 = "0mralimyzhyp4x9q98x3ck64ifbjqdp8cxcami7clvdvkmf8hxhf";
}
{
name = "vsliveshare";
publisher = "ms-vsliveshare";
version = "1.0.4272";
sha256 = "0dhs9lkprz2q79kpkj2d22d09lvhl77n38vj0rsz80g9vj41jzwh";
}
];
vscode =
pkgs.vscode-with-extensions.override { vscodeExtensions = extensions; };
in { home.packages = [ vscode ]; }
{ config, ... }:
let inherit (config) dots;
in {
xdg.configFile."waybar/style.css".text =
builtins.readFile (dots + "/waybar/style.css");
xdg.configFile."waybar/config".text =
builtins.readFile (dots + "/waybar/config");
}
{
gui_support = true;
dots = ./dotfiles;
scripts = ~/.config/scripts;
modifier = "Mod4";
}
{ fetchFromGitHub, pkgconfig, openssl, glib, pango, atk, gdk-pixbuf, gtk3
, libappindicator, llvmPackages, clang, cairo, ... }:
let unstable = import <unstable> { };
in unstable.rustPlatform.buildRustPackage rec {
pname = "buzz";
version = "04-29-21";
nativeBuildInputs = [
pkgconfig
openssl
glib
pango
atk
gdk-pixbuf
gtk3
libappindicator
llvmPackages.libclang
clang
];
buildInputs = [
pkgconfig
openssl
glib
cairo
pango
atk
gdk-pixbuf
gtk3
libappindicator
llvmPackages.libclang
];
src = fetchFromGitHub {
owner = "jonhoo";
repo = pname;
rev = "02479643ed1b0325050245dbb3b70411b8cffb7a";
sha256 = "1spklfv02qlinlail5rmhh1c4926gyrkr2ydd9g6z919rxkl0ywk";
};
LIBCLANG_PATH = "${llvmPackages.libclang}/lib";
cargoSha256 = "1saj2r337jmy0fzyriyk7xk6q30d0hzl8zdl06f9xbmvdmmjddjy";
}
Preamp: -7.6 dB
Filter 1: ON PK Fc 34 Hz Gain 6.9 dB Q 0.65
Filter 2: ON PK Fc 1599 Hz Gain 5.3 dB Q 4.10
Filter 3: ON PK Fc 3679 Hz Gain 5.4 dB Q 5.27
Filter 4: ON PK Fc 4828 Hz Gain 3.8 dB Q 4.02
Filter 5: ON PK Fc 18660 Hz Gain 7.1 dB Q 0.91
Filter 6: ON PK Fc 74 Hz Gain 2.4 dB Q 1.73
Filter 7: ON PK Fc 245 Hz Gain -3.2 dB Q 0.64
Filter 8: ON PK Fc 801 Hz Gain -2.3 dB Q 3.15
Filter 9: ON PK Fc 7300 Hz Gain -3.8 dB Q 4.24
Filter 10: ON PK Fc 18712 Hz Gain -0.4 dB Q 2.75
alias ls = exa -a
alias lsl = exa -al
alias fucking = sudo -E
let active_theme = "base16-oceanicnext"
keybindings vi
#status -i is currently broken ( to check if in interactive mode )
#fixed upstream a month back, but not updated to a new release.
#need to make a nix package with new release too (and upstream to nixpkgs?)
#if status -i
let home = "${env::HOME}"
export BASE16_SHELL = "$home/.config/base16-shell"
export BASE16_THEME = "$active_theme"
export PATH = "$PATH:/home/$USER/.cargo/bin"
# setup base16 oceanicnext theme.
cat "${env::BASE16_SHELL}/scripts/$active_theme.sh" | sh
#end
eval $(starship init ion)
background-color=#1b2b34
border-color=#474747
border-size=3
font=DejaVu Sans Mono 11
default-timeout=5000
layer=overlay
{
"python.linting.pylintEnabled": true,
"python.formatting.provider": "black",
"python.formatting.blackPath": "/home/bender/.nix-profile/bin/black",
"rust-analyzer.server.path": "rust-analyzer"
}
local setOptions = function()
local scopes = {o = vim.o, b = vim.bo, w = vim.wo}
local opt = function(scope, key, value)
scopes[scope][key] = value
if scope ~= 'o' then scopes['o'][key] = value end
end
vim.wo.relativenumber = true
vim.wo.number = true
vim.bo.shiftwidth = 4
vim.bo.tabstop = 4
vim.bo.expandtab = true
vim.o.updatetime = 300
vim.o.splitbelow = true
vim.o.termguicolors = true
vim.o.showcmd = true
end
local latexSetUp = function()
vim.g.tex_flavor = 'latex'
vim.g.vimtex_view_general_viewer = 'zathura'
end
local cocSetUp = function()
vim.g.coc_global_extensions = { 'coc-omnisharp', 'coc-rust-analyzer', 'coc-go', 'coc-actions', 'coc-emmet', 'coc-css', 'coc-tsserver', 'coc-prettier', 'coc-deno','coc-html', 'coc-eslint', 'coc-texlab', 'coc-pyright'}
end
local gitgutterSetUp = function()
vim.g.gitgutter_sign_added = '✚'
vim.g.gitgutter_sign_modified = '✹'
vim.g.gitgutter_sign_removed = '-'
vim.g.gitgutter_sign_removed_first_line = '-'
vim.g.gitgutter_sign_modified_removed = '-'
end
local setUpAll = function()
setOptions()
gitgutterSetUp()
latexSetUp()
cocSetUp()
end
local setKeybindings = function()
--keybindings (would love to get vimp working)
vim.api.nvim_set_keymap('', '<c-n>', ':lua require(\'plugins/Terminal\').open(0.8, 0.8) <CR>', {silent = true})
vim.api.nvim_set_keymap('', '<c-t>', ':lua require(\'plugins/FZF\').open(\'vert new\', 0.8, 0.8) <CR>', {silent = true})
vim.api.nvim_set_keymap('', '<c-r>', ':lua require(\'plugins/FZF\').open(\'e\', 0.8, 0.8) <CR>', {silent = true})
vim.api.nvim_set_keymap('', '<A-h>', ':wincmd h <CR>', {})
vim.api.nvim_set_keymap('', '<A-j>', ':wincmd j <CR>', {})
vim.api.nvim_set_keymap('', '<A-k>', ':wincmd k <CR>', {})
vim.api.nvim_set_keymap('', '<A-l>', ':wincmd l <CR>', {})
vim.api.nvim_set_keymap('n', 'gd', '<Plug>(coc-definition)', {})
vim.api.nvim_set_keymap('n', 'gy', '<Plug>(coc-type-definition)', {})
vim.api.nvim_set_keymap('n', 'ga', '<Plug>(coc-codeaction)', {})
vim.api.nvim_command('autocmd BufWritePre * :silent! call CocAction(\'format\')')
end
-- entry point
local main = function()
--set color
vim.cmd('colorscheme base16-gruvbox-dark-hard')
setKeybindings()
setUpAll()
end
main()
--Make a new fzf window.
local OpenFZF = function(action, size_x_percent, size_y_percent)
--vim.g.fzf_colors = {
-- ["fg"]= {'fg', 'Normal'},
-- ["bg"]= {'bg', 'Normal'},
-- ["hl"]= {'fg', 'Comment'},
-- ["fg+"]= {'fg', 'CursorLine', 'CursorColumn', 'Normal'},
-- ["bg+"]= {'bg', 'CursorLine', 'CursorColumn'},
-- ["hl+"]= {'fg', 'Statement'},
-- ["info"]= {'fg', 'PreProc'},
-- ["border"]= {'fg', 'Ignore'},
-- ["prompt"]= {'fg', 'Conditional'},
-- ["pointer"]= {'fg', 'Exception'},
-- ["marker"]= {'fg', 'Keyword'},
-- ["spinner"]= {'fg', 'Label'},
-- ["header"]= {'fg', 'Comment'}
--}
local cmd = ":call fzf#run(fzf#wrap({"..
string.format("'sink': '%s',", action)..
"'source': 'rg --files',"..
[['options': '--preview-window=50% --preview="bat {} --color=always --style=plain"',]]..
string.format("'window': {'width': %f, 'height': %f, 'border': 'no'},", size_x_percent, size_y_percent)..
"}))"
vim.api.nvim_command(cmd)
end
local r = {
open = function(action, x, y) OpenFZF(action, x, y) end
}
return r
--Opens a terminal in a floating window.
local OpenTerminal = function(size_x_percent, size_y_percent)
local utils = require('plugins/utils')
local width = vim.api.nvim_get_option("columns")
local height = vim.api.nvim_get_option("lines")
local win_height = math.ceil(height * size_x_percent)
local win_width = math.ceil(width * size_y_percent)
local col_pos = math.floor(width * (1-size_y_percent)/2)
local row_pos = math.floor(height * (1-size_x_percent)/2)
local buffer = utils.make_window(win_width, win_height, row_pos, col_pos, "minimal", "editor")
vim.api.nvim_command('term')
end
local r = {
-- Takes a x and y as percentage size of the screen.
open = function(x, y) OpenTerminal(x, y) end
}
return r
local r = {
-- Makes a window and returns it's buffer.
make_window = function(width, height, x, y, style, relative)
local buf = vim.api.nvim_create_buf(false, true)
local opts = {
style = style,
relative = relative,
width = width,
height = height,
row = x,
col = y
}
local win = vim.api.nvim_open_win(buf, true, opts)
return buf
end
}
return r
add_newline = false
[line_break]
disabled = true
[cmd_duration]
disabled = true
[username]
show_always = true
format = "[$user]($style)"
[aws]
symbol = " "
[battery]
disabled = true
[conda]
symbol = " "
[dart]
symbol = " "
[directory]
format = "[$path](bg:#0578fc fg:#141414)"
[docker]
symbol = " "
[elixir]
symbol = " "
disabled = true
[elm]
symbol = " "
disabled = true
[git_commit]
disabled = true
[git_branch]
symbol = " "
format = "[on $branch]($style)"
[golang]
symbol = " "
[haskell]
symbol = " "
[hg_branch]
symbol = " "
[java]
symbol = " "
[julia]
symbol = " "
[memory_usage]
symbol = " "
[nim]
symbol = " "
[nix_shell]
symbol = " "
[nodejs]
symbol = " "
[package]
symbol = " "
disabled = true
[perl]
symbol = " "
[php]
symbol = " "
[python]
symbol = " "
[ruby]
symbol = " "
[rust]
symbol = " "
[swift]
symbol = "ﯣ "
{
// "layer": "top", // Waybar at top layer
// "position": "bottom", // Waybar position (top|bottom|left|right)
"height": 30, // Waybar height (to be removed for auto height)
// "width": 1280, // Waybar width
// Choose the order of the modules
"modules-left": ["sway/workspaces", "sway/mode", "custom/media"],
//"modules-center": ["sway/window"],
"modules-right": ["pulseaudio", "battery", "backlight", "temperature", "network", "clock", "tray"],
// Modules configuration
// "sway/workspaces": {
// "disable-scroll": true,
// "all-outputs": true,
// "format": "{name}: {icon}",
// "format-icons": {
// "1": "",
// "2": "",
// "3": "",
// "4": "",
// "5": "",
// "urgent": "",
// "focused": "",
// "default": ""
// }
// },
"sway/mode": {
"format": "<span style=\"italic\">{}</span>"
},
"mpd": {
"format": "{stateIcon} {consumeIcon}{randomIcon}{repeatIcon}{singleIcon}{artist} - {album} - {title} ({elapsedTime:%M:%S}/{totalTime:%M:%S}) ",
"format-disconnected": "Disconnected ",
"format-stopped": "{consumeIcon}{randomIcon}{repeatIcon}{singleIcon}Stopped ",
"unknown-tag": "N/A",
"interval": 2,
"consume-icons": {
"on": " "
},
"random-icons": {
"off": "<span color=\"#f53c3c\"></span> ",
"on": " "
},
"repeat-icons": {
"on": " "
},
"single-icons": {
"on": "1 "
},
"state-icons": {
"paused": "",
"playing": ""
},
"tooltip-format": "MPD (connected)",
"tooltip-format-disconnected": "MPD (disconnected)"
},
"idle_inhibitor": {
"format": "{icon}",
"format-icons": {
"activated": "",
"deactivated": ""
}
},
"tray": {
// "icon-size": 21,
"spacing": 10
},
"clock": {
// "timezone": "America/New_York",
"tooltip-format": "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>",
"format-alt": "{:%Y-%m-%d}"
},
"cpu": {
"format": "{usage}% ",
"tooltip": false
},
"memory": {
"format": "{}% "
},
"temperature": {
// "thermal-zone": 2,
// "hwmon-path": "/sys/class/hwmon/hwmon2/temp1_input",
"critical-threshold": 80,
// "format-critical": "{temperatureC}°C {icon}",
"format": "{temperatureC}°C {icon}",
"format-icons": ["", "", ""]
},
"backlight": {
// "device": "acpi_video1",
"format": "{percent}% {icon}",
"format-icons": ["", ""]
},
"battery": {
"states": {
// "good": 95,
"warning": 30,
"critical": 15
},
"format": "{capacity}% {icon}",
"format-charging": "{capacity}% ",
"format-plugged": "{capacity}% ",
"format-alt": "{time} {icon}",
// "format-good": "", // An empty format will hide the module
// "format-full": "",
"format-icons": ["", "", "", "", ""]
},
"battery#bat2": {
"bat": "BAT2"
},
"network": {
// "interface": "wlp2*", // (Optional) To force the use of this interface
"format-wifi": "{essid} ({signalStrength}%) ",
"format-ethernet": "{ifname}: {ipaddr}/{cidr} ",
"format-linked": "{ifname} (No IP) ",
"format-disconnected": "Disconnected ⚠",
"format-alt": "{ifname}: {ipaddr}/{cidr}"
},
"pulseaudio": {
// "scroll-step": 1, // %, can be a float
"format": "{volume}% {icon} {format_source}",
"format-bluetooth": "{volume}% {icon} {format_source}",
"format-bluetooth-muted": " {icon} {format_source}",
"format-muted": " {format_source}",
"format-sorce": "{volume}% ",
"format-source-muted": "",
"format-icons": {
"headphone": "",
"hands-free": "",
"headset": "",
"phone": "",
"portable": "",
"car": "",
"default": ["", "", ""]
},
"on-click": "pavucontrol"
},
"custom/media": {
"format": "{icon} {}",
"return-type": "json",
"max-length": 40,
"format-icons": {
"spotify": "",
"default": "🎜"
},
"escape": true,
"exec": "$HOME/.config/waybar/mediaplayer.py 2> /dev/null" // Script in resources folder
// "exec": "$HOME/.config/waybar/mediaplayer.py --player spotify 2> /dev/null" // Filter player based on name
}
}
* {
border: none;
border-radius: 0;
font-family: sans-serif;
font-size: 14px;
}
window {
background: rgba(0, 0, 0, 0.4);
color: white;
}
#workspaces button {
padding: 5px 10px;
background: transparent;
color: white;
border-bottom: 3px solid transparent;
}
#workspaces button.icon label {
font-size: 10px;
}
#workspaces button.focused {
background: rgba(200, 200, 200, 0.1);
border-bottom: 3px solid white;
}
#clock,
#battery,
#cpu,
#memory,
#network,
#pulseaudio,
#backlight,
#temperature,
#tray {
padding: 0 6px;
margin: 0 2px;
}
@keyframes blink {
to {
background-color: #ffffff;
color: black;
}
}
#battery.warning {
background: #f53c3c;
color: white;
animation-name: blink;
animation-duration: 0.5s;
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-direction: alternate;
}
{ config, lib, pkgs, ... }:
let unstable = import <unstable> { configuration = { allowUnfree = true; }; };
in {
imports = [
./applications/waybar.nix
./applications/vscode.nix
./applications/sway.nix
./applications/mako.nix
./applications/alacritty.nix
];
#enable these
programs.firefox.enable = true;
home.packages = with pkgs; [
#Sway.
waybar
dolphin
breeze-icons
mako # notification daemon.
grim
slurp
wl-clipboard
#Gnome
gnome3.gnome-tweaks
#CLI stuff.
alacritty
konsole
#pdf viewer
zathura
#chat clients
discord
element-desktop
#osu - need I say more?
osu-lazer
#general
xournalpp
#Audio
pulseeffects-legacy
#until I setup something with pactl.
pavucontrol
spotify
#fonts
font-awesome
fira-code
(nerdfonts.override { fonts = [ "FiraCode" ]; })
#Video editing
kdenlive
];
fonts.fontconfig = { enable = true; };
}
{ config, lib, pkgs, ... }:
with lib;
let
# unstable = import <unstable> { configuration = { allowUnfree = true; }; };
user_configuration = import ./configuration.nix;
custom_packages = [
# (import ./custom_pkgs/buzz.nix pkgs) # buzz for email notifiactions...
];
in {
imports = [
./applications/git.nix
./applications/ion.nix
./applications/starship.nix
./applications/neovim.nix
] ++ (if user_configuration.gui_support then
[ ./gui_supported.nix ]
else
[ ]);
options = {
dots = mkOption { type = types.path; };
modifier = mkOption { type = types.str; };
scripts = mkOption { type = types.path; };
gui_support = mkOption { type = types.boolean; };
};
config = {
inherit (user_configuration) dots modifier scripts gui_support;
home.packages = with pkgs;
[
#this is making me want to cry, I can't make an overlay with a new version
#without a stack overflow for some reason.
ion
exa
git
ripgrep
bat
bottom # top sucks.
#development stuff
mutt
lynx
nixfmt
nodejs
deno
python39
black
python3.pkgs.pylint
texlive.combined.scheme-full
gdb
notify-desktop
starship
] ++ custom_packages;
# This value determines the Home Manager release that your
# configuration is compatible with. This helps avoid breakage
# when a new Home Manager release introduces backwards
# incompatible changes.
#
# You can update Home Manager without changing this value. See
# the Home Manager release notes for a list of state version
# changes in each release.
home.stateVersion = "20.09";
};
}
[
#import ./neovimOverlay.nix
#import ./discordOverlay.nix
(self: super:
{
#discord = super.discord.overrideAttrs (_: {
# src = builtins.fetchTarball {
# src = "https://discordapp.com/api/download?platform=linux&format=tar.gz";
#}});
})
(self: super: {
neovim-unwrapped = super.neovim-unwrapped.overrideAttrs (oldAttrs: {
version = "01-27-2021";
src = self.fetchFromGitHub {
owner = "neovim";
repo = "neovim";
rev = "52ca7f1a26e4da95f3b3b00670252cfdf788a011";
sha256 = "1970c4yrbfcwa2nnf3wjzaic7n6dplz786ns40sf5saj0nkqp7hj";
};
buildInputs = (oldAttrs.buildInputs ++ ([ self.tree-sitter ]));
cmakeFlags = oldAttrs.cmakeFlags ++ [ "-DUSE_BUNDLED=OFF" ];
});
})
]
(self: super: {
#discord = super.discord.overrideAttrs (_: {
# src = builtins.fetchTarball {
# src = "https://discordapp.com/api/download?platform=linux&format=tar.gz";
#}});
})
self: super:
{
neovim-unwrapped = super.neovim-unwrapped.overrideAttrs (oldAttrs: {
version = "01-27-2021";
src = super.fetchFromGitHub {
owner = "neovim";
repo = "neovim";
rev = "52ca7f1a26e4da95f3b3b00670252cfdf788a011";
sha256 = "1970c4yrbfcwa2nnf3wjzaic7n6dplz786ns40sf5saj0nkqp7hj";
};
buildInputs = (oldAttrs.buildInputs ++ ([ self.tree-sitter ]));
cmakeFlags = oldAttrs.cmakeFlags ++ [ "-DUSE_BUNDLED=OFF" ];
});
}
# from https://github.com/mozilla/nixpkgs-mozilla/blob/master/rust-overlay.nix
# This file provide a Rust overlay, which provides pre-packaged bleeding edge versions of rustc
# and cargo.
self: super:
let
fromTOML =
# nix 2.1 added the fromTOML builtin
if builtins ? fromTOML then
builtins.fromTOML
else
(import ./lib/parseTOML.nix).fromTOML;
# Function that takes in a file, and
# returns an empty set if file is null, or
# returns a set with channel and date.
parseRustToolchain = file:
with builtins;
if file == null then
{ }
else
let
# matches toolchain descriptions of type "nightly" or "nightly-2020-01-01"
channel_by_name =
match "([a-z]+)(-([0-9]{4}-[0-9]{2}-[0-9]{2}))?.*" (readFile file);
# matches toolchain descriptions of type "1.34.0" or "1.34.0-2019-04-10"
channel_by_version =
match "([0-9]+\\.[0-9]+\\.[0-9]+)(-([0-9]{4}-[0-9]{2}-[0-9]{2}))?.*"
(readFile file);
in (x: {
channel = head x;
date = (head (tail (tail x)));
})
(if channel_by_name != null then channel_by_name else channel_by_version);
# See https://github.com/rust-lang-nursery/rustup.rs/blob/master/src/dist/src/dist.rs
defaultDistRoot = "https://static.rust-lang.org";
manifest_v1_url = { dist_root ? defaultDistRoot + "/dist", date ? null
, staging ? false,
# A channel can be "nightly", "beta", "stable", or "\d{1}\.\d{1,3}\.\d{1,2}".
channel ? "nightly",
# A path that points to a rust-toolchain file, typically ./rust-toolchain.
rustToolchain ? null, ... }:
let args = { inherit channel date; } // parseRustToolchain rustToolchain;
in let inherit (args) date channel;
in if date == null && staging == false then
"${dist_root}/channel-rust-${channel}"
else if date != null && staging == false then
"${dist_root}/${date}/channel-rust-${channel}"
else if date == null && staging == true then
"${dist_root}/staging/channel-rust-${channel}"
else
throw "not a real-world case";
manifest_v2_url = args: (manifest_v1_url args) + ".toml";
getComponentsWithFixedPlatform = pkgs: pkgname: stdenv:
let
pkg = pkgs.${pkgname};
srcInfo = pkg.target.${
super.rust.toRustTarget stdenv.targetPlatform
} or pkg.target."*";
components = srcInfo.components or [ ];
componentNamesList = builtins.map (pkg: pkg.pkg)
(builtins.filter (pkg: (pkg.target != "*")) components);
in componentNamesList;
getExtensions = pkgs: pkgname: stdenv:
let
inherit (super.lib) unique;
pkg = pkgs.${pkgname};
srcInfo = pkg.target.${
super.rust.toRustTarget stdenv.targetPlatform
} or pkg.target."*";
extensions = srcInfo.extensions or [ ];
extensionNamesList = unique (builtins.map (pkg: pkg.pkg) extensions);
in extensionNamesList;
hasTarget = pkgs: pkgname: target: pkgs ? ${pkgname}.target.${target};
getTuples = pkgs: name: targets:
builtins.map (target: { inherit name target; })
(builtins.filter (target: hasTarget pkgs name target) targets);
# In the manifest, a package might have different components which are bundled with it, as opposed as the extensions which can be added.
# By default, a package will include the components for the same architecture, and offers them as extensions for other architectures.
#
# This functions returns a list of { name, target } attribute sets, which includes the current system package, and all its components for the selected targets.
# The list contains the package for the pkgTargets as well as the packages for components for all compTargets
getTargetPkgTuples = pkgs: pkgname: pkgTargets: compTargets: stdenv:
let
inherit (builtins) elem;
inherit (super.lib) intersectLists;
components = getComponentsWithFixedPlatform pkgs pkgname stdenv;
extensions = getExtensions pkgs pkgname stdenv;
compExtIntersect = intersectLists components extensions;
tuples = (getTuples pkgs pkgname pkgTargets)
++ (builtins.map (name: getTuples pkgs name compTargets)
compExtIntersect);
in tuples;
getFetchUrl = pkgs: pkgname: target: stdenv: fetchurl:
let
pkg = pkgs.${pkgname};
srcInfo = pkg.target.${target};
in (super.fetchurl {
url = srcInfo.xz_url;
sha256 = srcInfo.xz_hash;
});
checkMissingExtensions = pkgs: pkgname: stdenv: extensions:
let
inherit (builtins) head;
inherit (super.lib) concatStringsSep subtractLists;
availableExtensions = getExtensions pkgs pkgname stdenv;
missingExtensions = subtractLists availableExtensions extensions;
extensionsToInstall = if missingExtensions == [ ] then
extensions
else
throw ''
While compiling ${pkgname}: the extension ${
head missingExtensions
} is not available.
Select extensions from the following list:
${concatStringsSep "\n" availableExtensions}'';
in extensionsToInstall;
getComponents =
pkgs: pkgname: targets: extensions: targetExtensions: stdenv: fetchurl:
let
inherit (builtins) head map;
inherit (super.lib) flatten remove subtractLists unique;
targetExtensionsToInstall =
checkMissingExtensions pkgs pkgname stdenv targetExtensions;
extensionsToInstall =
checkMissingExtensions pkgs pkgname stdenv extensions;
hostTargets = [
"*"
(super.rust.toRustTarget stdenv.hostPlatform)
(super.rust.toRustTarget stdenv.targetPlatform)
];
pkgTuples =
flatten (getTargetPkgTuples pkgs pkgname hostTargets targets stdenv);
extensionTuples = flatten
(map (name: getTargetPkgTuples pkgs name hostTargets targets stdenv)
extensionsToInstall);
targetExtensionTuples = flatten
(map (name: getTargetPkgTuples pkgs name targets targets stdenv)
targetExtensionsToInstall);
pkgsTuples = pkgTuples ++ extensionTuples ++ targetExtensionTuples;
missingTargets = subtractLists (map (tuple: tuple.target) pkgsTuples)
(remove "*" targets);
pkgsTuplesToInstall = if missingTargets == [ ] then
pkgsTuples
else
throw "While compiling ${pkgname}: the target ${
head missingTargets
} is not available for any package.";
in map (tuple: {
name = tuple.name;
src = (getFetchUrl pkgs tuple.name tuple.target stdenv fetchurl);
}) pkgsTuplesToInstall;
installComponents = stdenv: namesAndSrcs:
let
inherit (builtins) map;
installComponent = name: src:
stdenv.mkDerivation {
inherit name;
inherit src;
# No point copying src to a build server, then copying back the
# entire unpacked contents after just a little twiddling.
preferLocalBuild = true;
# (@nbp) TODO: Check on Windows and Mac.
# This code is inspired by patchelf/setup-hook.sh to iterate over all binaries.
installPhase = ''
patchShebangs install.sh
CFG_DISABLE_LDCONFIG=1 ./install.sh --prefix=$out --verbose
setInterpreter() {
local dir="$1"
[ -e "$dir" ] || return 0
header "Patching interpreter of ELF executables and libraries in $dir"
local i
while IFS= read -r -d $'\0' i; do
if [[ "$i" =~ .build-id ]]; then continue; fi
if ! isELF "$i"; then continue; fi
echo "setting interpreter of $i"
if [[ -x "$i" ]]; then
# Handle executables
patchelf \
--set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
--set-rpath "${
super.lib.makeLibraryPath [ self.zlib ]
}:$out/lib" \
"$i" || true
else
# Handle libraries
patchelf \
--set-rpath "${
super.lib.makeLibraryPath [ self.zlib ]
}:$out/lib" \
"$i" || true
fi
done < <(find "$dir" -type f -print0)
}
setInterpreter $out
'';
postFixup = ''
# Function moves well-known files from etc/
handleEtc() {
local oldIFS="$IFS"
# Directories we are aware of, given as substitution lists
for paths in \
"etc/bash_completion.d","share/bash_completion/completions","etc/bash_completions.d","share/bash_completions/completions";
do
# Some directoties may be missing in some versions. If so we just skip them.
# See https://github.com/mozilla/nixpkgs-mozilla/issues/48 for more infomation.
if [ ! -e $paths ]; then continue; fi
IFS=","
set -- $paths
IFS="$oldIFS"
local orig_path="$1"
local wanted_path="$2"
# Rename the files
if [ -d ./"$orig_path" ]; then
mkdir -p "$(dirname ./"$wanted_path")"
fi
mv -v ./"$orig_path" ./"$wanted_path"
# Fail explicitly if etc is not empty so we can add it to the list and/or report it upstream
rmdir ./etc || {
echo Installer tries to install to /etc:
find ./etc
exit 1
}
done
}
if [ -d "$out"/etc ]; then
pushd "$out"
handleEtc
popd
fi
'';
dontStrip = true;
};
in map (nameAndSrc: (installComponent nameAndSrc.name nameAndSrc.src))
namesAndSrcs;
# Manifest files are organized as follow:
# { date = "2017-03-03";
# pkg.cargo.version= "0.18.0-nightly (5db6d64 2017-03-03)";
# pkg.cargo.target.x86_64-unknown-linux-gnu = {
# available = true;
# hash = "abce..."; # sha256
# url = "https://static.rust-lang.org/dist/....tar.gz";
# xz_hash = "abce..."; # sha256
# xz_url = "https://static.rust-lang.org/dist/....tar.xz";
# };
# }
#
# The packages available usually are:
# cargo, rust-analysis, rust-docs, rust-src, rust-std, rustc, and
# rust, which aggregates them in one package.
#
# For each package the following options are available:
# extensions - The extensions that should be installed for the package.
# For example, install the package rust and add the extension rust-src.
# targets - The package will always be installed for the host system, but with this option
# extra targets can be specified, e.g. "mips-unknown-linux-musl". The target
# will only apply to components of the package that support being installed for
# a different architecture. For example, the rust package will install rust-std
# for the host system and the targets.
# targetExtensions - If you want to force extensions to be installed for the given targets, this is your option.
# All extensions in this list will be installed for the target architectures.
# *Attention* If you want to install an extension like rust-src, that has no fixed architecture (arch *),
# you will need to specify this extension in the extensions options or it will not be installed!
fromManifestFile = manifest:
{ stdenv, fetchurl, patchelf }:
let
inherit (builtins) elemAt;
inherit (super) makeOverridable;
inherit (super.lib) flip mapAttrs;
pkgs = fromTOML (builtins.readFile manifest);
in flip mapAttrs pkgs.pkg (name: pkg:
makeOverridable ({ extensions, targets, targetExtensions }:
let
version' = builtins.match "([^ ]*) [(]([^ ]*) ([^ ]*)[)]" pkg.version;
version =
"${elemAt version' 0}-${elemAt version' 2}-${elemAt version' 1}";
namesAndSrcs =
getComponents pkgs.pkg name targets extensions targetExtensions
stdenv fetchurl;
components = installComponents stdenv namesAndSrcs;
componentsOuts = builtins.map (comp:
(super.lib.strings.escapeNixString
(super.lib.getOutput "out" comp))) components;
in super.pkgs.symlinkJoin {
name = name + "-" + version;
paths = components;
postBuild = ''
# If rustc or rustdoc is in the derivation, we need to copy their
# executable into the final derivation. This is required
# for making them find the correct SYSROOT.
for target in $out/bin/{rustc,rustdoc}; do
if [ -e $target ]; then
cp --remove-destination "$(realpath -e $target)" $target
fi
done
'';
# Add the compiler as part of the propagated build inputs in order
# to run:
#
# $ nix-shell -p rustChannels.stable.rust
#
# And get a fully working Rust compiler, with the stdenv linker.
propagatedBuildInputs = [ stdenv.cc ];
meta.platforms = stdenv.lib.platforms.all;
}) {
extensions = [ ];
targets = [ ];
targetExtensions = [ ];
});
fromManifest = sha256: manifest:
{ stdenv, fetchurl, patchelf }:
let
manifestFile = if sha256 == null then
builtins.fetchurl manifest
else
fetchurl {
url = manifest;
inherit sha256;
};
in fromManifestFile manifestFile { inherit stdenv fetchurl patchelf; };
in rec {
lib = super.lib // {
inherit fromTOML;
rustLib = { inherit fromManifest fromManifestFile manifest_v2_url; };
};
rustChannelOf = { sha256 ? null, ... }@manifest_args:
fromManifest sha256 (manifest_v2_url manifest_args) {
inherit (self) stdenv fetchurl patchelf;
};
# Set of packages which are automagically updated. Do not rely on these for
# reproducible builds.
latest = (super.latest or { }) // {
rustChannels = {
nightly = rustChannelOf { channel = "nightly"; };
beta = rustChannelOf { channel = "beta"; };
stable = rustChannelOf { channel = "stable"; };
};
};
# Helper builder
rustChannelOfTargets = channel: date: targets:
(rustChannelOf { inherit channel date; }).rust.override {
inherit targets;
};
# For backward compatibility
rustChannels = latest.rustChannels;
# For each channel:
# latest.rustChannels.nightly.cargo
# latest.rustChannels.nightly.rust # Aggregate all others. (recommended)
# latest.rustChannels.nightly.rustc
# latest.rustChannels.nightly.rust-analysis
# latest.rustChannels.nightly.rust-docs
# latest.rustChannels.nightly.rust-src
# latest.rustChannels.nightly.rust-std
# For a specific date:
# (rustChannelOf { date = "2017-06-06"; channel = "beta"; }).rust
}
{
"nodes": {
"home-manager": {
"inputs": {
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1622753049,
"narHash": "sha256-clDbg4Lg4RGHJnGBLi2jp5kV4+01P42dAYB0imNmrhU=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "45f9cb06a9152ca367edc3e7eaa5449338885167",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1622889713,
"narHash": "sha256-f8IPyKmTA4v0MwCQE2TZXk709ZcBUfiuXEPLP9YsN/Q=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "93189848db3dbfa604791426f770563542882668",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1622545032,
"narHash": "sha256-1Y+2LFqnMBEH9OZzMBdLWl6GWFt/xzNz0V5X+m05Ing=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "1c2986bbb806c57f9470bf3231d8da7250ab9091",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"home-manager": "home-manager",
"nixpkgs": "nixpkgs_2"
}
}
},
"root": "root",
"version": 7
}
{
description = "My home configuration.";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager.url = "github:nix-community/home-manager";
};
outputs = { home-manager, nixpkgs, ... }:
let settings = import ./settings.nix; in{
nixosConfigurations.nixos = (nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./system/laptop/configuration.nix
(home-manager.nixosModules.home-manager)
{
config = {
home-manager.users.bender = import ./bender/home.nix;
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
nixpkgs.overlays = import ./bender/overlays;
};
}
] /*++ (if settings.machine == "laptop" then
[ ./system/laptop/configuration.nix ]
else
[ ./configuration.nix ])*/;
});
};
}
{ config, pkgs, ... }: {
enviorment = {
systemPackages = [ sway ];
}
#Make available to display manager if exists.
services.xserver.displayManager.sessionPackages = [ sway ];
}
{ machine = "laptop"; }
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, pkgs, ... }:
{
nix = {
package = pkgs.nixUnstable;
extraOptions = ''
experimental-features = nix-command flakes
'';
};
imports =
[
./hardware-configuration.nix
];
nixpkgs.config.allowUnfree = true;
#autoupdates
system.autoUpgrade.enable = true;
# Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
networking.hostName = "nixos"; # Define your hostname.
networking.networkmanager.enable = true;
#networking.wireless.enable = true;
#networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
#networking.supplicant.wlp2s0.configFile.path = "/etc/wpa_supplicant.conf";
# All networking devices should use DHCP
# Can we get this to be automated?
#networking.interfaces.enp1s0.useDHCP = true;
#networking.interfaces.wlp2s0.useDHCP = true;
##networking.useDHCP = true;
##for rkvm
#networking.firewall.allowedTCPPorts = [
# 5000
#];
networking.firewall.allowedUDPPorts = [
5000
];
services.avahi = {
enable = true;
nssmdns = true;
reflector = true;
};
networking.firewall.enable = true;
i18n.defaultLocale = "en_US.UTF-8";
# Set your time zone.
time.timeZone = "US/Central";
############## List of Packages Without much configuration ###############
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
neovim
mkpasswd
gnome3.gnome-tweaks
];
############### DEFAULT ENVIORNMENT VARIABLES ###############
environment.variables = {
EDITOR = "nvim";
};
# Enable sound.
sound.enable = true;
hardware.pulseaudio.enable = true;
# Enable the X11 windowing system.
services.xserver.enable = true;
services.xserver.displayManager.gdm.enable = true;
services.xserver.desktopManager.gnome3.enable = true;
services.xserver.layout = "us";
#printing
services.printing.enable = true;
services.printing.drivers = [ pkgs.brlaser ];
#scanning
hardware.sane = {
enable = true;
extraBackends = [pkgs.sane-airscan];
};
programs.dconf.enable = true;
# Enable touchpad support.
services.xserver.libinput.enable = true;
# Define a user account. Don't forget to set a password with ‘passwd’.
users.users.bender = rec {
home = "/home/bender";
description = "Arvinder Dhanoa";
isNormalUser = true;
extraGroups = [ "wheel" "scanner" "lp" ];
passwordFile = home + "/.secrets/passwordfile";
};
users.mutableUsers = false;
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. It‘s perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "20.03"; # Did you read the comment?
}
# Do not modify this file! It was generated by ‘nixos-generate-config’
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "sd_mod" "rtsx_usb_sdmmc" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/3825289c-8591-4ece-a214-a28f6dd6a47e";
fsType = "btrfs";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/F8D0-D471";
fsType = "vfat";
};
swapDevices = [ ];
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
}