LNDLMQXKTVH725EQKPN4CZ7RQM3CBEKSKRWYT6BRQRYZOMTSI5FAC
MAYALEYKYW55PDFYXTZA6L2BZAKCC5K3WEF7LD33STUWMURODKEAC
AVS7OB57NM6DSCIUDVEZGM5WWIZI34VK6HATDHV4WNG5TMW7XK2QC
5OE2E6HTLG4D5ENL2QTHM532MPAOIPXAZQITOWJDHPH6HMOYUQXQC
E3EMA3IW37WCVHTSMYURH43VYMABZ2YFCTRDQKEJM26KKMJZASWAC
6QRIDMN2WZ4TLWUHF4P7WOVGGVA7LJFA5B3FMB22F54QFFNIL27AC
LVUHNCEWDKH2JX46AOWFVHCRUSP2LFZHG5QSXXGJQSGN5HE2AYZAC
DDJCGCFVRUGNZA4PBKTZA267LYZVC7NP22BRF4N34VZMEH6HV6MQC
WT6F3UIU4S3B7G4CK3NUV7UCRQFB2WEEIAL6GRUICQX5O3YAHIWQC
FCZGSCYUU6XCWX3WT2CLGNSU62TCZH4QY2UOLGIWCIEGYADB6YYAC
6TXTUPQJMBUINHEWJDFSS4A6ZLKC5JSV7HJAZAQKZBX6DY6YNBCAC
V62DRTCOTFWHZQZP2HVFPTNANJAGECOJF5ZHZEU6PS2IATI64POAC
ROPHEBD5FLKAZSQOYRWJWQJ4GMPNIZ7Z3A7O7FR3S6PNMEKEUMOAC
HOO6QSJ73KJVRH7TTH6XN6BVONRGVQVE4BQSC74XACRTTKZTCKJQC
YTAPVEQTBGK2OP64KXW7QHKRYSXGNGQNNCP4ZZ3Q6VDPHCYQSGTAC
ZHOJ7VHYIOFB6XQNRESJLWZZLLOGUYCMSI6PIGXKANH6V2TGUH4AC
VKYIACEV277G3JADDS3P2OUBUQWH2KBLYU5DETWXAOSDDMNNYWUAC
P7TFDT656QZ7EDLGT65CD4ZCZKPNBLHD73MPVOD5GDDC7QIT7JDQC
OSQ7RN5OVUZUA3BMH5UMGKXP5ID2V6ZZHL7HDPJN3V5G2UI3U2CQC
TXZSCC335YEZEM4EBTDGU7V75RFVEDRJ3TZZJ4YE7C3LMSFBROWQC
TNFW2Z26BE3RGRUBFH2XCMAQFVZ4J73EEU6RIXPPYWEXCRJGODYAC
FMMHG5RSEJ6ND52DM4Z4477EZKH3YC3HL2D6WDLN7B5VIFUXHRDQC
T6EH3BKQOP2MIDE4BKW6ASIAOJCNH5RBSIKSI7JQLP4UET7QAZYAC
EXWV64EDZHZMARHYMMLSRSIE37MFQAOBNB6VCT2CJROBJBG7M4JAC
7B2CUQFQULD2G5LQ4R2KK2CPPL54TOLZSTRBZ7SMYG3FWU5G7BHAC
EQWBRL6L7JCCRIJO5O4DEA3IV4IAI4RHKL3LOBNDXPOYM3TK5SSAC
RLHIXTT6EVG4LNS4GIUPU6ZFCIP6ALOU74SWFLLZSGN63TTHLXMAC
VG5ZNJ3K6FPBEEEA5GX4I7ARZDGO3EYIQX2PDLUSUHIKTDCMKKYQC
KZNCDD4L25WFCU4C24ELYIZZVBKSNBBQIBC2ZE3J5RBQZNYMY4GAC
JO5ZSR4IB3JSICGSTIPP3RG37QVECXKFHQTB35Y6BOPUGEX55UMQC
SBXEWQSVHYIMXSVOT2SX4YZQ5UVU6KCZGYNCHNSKGI4QOP75BREQC
6WLPQQSNPMTKQTUKG5UGF6BW4JX62M2WWCPLDSDO7NT7IWOLMNYAC
GUH73C3BT6V7LCWJXJA6MITGDRPIKC52ZTOUVOB4JX2WIFR4XSHQC
6TJTI7RQ5QVCBPW6BKPUL6XUFWUIMXH774UAFCHACDJQWDMPSZNQC
L2MS4TSNRLJSAN6IYUQJQIDLBJ46DI6J72RQV7VUDMY6LZE44G5AC
DQI5AYP6Y6R7RJZV3FMSLGTBADXTKN7ZMH7C55EEBWRG5E6T22UQC
O7PKO65N6EGZ5ROHWFF3KBS334G7ADE2DDOWR3BICDUC7WBA4MXAC
IXOYLUPPWN5SBNDKP4JTF5ZSCJDVXVJSUCAFL56ORIPWKBJ4R6DQC
H7I6OGUPFPXA4FGONARVWB4TSL5V4L4XAZ5T23NHDICBG3YNODPAC
Q7BS5BOC3RO35IO5WMOGTRG6NPO4Z4EWFWPDFVDC5AWNDQ2INWWAC
XNGFJHLQT32DYH52PZRADH5EQDY7HRNEJ472IP4FNWL45NYO6LNAC
ZRJNPDNXM2XBDKJH4I4WFFNGFVWGFDPWRKAICRN45CMYRR5VADZAC
66COC6TI5UGIYQMWHOTONDBSH63AQYAHYP5UKYZR65Y6VEVJIPZQC
XYVOW54TWIJYX7VDWOTXFNM27C2ODJKTGUZ3LXVDURPHHLBKXS6QC
XRL7BCX5LXCBBAPUZDIHKFHSH6K32YNNC6ZQMBKNBZNK6ZBIFDNQC
RHDO6BBKT5SL2IER3BMB3RO7FF7HCKVSOHYO3C7KCVEVVZPVVV2QC
7WRCELP442EOY7MDXW7DKSERVERT5BNYGWUMIMBMNEBYKGYJMVMAC
PX3D4SDCXCVNA4ZPA4Y4O675C3KSYJWQOZCLVLSNX4LLSET3MDWAC
IZLESURJZCWFFIFPDX2LIB4WDOY3DKJSRSTBSSQBTHQBL7TBSCPAC
SCDIKI3JG3AOMEQUIX4CDOYRJH2VOWYBO5PZBDQMETW4RZOR676QC
LCU2Y6NLRNRKR4R2YHQH5G6LJXG4UZZOMFEV7C5B2BDQPC45E5YAC
5P6VVSEVXATMU5OBYS4EZQQIUN5YFPYHHIUFAKS5UMCD4Q5KQKWAC
M7LUQWO6IPWSFGFY3LMG57EMRKLWGKA6TCQNBYPD4VWLFQSMEFQQC
7PXJA6YOA6OLBMCCPROMGWY2EN6ASWIJNSKDOIKN2MOQ2GCOR5BQC
MXZBXPX56QLVRVSMTYDFPIUSQ3HG3BBIIAOSYVE2K5LQW54VUW3QC
YQUFGGWU6WFCVRSGS3J577RQL7WJRQCLXVHHXVXDUJTMDRQC5BSQC
WOVOJYXQSEPSUTQGPT625ZIXV7GHKFRJ64CGGL64QBNOIRHOKVTAC
5C7V5HBQN72EONBIORLYJPIY4OYZTI3YJEWIDCTLSDOQ44N6W4YAC
6JAZSTWHYD5WOY5KLRXWKUSQQHJY5LV7KB26XYHSIKG7XVJDJVVAC
QKXSAPK72YBZXXIZDA6NDWIRNXU3BAAEM6WGDZTDODDJJSAHOIHAC
7SS3AXZUMW4YXEDMAQMMWIH7CNT3EUAHF2WIRM5DYYDS2IL5JUVQC
WWKBCPT4VJPJTJ5UPN7JBOUFNP7BE6SQ5FUIQ7A5IVRSEIK7GI4QC
KNVR6AKC5RT232R42JZ4GREX5HZZK57T7P4UE3ZRRBTSWRN4IE7QC
IUWUPUTGXRMPSV3BOIT5HY2YGBXGFB2EQ4VCUOGQIYE4VT5CS5NQC
CFC5MXQGM5XGLOFFQ43A2E44QOBUW2RF4MRRPS7QYZABTMH4BWLAC
{ ... }: {
services.samba = {
enable = true;
extraConfig = ''
# 192.168.111 host's my local VM network - nothing off
# that should get access.
workgroup = WORKGROUP
hosts allow = localhost 192.168.111.0/255.255.255.0
server min protocol = SMB2
server string = local_file_share
netbios name = nixos
use sendfile = yes
guest account = nobody
map to guest = bad user
'';
shares = {
bender = {
path = "/mnt/share/bender";
browseable = "yes";
"read only" = "no";
"valid users" = "bender";
"directory mask" = "0750";
};
};
};
}
{ ... }: {
services.samba = {
enable = true;
extraConfig = ''
# 192.168.111 host's my local VM network - nothing off
# that should get access.
workgroup = WORKGROUP
hosts allow = localhost 192.168.111.0/255.255.255.0
server min protocol = SMB2
server string = local_file_share
netbios name = nixos
use sendfile = yes
guest account = nobody
map to guest = bad user
'';
shares = {
bender = {
path = "/mnt/share/bender";
browseable = "yes";
"read only" = "no";
"valid users" = "bender";
"directory mask" = "0750";
};
};
};
}
# 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 = [ ];
boot.initrd.availableKernelModules = [ "sd_mod" "sr_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/c00f5522-0691-447d-90a7-a364f2a9be91";
fsType = "ext4";
};
swapDevices = [ ];
virtualisation.hypervGuest.enable = true;
}
# 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 = [ ];
boot.initrd.availableKernelModules = [ "sd_mod" "sr_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/c00f5522-0691-447d-90a7-a364f2a9be91";
fsType = "ext4";
};
swapDevices = [ ];
virtualisation.hypervGuest.enable = true;
}
# 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 =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
# this sets up the share for the host, Nix, and
# anything else I feel like adding to the network.
./samba_share_local.nix
];
nixpkgs.config.allowUnfree = true;
virtualisation.hypervGuest = {
enable = true;
videoMode = "1680x1050";
};
boot.kernelPackages = pkgs.nixpkgs-master.linuxPackages_latest;
# 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.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# Set your time zone.
# time.timeZone = "Europe/Amsterdam";
# The global useDHCP flag is deprecated, therefore explicitly set to false here.
# Per-interface useDHCP will be mandatory in the future, so this generated config
# replicates the default behaviour.
networking.useDHCP = false;
networking.interfaces.eth0.useDHCP = true;
networking.nameservers = ["1.1.1.1" "199.16.166.186" "199.17.166.187"];
networking.interfaces.enp0.ipv4.addresses = [{
address = "192.168.111.11";
prefixLength = 24;
}];
# Open ports in the firewall.
networking.firewall.allowedTCPPorts = [
5201 # iperf
445 139 #samba
];
networking.firewall.allowedUDPPorts = [
5201 # iperf
137 138 #samba
];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Select internationalisation properties.
# i18n.defaultLocale = "en_US.UTF-8";
# console = {
# font = "Lat2-Terminus16";
# keyMap = "us";
# };
# Enable the X11 windowing system.
services.xserver.enable = true;
# Enable the GNOME Desktop Environment.
services.xserver.desktopManager.gnome.enable = true;
# Configure keymap in X11
# services.xserver.layout = "us";
# services.xserver.xkbOptions = "eurosign:e";
# Enable CUPS to print documents.
# services.printing.enable = true;
# Enable sound.
# sound.enable = true;
# hardware.pulseaudio.enable = true;
# Enable touchpad support (enabled default in most desktopManager).
# services.xserver.libinput.enable = true;
# Define a user account. Don't forget to set a password with ‘passwd’.
# users.users.jane = {
# isNormalUser = true;
# extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user.
# };
users.users.bender = {
isNormalUser = true;
extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user.
};
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
iperf
keepassx
];
environment.variables.EDITOR = "nvim";
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
# programs.gnupg.agent = {
# enable = true;
# enableSSHSupport = true;
# };
# List services that you want to enable:
# Enable the OpenSSH daemon.
# services.openssh.enable = true;
# 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 = "21.05"; # Did you read the comment?
}
# 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 =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
# this sets up the share for the host, Nix, and
# anything else I feel like adding to the network.
./samba_share_local.nix
];
nixpkgs.config.allowUnfree = true;
virtualisation.hypervGuest = {
enable = true;
videoMode = "1680x1050";
};
boot.kernelPackages = pkgs.nixpkgs-master.linuxPackages_latest;
# 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.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# Set your time zone.
# time.timeZone = "Europe/Amsterdam";
# The global useDHCP flag is deprecated, therefore explicitly set to false here.
# Per-interface useDHCP will be mandatory in the future, so this generated config
# replicates the default behaviour.
networking.useDHCP = false;
networking.interfaces.eth0.useDHCP = true;
networking.nameservers = ["1.1.1.1" "199.16.166.186" "199.17.166.187"];
networking.interfaces.enp0.ipv4.addresses = [{
address = "192.168.111.11";
prefixLength = 24;
}];
# Open ports in the firewall.
networking.firewall.allowedTCPPorts = [
5201 # iperf
445 139 #samba
];
networking.firewall.allowedUDPPorts = [
5201 # iperf
137 138 #samba
];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Select internationalisation properties.
# i18n.defaultLocale = "en_US.UTF-8";
# console = {
# font = "Lat2-Terminus16";
# keyMap = "us";
# };
# Enable the X11 windowing system.
services.xserver.enable = true;
# Enable the GNOME Desktop Environment.
services.xserver.desktopManager.gnome.enable = true;
# Configure keymap in X11
# services.xserver.layout = "us";
# services.xserver.xkbOptions = "eurosign:e";
# Enable CUPS to print documents.
# services.printing.enable = true;
# Enable sound.
# sound.enable = true;
# hardware.pulseaudio.enable = true;
# Enable touchpad support (enabled default in most desktopManager).
# services.xserver.libinput.enable = true;
# Define a user account. Don't forget to set a password with ‘passwd’.
# users.users.jane = {
# isNormalUser = true;
# extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user.
# };
users.users.bender = {
isNormalUser = true;
extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user.
};
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
iperf
keepassx
];
environment.variables.EDITOR = "nvim";
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
# programs.gnupg.agent = {
# enable = true;
# enableSSHSupport = true;
# };
# List services that you want to enable:
# Enable the OpenSSH daemon.
# services.openssh.enable = true;
# 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 = "21.05"; # Did you read the comment?
}
{ config, pkgs, lib, ... }:
let server_bindings = [
{name = "fedora"; pubKey = "5oqbinscH3o9mWBFNYOPdHrMB5NOw1P/AGK4I5exAmY="; ip = "10.100.0.2";}
];
in {
services.bind = {
enable = true;
forwarders = ["192.168.1.1"];
cacheNetworks = ["10.100.0.0/16" "127.0.0.0/24"];
zones = {
"server.home.arpa" = {
master = true;
file = pkgs.writeText "server-zone-conf" ''
$TTL 1h
@ IN SOA wireguard.server.home.arpa. admin.wireguard.server.home.arpa. (
21121201 ; Serial
1H ; Refresh
1H ; Retry
1W ; Expire
3H ); Negative Cache TTL
IN NS wireguard
wireguard IN A 10.100.0.1
${builtins.concatStringsSep "\n" (builtins.map ({name, ip, ...}: "${name} IN A ${ip}" ) server_bindings)}
;fedora IN A 10.100.0.2
'';
};
};
};
networking.nat = {
enable = true;
externalInterface = "ens18";
internalInterfaces = ["wg0"];
};
networking.nameservers = ["192.168.1.1" "127.0.0.1"];
networking.wireguard.interfaces = {
wg0 = {
ips = ["10.100.0.1/24"];
listenPort = 51820;
privateKeyFile = config.age.secrets."wireguard/private.key".path;
# This allows the wireguard server to route your traffic to the internet and hence be like a VPN
# For this to work you have to set the dnsserver IP of your router (or dnsserver of choice) in your clients
postSetup = ''
${pkgs.iptables}/bin/iptables -t nat -A POSTROUTING -s 10.100.0.0/16 -o eth0 -j MASQUERADE
'';
# This undoes the above command
postShutdown = ''
${pkgs.iptables}/bin/iptables -t nat -D POSTROUTING -s 10.100.0.0/24 -o eth0 -j MASQUERADE
'';
peers = [
{ # Windows desktop
publicKey = "cuPku4mcym5S7KR1/NJMwAFnw7+yUeCq8KmJv52dqEk=";
# List of IPs assigned to this peer within the tunnel subnet. Used to configure routing.
allowedIPs = [ "10.100.1.1/32" ];
}
] ++ (builtins.map ({pubKey, ip, ...}: {publicKey = pubKey; allowedIPs = ["${ip}/32"];}) server_bindings);
};
};
age.secrets."wireguard/private.key".file = ../../secrets/wireguard/private.key;
networking.firewall.allowedUDPPorts = [ 51820 ];
}
{ config, pkgs, lib, ... }:
let server_bindings = [
{name = "fedora"; pubKey = "5oqbinscH3o9mWBFNYOPdHrMB5NOw1P/AGK4I5exAmY="; ip = "10.100.0.2";}
];
in {
services.bind = {
enable = true;
forwarders = ["192.168.1.1"];
cacheNetworks = ["10.100.0.0/16" "127.0.0.0/24"];
zones = {
"server.home.arpa" = {
master = true;
file = pkgs.writeText "server-zone-conf" ''
$TTL 1h
@ IN SOA wireguard.server.home.arpa. admin.wireguard.server.home.arpa. (
21121201 ; Serial
1H ; Refresh
1H ; Retry
1W ; Expire
3H ); Negative Cache TTL
IN NS wireguard
wireguard IN A 10.100.0.1
${builtins.concatStringsSep "\n" (builtins.map ({name, ip, ...}: "${name} IN A ${ip}" ) server_bindings)}
;fedora IN A 10.100.0.2
'';
};
};
};
networking.nat = {
enable = true;
externalInterface = "ens18";
internalInterfaces = ["wg0"];
};
networking.nameservers = ["192.168.1.1" "127.0.0.1"];
networking.wireguard.interfaces = {
wg0 = {
ips = ["10.100.0.1/24"];
listenPort = 51820;
privateKeyFile = config.age.secrets."wireguard/private.key".path;
# This allows the wireguard server to route your traffic to the internet and hence be like a VPN
# For this to work you have to set the dnsserver IP of your router (or dnsserver of choice) in your clients
postSetup = ''
${pkgs.iptables}/bin/iptables -t nat -A POSTROUTING -s 10.100.0.0/16 -o eth0 -j MASQUERADE
'';
# This undoes the above command
postShutdown = ''
${pkgs.iptables}/bin/iptables -t nat -D POSTROUTING -s 10.100.0.0/24 -o eth0 -j MASQUERADE
'';
peers = [
{ # Windows desktop
publicKey = "cuPku4mcym5S7KR1/NJMwAFnw7+yUeCq8KmJv52dqEk=";
# List of IPs assigned to this peer within the tunnel subnet. Used to configure routing.
allowedIPs = [ "10.100.1.1/32" ];
}
] ++ (builtins.map ({pubKey, ip, ...}: {publicKey = pubKey; allowedIPs = ["${ip}/32"];}) server_bindings);
};
};
age.secrets."wireguard/private.key".file = ../../secrets/wireguard/private.key;
networking.firewall.allowedUDPPorts = [ 51820 ];
}
{ config, pkgs, ... }: {
services.zabbixServer.enable = true;
services.zabbixWeb = {
enable = true;
server = {
port = 10051;
address = "10.100.0.1";
};
virtualHost = {
hostName = "wireguard.server.home.arpa";
adminAddr = "tmp@tmp.org";
};
};
services.zabbixAgent = {
enable = true;
server = "localhost";
};
services.promtail = {
enable = true;
configuration = {
server.http_listen_port = 9080;
server.grpc_listen_port = 0;
clients = [{url = "http://localhost:3100/loki/api/v1/push";}];
scrape_configs = [{
job_name = "journal";
journal = {
max_age = "12h";
labels = {
job = "systemd-journal";
server = "wireguard";
};
};
#relable_configs = [{source_label = "__journal__systemd_unit"; target_label = "unit";}];
}];
};
};
services.grafana = {
enable = true;
addr = "";
domain = "wireguard.server.home.arpa";
port = 3000;
protocol = "http";
};
services.loki = {
enable = true;
configFile = pkgs.writeText "config.yaml" ''
auth_enabled: false
server:
http_listen_port: 3100
grpc_listen_port: 9096
ingester:
wal:
enabled: true
dir: /tmp/wal
lifecycler:
address: 127.0.0.1
ring:
kvstore:
store: inmemory
replication_factor: 1
final_sleep: 0s
chunk_idle_period: 1h # Any chunk not receiving new logs in this time will be flushed
max_chunk_age: 1h # All chunks will be flushed when they hit this age, default is 1h
chunk_target_size: 1048576 # Loki will attempt to build chunks up to 1.5MB, flushing first if chunk_idle_period or max_chunk_age is reached first
chunk_retain_period: 30s # Must be greater than index read cache TTL if using an index cache (Default index read cache TTL is 5m)
max_transfer_retries: 0 # Chunk transfers disabled
schema_config:
configs:
- from: 2020-10-24
store: boltdb-shipper
object_store: filesystem
schema: v11
index:
prefix: index_
period: 24h
storage_config:
boltdb_shipper:
active_index_directory: /tmp/loki/boltdb-shipper-active
cache_location: /tmp/loki/boltdb-shipper-cache
cache_ttl: 24h # Can be increased for faster performance over longer query periods, uses more disk space
shared_store: filesystem
filesystem:
directory: /tmp/loki/chunks
compactor:
working_directory: /tmp/loki/boltdb-shipper-compactor
shared_store: filesystem
limits_config:
reject_old_samples: true
reject_old_samples_max_age: 168h
chunk_store_config:
max_look_back_period: 0s
table_manager:
retention_deletes_enabled: false
retention_period: 0s
ruler:
storage:
type: local
local:
directory: /tmp/loki/rules
rule_path: /tmp/loki/rules-temp
alertmanager_url: http://localhost:9093
ring:
kvstore:
store: inmemory
enable_api: true'';
#configuration = {
# auth_enabled = false;
# server = {
# http_listen_port = 3100;
# grpc_listen_port = 9096;
# };
# common = {
# path_prefix = "/tmp/loki";
# storage = {
# filesystem = {
# chunks_directory = "/tmp/loki/chunks";
# rules_directory = "/tmp/loki/rules";
# };
# replication_factor = 1;
# ring = {
# instance_addr = "127.0.0.1";
# kv_store = {
# store = "inmemory";
# };
# };
# };
# };
# schema_config = {
# configs = [{
# from = "2021-12-15";
# store = "boltdb-shipper";
# object_store = "filesystem";
# schema = "v11";
# index = {
# prefix = "index_";
# period = "24h";
# };
# }];
# };
# ruler = {
# alertmanager_url = "http://localhost:9093";
# };
#};
};
networking.firewall.allowedTCPPorts = [80 3000 9002 9000 10051];
services.prometheus =
let servers = ["fedora" "wireguard"];
in
{
enable = true;
scrapeConfigs =
builtins.map (server: {
job_name = "${server}";
static_configs = [{
labels = {
server = "${server}";
};
targets = ["${server}.server.home.arpa:9002"];
}];
}) servers;
exporters = {
node = {
enable = true;
enabledCollectors = ["systemd"];
port = 9002;
};
};
};
}
{ config, pkgs, ... }: {
services.zabbixServer.enable = true;
services.zabbixWeb = {
enable = true;
server = {
port = 10051;
address = "10.100.0.1";
};
virtualHost = {
hostName = "wireguard.server.home.arpa";
adminAddr = "tmp@tmp.org";
};
};
services.zabbixAgent = {
enable = true;
server = "localhost";
};
services.promtail = {
enable = true;
configuration = {
server.http_listen_port = 9080;
server.grpc_listen_port = 0;
clients = [{url = "http://localhost:3100/loki/api/v1/push";}];
scrape_configs = [{
job_name = "journal";
journal = {
max_age = "12h";
labels = {
job = "systemd-journal";
server = "wireguard";
};
};
#relable_configs = [{source_label = "__journal__systemd_unit"; target_label = "unit";}];
}];
};
};
services.grafana = {
enable = true;
addr = "";
domain = "wireguard.server.home.arpa";
port = 3000;
protocol = "http";
};
services.loki = {
enable = true;
configFile = pkgs.writeText "config.yaml" ''
auth_enabled: false
server:
http_listen_port: 3100
grpc_listen_port: 9096
ingester:
wal:
enabled: true
dir: /tmp/wal
lifecycler:
address: 127.0.0.1
ring:
kvstore:
store: inmemory
replication_factor: 1
final_sleep: 0s
chunk_idle_period: 1h # Any chunk not receiving new logs in this time will be flushed
max_chunk_age: 1h # All chunks will be flushed when they hit this age, default is 1h
chunk_target_size: 1048576 # Loki will attempt to build chunks up to 1.5MB, flushing first if chunk_idle_period or max_chunk_age is reached first
chunk_retain_period: 30s # Must be greater than index read cache TTL if using an index cache (Default index read cache TTL is 5m)
max_transfer_retries: 0 # Chunk transfers disabled
schema_config:
configs:
- from: 2020-10-24
store: boltdb-shipper
object_store: filesystem
schema: v11
index:
prefix: index_
period: 24h
storage_config:
boltdb_shipper:
active_index_directory: /tmp/loki/boltdb-shipper-active
cache_location: /tmp/loki/boltdb-shipper-cache
cache_ttl: 24h # Can be increased for faster performance over longer query periods, uses more disk space
shared_store: filesystem
filesystem:
directory: /tmp/loki/chunks
compactor:
working_directory: /tmp/loki/boltdb-shipper-compactor
shared_store: filesystem
limits_config:
reject_old_samples: true
reject_old_samples_max_age: 168h
chunk_store_config:
max_look_back_period: 0s
table_manager:
retention_deletes_enabled: false
retention_period: 0s
ruler:
storage:
type: local
local:
directory: /tmp/loki/rules
rule_path: /tmp/loki/rules-temp
alertmanager_url: http://localhost:9093
ring:
kvstore:
store: inmemory
enable_api: true'';
#configuration = {
# auth_enabled = false;
# server = {
# http_listen_port = 3100;
# grpc_listen_port = 9096;
# };
# common = {
# path_prefix = "/tmp/loki";
# storage = {
# filesystem = {
# chunks_directory = "/tmp/loki/chunks";
# rules_directory = "/tmp/loki/rules";
# };
# replication_factor = 1;
# ring = {
# instance_addr = "127.0.0.1";
# kv_store = {
# store = "inmemory";
# };
# };
# };
# };
# schema_config = {
# configs = [{
# from = "2021-12-15";
# store = "boltdb-shipper";
# object_store = "filesystem";
# schema = "v11";
# index = {
# prefix = "index_";
# period = "24h";
# };
# }];
# };
# ruler = {
# alertmanager_url = "http://localhost:9093";
# };
#};
};
networking.firewall.allowedTCPPorts = [80 3000 9002 9000 10051];
services.prometheus =
let servers = ["fedora" "wireguard"];
in
{
enable = true;
scrapeConfigs =
builtins.map (server: {
job_name = "${server}";
static_configs = [{
labels = {
server = "${server}";
};
targets = ["${server}.server.home.arpa:9002"];
}];
}) servers;
exporters = {
node = {
enable = true;
enabledCollectors = ["systemd"];
port = 9002;
};
};
};
}
# 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 = [ ];
boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "sd_mod" "sr_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/5dc0d3b1-5c8f-4796-9f54-6fa499ed8e61";
fsType = "ext4";
};
swapDevices = [ ];
virtualisation.hypervGuest.enable = true;
}
# 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 = [ ];
boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "sd_mod" "sr_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/5dc0d3b1-5c8f-4796-9f54-6fa499ed8e61";
fsType = "ext4";
};
swapDevices = [ ];
virtualisation.hypervGuest.enable = true;
}
{config, pkgs, ...}:
{
services.ddclient = {
enable = true;
protocol = "namecheap";
domains = ["internal"];
passwordFile = config.age.secrets."dyndns/password.priv".path;
username = "arvinderd.com";
};
age.secrets."dyndns/password.priv".file = ../../secrets/dyndns/password.priv;
}
{config, pkgs, ...}:
{
services.ddclient = {
enable = true;
protocol = "namecheap";
domains = ["internal"];
passwordFile = config.age.secrets."dyndns/password.priv".path;
username = "arvinderd.com";
};
age.secrets."dyndns/password.priv".file = ../../secrets/dyndns/password.priv;
}
$TTL 1h
@ IN SOA wireguard.server.home.arpa. admin.wireguard.server.home.arpa. (
21121201 ; Serial
1H ; Refresh
1H ; Retry
1W ; Expire
3H ); Negative Cache TTL
IN NS wireguard
wireguard IN A 10.100.0.1
fedora IN A 10.100.0.2
$TTL 1h
@ IN SOA wireguard.server.home.arpa. admin.wireguard.server.home.arpa. (
21121201 ; Serial
1H ; Refresh
1H ; Retry
1W ; Expire
3H ); Negative Cache TTL
IN NS wireguard
wireguard IN A 10.100.0.1
fedora IN A 10.100.0.2
# 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, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
./wireguard.nix
./prometheus.nix
./dyndns.nix
];
nix = { package = pkgs.nixFlakes; extraOptions = ''experimental-features = nix-command flakes''; };
nixpkgs.config.allowUnfree = true;
boot.loader.systemd-boot.enable = true;
networking.hostName = "nixos"; # Define your hostname.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# Set your time zone.
time.timeZone = "America/Chicago";
# The global useDHCP flag is deprecated, therefore explicitly set to false here.
# Per-interface useDHCP will be mandatory in the future, so this generated config
# replicates the default behaviour.
networking.useDHCP = false;
networking.interfaces.ens18.useDHCP = true;
networking.interfaces.ens18.ipv4.addresses = [{
address = "192.168.1.24";
prefixLength = 32;
}];
# Select internationalisation properties.
# i18n.defaultLocale = "en_US.UTF-8";
# console = {
# font = "Lat2-Terminus16";
# keyMap = "us";
# };
# Enable the GNOME 3 Desktop Environment.
# services.xserver.enable = true;
# services.xserver.displayManager.gdm.enable = true;
# services.xserver.desktopManager.gnome3.enable = true;
# Configure keymap in X11
# services.xserver.layout = "us";
# services.xserver.xkbOptions = "eurosign:e";
# Enable CUPS to print documents.
# services.printing.enable = true;
# Enable sound.
# sound.enable = true;
# hardware.pulseaudio.enable = true;
# Enable touchpad support (enabled default in most desktopManager).
# services.xserver.libinput.enable = true;
users.users.bender = {
isNormalUser = true;
extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user.
};
# List packages installed in system profile. To search, run:
# $ nix search wget
# environment.systemPackages = with pkgs; [
# wget vim
# firefox
# ];
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
# programs.gnupg.agent = {
# enable = true;
# enableSSHSupport = true;
# };
# List services that you want to enable:
# Enable the OpenSSH daemon.
services.openssh.enable = true;
services.journald.extraConfig = ''
SystemMaxUse = 1G
'';
# Open ports in the firewall.
networking.firewall.allowedTCPPorts = [
22 #ssh
53 #DNS
];
networking.firewall.allowedUDPPorts = [
53 #DNS
];
# Or disable the firewall altogether.
# networking.firewall.enable = 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.09"; # Did you read the comment?
}
# 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, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
./wireguard.nix
./prometheus.nix
./dyndns.nix
];
nix = { package = pkgs.nixFlakes; extraOptions = ''experimental-features = nix-command flakes''; };
nixpkgs.config.allowUnfree = true;
boot.loader.systemd-boot.enable = true;
networking.hostName = "nixos"; # Define your hostname.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# Set your time zone.
time.timeZone = "America/Chicago";
# The global useDHCP flag is deprecated, therefore explicitly set to false here.
# Per-interface useDHCP will be mandatory in the future, so this generated config
# replicates the default behaviour.
networking.useDHCP = false;
networking.interfaces.ens18.useDHCP = true;
networking.interfaces.ens18.ipv4.addresses = [{
address = "192.168.1.24";
prefixLength = 32;
}];
# Select internationalisation properties.
# i18n.defaultLocale = "en_US.UTF-8";
# console = {
# font = "Lat2-Terminus16";
# keyMap = "us";
# };
# Enable the GNOME 3 Desktop Environment.
# services.xserver.enable = true;
# services.xserver.displayManager.gdm.enable = true;
# services.xserver.desktopManager.gnome3.enable = true;
# Configure keymap in X11
# services.xserver.layout = "us";
# services.xserver.xkbOptions = "eurosign:e";
# Enable CUPS to print documents.
# services.printing.enable = true;
# Enable sound.
# sound.enable = true;
# hardware.pulseaudio.enable = true;
# Enable touchpad support (enabled default in most desktopManager).
# services.xserver.libinput.enable = true;
users.users.bender = {
isNormalUser = true;
extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user.
};
# List packages installed in system profile. To search, run:
# $ nix search wget
# environment.systemPackages = with pkgs; [
# wget vim
# firefox
# ];
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
# programs.gnupg.agent = {
# enable = true;
# enableSSHSupport = true;
# };
# List services that you want to enable:
# Enable the OpenSSH daemon.
services.openssh.enable = true;
services.journald.extraConfig = ''
SystemMaxUse = 1G
'';
# Open ports in the firewall.
networking.firewall.allowedTCPPorts = [
22 #ssh
53 #DNS
];
networking.firewall.allowedUDPPorts = [
53 #DNS
];
# Or disable the firewall altogether.
# networking.firewall.enable = 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.09"; # 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";
}
# 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";
}
# 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.gnome.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?
}
# 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.gnome.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" "usbhid" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" "v4l2loopback"];
boot.extraModulePackages = [ pkgs.linuxPackages.v4l2loopback ];
nixpkgs.config.allowUnfree = true;
fileSystems."/" = {
device = "/dev/disk/by-uuid/91c3546a-54d1-4c02-bbf6-21394f4934f1";
fsType = "ext4";
};
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/1688-EC4D";
fsType = "vfat";
};
swapDevices =
[{ device = "/dev/disk/by-uuid/7a34c74f-aa77-47dc-8e55-be8053268a5b"; }];
}
# 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" "usbhid" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" "v4l2loopback"];
boot.extraModulePackages = [ pkgs.linuxPackages.v4l2loopback ];
nixpkgs.config.allowUnfree = true;
fileSystems."/" = {
device = "/dev/disk/by-uuid/91c3546a-54d1-4c02-bbf6-21394f4934f1";
fsType = "ext4";
};
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/1688-EC4D";
fsType = "vfat";
};
swapDevices =
[{ device = "/dev/disk/by-uuid/7a34c74f-aa77-47dc-8e55-be8053268a5b"; }];
}
# 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 = [ # Include the results of the hardware scan.
./hardware-configuration.nix
];
# Use the GRUB 2 boot loader.
# boot.loader.grub.enable = true;
# boot.loader.grub.version = 2;
# boot.loader.grub.efiSupport = true;
# boot.loader.grub.efiInstallAsRemovable = true;
# boot.loader.efi.efiSysMountPoint = "/boot/efi";
# Define on which hard drive you want to install Grub.
# boot.loader.grub.device = "/dev/sda"; # or "nodev" for efi only
boot.loader.systemd-boot.enable = true;
networking.hostName = "nixos"; # Define your hostname.
networking.firewall.allowPing = true;
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# Set your time zone.
time.timeZone = "America/Chicago";
# The global useDHCP flag is deprecated, therefore explicitly set to false here.
# Per-interface useDHCP will be mandatory in the future, so this generated config
# replicates the default behaviour.
networking.useDHCP = false;
networking.interfaces.enp0s3.useDHCP = true;
networking.interfaces.enp35s0.useDHCP = true;
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Select internationalisation properties.
# i18n.defaultLocale = "en_US.UTF-8";
# console = {
# font = "Lat2-Terminus16";
# keyMap = "us";
# };
# Enable the GNOME 3 Desktop Environment.
services.xserver.enable = true;
services.xserver.videoDrivers = ["nvidia"];
services.xserver.displayManager.gdm.enable = true;
services.xserver.desktopManager.gnome.enable = true;
services.gnome.gnome-remote-desktop.enable = true;
# Configure keymap in X11
# services.xserver.layout = "us";
# services.xserver.xkbOptions = "eurosign:e";
# Enable CUPS to print documents.
services.printing.enable = true;
xdg = {
portal = {
enable = true;
extraPortals = [
pkgs.xdg-desktop-portal-wlr
pkgs.xdg-desktop-portal-gtk
];
};
};
# Enable sound.
hardware.pulseaudio.enable = false;
# rtkit is optional but recommended
security.rtkit.enable = true;
programs.dconf.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
# If you want to use JACK applications, uncomment this
#jack.enable = true;
# use the example session manager (no others are packaged yet so this is enabled by default,
# no need to redefine it in your config for now)
#media-session.enable = true;
};
# Enable touchpad support (enabled default in most desktopManager).
services.xserver.libinput.enable = true;
# Define a user account. Don't forget to set a password with ‘passwd’.
users.users.bender = {
isNormalUser = true;
extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user.
};
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [ wget neovim git linuxPackages.v4l2loopback];
environment.variables.EDITOR = "nvim";
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
programs.mtr.enable = true;
programs.gnupg.agent = {
enable = true;
enableSSHSupport = true;
};
# some development thing I made on the spot.
services.postgresql = {
enable = true;
package = pkgs.postgresql_10;
enableTCPIP = true;
authentication = pkgs.lib.mkOverride 10 ''
local all all trust
host all all ::1/128 trust
host all all 127.0.0.1/32 trust
'';
};
# List services that you want to enable:
# Enable the OpenSSH daemon.
services.openssh.enable = true;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = 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.09"; # Did you read the comment?
}
# 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 = [ # Include the results of the hardware scan.
./hardware-configuration.nix
];
# Use the GRUB 2 boot loader.
# boot.loader.grub.enable = true;
# boot.loader.grub.version = 2;
# boot.loader.grub.efiSupport = true;
# boot.loader.grub.efiInstallAsRemovable = true;
# boot.loader.efi.efiSysMountPoint = "/boot/efi";
# Define on which hard drive you want to install Grub.
# boot.loader.grub.device = "/dev/sda"; # or "nodev" for efi only
boot.loader.systemd-boot.enable = true;
networking.hostName = "nixos"; # Define your hostname.
networking.firewall.allowPing = true;
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# Set your time zone.
time.timeZone = "America/Chicago";
# The global useDHCP flag is deprecated, therefore explicitly set to false here.
# Per-interface useDHCP will be mandatory in the future, so this generated config
# replicates the default behaviour.
networking.useDHCP = false;
networking.interfaces.enp0s3.useDHCP = true;
networking.interfaces.enp35s0.useDHCP = true;
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Select internationalisation properties.
# i18n.defaultLocale = "en_US.UTF-8";
# console = {
# font = "Lat2-Terminus16";
# keyMap = "us";
# };
# Enable the GNOME 3 Desktop Environment.
services.xserver.enable = true;
services.xserver.videoDrivers = ["nvidia"];
services.xserver.displayManager.gdm.enable = true;
services.xserver.desktopManager.gnome.enable = true;
services.gnome.gnome-remote-desktop.enable = true;
# Configure keymap in X11
# services.xserver.layout = "us";
# services.xserver.xkbOptions = "eurosign:e";
# Enable CUPS to print documents.
services.printing.enable = true;
xdg = {
portal = {
enable = true;
extraPortals = [
pkgs.xdg-desktop-portal-wlr
pkgs.xdg-desktop-portal-gtk
];
};
};
# Enable sound.
hardware.pulseaudio.enable = false;
# rtkit is optional but recommended
security.rtkit.enable = true;
programs.dconf.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
# If you want to use JACK applications, uncomment this
#jack.enable = true;
# use the example session manager (no others are packaged yet so this is enabled by default,
# no need to redefine it in your config for now)
#media-session.enable = true;
};
# Enable touchpad support (enabled default in most desktopManager).
services.xserver.libinput.enable = true;
# Define a user account. Don't forget to set a password with ‘passwd’.
users.users.bender = {
isNormalUser = true;
extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user.
};
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [ wget neovim git linuxPackages.v4l2loopback];
environment.variables.EDITOR = "nvim";
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
programs.mtr.enable = true;
programs.gnupg.agent = {
enable = true;
enableSSHSupport = true;
};
# some development thing I made on the spot.
services.postgresql = {
enable = true;
package = pkgs.postgresql_10;
enableTCPIP = true;
authentication = pkgs.lib.mkOverride 10 ''
local all all trust
host all all ::1/128 trust
host all all 127.0.0.1/32 trust
'';
};
# List services that you want to enable:
# Enable the OpenSSH daemon.
services.openssh.enable = true;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = 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.09"; # Did you read the comment?
}
let
coding_server = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIuYCV7NwqlACA5rp8WH4lerKB8M9Ci3jucyW0hhQLfD";
in {
"wireguard/private.key".publicKeys = [coding_server];
"dyndns/password.priv".publicKeys = [coding_server];
}
let
coding_server = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIuYCV7NwqlACA5rp8WH4lerKB8M9Ci3jucyW0hhQLfD";
in {
"wireguard/private.key".publicKeys = [coding_server];
"dyndns/password.priv".publicKeys = [coding_server];
}
{
description = "My home configuration.";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-21.11";
home-manager.url = "github:nix-community/home-manager/release-21.11";
nixpkgs-master.url = "github:nixos/nixpkgs/master";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
agenix.url = "github:ryantm/agenix";
};
outputs = {self, home-manager, nixpkgs, nixpkgs-master, nixpkgs-unstable, agenix, ... }:
let
baseModules = overlays: [
(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 ++ [ overlays ];
};
}
agenix.nixosModules.age
];
in {
overlay = final: prev: {
nixpkgs-master = nixpkgs-master.legacyPackages."x86_64-linux";
nixpkgs-unstable = nixpkgs-unstable.legacyPackages."x86_64-linux";
};
nixosConfigurations.desktop = (nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = baseModules self.overlay ++ [ ./system/desktop/configuration.nix ];
});
nixosConfigurations.laptop = (nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = baseModules self.overlay ++ [ ./system/laptop/configuration.nix ];
});
nixosConfigurations.work_vm = (nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = baseModules self.overlay ++ [ ./system/work_vm/configuration.nix ];
});
nixosConfigurations.wireguard_server = (nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = baseModules self.overlay ++ [ ./system/wireguard_server/configuration.nix ];
});
};
}
{
description = "My home configuration.";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-21.11";
home-manager.url = "github:nix-community/home-manager/release-21.11";
nixpkgs-master.url = "github:nixos/nixpkgs/master";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
agenix.url = "github:ryantm/agenix";
};
outputs = {self, home-manager, nixpkgs, nixpkgs-master, nixpkgs-unstable, agenix, ... }:
let
baseModules = overlays: [
(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 ++ [ overlays ];
};
}
agenix.nixosModules.age
];
in {
overlay = final: prev: {
nixpkgs-master = nixpkgs-master.legacyPackages."x86_64-linux";
nixpkgs-unstable = nixpkgs-unstable.legacyPackages."x86_64-linux";
};
nixosConfigurations.desktop = (nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = baseModules self.overlay ++ [ ./system/desktop/configuration.nix ];
});
nixosConfigurations.laptop = (nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = baseModules self.overlay ++ [ ./system/laptop/configuration.nix ];
});
nixosConfigurations.work_vm = (nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = baseModules self.overlay ++ [ ./system/work_vm/configuration.nix ];
});
nixosConfigurations.wireguard_server = (nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = baseModules self.overlay ++ [ ./system/wireguard_server/configuration.nix ];
});
};
}
{
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-20.03";
outputs = { self, nixpkgs }: {
nixosConfigurations.container = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
({ pkgs, ... }@inputs:
import ./configuration.nix (inputs // { flake = self; }))
];
};
};
}
{
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-20.03";
outputs = { self, nixpkgs }: {
nixosConfigurations.container = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
({ pkgs, ... }@inputs:
import ./configuration.nix (inputs // { flake = self; }))
];
};
};
}
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1620055814,
"narHash": "sha256-8LEHoYSJiL901bTMVatq+rf8y7QtWuZhwwpKE2fyaRY=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "1db42b7fe3878f3f5f7a4f2dc210772fd080e205",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-20.03",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1620055814,
"narHash": "sha256-8LEHoYSJiL901bTMVatq+rf8y7QtWuZhwwpKE2fyaRY=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "1db42b7fe3878f3f5f7a4f2dc210772fd080e205",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-20.03",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}
({ pkgs, flake, ... }: {
boot.isContainer = true;
# Let 'nixos-version --json' know about the Git revision
# of this flake.
system.configurationRevision = pkgs.lib.mkIf (flake ? rev) flake.rev;
environment.systemPackages = with pkgs; [ wireguard ];
# Network configuration.
networking.useDHCP = false;
networking.firewall.allowedUDPPorts = [ 51820 ];
networking.nat.enable = true;
networking.nat.externalInterface = "wlan0";
networking.nat.internalInterfaces = [ "wg0" ];
networking.wireguard.interfaces = {
wg0 = {
ips = [ "10.0.0.1/24" ];
listenPort = 51820;
postSetup = ''
${pkgs.iptables}/bin/iptables -t nat -A POSTROUTING -s 10.100.0.0/24 -o eth0 -j MASQUERADE
'';
postShutdown = ''
${pkgs.iptables}/bin/iptables -t nat -D POSTROUTING -s 10.100.0.0/24 -o eth0 -j MASQUERADE
'';
privateKeyFile = ".private";
peers = [{
publicKey = "mkH6f0LZM8oiMw6bRVkzhcw/OibwtENkR0WnQZYz1nQ=";
allowedIPs = [ "10.1.0.0/32" ];
}];
};
};
})
({ pkgs, flake, ... }: {
boot.isContainer = true;
# Let 'nixos-version --json' know about the Git revision
# of this flake.
system.configurationRevision = pkgs.lib.mkIf (flake ? rev) flake.rev;
environment.systemPackages = with pkgs; [ wireguard ];
# Network configuration.
networking.useDHCP = false;
networking.firewall.allowedUDPPorts = [ 51820 ];
networking.nat.enable = true;
networking.nat.externalInterface = "wlan0";
networking.nat.internalInterfaces = [ "wg0" ];
networking.wireguard.interfaces = {
wg0 = {
ips = [ "10.0.0.1/24" ];
listenPort = 51820;
postSetup = ''
${pkgs.iptables}/bin/iptables -t nat -A POSTROUTING -s 10.100.0.0/24 -o eth0 -j MASQUERADE
'';
postShutdown = ''
${pkgs.iptables}/bin/iptables -t nat -D POSTROUTING -s 10.100.0.0/24 -o eth0 -j MASQUERADE
'';
privateKeyFile = ".private";
peers = [{
publicKey = "mkH6f0LZM8oiMw6bRVkzhcw/OibwtENkR0WnQZYz1nQ=";
allowedIPs = [ "10.1.0.0/32" ];
}];
};
};
})
# 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
}
# 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
}
self: super: {
neovim = self.nixpkgs-master.neovim;
neovim-unwrapped = self.nixpkgs-master.neovim-unwrapped;
}
self: super: {
neovim = self.nixpkgs-master.neovim;
neovim-unwrapped = self.nixpkgs-master.neovim-unwrapped;
}
final: prev: rec {
discord-canary-system = prev.callPackage mkDiscord (rec {
pname = "discord-canary";
version = "latest";
binaryName = "DiscordCanary";
desktopName = "Discord Canary";
src = final.discord-canary.src;
isWayland = true;
enableVulkan = false;
extraOptions = [
"--enable-vulkan"
"--ignore-gpu-blocklist"
"--enable-gpu-rasterization"
"--enable-zero-copy"
"--disable-gpu-driver-bug-workarounds"
];
});
mkDiscord =
{ pname
, version
, src
, binaryName
, desktopName
, isWayland ? false
, enableVulkan ? false
, extraOptions ? [ ]
, autoPatchelfHook
, makeDesktopItem
, lib
, stdenv
, wrapGAppsHook
, alsaLib
, at-spi2-atk
, at-spi2-core
, atk
, cairo
, cups
, dbus
, electron
, expat
, fontconfig
, freetype
, gdk-pixbuf
, glib
, gtk3
, libcxx
, libdrm
, libnotify
, libpulseaudio
, libuuid
, libX11
, libXScrnSaver
, libXcomposite
, libXcursor
, libXdamage
, libXext
, libXfixes
, libXi
, libXrandr
, libXrender
, libXtst
, libxcb
, mesa
, nspr
, nss
, pango
, systemd
, libappindicator-gtk3
, libdbusmenu
, nodePackages
, vulkan-loader
, vulkan-extension-layer
, libGL
}:
stdenv.mkDerivation rec {
inherit pname version src;
nativeBuildInputs = [
nodePackages.asar
alsaLib
autoPatchelfHook
cups
libdrm
libuuid
libXdamage
libX11
libXScrnSaver
libXtst
libxcb
mesa.drivers
nss
wrapGAppsHook
];
dontWrapGApps = true;
libPath = lib.makeLibraryPath [
libcxx
systemd
libpulseaudio
stdenv.cc.cc
alsaLib
atk
at-spi2-atk
at-spi2-core
cairo
cups
dbus
expat
fontconfig
freetype
gdk-pixbuf
glib
gtk3
libnotify
libX11
libXcomposite
libuuid
libXcursor
libXdamage
libXext
libXfixes
libXi
libXrandr
libXrender
libXtst
nspr
nss
libxcb
pango
systemd
libXScrnSaver
libappindicator-gtk3
libdbusmenu
vulkan-loader
vulkan-extension-layer
libGL
];
flags = (lib.optionals isWayland [
"--flag-switches-begin"
"--enable-features=UseOzonePlatform,WebRTCPipeWireCapturer${lib.optionalString enableVulkan ",Vulkan"}"
"--flag-switches-end"
"--ozone-platform=wayland"
"--enable-webrtc-pipewire-capturer"
]) ++ extraOptions;
installPhase = ''
mkdir -p $out/{bin,usr/lib/${pname},share/pixmaps}
ln -s discord.png $out/share/pixmaps/${pname}.png
ln -s "${desktopItem}/share/applications" $out/share/
# HACKS FOR SYSTEM ELECTRON
asar e resources/app.asar resources/app
rm resources/app.asar
sed -i "s|process.resourcesPath|'$out/usr/lib/${pname}'|" resources/app/app_bootstrap/buildInfo.js
sed -i "s|exeDir,|'$out/share/pixmaps',|" resources/app/app_bootstrap/autoStart/linux.js
asar p resources/app resources/app.asar --unpack-dir '**'
rm -rf resources/app
# Copy Relevanat data
cp -r resources/* $out/usr/lib/${pname}/
# Create starter script for discord
echo "#!${stdenv.shell}" > $out/bin/${pname}
echo "exec ${electron}/bin/electron ${lib.concatStringsSep " " flags} $out/usr/lib/${pname}/app.asar \$@" >> $out/bin/${pname}
chmod 755 $out/bin/${pname}
wrapProgram $out/bin/${pname} \
"''${gappsWrapperArgs[@]}" \
--prefix XDG_DATA_DIRS : "${gtk3}/share/gsettings-schemas/${gtk3.name}/" \
--prefix LD_LIBRARY_PATH : ${libPath}
'';
desktopItem = makeDesktopItem {
name = pname;
exec = pname;
icon = pname;
inherit desktopName;
genericName = meta.description;
categories = "Network;InstantMessaging;";
mimeType = "x-scheme-handler/discord";
};
meta = with lib; {
description = "All-in-one cross-platform voice and text chat for gamers";
homepage = "https://discordapp.com/";
downloadPage = "https://discordapp.com/download";
platforms = [ "x86_64-linux" ];
};
};
}
final: prev: rec {
discord-canary-system = prev.callPackage mkDiscord (rec {
pname = "discord-canary";
version = "latest";
binaryName = "DiscordCanary";
desktopName = "Discord Canary";
src = final.discord-canary.src;
isWayland = true;
enableVulkan = false;
extraOptions = [
"--enable-vulkan"
"--ignore-gpu-blocklist"
"--enable-gpu-rasterization"
"--enable-zero-copy"
"--disable-gpu-driver-bug-workarounds"
];
});
mkDiscord =
{ pname
, version
, src
, binaryName
, desktopName
, isWayland ? false
, enableVulkan ? false
, extraOptions ? [ ]
, autoPatchelfHook
, makeDesktopItem
, lib
, stdenv
, wrapGAppsHook
, alsaLib
, at-spi2-atk
, at-spi2-core
, atk
, cairo
, cups
, dbus
, electron
, expat
, fontconfig
, freetype
, gdk-pixbuf
, glib
, gtk3
, libcxx
, libdrm
, libnotify
, libpulseaudio
, libuuid
, libX11
, libXScrnSaver
, libXcomposite
, libXcursor
, libXdamage
, libXext
, libXfixes
, libXi
, libXrandr
, libXrender
, libXtst
, libxcb
, mesa
, nspr
, nss
, pango
, systemd
, libappindicator-gtk3
, libdbusmenu
, nodePackages
, vulkan-loader
, vulkan-extension-layer
, libGL
}:
stdenv.mkDerivation rec {
inherit pname version src;
nativeBuildInputs = [
nodePackages.asar
alsaLib
autoPatchelfHook
cups
libdrm
libuuid
libXdamage
libX11
libXScrnSaver
libXtst
libxcb
mesa.drivers
nss
wrapGAppsHook
];
dontWrapGApps = true;
libPath = lib.makeLibraryPath [
libcxx
systemd
libpulseaudio
stdenv.cc.cc
alsaLib
atk
at-spi2-atk
at-spi2-core
cairo
cups
dbus
expat
fontconfig
freetype
gdk-pixbuf
glib
gtk3
libnotify
libX11
libXcomposite
libuuid
libXcursor
libXdamage
libXext
libXfixes
libXi
libXrandr
libXrender
libXtst
nspr
nss
libxcb
pango
systemd
libXScrnSaver
libappindicator-gtk3
libdbusmenu
vulkan-loader
vulkan-extension-layer
libGL
];
flags = (lib.optionals isWayland [
"--flag-switches-begin"
"--enable-features=UseOzonePlatform,WebRTCPipeWireCapturer${lib.optionalString enableVulkan ",Vulkan"}"
"--flag-switches-end"
"--ozone-platform=wayland"
"--enable-webrtc-pipewire-capturer"
]) ++ extraOptions;
installPhase = ''
mkdir -p $out/{bin,usr/lib/${pname},share/pixmaps}
ln -s discord.png $out/share/pixmaps/${pname}.png
ln -s "${desktopItem}/share/applications" $out/share/
# HACKS FOR SYSTEM ELECTRON
asar e resources/app.asar resources/app
rm resources/app.asar
sed -i "s|process.resourcesPath|'$out/usr/lib/${pname}'|" resources/app/app_bootstrap/buildInfo.js
sed -i "s|exeDir,|'$out/share/pixmaps',|" resources/app/app_bootstrap/autoStart/linux.js
asar p resources/app resources/app.asar --unpack-dir '**'
rm -rf resources/app
# Copy Relevanat data
cp -r resources/* $out/usr/lib/${pname}/
# Create starter script for discord
echo "#!${stdenv.shell}" > $out/bin/${pname}
echo "exec ${electron}/bin/electron ${lib.concatStringsSep " " flags} $out/usr/lib/${pname}/app.asar \$@" >> $out/bin/${pname}
chmod 755 $out/bin/${pname}
wrapProgram $out/bin/${pname} \
"''${gappsWrapperArgs[@]}" \
--prefix XDG_DATA_DIRS : "${gtk3}/share/gsettings-schemas/${gtk3.name}/" \
--prefix LD_LIBRARY_PATH : ${libPath}
'';
desktopItem = makeDesktopItem {
name = pname;
exec = pname;
icon = pname;
inherit desktopName;
genericName = meta.description;
categories = "Network;InstantMessaging;";
mimeType = "x-scheme-handler/discord";
};
meta = with lib; {
description = "All-in-one cross-platform voice and text chat for gamers";
homepage = "https://discordapp.com/";
downloadPage = "https://discordapp.com/download";
platforms = [ "x86_64-linux" ];
};
};
}
[
(import ./neovimOverlay.nix)
(import ./discordOverlay.nix)
(import ./broken_rockspec.nix)
]
[
(import ./neovimOverlay.nix)
(import ./discordOverlay.nix)
(import ./broken_rockspec.nix)
]
self: super: {
lua51Packages = super.lua51Packages.extend (_: lsuper: {
plenary-nvim = lsuper.plenary-nvim.overrideAttrs (_: {
knownRockspec = (self.fetchurl {
url = "https://raw.githubusercontent.com/nvim-lua/plenary.nvim/master/plenary.nvim-scm-1.rockspec";
sha256 = "08kv1s66zhl9amzy9gx3101854ig992kl1gzzr51sx3szr43bx3x";
});
});
});
}
self: super: {
lua51Packages = super.lua51Packages.extend (_: lsuper: {
plenary-nvim = lsuper.plenary-nvim.overrideAttrs (_: {
knownRockspec = (self.fetchurl {
url = "https://raw.githubusercontent.com/nvim-lua/plenary.nvim/master/plenary.nvim-scm-1.rockspec";
sha256 = "08kv1s66zhl9amzy9gx3101854ig992kl1gzzr51sx3szr43bx3x";
});
});
});
}
{ config, lib, pkgs, ... }:
with lib;
let
# unstable = import <unstable> { configuration = { allowUnfree = true; }; };
user_configuration = import ./configuration.nix;
custom_packages = [
(pkgs.callPackage ./custom_pkgs/base16-shell.nix {})
];
in {
imports = [
./applications/git.nix
./applications/ion.nix
./applications/starship.nix
./applications/neovim.nix
./applications/tmux.nix
./applications/kakoune.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;
[
discord
#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
texlive.combined.scheme-full
gdb
notify-desktop
nodePackages.pyright
dbeaver
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";
};
}
{ config, lib, pkgs, ... }:
with lib;
let
# unstable = import <unstable> { configuration = { allowUnfree = true; }; };
user_configuration = import ./configuration.nix;
custom_packages = [
(pkgs.callPackage ./custom_pkgs/base16-shell.nix {})
];
in {
imports = [
./applications/git.nix
./applications/ion.nix
./applications/starship.nix
./applications/neovim.nix
./applications/tmux.nix
./applications/kakoune.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;
[
discord
#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
texlive.combined.scheme-full
gdb
notify-desktop
nodePackages.pyright
dbeaver
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";
};
}
{ config, lib, pkgs, ... }:
{
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-canary-system
element-desktop
#osu - need I say more?
osu-lazer
#general
xournalpp
calibre
#Audio
nixpkgs-master.easyeffects
#until I setup something with pactl.
pavucontrol
spotify
#stuff.
obs-studio
#fonts
font-awesome
fira-code
(nerdfonts.override { fonts = [ "FiraCode" ]; })
font-awesome_5
#Video editing
kdenlive
#Video Viewer
vlc
#art
krita
];
fonts.fontconfig = { enable = true; };
}
{ config, lib, pkgs, ... }:
{
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-canary-system
element-desktop
#osu - need I say more?
osu-lazer
#general
xournalpp
calibre
#Audio
nixpkgs-master.easyeffects
#until I setup something with pactl.
pavucontrol
spotify
#stuff.
obs-studio
#fonts
font-awesome
fira-code
(nerdfonts.override { fonts = [ "FiraCode" ]; })
font-awesome_5
#Video editing
kdenlive
#Video Viewer
vlc
#art
krita
];
fonts.fontconfig = { enable = true; };
}
* {
font-size: 20px;
font-family: monospace;
}
window#waybar {
background: #292b2e;
color: #fdf6e3;
}
#custom-right-arrow-dark,
#custom-left-arrow-dark {
color: #1a1a1a;
}
#custom-right-arrow-light,
#custom-left-arrow-light {
color: #292b2e;
background: #1a1a1a;
}
#workspaces,
#clock.1,
#clock.2,
#clock.3,
#pulseaudio,
#memory,
#cpu,
#battery,
#disk,
#tray {
background: #1a1a1a;
}
#workspaces button {
padding: 0 2px;
color: #fdf6e3;
}
#workspaces button.focused {
color: #268bd2;
}
#workspaces button:hover {
box-shadow: inherit;
text-shadow: inherit;
}
#workspaces button:hover {
background: #1a1a1a;
border: #1a1a1a;
padding: 0 3px;
}
#pulseaudio {
color: #268bd2;
}
#memory {
color: #2aa198;
}
#cpu {
color: #6c71c4;
}
#battery {
color: #859900;
}
#disk {
color: #b58900;
}
#clock,
#pulseaudio,
#memory,
#cpu,
#battery,
#disk {
padding: 0 10px;
}
* {
font-size: 20px;
font-family: monospace;
}
window#waybar {
background: #292b2e;
color: #fdf6e3;
}
#custom-right-arrow-dark,
#custom-left-arrow-dark {
color: #1a1a1a;
}
#custom-right-arrow-light,
#custom-left-arrow-light {
color: #292b2e;
background: #1a1a1a;
}
#workspaces,
#clock.1,
#clock.2,
#clock.3,
#pulseaudio,
#memory,
#cpu,
#battery,
#disk,
#tray {
background: #1a1a1a;
}
#workspaces button {
padding: 0 2px;
color: #fdf6e3;
}
#workspaces button.focused {
color: #268bd2;
}
#workspaces button:hover {
box-shadow: inherit;
text-shadow: inherit;
}
#workspaces button:hover {
background: #1a1a1a;
border: #1a1a1a;
padding: 0 3px;
}
#pulseaudio {
color: #268bd2;
}
#memory {
color: #2aa198;
}
#cpu {
color: #6c71c4;
}
#battery {
color: #859900;
}
#disk {
color: #b58900;
}
#clock,
#pulseaudio,
#memory,
#cpu,
#battery,
#disk {
padding: 0 10px;
}
{
"layer": "top",
"height": 5,
"position": "bottom",
"modules-left": [
"sway/workspaces",
"custom/right-arrow-dark"
],
"modules-center": [
"custom/left-arrow-dark",
"clock#1",
"custom/left-arrow-light",
"custom/left-arrow-dark",
"clock#2",
"custom/right-arrow-dark",
"custom/right-arrow-light",
"clock#3",
"custom/right-arrow-dark"
],
"modules-right": [
"custom/left-arrow-dark",
"pulseaudio",
"custom/left-arrow-light",
"custom/left-arrow-dark",
"memory",
"custom/left-arrow-light",
"custom/left-arrow-dark",
"cpu",
"custom/left-arrow-light",
"custom/left-arrow-dark",
"battery",
"custom/left-arrow-light",
"custom/left-arrow-dark",
"disk",
"custom/left-arrow-light",
"custom/left-arrow-dark",
"tray"
],
"custom/left-arrow-dark": {
"format": "",
"tooltip": false
},
"custom/left-arrow-light": {
"format": "",
"tooltip": false
},
"custom/right-arrow-dark": {
"format": "",
"tooltip": false
},
"custom/right-arrow-light": {
"format": "",
"tooltip": false
},
"sway/workspaces": {
"disable-scroll": true,
"format": "{name}"
},
"clock#1": {
"format": "{:%a}",
"tooltip": false
},
"clock#2": {
"format": "{:%H:%M}",
"tooltip": false
},
"clock#3": {
"format": "{:%m-%d}",
"tooltip": false
},
"pulseaudio": {
"format": "{icon} {volume:2}%",
"format-bluetooth": "{icon} {volume}%",
"format-muted": "MUTE",
"format-icons": {
"headphones": "",
"default": [
"",
""
]
},
"scroll-step": 5,
"on-click": "pamixer -t",
"on-click-right": "pavucontrol"
},
"memory": {
"interval": 5,
"format": "Mem {}%"
},
"cpu": {
"interval": 5,
"format": "CPU {usage:2}%"
},
"battery": {
"states": {
"good": 95,
"warning": 30,
"critical": 15
},
"format": "{icon} {capacity}%",
"format-icons": [
"",
"",
"",
"",
""
]
},
"disk": {
"interval": 5,
"format": "Disk {percentage_used:2}%",
"path": "/"
},
"tray": {
"icon-size": 20
}
}
{
"layer": "top",
"height": 5,
"position": "bottom",
"modules-left": [
"sway/workspaces",
"custom/right-arrow-dark"
],
"modules-center": [
"custom/left-arrow-dark",
"clock#1",
"custom/left-arrow-light",
"custom/left-arrow-dark",
"clock#2",
"custom/right-arrow-dark",
"custom/right-arrow-light",
"clock#3",
"custom/right-arrow-dark"
],
"modules-right": [
"custom/left-arrow-dark",
"pulseaudio",
"custom/left-arrow-light",
"custom/left-arrow-dark",
"memory",
"custom/left-arrow-light",
"custom/left-arrow-dark",
"cpu",
"custom/left-arrow-light",
"custom/left-arrow-dark",
"battery",
"custom/left-arrow-light",
"custom/left-arrow-dark",
"disk",
"custom/left-arrow-light",
"custom/left-arrow-dark",
"tray"
],
"custom/left-arrow-dark": {
"format": "",
"tooltip": false
},
"custom/left-arrow-light": {
"format": "",
"tooltip": false
},
"custom/right-arrow-dark": {
"format": "",
"tooltip": false
},
"custom/right-arrow-light": {
"format": "",
"tooltip": false
},
"sway/workspaces": {
"disable-scroll": true,
"format": "{name}"
},
"clock#1": {
"format": "{:%a}",
"tooltip": false
},
"clock#2": {
"format": "{:%H:%M}",
"tooltip": false
},
"clock#3": {
"format": "{:%m-%d}",
"tooltip": false
},
"pulseaudio": {
"format": "{icon} {volume:2}%",
"format-bluetooth": "{icon} {volume}%",
"format-muted": "MUTE",
"format-icons": {
"headphones": "",
"default": [
"",
""
]
},
"scroll-step": 5,
"on-click": "pamixer -t",
"on-click-right": "pavucontrol"
},
"memory": {
"interval": 5,
"format": "Mem {}%"
},
"cpu": {
"interval": 5,
"format": "CPU {usage:2}%"
},
"battery": {
"states": {
"good": 95,
"warning": 30,
"critical": 15
},
"format": "{icon} {capacity}%",
"format-icons": [
"",
"",
"",
"",
""
]
},
"disk": {
"interval": 5,
"format": "Disk {percentage_used:2}%",
"path": "/"
},
"tray": {
"icon-size": 20
}
}
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 = "ﯣ "
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 out = {}
function out.t(term)
return vim.api.nvim_replace_termcodes(term, true, true, true)
end
return out
local out = {}
function out.t(term)
return vim.api.nvim_replace_termcodes(term, true, true, true)
end
return out
--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 CocActionAsync(\'format\')')
--end
--
--
-- entry point
--local main = function()
-- --set color
-- vim.cmd('colorscheme base16-gruvbox-dark-hard')
-- setKeybindings()
-- setUpAll()
--end
--
modules = {
"lsp",
"telescope",
"treesitter",
"nerdtree",
"keybindings",
}
function main()
vim.cmd'colorscheme gruvbox'
vim.opt.updatetime = 250;
vim.opt.termguicolors = true
vim.opt.number = true;
vim.opt.smartindent = false;
vim.opt.autoindent = true;
vim.cmd'filetype plugin indent on'
vim.opt.relativenumber = true;
vim.g.mapleader=" "
for _, module in ipairs(modules) do
require("config." .. module)
end
end
main()
--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 CocActionAsync(\'format\')')
--end
--
--
-- entry point
--local main = function()
-- --set color
-- vim.cmd('colorscheme base16-gruvbox-dark-hard')
-- setKeybindings()
-- setUpAll()
--end
--
modules = {
"lsp",
"telescope",
"treesitter",
"nerdtree",
"keybindings",
}
function main()
vim.cmd'colorscheme gruvbox'
vim.opt.updatetime = 250;
vim.opt.termguicolors = true
vim.opt.number = true;
vim.opt.smartindent = false;
vim.opt.autoindent = true;
vim.cmd'filetype plugin indent on'
vim.opt.relativenumber = true;
vim.g.mapleader=" "
for _, module in ipairs(modules) do
require("config." .. module)
end
end
main()
vim.opt.completeopt = "menu,menuone,noselect";
local cmp = require'cmp';
cmp.setup({
snippet = {
expand = function(args)
-- For `vsnip` user.
vim.fn["vsnip#anonymous"](args.body)
-- For `luasnip` user.
-- require('luasnip').lsp_expand(args.body)
-- For `ultisnips` user.
-- vim.fn["UltiSnips#Anon"](args.body)
end,
},
mapping = {
['<C-d>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.close(),
['<CR>'] = cmp.mapping.confirm({ select = true }),
},
sources = {
{ name = 'nvim_lsp' },
{ name = 'buffer' },
}
})
local nvim_lsp = require'lspconfig';
local servers = {"rust_analyzer", "pyright", "tsserver"};
for _, server in ipairs(servers) do
nvim_lsp[server].setup {
capabilities = require('cmp_nvim_lsp')
.update_capabilities(vim.lsp.protocol.make_client_capabilities());
}
end
vim.api.nvim_set_keymap("i", "<Tab>", "v:lua.tab_complete()", {expr = true})
vim.api.nvim_set_keymap("s", "<Tab>", "v:lua.tab_complete()", {expr = true})
vim.api.nvim_set_keymap("i", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true})
vim.api.nvim_set_keymap("s", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true})
vim.cmd'autocmd BufWritePre *.rs lua vim.lsp.buf.formatting()'
vim.cmd(
'autocmd BufWritePre *.js,*.ts,*.tsx,*.jsx Neoformat prettier'
)
vim.opt.completeopt = "menu,menuone,noselect";
local cmp = require'cmp';
cmp.setup({
snippet = {
expand = function(args)
-- For `vsnip` user.
vim.fn["vsnip#anonymous"](args.body)
-- For `luasnip` user.
-- require('luasnip').lsp_expand(args.body)
-- For `ultisnips` user.
-- vim.fn["UltiSnips#Anon"](args.body)
end,
},
mapping = {
['<C-d>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.close(),
['<CR>'] = cmp.mapping.confirm({ select = true }),
},
sources = {
{ name = 'nvim_lsp' },
{ name = 'buffer' },
}
})
local nvim_lsp = require'lspconfig';
local servers = {"rust_analyzer", "pyright", "tsserver"};
for _, server in ipairs(servers) do
nvim_lsp[server].setup {
capabilities = require('cmp_nvim_lsp')
.update_capabilities(vim.lsp.protocol.make_client_capabilities());
}
end
vim.api.nvim_set_keymap("i", "<Tab>", "v:lua.tab_complete()", {expr = true})
vim.api.nvim_set_keymap("s", "<Tab>", "v:lua.tab_complete()", {expr = true})
vim.api.nvim_set_keymap("i", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true})
vim.api.nvim_set_keymap("s", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true})
vim.cmd'autocmd BufWritePre *.rs lua vim.lsp.buf.formatting()'
vim.cmd(
'autocmd BufWritePre *.js,*.ts,*.tsx,*.jsx Neoformat prettier'
)
local wk = require'which-key'
wk.setup {}
wk.register({
f = {
name = "telescope",
f = {"<cmd>Telescope find_files<CR>", "Find File"},
g = {"<cmd>Telescope live_grep<CR>", "Live Grep"},
},
p = {":NERDTreeToggle<CR>", "Toggle NERDTree"},
s = {
name = "Split",
v = {":vsp new<CR>", "Vertical"},
h = {":sp new<CR>", "Horizontal"},
},
}, {prefix = "<leader>"})
-- Navigating windows
vim.api.nvim_set_keymap('n', '<A-h>', ':wincmd h<CR>', {noremap = true;});
vim.api.nvim_set_keymap('n', '<A-j>', ':wincmd j<CR>', {noremap = true;});
vim.api.nvim_set_keymap('n', '<A-k>', ':wincmd k<CR>', {noremap = true;});
vim.api.nvim_set_keymap('n', '<A-l>', ':wincmd l<CR>', {noremap = true;});
vim.api.nvim_set_keymap('t', '<ESC>', '<C-\\><C-n>', {noremap = true;});
local wk = require'which-key'
wk.setup {}
wk.register({
f = {
name = "telescope",
f = {"<cmd>Telescope find_files<CR>", "Find File"},
g = {"<cmd>Telescope live_grep<CR>", "Live Grep"},
},
p = {":NERDTreeToggle<CR>", "Toggle NERDTree"},
s = {
name = "Split",
v = {":vsp new<CR>", "Vertical"},
h = {":sp new<CR>", "Horizontal"},
},
}, {prefix = "<leader>"})
-- Navigating windows
vim.api.nvim_set_keymap('n', '<A-h>', ':wincmd h<CR>', {noremap = true;});
vim.api.nvim_set_keymap('n', '<A-j>', ':wincmd j<CR>', {noremap = true;});
vim.api.nvim_set_keymap('n', '<A-k>', ':wincmd k<CR>', {noremap = true;});
vim.api.nvim_set_keymap('n', '<A-l>', ':wincmd l<CR>', {noremap = true;});
vim.api.nvim_set_keymap('t', '<ESC>', '<C-\\><C-n>', {noremap = true;});
{
"python.linting.pylintEnabled": true,
"python.formatting.provider": "black",
"python.formatting.blackPath": "/home/bender/.nix-profile/bin/black",
"rust-analyzer.inlayHints.enable": false,
"rust-analyzer.server.path": "rust-analyzer"
}
{
"python.linting.pylintEnabled": true,
"python.formatting.provider": "black",
"python.formatting.blackPath": "/home/bender/.nix-profile/bin/black",
"rust-analyzer.inlayHints.enable": false,
"rust-analyzer.server.path": "rust-analyzer"
}
snippet_support = false
verbosity = 2
[semantic_tokens]
type = "type"
variable = "variable"
namespace = "module"
function = "function"
string = "string"
keyword = "keyword"
operator = "operator"
comment = "comment"
[semantic_token_modifiers]
documentation = "documentation"
readonly = "default+d"
[server]
# exit session if no requests were received during given period in seconds
# works only in unix sockets mode (-s/--session)
# set to 0 to disable
timeout = 1800 # seconds = 30 minutes
[language.bash]
filetypes = ["sh"]
roots = [".git", ".hg"]
command = "bash-language-server"
args = ["start"]
[language.c_cpp]
filetypes = ["c", "cpp"]
roots = ["compile_commands.json", ".clangd"]
command = "clangd"
[language.crystal]
filetypes = ["crystal"]
roots = ["shard.yml"]
command = "scry"
[language.css]
filetypes = ["css"]
roots = ["package.json", ".git"]
command = "css-languageserver"
args = ["--stdio"]
[language.less]
filetypes = ["less"]
roots = ["package.json", ".git"]
command = "css-languageserver"
args = ["--stdio"]
[language.scss]
filetypes = ["scss"]
roots = ["package.json", ".git"]
command = "css-languageserver"
args = ["--stdio"]
[language.d]
filetypes = ["d", "di"]
roots = [".git", "dub.sdl", "dub.json"]
command = "dls"
[language.dart]
# start shell to find path to dart analysis server source
filetypes = ["dart"]
roots = ["pubspec.yaml", ".git"]
command = "sh"
args = ["-c", "dart $(dirname $(which dart))/snapshots/analysis_server.dart.snapshot --lsp"]
[language.elixir]
filetypes = ["elixir"]
roots = ["mix.exs"]
command = "elixir-ls"
[language.elm]
filetypes = ["elm"]
roots = ["elm.json"]
command = "elm-language-server"
args = ["--stdio"]
[language.elm.initialization_options]
runtime = "node"
elmPath = "elm"
elmFormatPath = "elm-format"
elmTestPath = "elm-test"
[language.go]
filetypes = ["go"]
roots = ["Gopkg.toml", "go.mod", ".git", ".hg"]
command = "gopls"
offset_encoding = "utf-8"
[language.haskell]
filetypes = ["haskell"]
roots = ["Setup.hs", "stack.yaml", "*.cabal"]
# You might also be interested in the newer, but early stage, haskell-language-server
# https://github.com/haskell/haskell-language-server
command = "hie-wrapper"
args = ["--lsp"]
[language.html]
filetypes = ["html"]
roots = ["package.json"]
command = "html-languageserver"
args = ["--stdio"]
# Commented out by default because you still need to set the paths in the JDT
# Language Server arguments below before this can become a valid configuration.
# [language.java]
# filetypes = ["java"]
# roots = [".git", "mvnw", "gradlew"]
# command = "java"
# args = [
# "-Declipse.application=org.eclipse.jdt.ls.core.id1",
# "-Dosgi.bundles.defaultStartLevel=4",
# "-Declipse.product=org.eclipse.jdt.ls.core.product",
# "-Dlog.level=ALL",
# "-Dfile.encoding=utf-8",
# "--add-modules=ALL-SYSTEM",
# "--add-opens",
# "java.base/java.util=ALL-UNNAMED",
# "--add-opens",
# "java.base/java.lang=ALL-UNNAMED",
# "-noverify",
# "-Xmx1G",
# "-jar",
# "/path/to/eclipse.jdt.ls/repository/plugins/org.eclipse.equinox.launcher_1.6.100.v20201223-0822.jar",
# "-configuration",
# "/path/to/eclipse.jdt.ls/repository/config_linux",
# "-data",
# "/path/to/eclipse-workspace"
# ]
[language.javascript]
filetypes = ["javascript"]
roots = [".flowconfig"]
command = "flow"
args = ["lsp"]
[language.json]
filetypes = ["json"]
roots = ["package.json"]
command = "json-languageserver"
args = ["--stdio"]
# Requires Julia packages "LanguageServer", "StaticLint" and "SymbolServer"
[language.julia]
filetypes = ["julia"]
roots = ["Project.toml", ".git"]
command = "julia"
args = [
"--startup-file=no",
"--history-file=no",
"-e",
"""
using LanguageServer;
using Pkg;
import StaticLint;
import SymbolServer;
import REPL;
env_path = dirname(Pkg.Types.Context().env.project_file);
server = LanguageServer.LanguageServerInstance(stdin, stdout, env_path, "");
server.runlinter = true;
run(server);
""",
]
[language.latex]
filetypes = ["latex"]
roots = [".git"]
command = "texlab"
[language.lua]
filetypes = ["lua"]
roots = [".git"]
command = "lua-language-server"
[language.nim]
filetypes = ["nim"]
roots = ["*.nimble", ".git"]
command = "nimlsp"
[language.nix]
filetypes = ["nix"]
roots = ["flake.nix", "shell.nix", ".git"]
command = "rnix-lsp"
[language.ocaml]
filetypes = ["ocaml"]
roots = ["Makefile", "opam", "*.opam", "dune"]
command = "ocamllsp"
[language.php]
filetypes = ["php"]
roots = [".htaccess", "composer.json"]
command = "intelephense"
args = ["--stdio"]
[language.php.initialization_options]
storagePath = "/tmp/intelephense"
[language.python]
filetypes = ["python"]
roots = ["requirements.txt", "setup.py", ".git", ".hg"]
command = "pyls"
offset_encoding = "utf-8"
[language.reason]
filetypes = ["reason"]
roots = ["package.json", "Makefile", ".git", ".hg"]
command = "ocaml-language-server"
args = ["--stdio"]
[language.ruby]
filetypes = ["ruby"]
roots = ["Gemfile"]
command = "solargraph"
args = ["stdio"]
[language.rust]
filetypes = ["rust"]
roots = ["Cargo.toml"]
command = "rust-analyzer"
[language.rust.initialization_options]
procMacro.enable = true
cargo.loadOutDirsFromCheck = true
[language.terraform]
filetypes = ["terraform"]
roots = ["*.tf"]
command = "terraform-ls"
args = ["serve"]
[language.yaml]
filetypes = ["yaml"]
roots = [".git"]
command = "yaml-language-server"
args = ["--stdio"]
[language.zig]
filetypes = ["zig"]
roots = ["build.zig"]
command = "zls"
snippet_support = false
verbosity = 2
[semantic_tokens]
type = "type"
variable = "variable"
namespace = "module"
function = "function"
string = "string"
keyword = "keyword"
operator = "operator"
comment = "comment"
[semantic_token_modifiers]
documentation = "documentation"
readonly = "default+d"
[server]
# exit session if no requests were received during given period in seconds
# works only in unix sockets mode (-s/--session)
# set to 0 to disable
timeout = 1800 # seconds = 30 minutes
[language.bash]
filetypes = ["sh"]
roots = [".git", ".hg"]
command = "bash-language-server"
args = ["start"]
[language.c_cpp]
filetypes = ["c", "cpp"]
roots = ["compile_commands.json", ".clangd"]
command = "clangd"
[language.crystal]
filetypes = ["crystal"]
roots = ["shard.yml"]
command = "scry"
[language.css]
filetypes = ["css"]
roots = ["package.json", ".git"]
command = "css-languageserver"
args = ["--stdio"]
[language.less]
filetypes = ["less"]
roots = ["package.json", ".git"]
command = "css-languageserver"
args = ["--stdio"]
[language.scss]
filetypes = ["scss"]
roots = ["package.json", ".git"]
command = "css-languageserver"
args = ["--stdio"]
[language.d]
filetypes = ["d", "di"]
roots = [".git", "dub.sdl", "dub.json"]
command = "dls"
[language.dart]
# start shell to find path to dart analysis server source
filetypes = ["dart"]
roots = ["pubspec.yaml", ".git"]
command = "sh"
args = ["-c", "dart $(dirname $(which dart))/snapshots/analysis_server.dart.snapshot --lsp"]
[language.elixir]
filetypes = ["elixir"]
roots = ["mix.exs"]
command = "elixir-ls"
[language.elm]
filetypes = ["elm"]
roots = ["elm.json"]
command = "elm-language-server"
args = ["--stdio"]
[language.elm.initialization_options]
runtime = "node"
elmPath = "elm"
elmFormatPath = "elm-format"
elmTestPath = "elm-test"
[language.go]
filetypes = ["go"]
roots = ["Gopkg.toml", "go.mod", ".git", ".hg"]
command = "gopls"
offset_encoding = "utf-8"
[language.haskell]
filetypes = ["haskell"]
roots = ["Setup.hs", "stack.yaml", "*.cabal"]
# You might also be interested in the newer, but early stage, haskell-language-server
# https://github.com/haskell/haskell-language-server
command = "hie-wrapper"
args = ["--lsp"]
[language.html]
filetypes = ["html"]
roots = ["package.json"]
command = "html-languageserver"
args = ["--stdio"]
# Commented out by default because you still need to set the paths in the JDT
# Language Server arguments below before this can become a valid configuration.
# [language.java]
# filetypes = ["java"]
# roots = [".git", "mvnw", "gradlew"]
# command = "java"
# args = [
# "-Declipse.application=org.eclipse.jdt.ls.core.id1",
# "-Dosgi.bundles.defaultStartLevel=4",
# "-Declipse.product=org.eclipse.jdt.ls.core.product",
# "-Dlog.level=ALL",
# "-Dfile.encoding=utf-8",
# "--add-modules=ALL-SYSTEM",
# "--add-opens",
# "java.base/java.util=ALL-UNNAMED",
# "--add-opens",
# "java.base/java.lang=ALL-UNNAMED",
# "-noverify",
# "-Xmx1G",
# "-jar",
# "/path/to/eclipse.jdt.ls/repository/plugins/org.eclipse.equinox.launcher_1.6.100.v20201223-0822.jar",
# "-configuration",
# "/path/to/eclipse.jdt.ls/repository/config_linux",
# "-data",
# "/path/to/eclipse-workspace"
# ]
[language.javascript]
filetypes = ["javascript"]
roots = [".flowconfig"]
command = "flow"
args = ["lsp"]
[language.json]
filetypes = ["json"]
roots = ["package.json"]
command = "json-languageserver"
args = ["--stdio"]
# Requires Julia packages "LanguageServer", "StaticLint" and "SymbolServer"
[language.julia]
filetypes = ["julia"]
roots = ["Project.toml", ".git"]
command = "julia"
args = [
"--startup-file=no",
"--history-file=no",
"-e",
"""
using LanguageServer;
using Pkg;
import StaticLint;
import SymbolServer;
import REPL;
env_path = dirname(Pkg.Types.Context().env.project_file);
server = LanguageServer.LanguageServerInstance(stdin, stdout, env_path, "");
server.runlinter = true;
run(server);
""",
]
[language.latex]
filetypes = ["latex"]
roots = [".git"]
command = "texlab"
[language.lua]
filetypes = ["lua"]
roots = [".git"]
command = "lua-language-server"
[language.nim]
filetypes = ["nim"]
roots = ["*.nimble", ".git"]
command = "nimlsp"
[language.nix]
filetypes = ["nix"]
roots = ["flake.nix", "shell.nix", ".git"]
command = "rnix-lsp"
[language.ocaml]
filetypes = ["ocaml"]
roots = ["Makefile", "opam", "*.opam", "dune"]
command = "ocamllsp"
[language.php]
filetypes = ["php"]
roots = [".htaccess", "composer.json"]
command = "intelephense"
args = ["--stdio"]
[language.php.initialization_options]
storagePath = "/tmp/intelephense"
[language.python]
filetypes = ["python"]
roots = ["requirements.txt", "setup.py", ".git", ".hg"]
command = "pyls"
offset_encoding = "utf-8"
[language.reason]
filetypes = ["reason"]
roots = ["package.json", "Makefile", ".git", ".hg"]
command = "ocaml-language-server"
args = ["--stdio"]
[language.ruby]
filetypes = ["ruby"]
roots = ["Gemfile"]
command = "solargraph"
args = ["stdio"]
[language.rust]
filetypes = ["rust"]
roots = ["Cargo.toml"]
command = "rust-analyzer"
[language.rust.initialization_options]
procMacro.enable = true
cargo.loadOutDirsFromCheck = true
[language.terraform]
filetypes = ["terraform"]
roots = ["*.tf"]
command = "terraform-ls"
args = ["serve"]
[language.yaml]
filetypes = ["yaml"]
roots = [".git"]
command = "yaml-language-server"
args = ["--stdio"]
[language.zig]
filetypes = ["zig"]
roots = ["build.zig"]
command = "zls"
alias ls = exa -a
alias lsl = exa -al
alias fucking = sudo -E
alias nixd = nix develop --command ion
alias nixb = nix build
alias nixr = nix run
let active_theme = "base16-gruvbox-dark-medium"
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.
sh "${active_theme}.sh"
#end
eval $(starship init ion)
alias ls = exa -a
alias lsl = exa -al
alias fucking = sudo -E
alias nixd = nix develop --command ion
alias nixb = nix build
alias nixr = nix run
let active_theme = "base16-gruvbox-dark-medium"
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.
sh "${active_theme}.sh"
#end
eval $(starship init ion)
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
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
{ 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";
}
{ 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";
}
{ fetchFromGitHub, stdenv, bash }:
stdenv.mkDerivation rec {
pname = "base16-shell";
version = "11-28-2021";
buildInputs = [
bash
];
src = fetchFromGitHub {
owner = "chriskempson";
repo = pname;
rev = "ce8e1e540367ea83cc3e01eec7b2a11783b3f9e1";
sha256 = "OMhC6paqEOQUnxyb33u0kfKpy8plLSRgp8X8T8w0Q/o=";
};
installPhase = ''
chmod -R 555 scripts/*
mkdir -p $out/bin
cp scripts/* $out/bin
'';
}
{ fetchFromGitHub, stdenv, bash }:
stdenv.mkDerivation rec {
pname = "base16-shell";
version = "11-28-2021";
buildInputs = [
bash
];
src = fetchFromGitHub {
owner = "chriskempson";
repo = pname;
rev = "ce8e1e540367ea83cc3e01eec7b2a11783b3f9e1";
sha256 = "OMhC6paqEOQUnxyb33u0kfKpy8plLSRgp8X8T8w0Q/o=";
};
installPhase = ''
chmod -R 555 scripts/*
mkdir -p $out/bin
cp scripts/* $out/bin
'';
}
{ 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, ... }:
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");
}
# Make this an overlay.
{ config, pkgs, ... }:
let
extensions = with pkgs.vscode-extensions;
[ ms-vscode.cpptools vscodevim.vim ];
vscode =
pkgs.vscode-with-extensions.override { vscodeExtensions = pkgs.vscode-utils.extensionsFromVscodeMarketplace (import ./vscode-extensions.nix).extensions; };
in { home.packages = [ vscode ]; }
# Make this an overlay.
{ config, pkgs, ... }:
let
extensions = with pkgs.vscode-extensions;
[ ms-vscode.cpptools vscodevim.vim ];
vscode =
pkgs.vscode-with-extensions.override { vscodeExtensions = pkgs.vscode-utils.extensionsFromVscodeMarketplace (import ./vscode-extensions.nix).extensions; };
in { home.packages = [ vscode ]; }
{ extensions = [
{
name = "nix-env-selector";
publisher = "arrterian";
version = "1.0.7";
sha256 = "0mralimyzhyp4x9q98x3ck64ifbjqdp8cxcami7clvdvkmf8hxhf";
}
{
name = "rust-analyzer";
publisher = "matklad";
version = "0.3.901";
sha256 = "EQgkP4OSMnxImUmRkN4do9kGv3bcwZb/4DQjTXkxvVA=";
}
{
name = "pretty-formatter";
publisher = "mblode";
version = "0.2.2";
sha256 = "1kdcxdvccf1fhg8lr8zwi5v7l2ja02p1kxq871jgakq2y42fclpy";
}
{
name = "cmake-tools";
publisher = "ms-vscode";
version = "1.9.2";
sha256 = "12r360fr38qq1cvssg0ajhhipcaymbdjjd9dncy4fb02ajha823s";
}
{
name = "cpptools";
publisher = "ms-vscode";
version = "1.7.1";
sha256 = "0hc6gnw00mri6hijm752zmhz26864dk8gxwa0yshy20hk9z29y6s";
}
{
name = "vsliveshare";
publisher = "ms-vsliveshare";
version = "1.0.5242";
sha256 = "0mndks2zfpxydd9fpwbi98qdhzkjzwfhh7hg3z222l18scfzad3z";
}
{
name = "cmake";
publisher = "twxs";
version = "0.0.17";
sha256 = "11hzjd0gxkq37689rrr2aszxng5l9fwpgs9nnglq3zhfa1msyn08";
}
{
name = "vim";
publisher = "vscodevim";
version = "1.21.10";
sha256 = "0c9m7mc2kmfzj3hkwq3d4hj43qha8a75q5r1rdf1xfx8wi5hhb1n";
}
{
name = "gruvbox";
publisher = "jdinhlife";
version = "1.5.1";
sha256 = "0ghB0E+Wa9W2bNFFiH2Q3pUJ9HV5+JfKohX4cRyevC8=";
}
];
}
{ extensions = [
{
name = "nix-env-selector";
publisher = "arrterian";
version = "1.0.7";
sha256 = "0mralimyzhyp4x9q98x3ck64ifbjqdp8cxcami7clvdvkmf8hxhf";
}
{
name = "rust-analyzer";
publisher = "matklad";
version = "0.3.901";
sha256 = "EQgkP4OSMnxImUmRkN4do9kGv3bcwZb/4DQjTXkxvVA=";
}
{
name = "pretty-formatter";
publisher = "mblode";
version = "0.2.2";
sha256 = "1kdcxdvccf1fhg8lr8zwi5v7l2ja02p1kxq871jgakq2y42fclpy";
}
{
name = "cmake-tools";
publisher = "ms-vscode";
version = "1.9.2";
sha256 = "12r360fr38qq1cvssg0ajhhipcaymbdjjd9dncy4fb02ajha823s";
}
{
name = "cpptools";
publisher = "ms-vscode";
version = "1.7.1";
sha256 = "0hc6gnw00mri6hijm752zmhz26864dk8gxwa0yshy20hk9z29y6s";
}
{
name = "vsliveshare";
publisher = "ms-vsliveshare";
version = "1.0.5242";
sha256 = "0mndks2zfpxydd9fpwbi98qdhzkjzwfhh7hg3z222l18scfzad3z";
}
{
name = "cmake";
publisher = "twxs";
version = "0.0.17";
sha256 = "11hzjd0gxkq37689rrr2aszxng5l9fwpgs9nnglq3zhfa1msyn08";
}
{
name = "vim";
publisher = "vscodevim";
version = "1.21.10";
sha256 = "0c9m7mc2kmfzj3hkwq3d4hj43qha8a75q5r1rdf1xfx8wi5hhb1n";
}
{
name = "gruvbox";
publisher = "jdinhlife";
version = "1.5.1";
sha256 = "0ghB0E+Wa9W2bNFFiH2Q3pUJ9HV5+JfKohX4cRyevC8=";
}
];
}
#! /usr/bin/env nix-shell
#! nix-shell -i bash -p curl jq unzip
# shellcheck shell=bash
set -eu -o pipefail
# can be added to your configuration with the following command and snippet:
# $ ./pkgs/misc/vscode-extensions/update_installed_exts.sh > extensions.nix
#
# packages = with pkgs;
# (vscode-with-extensions.override {
# vscodeExtensions = map
# (extension: vscode-utils.buildVscodeMarketplaceExtension {
# mktplcRef = {
# inherit (extension) name publisher version sha256;
# };
# })
# (import ./extensions.nix).extensions;
# })
# ]
# Helper to just fail with a message and non-zero exit code.
function fail() {
echo "$1" >&2
exit 1
}
# Helper to clean up after ourselves if we're killed by SIGINT.
function clean_up() {
TDIR="${TMPDIR:-/tmp}"
echo "Script killed, cleaning up tmpdirs: $TDIR/vscode_exts_*" >&2
rm -Rf "$TDIR/vscode_exts_*"
}
function get_vsixpkg() {
N="$1.$2"
# Create a tempdir for the extension download.
EXTTMP=$(mktemp -d -t vscode_exts_XXXXXXXX)
URL="https://$1.gallery.vsassets.io/_apis/public/gallery/publisher/$1/extension/$2/latest/assetbyname/Microsoft.VisualStudio.Services.VSIXPackage"
# Quietly but delicately curl down the file, blowing up at the first sign of trouble.
curl --silent --show-error --fail -X GET -o "$EXTTMP/$N.zip" "$URL"
# Unpack the file we need to stdout then pull out the version
VER=$(jq -r '.version' <(unzip -qc "$EXTTMP/$N.zip" "extension/package.json"))
# Calculate the SHA
SHA=$(nix-hash --flat --base32 --type sha256 "$EXTTMP/$N.zip")
# Clean up.
rm -Rf "$EXTTMP"
# I don't like 'rm -Rf' lurking in my scripts but this seems appropriate.
cat <<-EOF
{
name = "$2";
publisher = "$1";
version = "$VER";
sha256 = "$SHA";
}
EOF
}
# See if we can find our `code` binary somewhere.
if [ $# -ne 0 ]; then
CODE=$1
else
CODE=$(command -v code || command -v codium)
fi
if [ -z "$CODE" ]; then
# Not much point continuing.
fail "VSCode executable not found"
fi
# Try to be a good citizen and clean up after ourselves if we're killed.
trap clean_up SIGINT
# Begin the printing of the nix expression that will house the list of extensions.
printf '{ extensions = [\n'
# Note that we are only looking to update extensions that are already installed.
for i in $($CODE --list-extensions)
do
OWNER=$(echo "$i" | cut -d. -f1)
EXT=$(echo "$i" | cut -d. -f2)
get_vsixpkg "$OWNER" "$EXT"
done
# Close off the nix expression.
printf '];\n}'
#! /usr/bin/env nix-shell
#! nix-shell -i bash -p curl jq unzip
# shellcheck shell=bash
set -eu -o pipefail
# can be added to your configuration with the following command and snippet:
# $ ./pkgs/misc/vscode-extensions/update_installed_exts.sh > extensions.nix
#
# packages = with pkgs;
# (vscode-with-extensions.override {
# vscodeExtensions = map
# (extension: vscode-utils.buildVscodeMarketplaceExtension {
# mktplcRef = {
# inherit (extension) name publisher version sha256;
# };
# })
# (import ./extensions.nix).extensions;
# })
# ]
# Helper to just fail with a message and non-zero exit code.
function fail() {
echo "$1" >&2
exit 1
}
# Helper to clean up after ourselves if we're killed by SIGINT.
function clean_up() {
TDIR="${TMPDIR:-/tmp}"
echo "Script killed, cleaning up tmpdirs: $TDIR/vscode_exts_*" >&2
rm -Rf "$TDIR/vscode_exts_*"
}
function get_vsixpkg() {
N="$1.$2"
# Create a tempdir for the extension download.
EXTTMP=$(mktemp -d -t vscode_exts_XXXXXXXX)
URL="https://$1.gallery.vsassets.io/_apis/public/gallery/publisher/$1/extension/$2/latest/assetbyname/Microsoft.VisualStudio.Services.VSIXPackage"
# Quietly but delicately curl down the file, blowing up at the first sign of trouble.
curl --silent --show-error --fail -X GET -o "$EXTTMP/$N.zip" "$URL"
# Unpack the file we need to stdout then pull out the version
VER=$(jq -r '.version' <(unzip -qc "$EXTTMP/$N.zip" "extension/package.json"))
# Calculate the SHA
SHA=$(nix-hash --flat --base32 --type sha256 "$EXTTMP/$N.zip")
# Clean up.
rm -Rf "$EXTTMP"
# I don't like 'rm -Rf' lurking in my scripts but this seems appropriate.
cat <<-EOF
{
name = "$2";
publisher = "$1";
version = "$VER";
sha256 = "$SHA";
}
EOF
}
# See if we can find our `code` binary somewhere.
if [ $# -ne 0 ]; then
CODE=$1
else
CODE=$(command -v code || command -v codium)
fi
if [ -z "$CODE" ]; then
# Not much point continuing.
fail "VSCode executable not found"
fi
# Try to be a good citizen and clean up after ourselves if we're killed.
trap clean_up SIGINT
# Begin the printing of the nix expression that will house the list of extensions.
printf '{ extensions = [\n'
# Note that we are only looking to update extensions that are already installed.
for i in $($CODE --list-extensions)
do
OWNER=$(echo "$i" | cut -d. -f1)
EXT=$(echo "$i" | cut -d. -f2)
get_vsixpkg "$OWNER" "$EXT"
done
# Close off the nix expression.
printf '];\n}'
{ pkgs, config, ... }: {
config = {
programs.tmux = {
enable = true;
disableConfirmationPrompt = true;
terminal = "screen-256color";
shell = "${pkgs.ion}/bin/ion";
keyMode = "vi";
reverseSplit = true;
extraConfig = builtins.readFile (config.dots + "/tmux.conf");
};
};
}
{ pkgs, config, ... }: {
config = {
programs.tmux = {
enable = true;
disableConfirmationPrompt = true;
terminal = "screen-256color";
shell = "${pkgs.ion}/bin/ion";
keyMode = "vi";
reverseSplit = true;
extraConfig = builtins.readFile (config.dots + "/tmux.conf");
};
};
}
# 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 = "#2b2b2b";
background = "#2b2b2b";
text = "#FFFFFF";
indicator = "#2b2b2b";
childBorder = "#e8e8e8";
};
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";
};
};
input = {
"1133:16489:Logitech_MX_Master_2S" = {
#disable mouse acceleration
pointer_accel = "-1";
};
};
output = {
"DP-1" = {
mode = "1920x1080@143Hz";
background = "/etc/nixos/bender/dotfiles/wallpaper.png fill";
};
};
gaps = {
inner = 5;
outer = 5;
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;
}
];
};
};
}
# 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 = "#2b2b2b";
background = "#2b2b2b";
text = "#FFFFFF";
indicator = "#2b2b2b";
childBorder = "#e8e8e8";
};
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";
};
};
input = {
"1133:16489:Logitech_MX_Master_2S" = {
#disable mouse acceleration
pointer_accel = "-1";
};
};
output = {
"DP-1" = {
mode = "1920x1080@143Hz";
background = "/etc/nixos/bender/dotfiles/wallpaper.png fill";
};
};
gaps = {
inner = 5;
outer = 5;
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;
}
];
};
};
}
{ config, pkgs, ... }:
let inherit (config) dots;
in let
buildVimPlugin = pkgs.vimUtils.buildVimPlugin;
configFiles = (builtins.readDir (dots + "/nvim"));
configFileNames =
(pkgs.lib.attrsets.mapAttrsToList (key: value: key) configFiles);
in {
home.packages = with pkgs; [
bat # required by my nixconfig
fzf # required by my nixconfig
];
xdg.configFile = builtins.listToAttrs (builtins.map (name: {
name = "nvim/" + name;
value = { source = "${dots}/nvim/${name}"; };
}) configFileNames);
programs.neovim = let
startupPlugins = with pkgs.vimPlugins; [
auto-pairs
vim-highlightedyank
vim-rooter
gruvbox-nvim
yats-vim
vim-gitgutter
vimtex
vim-sensible
vim-nix
(nvim-treesitter.withPlugins (p: builtins.attrValues p))
nvim-lspconfig
telescope-nvim
nerdtree
neoformat
] ++ [(buildVimPlugin { # I'm guessing this is temporary, so I don't care about
# making an overlay from the flake.nix.
pname = "nvim-whichkey";
version = "2021-06-20";
src = pkgs.fetchFromGitHub{
owner = "folke";
repo = "which-key.nvim";
rev = "bea079f1eb0574ca9fb4bcceab67c3dc2757c5f8";
sha256 = "nNBni6I0G6HSI4aV9AUnfJX/LPaRaAOwZUtNhMIYUYM=";
};
})
(buildVimPlugin {
pname = "nvim-cmp";
version = "2021-10-16";
buildInputs = [pkgs.nixpkgs-unstable.stylua];
src = pkgs.fetchFromGitHub {
owner = "hrsh7th";
repo = "nvim-cmp";
rev = "4ecf2a24265626a2c00427394deb4747c7b9d5dc";
sha256 = "pJ1bEmOEsW8fDZLNawGwpbPsiIEaYnXsA3GKlxYnI9w=";
};
})
(buildVimPlugin {
pname = "cmp-nvim-lsp";
version = "2021-10-17";
src = pkgs.fetchFromGitHub {
owner = "hrsh7th";
repo = "cmp-nvim-lsp";
rev = "accbe6d97548d8d3471c04d512d36fa61d0e4be8";
sha256 = "lVcTATtmUu1dL9CvX/GR0b5fNj9IyWsls6kD07I3Hbc=";
};
})
(buildVimPlugin {
pname = "cmp-buffer";
version = "2021-10-17";
src = pkgs.fetchFromGitHub {
owner = "hrsh7th";
repo = "cmp-buffer";
rev = "5dde5430757696be4169ad409210cf5088554ed6";
sha256 = "lLP6gnuSN/tJiJ1sb2u6Xm5G2P59pz6tnOGDRfbivjk=";
};
})];
in {
enable = true;
vimAlias = true;
viAlias = true;
withNodeJs = true;
withRuby = true;
extraConfig = "lua require('config')";
plugins = [ ]
++ (builtins.map (plugin: { inherit plugin; }) startupPlugins);
};
}
{ config, pkgs, ... }:
let inherit (config) dots;
in let
buildVimPlugin = pkgs.vimUtils.buildVimPlugin;
configFiles = (builtins.readDir (dots + "/nvim"));
configFileNames =
(pkgs.lib.attrsets.mapAttrsToList (key: value: key) configFiles);
in {
home.packages = with pkgs; [
bat # required by my nixconfig
fzf # required by my nixconfig
];
xdg.configFile = builtins.listToAttrs (builtins.map (name: {
name = "nvim/" + name;
value = { source = "${dots}/nvim/${name}"; };
}) configFileNames);
programs.neovim = let
startupPlugins = with pkgs.vimPlugins; [
auto-pairs
vim-highlightedyank
vim-rooter
gruvbox-nvim
yats-vim
vim-gitgutter
vimtex
vim-sensible
vim-nix
(nvim-treesitter.withPlugins (p: builtins.attrValues p))
nvim-lspconfig
telescope-nvim
nerdtree
neoformat
] ++ [(buildVimPlugin { # I'm guessing this is temporary, so I don't care about
# making an overlay from the flake.nix.
pname = "nvim-whichkey";
version = "2021-06-20";
src = pkgs.fetchFromGitHub{
owner = "folke";
repo = "which-key.nvim";
rev = "bea079f1eb0574ca9fb4bcceab67c3dc2757c5f8";
sha256 = "nNBni6I0G6HSI4aV9AUnfJX/LPaRaAOwZUtNhMIYUYM=";
};
})
(buildVimPlugin {
pname = "nvim-cmp";
version = "2021-10-16";
buildInputs = [pkgs.nixpkgs-unstable.stylua];
src = pkgs.fetchFromGitHub {
owner = "hrsh7th";
repo = "nvim-cmp";
rev = "4ecf2a24265626a2c00427394deb4747c7b9d5dc";
sha256 = "pJ1bEmOEsW8fDZLNawGwpbPsiIEaYnXsA3GKlxYnI9w=";
};
})
(buildVimPlugin {
pname = "cmp-nvim-lsp";
version = "2021-10-17";
src = pkgs.fetchFromGitHub {
owner = "hrsh7th";
repo = "cmp-nvim-lsp";
rev = "accbe6d97548d8d3471c04d512d36fa61d0e4be8";
sha256 = "lVcTATtmUu1dL9CvX/GR0b5fNj9IyWsls6kD07I3Hbc=";
};
})
(buildVimPlugin {
pname = "cmp-buffer";
version = "2021-10-17";
src = pkgs.fetchFromGitHub {
owner = "hrsh7th";
repo = "cmp-buffer";
rev = "5dde5430757696be4169ad409210cf5088554ed6";
sha256 = "lLP6gnuSN/tJiJ1sb2u6Xm5G2P59pz6tnOGDRfbivjk=";
};
})];
in {
enable = true;
vimAlias = true;
viAlias = true;
withNodeJs = true;
withRuby = true;
extraConfig = "lua require('config')";
plugins = [ ]
++ (builtins.map (plugin: { inherit plugin; }) startupPlugins);
};
}
{ config, pkgs, ... }: {
home.packages = with pkgs; [
bat
fzf
];
xdg.configFile."kak-lsp/kak-lsp.toml".source = "${config.dots}/kak-lsp.toml";
programs.kakoune = {
enable = true;
plugins = [
pkgs.kakounePlugins.kak-lsp
];
config = {
colorScheme = "gruvbox";
tabStop = 4;
autoInfo = [ "command" "onkey" ];
scrollOff = {
lines = 1;
};
ui = {
enableMouse = true;
assistant = "none";
};
showMatching = true;
};
extraConfig = ''
hook global WinSetOption filetype=rust %{
lsp-enable-window
lsp-auto-signature-help-enable
hook window -group semantic-tokens BufReload .* lsp-semantic-tokens
hook window -group semantic-tokens NormalIdle .* lsp-semantic-tokens
hook window -group semantic-tokens InsertIdle .* lsp-semantic-tokens
hook -once -always window WinSetOption filetype=.* %{
remove-hooks window semantic-tokens
}
}
eval %sh{kak-lsp --kakoune -s $kak_session}
lsp-enable
'';
};
}
{ config, pkgs, ... }: {
home.packages = with pkgs; [
bat
fzf
];
xdg.configFile."kak-lsp/kak-lsp.toml".source = "${config.dots}/kak-lsp.toml";
programs.kakoune = {
enable = true;
plugins = [
pkgs.kakounePlugins.kak-lsp
];
config = {
colorScheme = "gruvbox";
tabStop = 4;
autoInfo = [ "command" "onkey" ];
scrollOff = {
lines = 1;
};
ui = {
enableMouse = true;
assistant = "none";
};
showMatching = true;
};
extraConfig = ''
hook global WinSetOption filetype=rust %{
lsp-enable-window
lsp-auto-signature-help-enable
hook window -group semantic-tokens BufReload .* lsp-semantic-tokens
hook window -group semantic-tokens NormalIdle .* lsp-semantic-tokens
hook window -group semantic-tokens InsertIdle .* lsp-semantic-tokens
hook -once -always window WinSetOption filetype=.* %{
remove-hooks window semantic-tokens
}
}
eval %sh{kak-lsp --kakoune -s $kak_session}
lsp-enable
'';
};
}
{ config, pkgs, ... }: {
programs.git = {
enable = true;
userName = "awesomearvinder";
userEmail = "ArvinderDhan@gmail.com";
extraConfig = {
pull.ff = "only";
};
};
}
{ config, pkgs, ... }: {
programs.git = {
enable = true;
userName = "awesomearvinder";
userEmail = "ArvinderDhan@gmail.com";
extraConfig = {
pull.ff = "only";
};
};
}
{ ... }: {
programs.alacritty = {
enable = true;
settings = {
shell = {
program = "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";
};
};
};
};
}
{ ... }: {
programs.alacritty = {
enable = true;
settings = {
shell = {
program = "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";
};
};
};
};
}