Added nix config
This commit is contained in:
commit
20bcd44cc1
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
*.swp
|
||||
|
||||
result
|
4
apply-system.sh
Executable file
4
apply-system.sh
Executable file
|
@ -0,0 +1,4 @@
|
|||
#!/bin/sh
|
||||
pushd ~/nix-config
|
||||
sudo nixos-rebuild switch --flake .#
|
||||
popd
|
5
apply-users.sh
Executable file
5
apply-users.sh
Executable file
|
@ -0,0 +1,5 @@
|
|||
#!/bin/sh
|
||||
pushd ~/nix-config
|
||||
nix build .#homeManagerConfigurations.alejandro.activationPackage
|
||||
./result/activate
|
||||
popd
|
48
flake.lock
Normal file
48
flake.lock
Normal file
|
@ -0,0 +1,48 @@
|
|||
{
|
||||
"nodes": {
|
||||
"home-manager": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1656169755,
|
||||
"narHash": "sha256-Nlnm4jeQWEGjYrE6hxi/7HYHjBSZ/E0RtjCYifnNsWk=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "4a3d01fb53f52ac83194081272795aa4612c2381",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"ref": "release-22.05",
|
||||
"repo": "home-manager",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1663410121,
|
||||
"narHash": "sha256-+SN249gXLmawmwTVo3AhydVoVwgi/gbqutJV7YHrj0Y=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "f21492b413295ab60f538d5e1812ab908e3e3292",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"ref": "nixos-22.05",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"home-manager": "home-manager",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
89
flake.nix
Normal file
89
flake.nix
Normal file
|
@ -0,0 +1,89 @@
|
|||
{
|
||||
description = "My Nix Configuration";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "nixpkgs/nixos-22.05";
|
||||
home-manager.url = "github:nix-community/home-manager/release-22.05";
|
||||
home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
outputs = {
|
||||
nixpkgs,
|
||||
home-manager,
|
||||
...
|
||||
}: let
|
||||
system = "x86_64-linux";
|
||||
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
config = {
|
||||
allowUnfree = true;
|
||||
};
|
||||
};
|
||||
|
||||
lib = nixpkgs.lib;
|
||||
in {
|
||||
homeManagerConfigurations = {
|
||||
alejandro = home-manager.lib.homeManagerConfiguration {
|
||||
inherit system pkgs;
|
||||
username = "alejandro";
|
||||
homeDirectory = "/home/alejandro";
|
||||
stateVersion = "22.05";
|
||||
configuration = {
|
||||
imports = [
|
||||
./users/alejandro/home.nix
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
nixosConfigurations = {
|
||||
virtual = lib.nixosSystem {
|
||||
inherit system;
|
||||
|
||||
modules = [
|
||||
./system/virtual/configuration.nix
|
||||
];
|
||||
};
|
||||
|
||||
carbon = lib.nixosSystem {
|
||||
inherit system;
|
||||
|
||||
modules = [
|
||||
./system/carbon/configuration.nix
|
||||
];
|
||||
};
|
||||
|
||||
gospel = lib.nixosSystem {
|
||||
inherit system;
|
||||
|
||||
modules = [
|
||||
./system/gospel/configuration.nix
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
devShells.${system} = {
|
||||
default = pkgs.mkShell {
|
||||
name = "nixosbuildshell";
|
||||
buildInputs = with pkgs; [
|
||||
git
|
||||
git-crypt
|
||||
nixFlakes
|
||||
alejandra
|
||||
pre-commit
|
||||
];
|
||||
|
||||
shellHook = ''
|
||||
echo "You can apply this flake to your system with nixos-rebuild switch --flake .#"
|
||||
|
||||
PATH=${pkgs.writeShellScriptBin "nix" ''
|
||||
${pkgs.nixFlakes}/bin/nix --experimental-features "nix-command flakes" "$@"
|
||||
''}/bin:$PATH
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
formatter = pkgs.alejandra;
|
||||
};
|
||||
}
|
177
system/carbon/configuration.nix
Normal file
177
system/carbon/configuration.nix
Normal file
|
@ -0,0 +1,177 @@
|
|||
# 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-zfs.nix
|
||||
./zfs.nix
|
||||
./vpn.nix
|
||||
];
|
||||
|
||||
# Make ready for nix flakes
|
||||
nix.package = pkgs.nixFlakes;
|
||||
nix.extraOptions = ''
|
||||
experimental-features = nix-command flakes
|
||||
'';
|
||||
|
||||
networking = {
|
||||
hostName = "carbon"; # Define your hostname.
|
||||
networkmanager.enable = true; # Enables wireless support via wpa_supplicant.
|
||||
|
||||
#wg-quick.interfaces = {
|
||||
#wg0 = {
|
||||
#address = [ "10.10.13.25/32" ];
|
||||
#dns = [ "192.168.113.69" ];
|
||||
#listenPort = 51820;
|
||||
#privateKeyFile = "/home/alejandro/wireguard_keys/carbon.pub";
|
||||
|
||||
#peers = [
|
||||
#{
|
||||
#publicKey = "HGm7lx+DbACPxEN7gaiuz4XklV/RdzmBj//FBSO7QUU=";
|
||||
#allowedIPs = [ "10.13.13.0/24" "192.168.113.0/24" ];
|
||||
#endpoint = "wg.kilonull.com:51820";
|
||||
#}
|
||||
#];
|
||||
#};
|
||||
#};
|
||||
};
|
||||
|
||||
# Set your time zone.
|
||||
time.timeZone = "America/Los_Angeles";
|
||||
|
||||
# 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;
|
||||
|
||||
# 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.alejandro = {
|
||||
isNormalUser = true;
|
||||
extraGroups = ["wheel" "video" "networkmanager"];
|
||||
shell = pkgs.zsh;
|
||||
};
|
||||
|
||||
fonts.fonts = with pkgs; [
|
||||
(nerdfonts.override {fonts = ["Hack"];})
|
||||
];
|
||||
|
||||
# List packages installed in system profile. To search, run:
|
||||
# $ nix search wget
|
||||
environment.systemPackages = with pkgs; [
|
||||
git
|
||||
vim_configurable # Using this instead of vim for python3 support
|
||||
wget
|
||||
firefox
|
||||
wl-clipboard
|
||||
stow
|
||||
tmux
|
||||
zsh
|
||||
home-manager
|
||||
sanoid
|
||||
killall
|
||||
usbutils
|
||||
# Below 3 installed for sanoid
|
||||
pv
|
||||
lzop
|
||||
mbuffer
|
||||
|
||||
# Installed for gammastep
|
||||
geoclue2
|
||||
|
||||
wireguard-tools
|
||||
|
||||
prusa-slicer
|
||||
];
|
||||
|
||||
# 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;
|
||||
# };
|
||||
|
||||
programs.zsh.enable = true;
|
||||
|
||||
programs.light.enable = true;
|
||||
|
||||
programs.sway = {
|
||||
enable = true;
|
||||
wrapperFeatures.gtk = true; # so that gtk works properly
|
||||
extraPackages = with pkgs; [
|
||||
swaylock
|
||||
swayidle
|
||||
wl-clipboard
|
||||
mako
|
||||
alacritty
|
||||
rofi
|
||||
waybar
|
||||
pavucontrol
|
||||
];
|
||||
};
|
||||
|
||||
# List services that you want to enable:
|
||||
|
||||
# Enable the OpenSSH daemon.
|
||||
services.openssh.enable = true;
|
||||
|
||||
services.avahi.enable = true;
|
||||
services.geoclue2 = {
|
||||
enable = true;
|
||||
#appConfig."gammastep" = {
|
||||
#isAllowed = true;
|
||||
#isSystem = true;
|
||||
#users = ["1000"];
|
||||
#};
|
||||
};
|
||||
|
||||
security.rtkit.enable = true;
|
||||
services.pipewire = {
|
||||
enable = true;
|
||||
alsa.enable = true;
|
||||
alsa.support32Bit = true;
|
||||
pulse.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 = "21.11"; # Did you read the comment?
|
||||
}
|
114
system/carbon/hardware-configuration-zfs.nix
Normal file
114
system/carbon/hardware-configuration-zfs.nix
Normal file
|
@ -0,0 +1,114 @@
|
|||
# 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" "nvme" "usb_storage" "sd_mod"];
|
||||
boot.initrd.kernelModules = [];
|
||||
boot.kernelModules = ["kvm-intel"];
|
||||
boot.extraModulePackages = [];
|
||||
|
||||
fileSystems."/" = {
|
||||
device = "rpool_/nixos/ROOT/default";
|
||||
fsType = "zfs";
|
||||
options = ["zfsutil" "X-mount.mkdir"];
|
||||
};
|
||||
|
||||
fileSystems."/boot" = {
|
||||
device = "bpool_/nixos/BOOT/default";
|
||||
fsType = "zfs";
|
||||
options = ["zfsutil" "X-mount.mkdir"];
|
||||
};
|
||||
|
||||
fileSystems."/home" = {
|
||||
device = "rpool_/nixos/DATA/default/home";
|
||||
fsType = "zfs";
|
||||
options = ["zfsutil" "X-mount.mkdir"];
|
||||
};
|
||||
|
||||
fileSystems."/root" = {
|
||||
device = "rpool_/nixos/DATA/default/root";
|
||||
fsType = "zfs";
|
||||
options = ["zfsutil" "X-mount.mkdir"];
|
||||
};
|
||||
|
||||
fileSystems."/srv" = {
|
||||
device = "rpool_/nixos/DATA/default/srv";
|
||||
fsType = "zfs";
|
||||
options = ["zfsutil" "X-mount.mkdir"];
|
||||
};
|
||||
|
||||
fileSystems."/usr/local" = {
|
||||
device = "rpool_/nixos/DATA/default/usr/local";
|
||||
fsType = "zfs";
|
||||
options = ["zfsutil" "X-mount.mkdir"];
|
||||
};
|
||||
|
||||
fileSystems."/var/log" = {
|
||||
device = "rpool_/nixos/DATA/default/var/log";
|
||||
fsType = "zfs";
|
||||
options = ["zfsutil" "X-mount.mkdir"];
|
||||
};
|
||||
|
||||
fileSystems."/var/spool" = {
|
||||
device = "rpool_/nixos/DATA/default/var/spool";
|
||||
fsType = "zfs";
|
||||
options = ["zfsutil" "X-mount.mkdir"];
|
||||
};
|
||||
|
||||
fileSystems."/nix" = {
|
||||
device = "rpool_/nixos/DATA/local/nix";
|
||||
fsType = "zfs";
|
||||
options = ["zfsutil" "X-mount.mkdir"];
|
||||
};
|
||||
|
||||
fileSystems."/state" = {
|
||||
device = "rpool_/nixos/DATA/default/state";
|
||||
fsType = "zfs";
|
||||
options = ["zfsutil" "X-mount.mkdir"];
|
||||
};
|
||||
|
||||
fileSystems."/etc/nixos" = {
|
||||
device = "/state/etc/nixos";
|
||||
fsType = "none";
|
||||
options = ["bind"];
|
||||
};
|
||||
|
||||
fileSystems."/etc/cryptkey.d" = {
|
||||
device = "/state/etc/cryptkey.d";
|
||||
fsType = "none";
|
||||
options = ["bind"];
|
||||
};
|
||||
|
||||
fileSystems."/boot/efis/nvme-SAMSUNG_MZVLW256HEHP-000L7_S35ENX1K539085-part1" = {
|
||||
device = "/dev/disk/by-uuid/F429-235F";
|
||||
fsType = "vfat";
|
||||
options = ["x-systemd.idle-timeout=1min" "x-systemd.automount" "noauto"];
|
||||
};
|
||||
|
||||
fileSystems."/boot/efis/nvme-WDC_PC_SN520_SDAPTUW-512G_182747800010-part1" = {
|
||||
device = "/dev/disk/by-uuid/F429-AB41";
|
||||
fsType = "vfat";
|
||||
options = ["x-systemd.idle-timeout=1min" "x-systemd.automount" "noauto"];
|
||||
};
|
||||
|
||||
fileSystems."/var/lib/docker" = {
|
||||
device = "rpool_/nixos/DATA/default/var/lib/docker";
|
||||
fsType = "zfs";
|
||||
options = ["zfsutil" "X-mount.mkdir"];
|
||||
};
|
||||
|
||||
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
|
||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
# high-resolution display
|
||||
hardware.video.hidpi.enable = lib.mkDefault true;
|
||||
}
|
25
system/carbon/vpn.nix
Normal file
25
system/carbon/vpn.nix
Normal file
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
# enable the tailscale daemon; this will do a
|
||||
# variety of tasks:
|
||||
# 1. create the TUN network device
|
||||
# 2. setup some IP routes to route through the TUN
|
||||
services.tailscale = {enable = true;};
|
||||
|
||||
# Let's open the UDP port with which the network is tunneled through
|
||||
networking.firewall.allowedUDPPorts = [41641];
|
||||
|
||||
# Disable SSH access through the firewall Only way into the machine will be
|
||||
# through This may cause a chicken & egg problem since you need to register
|
||||
# a machine first using `tailscale up`
|
||||
# Better to rely on EC2 SecurityGroups
|
||||
# services.openssh.openFirewall = false;
|
||||
|
||||
# Let's make the tailscale binary avilable to all users
|
||||
environment.systemPackages = [pkgs.tailscale];
|
||||
|
||||
# TODO: Enable SSH via tailscale
|
||||
}
|
62
system/carbon/zfs.nix
Normal file
62
system/carbon/zfs.nix
Normal file
|
@ -0,0 +1,62 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
boot.supportedFilesystems = ["zfs"];
|
||||
networking.hostId = "b2d25606";
|
||||
boot.zfs.devNodes = "/dev/disk/by-id";
|
||||
boot.kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages;
|
||||
swapDevices = [
|
||||
{
|
||||
device = "/dev/disk/by-id/nvme-SAMSUNG_MZVLW256HEHP-000L7_S35ENX1K539085-part4";
|
||||
randomEncryption.enable = true;
|
||||
}
|
||||
{
|
||||
device = "/dev/disk/by-id/nvme-WDC_PC_SN520_SDAPTUW-512G_182747800010-part4";
|
||||
randomEncryption.enable = true;
|
||||
}
|
||||
];
|
||||
systemd.services.zfs-mount.enable = false;
|
||||
environment.etc."machine-id".source = "/state/etc/machine-id";
|
||||
environment.etc."zfs/zpool.cache".source = "/state/etc/zfs/zpool.cache";
|
||||
boot.loader.efi.efiSysMountPoint = "/boot/efis/nvme-SAMSUNG_MZVLW256HEHP-000L7_S35ENX1K539085-part1";
|
||||
boot.loader.efi.canTouchEfiVariables = false;
|
||||
##if UEFI firmware can detect entries
|
||||
#boot.loader.efi.canTouchEfiVariables = true;
|
||||
|
||||
boot.loader = {
|
||||
generationsDir.copyKernels = true;
|
||||
##for problematic UEFI firmware
|
||||
grub.efiInstallAsRemovable = true;
|
||||
grub.enable = true;
|
||||
grub.version = 2;
|
||||
grub.copyKernels = true;
|
||||
grub.efiSupport = true;
|
||||
grub.zfsSupport = true;
|
||||
# for systemd-autofs
|
||||
grub.extraPrepareConfig = ''
|
||||
mkdir -p /boot/efis /boot/efi
|
||||
for i in /boot/efis/*; do mount $i ; done
|
||||
mount /boot/efi
|
||||
'';
|
||||
grub.extraInstallCommands = ''
|
||||
export ESP_MIRROR=$(mktemp -d -p /tmp)
|
||||
cp -r /boot/efis/nvme-SAMSUNG_MZVLW256HEHP-000L7_S35ENX1K539085-part1/EFI $ESP_MIRROR
|
||||
for i in /boot/efis/*; do
|
||||
cp -r $ESP_MIRROR/EFI $i
|
||||
done
|
||||
rm -rf $ESP_MIRROR
|
||||
'';
|
||||
grub.devices = [
|
||||
"/dev/disk/by-id/nvme-SAMSUNG_MZVLW256HEHP-000L7_S35ENX1K539085"
|
||||
"/dev/disk/by-id/nvme-WDC_PC_SN520_SDAPTUW-512G_182747800010"
|
||||
];
|
||||
};
|
||||
users.users.root.initialHashedPassword = "$6$VOzIHqv12iJGQIFl$NQf1GeiGhtdLfZFmtZl4vab.xvtVvI7.5ty9zbMFI2dpmHoFdc6XnGwTlClVe./CbcrsQjtPpt7NKf0dNttcw.";
|
||||
|
||||
services.zfs = {
|
||||
autoScrub.enable = true;
|
||||
autoSnapshot.enable = true;
|
||||
};
|
||||
}
|
129
system/gospel/configuration.nix
Normal file
129
system/gospel/configuration.nix
Normal file
|
@ -0,0 +1,129 @@
|
|||
# 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 ./zfs.nix ./vpn.nix
|
||||
];
|
||||
|
||||
hardware.opengl.enable = true;
|
||||
|
||||
# Make ready for nix flakes
|
||||
nix.package = pkgs.nixFlakes;
|
||||
nix.extraOptions = ''
|
||||
experimental-features = nix-command flakes
|
||||
'';
|
||||
|
||||
networking.hostName = "gospel"; # Define your hostname.
|
||||
# Pick only one of the below networking options.
|
||||
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
|
||||
# networking.networkmanager.enable = true; # Easiest to use and most distros use this by default.
|
||||
|
||||
# Set your time zone.
|
||||
time.timeZone = "America/Los_Angeles";
|
||||
|
||||
# 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";
|
||||
# useXkbConfig = true; # use xkbOptions in tty.
|
||||
# };
|
||||
|
||||
# Enable the X11 windowing system.
|
||||
|
||||
|
||||
|
||||
|
||||
# Configure keymap in X11
|
||||
# "eurosign:e";
|
||||
# "caps:escape" # map caps to escape.
|
||||
# };
|
||||
|
||||
# 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).
|
||||
|
||||
# Define a user account. Don't forget to set a password with ‘passwd’.
|
||||
users.users.alejandro = {
|
||||
isNormalUser = true;
|
||||
extraGroups = ["wheel" "video" "networkmanager"];
|
||||
shell = pkgs.zsh;
|
||||
};
|
||||
|
||||
programs.sway = {
|
||||
enable = true;
|
||||
wrapperFeatures.gtk = true; # so that gtk works properly
|
||||
extraPackages = with pkgs; [ swaylock ];
|
||||
};
|
||||
|
||||
fonts.fonts = with pkgs; [
|
||||
(nerdfonts.override {fonts = ["Hack"];})
|
||||
];
|
||||
|
||||
# List packages installed in system profile. To search, run:
|
||||
# $ nix search wget
|
||||
environment.systemPackages = with pkgs; [
|
||||
vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
|
||||
wget
|
||||
git
|
||||
killall
|
||||
usbutils
|
||||
pavucontrol
|
||||
];
|
||||
|
||||
# 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;
|
||||
|
||||
security.rtkit.enable = true;
|
||||
services.pipewire = {
|
||||
enable = true;
|
||||
alsa.enable = true;
|
||||
alsa.support32Bit = true;
|
||||
pulse.enable = true;
|
||||
};
|
||||
|
||||
# Open ports in the firewall.
|
||||
# networking.firewall.allowedTCPPorts = [ ... ];
|
||||
# networking.firewall.allowedUDPPorts = [ ... ];
|
||||
# Or disable the firewall altogether.
|
||||
# networking.firewall.enable = false;
|
||||
|
||||
# Copy the NixOS configuration file and link it from the resulting system
|
||||
# (/run/current-system/configuration.nix). This is useful in case you
|
||||
# accidentally delete configuration.nix.
|
||||
# system.copySystemConfiguration = 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 = "22.05"; # Did you read the comment?
|
||||
|
||||
}
|
||||
|
63
system/gospel/hardware-configuration.nix
Normal file
63
system/gospel/hardware-configuration.nix
Normal file
|
@ -0,0 +1,63 @@
|
|||
# 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" "nvme" "usbhid" "usb_storage" "sd_mod" ];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ "kvm-intel" ];
|
||||
boot.extraModulePackages = [ ];
|
||||
|
||||
fileSystems."/" =
|
||||
{ device = "rpool/nixos/root";
|
||||
fsType = "zfs"; options = [ "zfsutil" "X-mount.mkdir" ];
|
||||
};
|
||||
|
||||
fileSystems."/home" =
|
||||
{ device = "rpool/nixos/home";
|
||||
fsType = "zfs"; options = [ "zfsutil" "X-mount.mkdir" ];
|
||||
};
|
||||
|
||||
fileSystems."/var/lib" =
|
||||
{ device = "rpool/nixos/var/lib";
|
||||
fsType = "zfs"; options = [ "zfsutil" "X-mount.mkdir" ];
|
||||
};
|
||||
|
||||
fileSystems."/var/log" =
|
||||
{ device = "rpool/nixos/var/log";
|
||||
fsType = "zfs"; options = [ "zfsutil" "X-mount.mkdir" ];
|
||||
};
|
||||
|
||||
fileSystems."/boot" =
|
||||
{ device = "bpool/nixos/root";
|
||||
fsType = "zfs"; options = [ "zfsutil" "X-mount.mkdir" ];
|
||||
};
|
||||
|
||||
fileSystems."/boot/efis/nvme-WDC_WDS100T2B0C-00PXH0_21111Y801086-part1" =
|
||||
{ device = "/dev/disk/by-uuid/1443-371C";
|
||||
fsType = "vfat";
|
||||
};
|
||||
|
||||
fileSystems."/boot/efi" =
|
||||
{ device = "/boot/efis/nvme-WDC_WDS100T2B0C-00PXH0_21111Y801086-part1";
|
||||
fsType = "none";
|
||||
options = [ "bind" ];
|
||||
};
|
||||
|
||||
swapDevices = [ ];
|
||||
|
||||
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
||||
# (the default) this is the recommended approach. When using systemd-networkd it's
|
||||
# still possible to use this option, but it's recommended to use it in conjunction
|
||||
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
|
||||
networking.useDHCP = lib.mkDefault true;
|
||||
# networking.interfaces.eno1.useDHCP = lib.mkDefault true;
|
||||
|
||||
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
|
||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
}
|
23
system/gospel/vpn.nix
Normal file
23
system/gospel/vpn.nix
Normal file
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
# enable the tailscale daemon; this will do a
|
||||
# variety of tasks:
|
||||
# 1. create the TUN network device
|
||||
# 2. setup some IP routes to route through the TUN
|
||||
services.tailscale = {enable = true;};
|
||||
|
||||
# Let's open the UDP port with which the network is tunneled through
|
||||
networking.firewall.allowedUDPPorts = [41641];
|
||||
|
||||
# Disable SSH access through the firewall Only way into the machine will be
|
||||
# through This may cause a chicken & egg problem since you need to register
|
||||
# a machine first using `tailscale up`
|
||||
# Better to rely on EC2 SecurityGroups
|
||||
# services.openssh.openFirewall = false;
|
||||
|
||||
# Let's make the tailscale binary avilable to all users
|
||||
environment.systemPackages = [pkgs.tailscale];
|
||||
}
|
34
system/gospel/zfs.nix
Normal file
34
system/gospel/zfs.nix
Normal file
|
@ -0,0 +1,34 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
{ boot.supportedFilesystems = [ "zfs" ];
|
||||
networking.hostId = "f8616592";
|
||||
boot.kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages;
|
||||
boot.loader.efi.efiSysMountPoint = "/boot/efi";
|
||||
boot.loader.efi.canTouchEfiVariables = false;
|
||||
boot.loader.generationsDir.copyKernels = true;
|
||||
boot.loader.grub.efiInstallAsRemovable = true;
|
||||
boot.loader.grub.enable = true;
|
||||
boot.loader.grub.version = 2;
|
||||
boot.loader.grub.copyKernels = true;
|
||||
boot.loader.grub.efiSupport = true;
|
||||
boot.loader.grub.zfsSupport = true;
|
||||
boot.loader.grub.extraPrepareConfig = ''
|
||||
mkdir -p /boot/efis
|
||||
for i in /boot/efis/*; do mount $i ; done
|
||||
|
||||
mkdir -p /boot/efi
|
||||
mount /boot/efi
|
||||
'';
|
||||
boot.loader.grub.extraInstallCommands = ''
|
||||
ESP_MIRROR=$(mktemp -d)
|
||||
cp -r /boot/efi/EFI $ESP_MIRROR
|
||||
for i in /boot/efis/*; do
|
||||
cp -r $ESP_MIRROR/EFI $i
|
||||
done
|
||||
rm -rf $ESP_MIRROR
|
||||
'';
|
||||
boot.loader.grub.devices = [
|
||||
"/dev/disk/by-id/nvme-WDC_WDS100T2B0C-00PXH0_21111Y801086"
|
||||
];
|
||||
users.users.root.initialHashedPassword = "$6$3Ps2Vmff.gUBkiCv$FCeCQjDvNTdWynQU81qtCXFHQht86w4unWNalUgkcyq7lkkI2klzRyTK3dZiQUjIrn8qPKtwJcY9SNdyE8v1L/";
|
||||
}
|
121
system/virtual/configuration.nix
Normal file
121
system/virtual/configuration.nix
Normal file
|
@ -0,0 +1,121 @@
|
|||
# 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
|
||||
];
|
||||
|
||||
hardware.opengl.enable = true;
|
||||
|
||||
# Make ready for nix flakes
|
||||
nix.package = pkgs.nixFlakes;
|
||||
nix.extraOptions = ''
|
||||
experimental-features = nix-command flakes
|
||||
'';
|
||||
|
||||
# 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 = "America/Los_Angeles";
|
||||
|
||||
# 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.enp1s0.useDHCP = true;
|
||||
networking.hostName = "virtual";
|
||||
|
||||
# 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;
|
||||
|
||||
# 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.alejandro = {
|
||||
isNormalUser = true;
|
||||
extraGroups = ["wheel"]; # Enable ‘sudo’ for the user.
|
||||
initialPassword = "test";
|
||||
shell = pkgs.zsh;
|
||||
};
|
||||
|
||||
fonts.fonts = with pkgs; [
|
||||
(nerdfonts.override {fonts = ["Hack"];})
|
||||
];
|
||||
|
||||
# List packages installed in system profile. To search, run:
|
||||
# $ nix search wget
|
||||
environment.systemPackages = with pkgs; [
|
||||
vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
|
||||
wget
|
||||
git
|
||||
ripgrep
|
||||
killall
|
||||
# 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:
|
||||
|
||||
services.spice-vdagentd.enable = true;
|
||||
|
||||
# Enable the OpenSSH daemon.
|
||||
services.openssh = {
|
||||
enable = true;
|
||||
passwordAuthentication = 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 = "22.05"; # Did you read the comment?
|
||||
}
|
34
system/virtual/hardware-configuration.nix
Normal file
34
system/virtual/hardware-configuration.nix
Normal file
|
@ -0,0 +1,34 @@
|
|||
# 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 + "/profiles/qemu-guest.nix")
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules = ["ahci" "xhci_pci" "virtio_pci" "sr_mod" "virtio_blk"];
|
||||
boot.initrd.kernelModules = [];
|
||||
boot.kernelModules = ["kvm-intel"];
|
||||
boot.extraModulePackages = [];
|
||||
|
||||
hardware.opengl.enable = true;
|
||||
fileSystems."/" = {
|
||||
device = "/dev/disk/by-uuid/8468529a-7215-4da3-af26-0c7f859e77f4";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
fileSystems."/boot" = {
|
||||
device = "/dev/disk/by-uuid/BBE3-1963";
|
||||
fsType = "vfat";
|
||||
};
|
||||
|
||||
swapDevices = [];
|
||||
|
||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
}
|
33
users/alejandro/alacritty.nix
Normal file
33
users/alejandro/alacritty.nix
Normal file
|
@ -0,0 +1,33 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
home.packages = [pkgs.alacritty];
|
||||
|
||||
programs.alacritty = {
|
||||
enable = true;
|
||||
settings = {
|
||||
window.opacity = 0.98;
|
||||
font = {
|
||||
size = 11.0;
|
||||
normal = {
|
||||
family = "Hack Nerd Font";
|
||||
style = "Regular";
|
||||
};
|
||||
bold = {
|
||||
family = "Hack Nerd Font";
|
||||
style = "Bold";
|
||||
};
|
||||
italic = {
|
||||
family = "Hack Nerd Font";
|
||||
style = "Italic";
|
||||
};
|
||||
bold_italic = {
|
||||
family = "Hack Nerd Font";
|
||||
style = "Bold Italic";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
56
users/alejandro/git.nix
Normal file
56
users/alejandro/git.nix
Normal file
|
@ -0,0 +1,56 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
home.packages = with pkgs; [
|
||||
git
|
||||
git-crypt
|
||||
];
|
||||
|
||||
programs.git = {
|
||||
delta = {
|
||||
enable = true;
|
||||
options = {
|
||||
line-numbers = true;
|
||||
navigate = true;
|
||||
};
|
||||
};
|
||||
|
||||
enable = true;
|
||||
userName = "Alejandro Angulo";
|
||||
userEmail = "iam@alejandr0angul0.dev";
|
||||
|
||||
aliases = {
|
||||
lol = "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative";
|
||||
pushup = "push -u origin HEAD";
|
||||
};
|
||||
|
||||
ignores = [
|
||||
# PyCharm
|
||||
".idea/"
|
||||
|
||||
# Vim artifacts
|
||||
"*.swp"
|
||||
"*.swo"
|
||||
"tags"
|
||||
".vimspector.json"
|
||||
".vimlocal"
|
||||
"Session.vim*"
|
||||
|
||||
# direnv
|
||||
".envrc"
|
||||
".direnv"
|
||||
];
|
||||
|
||||
extraConfig = {
|
||||
init = {
|
||||
defaultBranch = "main";
|
||||
};
|
||||
|
||||
pull = {
|
||||
rebase = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
19
users/alejandro/gpg.nix
Normal file
19
users/alejandro/gpg.nix
Normal file
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
home.packages = with pkgs; [
|
||||
gnupg
|
||||
pinentry-curses
|
||||
];
|
||||
|
||||
programs.gpg = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
services.gpg-agent = {
|
||||
enable = true;
|
||||
pinentryFlavor = "curses";
|
||||
};
|
||||
}
|
62
users/alejandro/home.nix
Normal file
62
users/alejandro/home.nix
Normal file
|
@ -0,0 +1,62 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
./alacritty.nix
|
||||
./git.nix
|
||||
./git.nix
|
||||
./mako.nix
|
||||
./rofi.nix
|
||||
./sway/sway.nix
|
||||
./tmux.nix
|
||||
./vim/vim.nix
|
||||
./zsh.nix
|
||||
];
|
||||
|
||||
# Home Manager needs a bit of information about you and the
|
||||
# paths it should manage.
|
||||
home.username = "alejandro";
|
||||
home.homeDirectory = "/home/alejandro";
|
||||
|
||||
home.packages = with pkgs; [
|
||||
kitty
|
||||
signal-desktop
|
||||
nodejs # For vim's CoC plugin
|
||||
pamixer # For sway binding to control audio
|
||||
# TODO: Remove this? Need to add programs.light.enable in system config
|
||||
#light # For sway binding to control backlight
|
||||
#swaynagmode
|
||||
python310
|
||||
gammastep
|
||||
super-slicer
|
||||
|
||||
firefox
|
||||
|
||||
kanshi
|
||||
#pkgs.busybox
|
||||
|
||||
playerctl
|
||||
];
|
||||
|
||||
services.gammastep = {
|
||||
enable = true;
|
||||
provider = "geoclue2";
|
||||
#latitude = 34.0;
|
||||
#longitude = -118.4;
|
||||
};
|
||||
|
||||
# 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 = "22.05";
|
||||
|
||||
# Let Home Manager install and manage itself.
|
||||
programs.home-manager.enable = true;
|
||||
}
|
24
users/alejandro/mako.nix
Normal file
24
users/alejandro/mako.nix
Normal file
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
home.packages = with pkgs; [
|
||||
mako
|
||||
libnotify
|
||||
];
|
||||
# TODO: Add hack nerd font
|
||||
|
||||
programs.mako = {
|
||||
enable = true;
|
||||
|
||||
font = "'Hack Nerd Font' Regular 9";
|
||||
|
||||
backgroundColor = "#1D2021F0";
|
||||
textColor = "#FFFFDF";
|
||||
borderColor = "#1C1C1C";
|
||||
borderRadius = 10;
|
||||
|
||||
padding = "10";
|
||||
};
|
||||
}
|
17
users/alejandro/rofi.nix
Normal file
17
users/alejandro/rofi.nix
Normal file
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
home.packages = [pkgs.rofi];
|
||||
# TODO: Add Hack Nerd Font
|
||||
|
||||
programs.rofi = {
|
||||
enable = true;
|
||||
font = "Hack Nerd Font 10";
|
||||
theme = "gruvbox-dark-hard";
|
||||
extraConfig = {
|
||||
show-icons = true;
|
||||
};
|
||||
};
|
||||
}
|
160
users/alejandro/sway/keybindings.nix
Normal file
160
users/alejandro/sway/keybindings.nix
Normal file
|
@ -0,0 +1,160 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
cfg = config.wayland.windowManager.sway.config;
|
||||
nag = "swaynag";
|
||||
leaveModeKeys = {
|
||||
"Insert" = "mode default";
|
||||
"Escape" = "mode default";
|
||||
"Return" = "mode default";
|
||||
};
|
||||
in {
|
||||
config.wayland.windowManager.sway.config = {
|
||||
modes = {
|
||||
resize =
|
||||
{
|
||||
# left will shrink the containers width
|
||||
# right will grow the containers width
|
||||
# up will shrink the containers height
|
||||
# down will grow the containers height
|
||||
"${cfg.left}" = "resize shrink width 50px";
|
||||
"${cfg.down}" = "resize grow height 50px";
|
||||
"${cfg.up}" = "resize shrink height 50px";
|
||||
"${cfg.right}" = "resize grow width 50px";
|
||||
|
||||
# Ditto, with arrow keys
|
||||
"Left" = "resize shrink width 50px";
|
||||
"Down" = "resize grow height 50px";
|
||||
"Up" = "resize shrink height 50px";
|
||||
"Right" = "resize grow width 50px";
|
||||
}
|
||||
// leaveModeKeys;
|
||||
|
||||
nag = {
|
||||
"Ctrl+d" = "mode default";
|
||||
|
||||
"Ctrl+c" = "exec ${nag} --exit";
|
||||
"q" = "exec ${nag} --exit";
|
||||
"Escape" = "exec ${nag} --exit";
|
||||
|
||||
"Return" = "exec ${nag} --confirm";
|
||||
|
||||
"j" = "exec ${nag} --next";
|
||||
"Tab" = "exec ${nag} --next";
|
||||
"Up" = "exec ${nag} --next";
|
||||
|
||||
"k" = "exec ${nag} --prev";
|
||||
"Shift+Tab" = "exec ${nag} prev";
|
||||
"Down" = "exec ${nag} prev";
|
||||
};
|
||||
};
|
||||
|
||||
keybindings = {
|
||||
# Activate modes
|
||||
"${cfg.modifier}+s" = "mode resize";
|
||||
|
||||
# Misc
|
||||
"${cfg.modifier}+Return" = "exec ${cfg.terminal}";
|
||||
"${cfg.modifier}+c" = "kill";
|
||||
"${cfg.modifier}+p" = "exec ${cfg.menu}";
|
||||
"${cfg.modifier}+z" = "reload";
|
||||
"${cfg.modifier}+x" = "exec swaylock -i ${config.home.homeDirectory}/wallpaper.png";
|
||||
|
||||
# Volume control
|
||||
"XF86AudioRaiseVolume" = " exec 'pamixer --increase 5'";
|
||||
"XF86AudioLowerVolume" = " exec 'pamixer --decrease 5'";
|
||||
"XF86AudioMute" = " exec 'pamixer --toggle-mute'";
|
||||
|
||||
# Music player control
|
||||
"XF86AudioPrev" = "exec 'playerctl previous'";
|
||||
"XF86AudioNext" = "exec 'playerctl next'";
|
||||
"XF86AudioPlay" = "exec 'playerctl play-pause'";
|
||||
"${cfg.modifier}+Down" = "exec 'playerctl pause'";
|
||||
"${cfg.modifier}+Up" = "exec 'playerctl play'";
|
||||
"${cfg.modifier}+Right" = "exec 'playerctl next'";
|
||||
"${cfg.modifier}+Left" = "exec 'playerctl previous'";
|
||||
|
||||
# Backlight keys
|
||||
"XF86MonBrightnessDown" = "exec 'light -U 5'";
|
||||
"XF86MonBrightnessUp" = "exec 'light -A 5'";
|
||||
|
||||
# Navigation
|
||||
|
||||
## Focus
|
||||
|
||||
### Move your focus around
|
||||
"${cfg.modifier}+${cfg.left}" = "focus left";
|
||||
"${cfg.modifier}+${cfg.down}" = "focus down";
|
||||
"${cfg.modifier}+${cfg.up}" = "focus up";
|
||||
"${cfg.modifier}+${cfg.right}" = "focus right";
|
||||
|
||||
### Move the focused window with the same, but add Shift
|
||||
"${cfg.modifier}+Shift+${cfg.left}" = "move left";
|
||||
"${cfg.modifier}+Shift+${cfg.down}" = "move down";
|
||||
"${cfg.modifier}+Shift+${cfg.up}" = "move up";
|
||||
"${cfg.modifier}+Shift+${cfg.right}" = "move right";
|
||||
|
||||
## Workspaces
|
||||
|
||||
### Switch to a workspace
|
||||
"${cfg.modifier}+q" = "workspace number 1";
|
||||
"${cfg.modifier}+w" = "workspace number 2";
|
||||
"${cfg.modifier}+e" = "workspace number 3";
|
||||
"${cfg.modifier}+r" = "workspace number 4";
|
||||
"${cfg.modifier}+t" = "workspace number 5";
|
||||
"${cfg.modifier}+y" = "workspace number 6";
|
||||
"${cfg.modifier}+u" = "workspace number 7";
|
||||
"${cfg.modifier}+i" = "workspace number 8";
|
||||
"${cfg.modifier}+o" = "workspace number 9";
|
||||
|
||||
### Move focused container to workspace
|
||||
"${cfg.modifier}+Shift+q" = "move container to workspace number 1";
|
||||
"${cfg.modifier}+Shift+w" = "move container to workspace number 2";
|
||||
"${cfg.modifier}+Shift+e" = "move container to workspace number 3";
|
||||
"${cfg.modifier}+Shift+r" = "move container to workspace number 4";
|
||||
"${cfg.modifier}+Shift+t" = "move container to workspace number 5";
|
||||
"${cfg.modifier}+Shift+y" = "move container to workspace number 6";
|
||||
"${cfg.modifier}+Shift+u" = "move container to workspace number 7";
|
||||
"${cfg.modifier}+Shift+i" = "move container to workspace number 8";
|
||||
"${cfg.modifier}+Shift+o" = "move container to workspace number 9";
|
||||
|
||||
# Layout
|
||||
|
||||
## Split direction
|
||||
"${cfg.modifier}+v" = "splith";
|
||||
"${cfg.modifier}+g" = "splitv";
|
||||
|
||||
## Switch the current container between different layout styles
|
||||
"${cfg.modifier}+b" = "layout stacking";
|
||||
"${cfg.modifier}+n" = "layout tabbed";
|
||||
"${cfg.modifier}+m" = "layout toggle split";
|
||||
|
||||
## Make the current focus fullscreen
|
||||
"${cfg.modifier}+f" = "fullscreen";
|
||||
|
||||
## move container between displays
|
||||
"${cfg.modifier}+semicolon" = "move workspace to output right";
|
||||
|
||||
## Toggle the current focus between tiling and floating mode
|
||||
"${cfg.modifier}+Shift+f" = "floating toggle";
|
||||
|
||||
## Swap focus between the tiling area and the floating area
|
||||
"${cfg.modifier}+space" = "focus mode_toggle";
|
||||
|
||||
## Move focus to the parent container
|
||||
"${cfg.modifier}+a" = "focus parent";
|
||||
|
||||
# Scratchpad
|
||||
# Move the currently focused window to the scratchpad
|
||||
"${cfg.modifier}+Shift+minus" = "move scratchpad";
|
||||
# Show the next scratchpad window or hide the focused scratchpad window.
|
||||
# If there are multiple scratchpad windows, this command cycles through them.
|
||||
"${cfg.modifier}+minus" = "scratchpad show";
|
||||
|
||||
# Exit sway (logs you out of your Wayland session)
|
||||
"${cfg.modifier}+Shift+z" = "exec ${nag} -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit' -b 'Reload' 'swaymsg reload'";
|
||||
};
|
||||
};
|
||||
}
|
88
users/alejandro/sway/sway.nix
Normal file
88
users/alejandro/sway/sway.nix
Normal file
|
@ -0,0 +1,88 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
./keybindings.nix
|
||||
./waybar.nix
|
||||
];
|
||||
|
||||
home.packages = with pkgs; [
|
||||
#light # TODO: Not enough to have this package, need it enabled in system config.
|
||||
pamixer
|
||||
playerctl
|
||||
rofi
|
||||
swaylock
|
||||
wl-clipboard
|
||||
];
|
||||
|
||||
services.playerctld.enable = true;
|
||||
|
||||
services.swayidle = {
|
||||
timeouts = [
|
||||
{
|
||||
timeout = 300;
|
||||
command = "${pkgs.swaylock}/bin/swaylock -i ${config.home.homeDirectory}/wallpaper.png";
|
||||
}
|
||||
{
|
||||
timeout = 600;
|
||||
command = "${pkgs.swaymsg}/bin/swaymsg 'ouput * dpms off'";
|
||||
resumeCommand = "${pkgs.swaymsg}/bin/swaymsg 'output * dpms on'";
|
||||
}
|
||||
];
|
||||
events = [
|
||||
{
|
||||
event = "before-sleep";
|
||||
command = "${pkgs.swaylock}/bin/swaylock";
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
wayland.windowManager.sway = {
|
||||
enable = true;
|
||||
swaynag.enable = true;
|
||||
wrapperFeatures.gtk = true; # so that gtk works properly
|
||||
|
||||
config = {
|
||||
modifier = "Mod4";
|
||||
terminal = "alacritty"; # TODO: include in packages above?
|
||||
menu = "rofi -show run";
|
||||
|
||||
colors = {
|
||||
focused = {
|
||||
border = "#484848";
|
||||
background = "#2B3C44";
|
||||
text = "#FFFFFF";
|
||||
indicator = "#333333";
|
||||
childBorder = "#000000";
|
||||
};
|
||||
focusedInactive = {
|
||||
border = "#484848";
|
||||
background = "#333333";
|
||||
text = "#FFFFFF";
|
||||
indicator = "#000000";
|
||||
childBorder = "#000000";
|
||||
};
|
||||
unfocused = {
|
||||
border = "#484848";
|
||||
background = "#333333";
|
||||
text = "#FFFFFF";
|
||||
indicator = "#000000";
|
||||
childBorder = "#000000";
|
||||
};
|
||||
};
|
||||
|
||||
output = {
|
||||
"*".bg = "${config.home.homeDirectory}/wallpaper.png fill";
|
||||
"eDP-1".scale = "1";
|
||||
|
||||
"Dell Inc. DELL S2721QS 47W7M43" = {
|
||||
transform = "270";
|
||||
position = "1920 0";
|
||||
};
|
||||
"Dell Inc. DELL S2721QS 4FR7M43".position = "4080 830";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
148
users/alejandro/sway/waybar.nix
Normal file
148
users/alejandro/sway/waybar.nix
Normal file
|
@ -0,0 +1,148 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
options,
|
||||
...
|
||||
}: {
|
||||
home.packages = with pkgs; [
|
||||
#pactl
|
||||
waybar
|
||||
];
|
||||
|
||||
programs.waybar = {
|
||||
enable = true;
|
||||
systemd.enable = true;
|
||||
|
||||
style = builtins.readFile ./waybar_style.css;
|
||||
|
||||
settings = [
|
||||
{
|
||||
layer = "top";
|
||||
position = "top";
|
||||
height = 20;
|
||||
modules-left = ["sway/workspaces"];
|
||||
modules-center = ["clock"];
|
||||
modules-right = [
|
||||
"idle_inhibitor"
|
||||
"temperature"
|
||||
"cpu"
|
||||
"pulseaudio"
|
||||
"battery"
|
||||
"memory"
|
||||
"backlight"
|
||||
"network"
|
||||
"tray"
|
||||
];
|
||||
|
||||
"sway/workspaces" = {
|
||||
disable-scroll = false;
|
||||
all-outputs = true;
|
||||
format = "{icon}";
|
||||
format-icons = {
|
||||
"1" = "q";
|
||||
"2" = "w";
|
||||
"3" = "e";
|
||||
"4" = "r";
|
||||
"5" = "t";
|
||||
"6" = "y";
|
||||
"7" = "u";
|
||||
"8" = "i";
|
||||
"9" = "o";
|
||||
urgent = " ";
|
||||
focused = " ";
|
||||
default = " ";
|
||||
};
|
||||
};
|
||||
|
||||
idle_inhibitor = {
|
||||
format = "{icon}";
|
||||
format-icons = {
|
||||
activated = " ";
|
||||
deactivated = " ";
|
||||
};
|
||||
};
|
||||
|
||||
temperature = {
|
||||
critical-threshold = 80;
|
||||
format = "{temperatureC}°C {icon}";
|
||||
format-icons = [" " " " " "];
|
||||
};
|
||||
|
||||
cpu = {
|
||||
format = "{usage}% ";
|
||||
tooltip = false;
|
||||
};
|
||||
|
||||
pulseaudio = {
|
||||
format = "{icon} {volume}% {format_source}";
|
||||
format-bluetooth = "{icon} {volume}% {format_source}";
|
||||
format-bluetooth-muted = " {volume}% {format_source}";
|
||||
format-muted = " {format_source}";
|
||||
format-source = " ";
|
||||
format-source-muted = " ";
|
||||
format-icons = {
|
||||
headphone = " ";
|
||||
hands-free = " ";
|
||||
headset = " ";
|
||||
phone = " ";
|
||||
portable = " ";
|
||||
car = " ";
|
||||
default = [" " " " " "];
|
||||
};
|
||||
tooltip-format = "{desc}, {volume}%";
|
||||
# TODO: Figure out how to get pactl binary?
|
||||
on-click = "pactl set-sink-mute @DEFAULT_SINK@ toggle";
|
||||
on-click-right = "pactl set-source-mute @DEFAULT_SOURCE@ toggle";
|
||||
on-click-middle = "pavucontrol";
|
||||
};
|
||||
|
||||
battery = {
|
||||
states = {
|
||||
warning = 30;
|
||||
critical = 1;
|
||||
};
|
||||
format = "{icon} {capacity}%";
|
||||
tooltip-format = "{timeTo}, {capacity}%";
|
||||
format-charging = " {capacity}%";
|
||||
format-plugged = " ";
|
||||
format-alt = "{time} {icon}";
|
||||
format-icons = ["" "" "" "" ""];
|
||||
};
|
||||
|
||||
memory = {
|
||||
format = "{}% ";
|
||||
};
|
||||
|
||||
backlight = {
|
||||
format = "{icon} {percent}%";
|
||||
format-icons = [" " " "];
|
||||
on-scroll-up = "light -A 1";
|
||||
on-scroll-down = "light -U 1";
|
||||
};
|
||||
|
||||
network = {
|
||||
format-wifi = "直 ";
|
||||
format-ethernet = "{ifname}: {ipaddr}/{cidr} ";
|
||||
format-linked = "{ifname} (No IP) ";
|
||||
format-disconnected = "睊 ";
|
||||
format-alt = "{ifname}: {ipaddr}/{cidr}";
|
||||
tooltip-format = "{essid} {signalStrength}%";
|
||||
};
|
||||
|
||||
tray = {
|
||||
spacing = 10;
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
wayland.windowManager.sway.config.bars = [];
|
||||
#wayland.windowManager.sway.config.bars = [
|
||||
#{
|
||||
#position = "top";
|
||||
#statusCommand = "${pkgs.waybar}/bin/waybar";
|
||||
#workspaceNumbers = false;
|
||||
#workspaceButtons = false;
|
||||
#}
|
||||
#];
|
||||
}
|
132
users/alejandro/sway/waybar_style.css
Normal file
132
users/alejandro/sway/waybar_style.css
Normal file
|
@ -0,0 +1,132 @@
|
|||
* {
|
||||
border: none;
|
||||
font-family: Hack Nerd Font, sans-serif;
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
window#waybar {
|
||||
background-color: rgba(29, 32, 33, 0.9);
|
||||
border-bottom: 3px solid #1d2021;
|
||||
color: #ffffdf;
|
||||
transition-property: background-color;
|
||||
transition-duration: .5s;
|
||||
}
|
||||
|
||||
window#waybar.hidden {
|
||||
opacity: 0.2;
|
||||
}
|
||||
|
||||
#workspaces,
|
||||
#mode,
|
||||
#cpu,
|
||||
#memory,
|
||||
#temperature,
|
||||
#clock,
|
||||
#idle_inhibitor,
|
||||
#language,
|
||||
#pulseaudio,
|
||||
#backlight,
|
||||
#battery,
|
||||
#network,
|
||||
#tray {
|
||||
background-color: #303030;
|
||||
padding: 0 10px;
|
||||
margin: 3px;
|
||||
border: 3px solid rgba(0, 0, 0, 0);
|
||||
border-radius: 90px;
|
||||
background-clip: padding-box;
|
||||
}
|
||||
|
||||
#workspaces button {
|
||||
padding: 0 5px;
|
||||
min-width: 20px;
|
||||
color: #87afaf;
|
||||
}
|
||||
|
||||
#workspaces button:hover {
|
||||
background-color: rgba(0, 0, 0, 1)
|
||||
}
|
||||
|
||||
#workspaces button.focused {
|
||||
color: #ffaf00;
|
||||
}
|
||||
|
||||
#workspaces button.urgent {
|
||||
color: #e06c75;
|
||||
}
|
||||
|
||||
#clock {
|
||||
color: #61afef;
|
||||
}
|
||||
|
||||
#idle_inhibitor {
|
||||
color: #abb2bf;
|
||||
}
|
||||
|
||||
#idle_inhibitor.activated {
|
||||
background-color: #abb2bf;
|
||||
color: #1e222a;
|
||||
}
|
||||
|
||||
#temperature {
|
||||
color: #fb4934;
|
||||
}
|
||||
|
||||
#temperature.critical {
|
||||
color: #1d2021;
|
||||
background-color: #9d0006;
|
||||
}
|
||||
|
||||
#cpu {
|
||||
color: #ff8700;
|
||||
}
|
||||
|
||||
#memory {
|
||||
color: #87af87;
|
||||
}
|
||||
|
||||
#battery {
|
||||
color: #b8bb26;
|
||||
}
|
||||
|
||||
#battery.charging, #battery.plugged {
|
||||
background-color: #1f321c;
|
||||
color: #ffffaf;
|
||||
}
|
||||
|
||||
@keyframes blink {
|
||||
to {
|
||||
background-color: #1f321c;
|
||||
color: #ffffaf;
|
||||
}
|
||||
}
|
||||
|
||||
#battery.critical:not(.charging) {
|
||||
background-color: #afaf00;
|
||||
color: #303030;
|
||||
animation-name: blink;
|
||||
animation-duration: 0.5s;
|
||||
animation-timing-function: linear;
|
||||
animation-iteration-count: infinite;
|
||||
animation-direction: alternate;
|
||||
}
|
||||
|
||||
#pulseaudio {
|
||||
color: #fabd2f;
|
||||
}
|
||||
|
||||
#pulseaudio.muted {
|
||||
color: #b57614;
|
||||
}
|
||||
|
||||
#backlight {
|
||||
color: #17ccd5;
|
||||
}
|
||||
|
||||
#network {
|
||||
color: #d787af;
|
||||
}
|
||||
|
||||
#network.disconnected {
|
||||
color: #875f87;
|
||||
}
|
68
users/alejandro/tmux.nix
Normal file
68
users/alejandro/tmux.nix
Normal file
|
@ -0,0 +1,68 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
programs.tmux = {
|
||||
enable = true;
|
||||
keyMode = "vi";
|
||||
newSession = true;
|
||||
sensibleOnTop = true;
|
||||
terminal = "screen-256color";
|
||||
|
||||
plugins = with pkgs.tmuxPlugins; [
|
||||
{
|
||||
plugin = resurrect;
|
||||
extraConfig = ''
|
||||
set -g @resurrect-capture-pane-contents 'on'
|
||||
set -g @resurrect-strategy-vim 'session'
|
||||
'';
|
||||
}
|
||||
{
|
||||
plugin = vim-tmux-navigator;
|
||||
extraConfig = ''
|
||||
'';
|
||||
}
|
||||
];
|
||||
|
||||
extraConfig = ''
|
||||
# Color fix
|
||||
# set-option -ga terminal-overrides ",alacritty:Tc,xterm-256color:Tc"
|
||||
|
||||
# Scrolling with mouse wheel scrolls output instead of previous commands
|
||||
setw -g mouse on
|
||||
|
||||
# Open panes in the same directory
|
||||
bind c new-window -c "#{pane_current_path}"
|
||||
bind '"' split-window -c "#{pane_current_path}"
|
||||
bind % split-window -h -c "#{pane_current_path}"
|
||||
|
||||
# Eye Candy
|
||||
# set -g @plugin 'mattdavis90/base16-tmux'
|
||||
# set -g @colors-base16 'darktooth'
|
||||
|
||||
# Integration with tmuxline.vim
|
||||
source-file ~/theme
|
||||
|
||||
# Smart pane switching with awareness of Vim splits.
|
||||
# See: https://github.com/christoomey/vim-tmux-navigator
|
||||
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
|
||||
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?\\.?g?(view|n?vim?x?)(-wrapped)?(diff)?$'"
|
||||
bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' 'select-pane -L'
|
||||
bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' 'select-pane -D'
|
||||
bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' 'select-pane -U'
|
||||
bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-l' 'select-pane -R'
|
||||
tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")'
|
||||
if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \
|
||||
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'"
|
||||
if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \
|
||||
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\\\' 'select-pane -l'"
|
||||
|
||||
bind-key -T copy-mode-vi 'C-h' select-pane -L
|
||||
bind-key -T copy-mode-vi 'C-j' select-pane -D
|
||||
bind-key -T copy-mode-vi 'C-k' select-pane -U
|
||||
bind-key -T copy-mode-vi 'C-l' select-pane -R
|
||||
bind-key -T copy-mode-vi 'C-\' select-pane -l
|
||||
'';
|
||||
};
|
||||
}
|
166
users/alejandro/vim/vim.nix
Normal file
166
users/alejandro/vim/vim.nix
Normal file
|
@ -0,0 +1,166 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
# home.packages = [ pkgs.vim ];
|
||||
home.packages = [pkgs.fzf];
|
||||
|
||||
programs.vim = {
|
||||
enable = true;
|
||||
|
||||
plugins = with pkgs.vimPlugins; [
|
||||
base16-vim
|
||||
vim-airline
|
||||
vim-airline-themes
|
||||
vim-devicons
|
||||
tmuxline-vim
|
||||
|
||||
gitgutter
|
||||
fugitive
|
||||
rhubarb
|
||||
|
||||
fzf-vim
|
||||
|
||||
nerdcommenter
|
||||
nerdtree
|
||||
|
||||
tmux-navigator
|
||||
|
||||
vimspector
|
||||
|
||||
ale
|
||||
coc-nvim
|
||||
# TODO: Add coc plugins
|
||||
|
||||
vim-obsession
|
||||
];
|
||||
|
||||
extraConfig = ''
|
||||
set tabstop=4
|
||||
set shiftwidth=4
|
||||
set mouse=a
|
||||
set ttymouse=sgr
|
||||
set mousemodel=popup_setpos
|
||||
set updatetime=100
|
||||
set expandtab
|
||||
set number
|
||||
set autoindent
|
||||
set laststatus=2
|
||||
set encoding=utf-8
|
||||
syntax on
|
||||
|
||||
let mapleader = "'"
|
||||
|
||||
" ALE (need to happen before ALE loaded)
|
||||
let g:ale_display_lsp = 1
|
||||
|
||||
filetype plugin indent on
|
||||
|
||||
" Use tabs for makefile
|
||||
autocmd Filetype make setlocal noexpandtab
|
||||
|
||||
" Toggle line highlighting based on focus
|
||||
autocmd BufEnter * setlocal cursorline
|
||||
autocmd BufLeave * setlocal nocursorline
|
||||
|
||||
" airline
|
||||
let g:airline_theme='base16_vim'
|
||||
let g:airline_powerline_fonts = 1
|
||||
|
||||
" Colorscheme
|
||||
if !exists('g:colors_name') || g:colors_name != 'base16-darktooth'
|
||||
set background=dark
|
||||
let base16colorspace=256
|
||||
colorscheme base16-darktooth
|
||||
hi Normal ctermbg=NONE guibg=NONE
|
||||
endif
|
||||
|
||||
" Toggle relative line numbers
|
||||
nmap <leader>num :set invrelativenumber<CR>
|
||||
|
||||
" Tab completion
|
||||
set wildmode=longest,list,full
|
||||
set wildmenu
|
||||
|
||||
" Move splits
|
||||
function! MarkWindowSwap()
|
||||
let g:markedWinNum = winnr()
|
||||
endfunction
|
||||
|
||||
function! DoWindowSwap()
|
||||
" Mark destination
|
||||
let curnum = winnr()
|
||||
let curBut = bufnr( "%" )
|
||||
" Switch to source and shuffle dest->source
|
||||
let markedBuf = bufnr( "%" )
|
||||
" Hide and open so that we aren't prompted and keep history
|
||||
exe 'hide buf' curBuf
|
||||
" Switch to dest and shuffle source->dest
|
||||
exe curnum . "wincmd w"
|
||||
" Hide and open so that we aren't prompted and keep history
|
||||
exe 'hide buf' markedBuf
|
||||
endfunction
|
||||
|
||||
nmap <silent> <leader>mv :call MarkWindowSwap()<CR>
|
||||
nmap <silent> <leader>pw :call DoWindowSwap()<CR>
|
||||
|
||||
" NERDTree
|
||||
nnoremap <leader>n :NERDTreeFocus<CR>
|
||||
nnoremap <C-n> :NERDTree<CR>
|
||||
nnoremap <C-t> :NERDTreeToggle<CR>
|
||||
nnoremap <C-f> :NERDTreeFind<CR>
|
||||
|
||||
let g:NERDTreeQuitOnOpen = 1
|
||||
let g:NERDTreeShowHidden = 1
|
||||
|
||||
" vimspector
|
||||
let g:vimspector_enable_mappings = 'HUMAN'
|
||||
let g:vimspector_enable_gadgets = ['debugpy', 'CodeLLDB']
|
||||
let g:vimspector_base_dir = expand('$HOME/.vim/bundle/vimspector')
|
||||
|
||||
nmap <Leader>di <Plug>VimspectorBalloonEval
|
||||
xmap <Leader>di <Plug>VimspectorBalloonEval
|
||||
|
||||
" fzf
|
||||
nnoremap <C-P> :GFiles<CR>
|
||||
nnoremap <C-G> :Rg<CR>
|
||||
|
||||
" coc.nvim
|
||||
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
|
||||
|
||||
" use <tab> for trigger completion and navigate to the next complete item
|
||||
function! s:check_back_space() abort
|
||||
let col = col('.') - 1
|
||||
return !col || getline('.')[col - 1] =~ '\s'
|
||||
endfunction
|
||||
|
||||
inoremap <silent><expr> <Tab>
|
||||
\ pumvisible() ? "\<C-n>" :
|
||||
\ <SID>check_back_space() ? "\<Tab>" :
|
||||
\ coc#refresh()
|
||||
|
||||
" uses tab and shift-tab to navigate completion list
|
||||
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
|
||||
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
|
||||
|
||||
nnoremap <Leader>cmd :CocCommand<CR>
|
||||
nnoremap <Leader>cfg :CocConfig<CR>
|
||||
nnoremap <Leader>def :call CocAction('jumpDefinition')<CR>
|
||||
nnoremap <Leader>fmt :call CocActionAsync('format')<CR>
|
||||
noremap <Leader>bro :GBrowse<CR>
|
||||
|
||||
" GoTo code navigation.
|
||||
nmap <silent> gd <Plug>(coc-definition)
|
||||
nmap <silent> gs :call CocAction('jumpDefinition', 'split')<CR>
|
||||
nmap <silent> gv :call CocAction('jumpDefinition', 'vsplit')<CR>
|
||||
nmap <silent> gn :call CocAction('jumpDefinition', 'tabe')<CR>
|
||||
nmap <silent> gy <Plug>(coc-type-definition)
|
||||
nmap <silent> gi <Plug>(coc-implementation)
|
||||
nmap <silent> gr <Plug>(coc-references)
|
||||
|
||||
" Project-specific config
|
||||
silent! so .vimlocal
|
||||
'';
|
||||
};
|
||||
}
|
72
users/alejandro/zsh.nix
Normal file
72
users/alejandro/zsh.nix
Normal file
|
@ -0,0 +1,72 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
home.packages = with pkgs; [
|
||||
# TODO: Should zsh be added here if already part of system configuration?
|
||||
#zsh
|
||||
ripgrep
|
||||
bat
|
||||
htop
|
||||
ranger
|
||||
lsd
|
||||
];
|
||||
|
||||
programs.direnv = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
};
|
||||
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
enableAutosuggestions = true;
|
||||
enableCompletion = true;
|
||||
envExtra = ''
|
||||
export PATH=~/.local/bin:$PATH
|
||||
export EDITOR=vim
|
||||
'';
|
||||
initExtra = ''
|
||||
base16_darktooth
|
||||
source ~/.p10k.zsh
|
||||
bindkey -v
|
||||
bindkey '^R' history-incremental-search-backward
|
||||
alias view="vim -R $1"
|
||||
alias ls=lsd
|
||||
alias l=ls
|
||||
'';
|
||||
|
||||
plugins = with pkgs; [
|
||||
{
|
||||
name = "zsh-syntax-highlighting";
|
||||
src = fetchFromGitHub {
|
||||
owner = "zsh-users";
|
||||
repo = "zsh-syntax-highlighting";
|
||||
rev = "0.6.0";
|
||||
sha256 = "0zmq66dzasmr5pwribyh4kbkk23jxbpdw4rjxx0i7dx8jjp2lzl4";
|
||||
};
|
||||
file = "zsh-syntax-highlighting.zsh";
|
||||
}
|
||||
{
|
||||
name = "powerlevel10k";
|
||||
src = fetchFromGitHub {
|
||||
owner = "romkatv";
|
||||
repo = "powerlevel10k";
|
||||
rev = "v1.16.1";
|
||||
sha256 = "0fkfh8j7rd8mkpgz6nsx4v7665d375266shl1aasdad8blgqmf0c";
|
||||
};
|
||||
file = "powerlevel10k.zsh-theme";
|
||||
}
|
||||
{
|
||||
name = "base16-shell";
|
||||
src = fetchFromGitHub {
|
||||
owner = "chriskempson";
|
||||
repo = "base16-shell";
|
||||
rev = "ce8e1e540367ea83cc3e01eec7b2a11783b3f9e1";
|
||||
sha256 = "1yj36k64zz65lxh28bb5rb5skwlinixxz6qwkwaf845ajvm45j1q";
|
||||
};
|
||||
file = "base16-shell.plugin.zsh";
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue