1
Fork 0

Refactor the entire configuration

With the release of the Nvidia 555 beta drivers and their improvements to
the Wayland experience I've finally decided to return to NixOS with
Hyprland again after 2 years of running Gentoo and Opensuse Tumbleweed
on X11. So this is me committing the work done so far from the last
couple of days. Future commits will be more incremental.
This commit is contained in:
caem 2024-05-24 21:33:00 +02:00
parent 97c86fb014
commit 75b13ac379
Signed by: caem
GPG key ID: 69A830D03203405F
72 changed files with 2045 additions and 196 deletions

View file

@ -1,13 +1,77 @@
# nixos-system-config
Modular multi-purpose NixOS configuration.
My NixOS configuration.
## About
This is the NixOS configuration I daily drive on my desktop. Feel free to use
and modify this configuration to your needs. No attribution required. I hold no
accountabilty for whatever you do with this configuration.
This is the NixOS configuration that I daily drive on my system. Feel free to use,
modify and share this configuration to your heart's content, no attribution required.
## Screenshots
[Wallpaper](https://www.deviantart.com/view/279239085) modified with [gruvbox-factory](https://github.com/paulopacitti/gruvbox-factory).
todo
## Layout
todo
```
├── assets ; Images used by the config and repo
│   └── wallpaper.png
├── flake.lock
├── flake.nix ; Entry point
├── machines ; Machine specific configuration
│   └── workstation
│   ├── configuration.nix
│   ├── hardware-configuration.nix ; Modified hardware configuration
│   └── persist.nix ; Impermanence configuration
├── packages ; Sets of packages to install and configure
│   ├── sets
│   │   ├── games.nix
│   │   └── ...
│   └── wm ; Package sets and basic config for WM and DE
│   ├── hyprland.nix
│   └── ...
├── README.md
├── secrets ; Git ignored folder to store confidentials
│   └── hu
│   └── pass ; Hashed password file for user
└── users
└── hu ; User specific configuration
├── packages ; Package configurations
│   ├── firefox.nix ; Configurations can be for NixOS or home-manager
│   ├── ...
│   └── zsh
│   ├── config ; Non-nix package config directory
│   │   └── conf.d
│   ├── zsh-home.nix ; For home-manager
│   └── zsh.nix ; For NixOS
├── persist.nix ; Impermanence configuration for the user
└── user.nix
```
## Installing
This configuration uses impermanence with btrfs snapshots so you'll have to partition
your system in a certain way.
First you'll need this partition layout, assuming you're installing on `nvme0n1`.
```
DEVICE FILESYSTEM PURPOSE
/dev/nvme0n1
├─/dev/nvme0n1p1 vfat EFI partition
└─/dev/nvme0n1p2 btrfs Partition to house all the subvolumes
```
Inside of the btrfs root volume we're going to need 2 subvolumes.
```
SUBVOLUME MOUNT PURPOSE
root / Impermanent data
nix /nix Permanent data
```
You'll also need to create a read-only snapshot of the `root` subvolume
and call it `root-blank`.
After you've mounted all the subvolumes and EFI partition (`/boot`) in `/mnt`
clone this repository in to `/mnt/nix/config`. Adjust all the block ids of the partitions
in `hardware-configuration.nix` and create a hashed password using `mkpasswd` and store it
in the `secrets/{user}` directory as `pass`.
Finally, in the config directory run `nixos-install --flake '.#'`, reboot and you're done.
## Screenshot
todo

BIN
assets/wallpaper.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 MiB

View file

@ -3,14 +3,16 @@
"aagl": {
"inputs": {
"flake-compat": "flake-compat",
"nixpkgs": "nixpkgs"
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1712185015,
"narHash": "sha256-mL3VSJRkyDJbMh/QqUeOhGOsEOTS7Jw9Tqw4fM+VjB4=",
"lastModified": 1716425853,
"narHash": "sha256-PSd1jStP3SfJB3JvHRVjHpGwy3eKjni06VciEly0rHQ=",
"owner": "ezKEa",
"repo": "aagl-gtk-on-nix",
"rev": "1dbb1c233a249e8cbc03907e965bd2a48d880262",
"rev": "fa6201a1cfcaa84d442c9c9b17c2e79df99f444b",
"type": "github"
},
"original": {
@ -19,6 +21,138 @@
"type": "github"
}
},
"ags": {
"inputs": {
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1715703984,
"narHash": "sha256-0BZkMui6aCqswMCouvp0G90tAxDOxVnxTvG6TDZsDaI=",
"owner": "Aylur",
"repo": "ags",
"rev": "11150225e62462bcd431d1e55185e810190a730a",
"type": "github"
},
"original": {
"owner": "Aylur",
"repo": "ags",
"type": "github"
}
},
"base16": {
"inputs": {
"fromYaml": "fromYaml"
},
"locked": {
"lastModified": 1708890466,
"narHash": "sha256-LlrC09LoPi8OPYOGPXegD72v+//VapgAqhbOFS3i8sc=",
"owner": "SenchoPens",
"repo": "base16.nix",
"rev": "665b3c6748534eb766c777298721cece9453fdae",
"type": "github"
},
"original": {
"owner": "SenchoPens",
"repo": "base16.nix",
"type": "github"
}
},
"base16-fish": {
"flake": false,
"locked": {
"lastModified": 1622559957,
"narHash": "sha256-PebymhVYbL8trDVVXxCvZgc0S5VxI7I1Hv4RMSquTpA=",
"owner": "tomyun",
"repo": "base16-fish",
"rev": "2f6dd973a9075dabccd26f1cded09508180bf5fe",
"type": "github"
},
"original": {
"owner": "tomyun",
"repo": "base16-fish",
"type": "github"
}
},
"base16-foot": {
"flake": false,
"locked": {
"lastModified": 1696725948,
"narHash": "sha256-65bz2bUL/yzZ1c8/GQASnoiGwaF8DczlxJtzik1c0AU=",
"owner": "tinted-theming",
"repo": "base16-foot",
"rev": "eedbcfa30de0a4baa03e99f5e3ceb5535c2755ce",
"type": "github"
},
"original": {
"owner": "tinted-theming",
"repo": "base16-foot",
"type": "github"
}
},
"base16-helix": {
"flake": false,
"locked": {
"lastModified": 1696727917,
"narHash": "sha256-FVrbPk+NtMra0jtlC5oxyNchbm8FosmvXIatkRbYy1g=",
"owner": "tinted-theming",
"repo": "base16-helix",
"rev": "dbe1480d99fe80f08df7970e471fac24c05f2ddb",
"type": "github"
},
"original": {
"owner": "tinted-theming",
"repo": "base16-helix",
"type": "github"
}
},
"base16-kitty": {
"flake": false,
"locked": {
"lastModified": 1665001328,
"narHash": "sha256-aRaizTYPpuWEcvoYE9U+YRX+Wsc8+iG0guQJbvxEdJY=",
"owner": "kdrag0n",
"repo": "base16-kitty",
"rev": "06bb401fa9a0ffb84365905ffbb959ae5bf40805",
"type": "github"
},
"original": {
"owner": "kdrag0n",
"repo": "base16-kitty",
"type": "github"
}
},
"base16-tmux": {
"flake": false,
"locked": {
"lastModified": 1696725902,
"narHash": "sha256-wDPg5elZPcQpu7Df0lI5O8Jv4A3T6jUQIVg63KDU+3Q=",
"owner": "tinted-theming",
"repo": "base16-tmux",
"rev": "c02050bebb60dbb20cb433cd4d8ce668ecc11ba7",
"type": "github"
},
"original": {
"owner": "tinted-theming",
"repo": "base16-tmux",
"type": "github"
}
},
"base16-vim": {
"flake": false,
"locked": {
"lastModified": 1663659192,
"narHash": "sha256-uJvaYYDMXvoo0fhBZUhN8WBXeJ87SRgof6GEK2efFT0=",
"owner": "chriskempson",
"repo": "base16-vim",
"rev": "3be3cd82cd31acfcab9a41bad853d9c68d30478d",
"type": "github"
},
"original": {
"owner": "chriskempson",
"repo": "base16-vim",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
@ -35,16 +169,88 @@
"type": "github"
}
},
"flake-compat_2": {
"flake": false,
"locked": {
"lastModified": 1673956053,
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"fromYaml": {
"flake": false,
"locked": {
"lastModified": 1689549921,
"narHash": "sha256-iX0pk/uB019TdBGlaJEWvBCfydT6sRq+eDcGPifVsCM=",
"owner": "SenchoPens",
"repo": "fromYaml",
"rev": "11fbbbfb32e3289d3c631e0134a23854e7865c84",
"type": "github"
},
"original": {
"owner": "SenchoPens",
"repo": "fromYaml",
"type": "github"
}
},
"gnome-shell": {
"flake": false,
"locked": {
"lastModified": 1713702291,
"narHash": "sha256-zYP1ehjtcV8fo+c+JFfkAqktZ384Y+y779fzmR9lQAU=",
"owner": "GNOME",
"repo": "gnome-shell",
"rev": "0d0aadf013f78a7f7f1dc984d0d812971864b934",
"type": "github"
},
"original": {
"owner": "GNOME",
"ref": "46.1",
"repo": "gnome-shell",
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": "nixpkgs_2"
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1712212014,
"narHash": "sha256-s+lbaf3nLRn1++/X2eXwY9mYCA/m9l8AvyG8beeOaXE=",
"lastModified": 1716457508,
"narHash": "sha256-ZxzffLuWRyuMrkVVq7wastNUqeO0HJL9xqfY1QsYaqo=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "7e91f2a0ba4b62b88591279d54f741a13e36245b",
"rev": "850cb322046ef1a268449cf1ceda5fd24d930b05",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"home-manager_2": {
"inputs": {
"nixpkgs": [
"stylix",
"nixpkgs"
]
},
"locked": {
"lastModified": 1714981474,
"narHash": "sha256-b3/U21CJjCjJKmA9WqUbZGZgCvospO3ArOUTgJugkOY=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "6ebe7be2e67be7b9b54d61ce5704f6fb466c536f",
"type": "github"
},
"original": {
@ -70,27 +276,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1711668574,
"narHash": "sha256-u1dfs0ASQIEr1icTVrsKwg2xToIpn7ZXxW3RHfHxshg=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "219951b495fc2eac67b1456824cc1ec1fd2ee659",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-23.11",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1711703276,
"narHash": "sha256-iMUFArF0WCatKK6RzfUJknjem0H9m4KgorO/p3Dopkk=",
"lastModified": 1708475490,
"narHash": "sha256-g1v0TsWBQPX97ziznfJdWhgMyMGtoBFs102xSYO4syU=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "d8fe5e6c92d0d190646fb9f1056741a229980089",
"rev": "0e74ca98a74bc7270d28838369593635a5db3260",
"type": "github"
},
"original": {
@ -100,26 +290,90 @@
"type": "github"
}
},
"nixpkgs_3": {
"nixpkgs_2": {
"locked": {
"lastModified": 1712026416,
"narHash": "sha256-N/3VR/9e1NlN49p7kCiATiEY6Tzdo+CbrAG8kqCQKcI=",
"owner": "NixOS",
"lastModified": 1716330097,
"narHash": "sha256-8BO3B7e3BiyIDsaKA0tY8O88rClYRTjvAp66y+VBUeU=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "080a4a27f206d07724b88da096e27ef63401a504",
"rev": "5710852ba686cc1fd0d3b8e22b3117d43ba374c2",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 1714912032,
"narHash": "sha256-clkcOIkg8G4xuJh+1onLG4HPMpbtzdLv4rHxFzgsH9c=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "ee4a6e0f566fe5ec79968c57a9c2c3c25f2cf41d",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nur": {
"locked": {
"lastModified": 1716563102,
"narHash": "sha256-oZiGIPcU6ht64RqZHp+tFlH/929nIwC1apTHcP2shug=",
"owner": "nix-community",
"repo": "NUR",
"rev": "577a1383f6cde64b8bffffbdef0e4a7e56cded7d",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "NUR",
"type": "github"
}
},
"root": {
"inputs": {
"aagl": "aagl",
"ags": "ags",
"home-manager": "home-manager",
"impermanence": "impermanence",
"nixpkgs": "nixpkgs_2",
"nur": "nur",
"stylix": "stylix"
}
},
"stylix": {
"inputs": {
"base16": "base16",
"base16-fish": "base16-fish",
"base16-foot": "base16-foot",
"base16-helix": "base16-helix",
"base16-kitty": "base16-kitty",
"base16-tmux": "base16-tmux",
"base16-vim": "base16-vim",
"flake-compat": "flake-compat_2",
"gnome-shell": "gnome-shell",
"home-manager": "home-manager_2",
"nixpkgs": "nixpkgs_3"
},
"locked": {
"lastModified": 1716456264,
"narHash": "sha256-s9Tyj5pEivl/AsvrpkUkfR1Iu3zHfXpviPfe4HbPJ5I=",
"owner": "danth",
"repo": "stylix",
"rev": "290c8aef476ce98fff9cefc059284429d561a085",
"type": "github"
},
"original": {
"owner": "danth",
"repo": "stylix",
"type": "github"
}
}
},

View file

@ -1,29 +1,43 @@
{
description = "Modular NixOS configuration.";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nur.url = "github:nix-community/NUR";
impermanence.url = "github:nix-community/impermanence";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
aagl = {
url = "github:ezKEa/aagl-gtk-on-nix";
};
inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, nixpkgs, impermanence, home-manager, aagl, ... }:
stylix.url = "github:danth/stylix";
ags.url = "github:Aylur/ags";
};
outputs = { nixpkgs, impermanence, home-manager, aagl, nur, stylix, ags, ... }:
{
nixosConfigurations.workstation = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
home-manager.nixosModules.home-manager {
home-manager.sharedModules = [
nur.hmModules.nur
ags.homeManagerModules.default
];
}
impermanence.nixosModules.impermanence
home-manager.nixosModules.home-manager
nur.nixosModules.nur
stylix.nixosModules.stylix
aagl.nixosModules.default
./machines/workstation.nix
./users/hu/user.nix
./machines/workstation/configuration.nix
];
};
};
}

View file

@ -1,91 +0,0 @@
# 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 = [ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
boot.initrd.postDeviceCommands = lib.mkAfter ''
mkdir /btrfs_tmp
mount /dev/nvme0n1p2 /btrfs_tmp
if [[ -e /btrfs_tmp/root ]]; then
mkdir -p /btrfs_tmp/old_roots
timestamp=$(date --date="@$(stat -c %Y /btrfs_tmp/root)" "+%Y-%m-%-d_%H:%M:%S")
mv /btrfs_tmp/root "/btrfs_tmp/old_roots/$timestamp"
fi
delete_subvolume_recursively() {
IFS=$'\n'
for i in $(btrfs subvolume list -o "$1" | cut -f 9- -d ' '); do
delete_subvolume_recursively "/btrfs_tmp/$i"
done
btrfs subvolume delete "$1"
}
for i in $(find /btrfs_tmp/old_roots/ -maxdepth 1 -mtime +30); do
delete_subvolume_recursively "$i"
done
btrfs subvolume create /btrfs_tmp/root
umount /btrfs_tmp
'';
fileSystems."/" =
{ device = "/dev/disk/by-uuid/8e515c16-703a-43ea-8653-ec0f739ba532";
fsType = "btrfs";
options = [ "subvol=root" "compress=zstd" "noatime" ];
};
fileSystems."/home" =
{ device = "/dev/disk/by-uuid/8e515c16-703a-43ea-8653-ec0f739ba532";
fsType = "btrfs";
options = [ "subvol=home" "compress=zstd" "noatime" ];
};
fileSystems."/nix" =
{ device = "/dev/disk/by-uuid/8e515c16-703a-43ea-8653-ec0f739ba532";
fsType = "btrfs";
options = [ "subvol=nix" "compress=zstd" "noatime" ];
};
fileSystems."/var/log" =
{ device = "/dev/disk/by-uuid/8e515c16-703a-43ea-8653-ec0f739ba532";
fsType = "btrfs";
options = [ "subvol=log" "compress=zstd" "noatime" ];
neededForBoot = true;
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/A925-0013";
fsType = "vfat";
};
fileSystems."/media/vault" =
{ device = "/dev/disk/by-uuid/048d175b-0e3e-4ec7-955b-3d9a45f9f237";
fsType = "xfs";
};
fileSystems."/media/attic" =
{ device = "/dev/disk/by-uuid/ec32ce36-9f53-4f44-ac8f-2c9163f0b3d7";
fsType = "xfs";
};
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.enp34s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View file

@ -1,15 +1,21 @@
{ config, lib, pkgs, ... }:
{ config, pkgs, ... }:
{
imports = [
./hardware/workstation.nix
./persist/workstation.nix
../wm/plasma.nix
../packages/sets/basic.nix
./hardware-configuration.nix
./persist.nix
../../packages/sets/basic.nix
../../packages/wm/hyprland.nix
../../users/hu/user.nix
];
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
boot.loader.grub = {
enable = true;
efiSupport = true;
device = "nodev";
gfxmodeEfi = "1920x1080";
};
boot.kernelPackages = pkgs.linuxPackages_latest;
boot.supportedFilesystems = [ "btrfs" "xfs" ];
@ -29,7 +35,8 @@
i18n.defaultLocale = "en_US.UTF-8";
console = {
font = "Lat2-Terminus16";
useXkbConfig = true;
keyMap = "uk";
# useXkbConfig = true;
};
nixpkgs.config.allowUnfree = true;
@ -43,8 +50,8 @@
nvidia = {
modesetting.enable = true;
nvidiaSettings = true;
open = false;
package = config.boot.kernelPackages.nvidiaPackages.production;
powerManagement.enable = true;
package = config.boot.kernelPackages.nvidiaPackages.beta;
};
};
@ -65,11 +72,19 @@
jack.enable = true;
};
# Todo: Move these packages out in the correct files.
# Todo: Reorganize these
environment.systemPackages = with pkgs; [
neovim
mpv
imagemagick
];
nix = {
extraOptions = ''
experimental-features = nix-command flakes
'';
};
system.stateVersion = "23.11";
}

View file

@ -0,0 +1,77 @@
{ config, lib, modulesPath, ... }:
{
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
];
fileSystems."/" = {
device = "/dev/disk/by-uuid/fe866aa8-706b-4a92-a3c3-c97c7c332c59";
fsType = "btrfs";
options = [ "subvol=root" "compress=zstd" "noatime" ];
};
fileSystems."/nix" = {
device = "/dev/disk/by-uuid/fe866aa8-706b-4a92-a3c3-c97c7c332c59";
fsType = "btrfs";
options = [ "subvol=nix" "compress=zstd" "noatime" ];
neededForBoot = true;
};
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/959D-5D4F";
fsType = "vfat";
};
fileSystems."/home/hu/mounts/vault" = {
device = "/dev/disk/by-uuid/048d175b-0e3e-4ec7-955b-3d9a45f9f237";
fsType = "xfs";
};
fileSystems."/home/hu/mounts/attic" = {
device = "/dev/disk/by-uuid/ec32ce36-9f53-4f44-ac8f-2c9163f0b3d7";
fsType = "xfs";
};
boot.initrd.availableKernelModules = [
"nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod"
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
boot.kernelParams = [
"nvidia.NVreg_PreserveVideoMemoryAllocations=1"
"nvidia_drm.fbdev=1"
];
boot.initrd.postDeviceCommands = lib.mkAfter ''
mkdir /btrfs_tmp
mount ${config.fileSystems."/".device} /btrfs_tmp
if [[ -e /btrfs_tmp/root ]]; then
mkdir -p /btrfs_tmp/old_roots
timestamp=$(date --date="@$(stat -c %Y /btrfs_tmp/root)" "+%Y-%m-%-d_%H:%M:%S")
mv /btrfs_tmp/root "/btrfs_tmp/old_roots/$timestamp"
fi
delete_subvolume_recursively() {
IFS=$'\n'
for i in $(btrfs subvolume list -o "$1" | cut -f 9- -d ' '); do
delete_subvolume_recursively "/btrfs_tmp/$i"
done
btrfs subvolume delete "$1"
}
for i in $(find /btrfs_tmp/old_roots/ -maxdepth 1 -mtime +30); do
delete_subvolume_recursively "$i"
done
btrfs subvolume create /btrfs_tmp/root
umount /btrfs_tmp
'';
networking.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View file

@ -2,8 +2,9 @@
{
environment.persistence."/nix/persist" = {
hideMounts = true;
hideMounts = false;
directories = [
"/var/log"
"/var/lib/nixos"
"/var/lib/systemd/coredump"
{

View file

@ -1,11 +1,11 @@
{ config, libs, pkgs, ... }:
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [
thunderbird
tutanota-desktop
signal-desktop
element-desktop
vesktop
];
}

8
packages/sets/fonts.nix Normal file
View file

@ -0,0 +1,8 @@
{ pkgs, ... }:
{
fonts.packages = with pkgs; [
nerdfonts
];
}

View file

@ -1,11 +1,12 @@
{ config, lib, pkgs, ... }:
{ ... }:
{
programs.steam = {
enable = true;
remotePlay.openFirewall = false;
dedicatedServer.openFirewall = false;
dedicatedServer.openFirewall = true;
};
programs.honkers-railway-launcher.enable = true;
}

View file

@ -1,13 +0,0 @@
{ config, lib, pkgs, ... }:
{
environment.systemPackages = with pkgs; [
firefox
xdotool
xorg.xkill
xorg.xinput
xclip
yt-dlp
ffmpeg
];
}

36
packages/wm/hyprland.nix Normal file
View file

@ -0,0 +1,36 @@
{ pkgs, ...}:
{
imports = [
../sets/fonts.nix
];
environment.systemPackages = with pkgs; [
hyprpaper
dunst
rofi-wayland
foot
wl-clipboard
pcmanfm # TODO: Replace with dolphin and figure out why stylix doesn't theme it.
];
# TODO: Use KDE portal features for file pickers and popups
# TODO: Add missing utilities for taking screenshots, recording, etc...
environment.variables = {
LIBVA_DRIVER_NAME = "nvidia";
XDG_SESSION_TYPE = "wayland";
GBM_BACKEND = "nvidia-drm";
__GLX_VENDOR_LIBRARY_NAME = "nvidia";
NIXOS_OZONE_WL = 1; # TODO: This doesn't work. Fix it
};
programs.hyprland.enable = true;
services.gnome.gnome-keyring.enable = true;
security.pam.services.sddm.enableGnomeKeyring = true;
# TODO: switch out the display manager for a tui based one
services.displayManager.sddm.enable = true;
services.displayManager.sddm.wayland.enable = true;
}

26
packages/wm/sway.nix Normal file
View file

@ -0,0 +1,26 @@
{ config, pkgs, ...}:
{
environment.systemPackages = with pkgs; [
rofi-wayland
foot
];
environment.variables = {
LIBVA_DRIVER_NAME = "nvidia";
XDG_SESSION_TYPE = "wayland";
GBM_BACKEND = "nvidia-drm";
__GLX_VENDOR_LIBRARY_NAME = "nvidia";
NIXOS_OZONE_WL = 1;
};
# programs.hyprland.enable = true;
programs.sway = {
enable = true;
wrapperFeatures.gtk = true;
};
services.displayManager.sddm.enable = true;
services.displayManager.sddm.wayland.enable = true;
}

View file

@ -1,4 +1,4 @@
{ config, lib, pkgs, ... }:
{ pkgs, ... }:
{
imports = [
@ -13,6 +13,10 @@
kitty
pavucontrol
picom
xdotool
xorg.xkill
xorg.xinput
xclip
];
services.xserver = {
@ -46,3 +50,4 @@
];
};
}

View file

@ -0,0 +1,16 @@
{ pkgs, ... }:
{
# TODO: config
programs.ags = {
enable = true;
configDir = ./config;
extraPackages = with pkgs; [
gtksourceview
webkitgtk
accountsservice
];
};
}

View file

@ -0,0 +1,7 @@
{ ... }:
{
# Todo: Make pretty
services.dunst.enable = true;
}

View file

@ -0,0 +1,389 @@
{ config, pkgs, ... }:
{
stylix.targets.firefox.enable = false;
programs.firefox = {
enable = true;
package = pkgs.firefox-esr;
policies = {
EnableTrackingProtection = {
Value = true;
Cryptomining = true;
Fingerprinting = true;
EmailTracking = true;
};
DisableTelemetry = true;
DisablePocket = true;
DisableFirefoxStudies = true;
DisableFirefoxAccounts = true;
DisableAccounts = true;
DontCheckDefaultBrowser = true;
OverrideFirstRunPage = "";
OverridePostUpdatePage = "";
NoDefaultBookmarks = true;
Cookies = {
Behaviour = "reject-foreign";
BehaviourPrivateBrowsing = "reject-foreign";
};
SearchEngines = { # ESR only
Remove = [ "Bing" "Google" "DuckDuckGo" "Wikipedia (en)" ];
};
ExtensionSettings = {
"wikipedia@search.mozilla.org" = {
installation_mode = "blocked";
};
"google@search.mozilla.org" = {
installation_mode = "blocked";
};
"bing@search.mozilla.org" = {
installation_mode = "blocked";
};
"ddg@search.mozilla.org" = {
installation_mode = "blocked";
};
};
"3rdparty".Extensions = {
"uBlock0@raymondhill.net".adminSettings = {
userSettings = {
importedLists = [
"https://raw.githubusercontent.com/DandelionSprout/adfilt/master/LegitimateURLShortener.txt"
];
externalLists = "https://raw.githubusercontent.com/DandelionSprout/adfilt/master/LegitimateURLShortener.txt";
};
selectedFilterLists = [
"https://raw.githubusercontent.com/DandelionSprout/adfilt/master/LegitimateURLShortener.txt"
"user-filters"
"ublock-filters"
"ublock-badware"
"ublock-privacy"
"ublock-quick-fixes"
"ublock-unbreak"
"easylist"
"adguard-generic"
"adguard-mobile"
"easyprivacy"
"adguard-spyware"
"adguard-spyware-url"
"block-lan"
"urlhaus-1"
"curben-phishing"
"plowe-0"
"dpollock-0"
"fanboy-cookiemonster"
"ublock-cookies-easylist"
"adguard-cookies"
"ublock-cookies-adguard"
"fanboy-social"
"adguard-social"
"fanboy-thirdparty_social"
"easylist-chat"
"easylist-newsletters"
"easylist-notifications"
"easylist-annoyances"
"adguard-mobile-app-banners"
"adguard-other-annoyances"
"adguard-popup-overlays"
"adguard-widgets"
"ublock-annoyances"
"ALB-0"
"BGR-0"
"CHN-0"
"CZE-0"
"DEU-0"
"EST-0"
"ara-0"
"spa-1"
"spa-0"
"FIN-0"
"FRA-0"
"GRC-0"
"HRV-0"
"HUN-0"
"IDN-0"
"ISR-0"
"IND-0"
"IRN-0"
"ISL-0"
"ITA-0"
"JPN-1"
"KOR-1"
"LTU-0"
"LVA-0"
"MKD-0"
"NLD-0"
"NOR-0"
"POL-0"
"POL-2"
"ROU-1"
"RUS-0"
"SWE-1"
"SVN-0"
"THA-0"
"TUR-0"
"VIE-1"
];
};
};
};
profiles.shaga = {
isDefault = true;
search = {
default = "Gruble";
order = [ "Gruble" "Nix Packages" "Home-manager options" ];
engines = {
"Gruble" = {
urls = [
{
template = "https://gruble.de/search";
params = [
{ name = "q"; value = "{searchTerms}"; }
];
}
];
iconUpdateURL = "https://gruble.de/favicon.ico";
updateInterval = 7 * 24 * 60 * 60 * 1000; # Weekly
definedAliases = [ "@g" ];
};
"Nix Packages" = {
urls = [{
template = "https://search.nixos.org/packages";
params = [
{ name = "type"; value = "packages"; }
{ name = "query"; value = "{searchTerms}"; }
];
}];
iconUpdateURL = "https://nixos.org/favicon.png";
updateInterval = 7 * 24 * 60 * 60 * 1000; # Weekly
definedAliases = [ "@np" ];
};
"Home-manager options" = {
urls = [{
template = "https://home-manager-options.extranix.com";
params = [
{ name = "release"; value = "master"; }
{ name = "query"; value = "{searchTerms}"; }
];
}];
iconUpdateURL = "https://home-manager-options.extranix.com/images/favicon.png";
updateInterval = 7 * 24 * 60 * 60 * 1000; # Weekly
definedAliases = [ "@ho" ];
};
};
force = true;
};
extensions = with config.nur.repos.rycee.firefox-addons; [
ublock-origin
image-search-options
bitwarden
skip-redirect
];
settings = {
"browser.urlbar.quicksuggest.contextualOptIn.topPosition" = false;
"extensions.postDownloadThirdPartyPrompt" = false;
"extensions.getAddons.cache.enabled" = false;
"browser.search.update" = false;
"extensions.autoDisableScopes" = 0;
"browser.startup.page" = 0;
"browser.startup.homepage" = "about:blank";
"browser.newtabpage.enabled" = false;
"browser.newtabpage.activity-stream.showSponsored" = false;
"browser.newtabpage.activity-stream.showSponsoredTopSites" = false;
"browser.newtabpage.activity-stream.default.sites" = "";
"geo.provider.use_gpsd" = false;
"extensions.getAddons.showPane" = false;
"htmlaboutaddons.recommendations.enabled" = false;
"discovery.enabled" = false;
"browser.shopping.experience2023.enabled" = false;
"app.shield.optoutstudies.enabled" = false;
"app.normandy.enabled" = false;
"app.normandy.api_url" = "";
"breakpad.reportURL" = "";
"browser.newtabpage.activity-stream.feeds.telemetry" = false;
"browser.newtabpage.activity-stream.telemetry" = false;
"browser.search.serpEventTelemetry.enabled" = false;
"dom.security.unexpected_system_load_telemetry_enabled" = false;
"network.trr.confirmation_telemetry_enabled" = false;
"security.app_menu.recordEventTelemetry" = false;
"security.certerrors.recordEventTelemetry" = false;
"security.protectionspopup.recordEventTelemetry" = false;
"toolkit.telemetry.bhrPing.enabled" = false;
"toolkit.telemetry.firstShutdownPing.enabled" = false;
"toolkit.telemetry.newProfilePing.enabled" = false;
"toolkit.telemetry.pioneer-new-studies-available" = false;
"toolkit.telemetry.shutdownPingSender.enabled" = false;
"toolkit.telemetry.unified" = false;
"toolkit.telemetry.updatePing.enabled" = false;
"toolkit.telemetry.server" = "127.0.0.1";
"browser.newtabpage.activity-stream.telemetry.structuredIngestion.endpoint" = "127.0.0.1";
"browser.tabs.crashReporting.sendReport" = false;
"browser.crashReports.unsubmittedCheck.autoSubmit2" = false;
"captivedetect.canonicalURL" = "";
"network.captive-portal-service.enabled" = false;
"network.connectivity-service.enabled" = false;
"browser.safebrowsing.downloads.remote.enabled" = false;
"browser.urlbar.speculativeConnect.enabled" = false;
"browser.search.suggest.enabled" = false;
"browser.urlbar.suggest.quicksuggest.nonsponsored" = false;
"browser.urlbar.suggest.quicksuggest.sponsored" = false;
"browser.urlbar.suggest.searches" = false;
"browser.urlbar.suggest.bookmark" = false;
"browser.urlbar.suggest.addons" = false;
"browser.urlbar.suggest.calculator" = false;
"browser.urlbar.suggest.clipboard" = false;
"browser.urlbar.suggest.engines" = false;
"browser.urlbar.suggest.history" = false;
"browser.urlbar.suggest.mdn" = false;
"browser.urlbar.suggest.openpage" = false;
"browser.urlbar.suggest.pocket" = false;
"browser.urlbar.suggest.recentsearches" = false;
"browser.urlbar.suggest.remotetab" = false;
"browser.urlbar.suggest.topsites" = false;
"browser.urlbar.suggest.trending" = false;
"browser.urlbar.suggest.weather" = false;
"browser.urlbar.suggest.yelp" = false;
"browser.urlbar.richSuggestions.tail" = false;
"browser.urlbar.quicksuggest.shouldShowOnboardingDialog" = false;
"browser.urlbar.quicksuggest.rustEnabled" = false;
"browser.urlbar.richSuggestions.featureGate" = false;
"browser.urlbar.trending.featureGate" = false;
"browser.urlbar.addons.featureGate" = false;
"browser.urlbar.mdn.featureGate" = false;
"browser.urlbar.pocket.featureGate" = false;
"browser.urlbar.weather.featureGate" = false;
"browser.formfill.enable" = false;
"dom.forms.autocomplete.formautofill" = false;
"extensions.formautofill.addresses.capture.enabled" = false;
"extensions.formautofill.creditCards.enabled" = false;
"signon.autofillForms" = false;
"signon.rememberSignons" = false;
"signon.formlessCapture.enabled" = false;
"network.auth.subresource-http-auth-allow" = 1;
"dom.security.https_only_mode" = true;
"network.http.referer.XOriginTrimmingPolicy" = 2;
"privacy.userContext.enabled" = true;
"privacy.userContext.ui.enabled" = true;
"privacy.sanitize.sanitizeOnShutdown" = true;
"privacy.clearHistory.siteSettings" = true;
"media.peerconnection.ice.no_host" = true;
"browser.download.start_downloads_in_tmp_dir" = true;
"browser.helperApps.deleteTempFileOnExit" = true;
"browser.uitour.enabled" = false;
"pdfjs.enableScripting" = false;
"browser.download.useDownloadDir" = false;
"browser.download.alwaysOpenPanel" = true;
"browser.download.manager.addToRecentDocs" = false;
"browser.download.always_ask_before_handling_new_types" = true;
"browser.contentblocking.category" = "strict";
"privacy.clearOnShutdown.cache" = true;
"privacy.clearOnShutdown.downloads" = true;
"privacy.clearOnShutdown.formdata" = true;
"privacy.clearOnShutdown.history" = true;
"privacy.clearOnShutdown.sessions" = true;
"privacy.clearOnShutdown.cookies" = true;
"privacy.clearOnShutdown.offlineApps" = true;
"privacy.clearSiteData.historyFormDataAndDownloads" = true;
"browser.startup.homepage_override.mstone" = "ignore";
"browser.newtabpage.activity-stream.asrouter.userprefs.cfr.addons" = false;
"browser.newtabpage.activity-stream.asrouter.userprefs.cfr.features" = false;
"extensions.activeThemeID" = "firefox-compact-dark@mozilla.org";
"browser.messaging-system.whatsNewPanel.enabled" = false;
"browser.urlbar.showSearchTerms.enabled" = false;
"browser.newtabpage.activity-stream.improvesearch.topSiteSearchShortcuts.havePinned" = "";
"browser.newtabpage.activity-stream.improvesearch.topSiteSearchShortcuts.searchEngines" = "";
# Options for the firefox-ui-fix using Photon
# https://github.com/black7375/Firefox-UI-Fix/blob/master/user.js
"userChrome.tab.connect_to_window" = true;
"userChrome.tab.color_like_toolbar" = true;
"userChrome.tab.lepton_like_padding" = false;
"userChrome.tab.photon_like_padding" = true;
"userChrome.tab.dynamic_separator" = false;
"userChrome.tab.static_separator" = true;
"userChrome.tab.static_separator.selected_accent" = false;
"userChrome.tab.newtab_button_like_tab" = false;
"userChrome.tab.newtab_button_smaller" = true;
"userChrome.tab.newtab_button_proton" = false;
"userChrome.icon.panel_full" = false;
"userChrome.icon.panel_photon" = true;
"userChrome.icon.panel_sparse" = false;
"userChrome.tab.box_shadow" = false;
"userChrome.tab.bottom_rounded_corner" = false;
"userChrome.tab.photon_like_contextline" = true;
"userChrome.rounding.square_tab" = true;
"toolkit.legacyUserProfileCustomizations.stylesheets" = true;
"svg.context-properties.content.enabled" = true;
"browser.compactmode.show" = true;
"browser.newtabpage.activity-stream.improvesearch.handoffToAwesomebar" = false;
"layout.css.has-selector.enabled" = true;
"userChrome.compatibility.theme" = true;
"userChrome.compatibility.os" = true;
"userChrome.theme.built_in_contrast" = true;
"userChrome.theme.system_default" = true;
"userChrome.theme.proton_color" = true;
"userChrome.theme.proton_chrome" = true;
"userChrome.theme.fully_color" = true;
"userChrome.theme.fully_dark" = true;
"userChrome.decoration.cursor" = true;
"userChrome.decoration.field_border" = true;
"userChrome.decoration.download_panel" = true;
"userChrome.decoration.animate" = true;
"userChrome.padding.tabbar_width" = true;
"userChrome.padding.tabbar_height" = true;
"userChrome.padding.toolbar_button" = true;
"userChrome.padding.navbar_width" = true;
"userChrome.padding.urlbar" = true;
"userChrome.padding.bookmarkbar" = true;
"userChrome.padding.infobar" = true;
"userChrome.padding.menu" = true;
"userChrome.padding.bookmark_menu" = true;
"userChrome.padding.global_menubar" = true;
"userChrome.padding.panel" = true;
"userChrome.padding.popup_panel" = true;
"userChrome.tab.multi_selected" = true;
"userChrome.tab.unloaded" = true;
"userChrome.tab.letters_cleary" = true;
"userChrome.tab.close_button_at_hover" = true;
"userChrome.tab.sound_hide_label" = true;
"userChrome.tab.sound_with_favicons" = true;
"userChrome.tab.pip" = true;
"userChrome.tab.container" = true;
"userChrome.tab.crashed" = true;
"userChrome.fullscreen.overlap" = true;
"userChrome.fullscreen.show_bookmarkbar" = true;
"userChrome.icon.library" = true;
"userChrome.icon.panel" = true;
"userChrome.icon.menu" = true;
"userChrome.icon.context_menu" = true;
"userChrome.icon.global_menu" = true;
"userChrome.icon.global_menubar" = true;
"userChrome.icon.1-25px_stroke" = true;
"userContent.player.ui" = true;
"userContent.player.icon" = true;
"userContent.player.noaudio" = true;
"userContent.player.size" = true;
"userContent.player.click_to_play" = true;
"userContent.player.animate" = true;
"userContent.newTab.full_icon" = true;
"userContent.newTab.animate" = true;
"userContent.newTab.pocket_to_last" = true;
"userContent.newTab.searchbar" = true;
"userContent.page.field_border" = true;
"userContent.page.illustration" = true;
"userContent.page.proton_color" = true;
"userContent.page.dark_mode" = true;
"userContent.page.proton" = true;
};
};
};
}

View file

@ -0,0 +1,21 @@
{ config, lib, pkgs, ... }:
{
programs.foot = {
enable = true;
settings = {
main = {
pad = "8x8 center";
};
mouse = {
hide-when-typing = "yes";
};
scrollback = {
lines = 10000;
};
};
};
}

View file

@ -1,13 +1,14 @@
{ config, lib, pkgs, ... }:
{ ... }:
{
programs.git = {
enable = true;
userName = "caem";
userEmail = "caem@dirae.org";
userEmail = "me@caem.dev";
signing = {
key = "D125101DC74D392FEFDFD54AF4F7229F8B860E9F";
key = "E50FC66B5062070DC462661C69A830D03203405F";
signByDefault = true;
};
};
}

View file

@ -0,0 +1,98 @@
{ config, lib, pkgs, ... }:
{
wayland.windowManager.hyprland.enable = true;
wayland.windowManager.hyprland.systemd.enable = true;
wayland.windowManager.hyprland.systemd.variables = ["--all"];
wayland.windowManager.hyprland.settings = {
"$mod" = "SUPER";
"$terminal" = "foot";
"$menu" = "rofi -show drun";
monitor = "DP-3,1920x1080@144,auto,1";
input = {
kb_layout = "gb:altgr-intl";
follow_mouse = 1;
};
general = {
gaps_in = 5;
gaps_out = 10;
border_size = 1;
layout = "master";
};
master = {
new_is_master = false;
mfact = 0.5;
};
decoration = {
rounding = 5;
blur = {
enabled = true;
size = 3;
passes = 1;
};
};
bindm = [
"$mod, mouse:272, movewindow"
"$mod, mouse:273, resizewindow"
];
bind = [
"$mod, P, exec, $menu"
"$mod, RETURN, exec, $terminal"
"$mod SHIFT, C, killactive"
"$mod, SPACE, togglefloating"
"$mod SHIFT, M, exit,"
"$mod SHIFT, RETURN, layoutmsg, swapwithmaster"
"$mod SHIFT, h, layoutmsg, mfact -0.05"
"$mod SHIFT, l, layoutmsg, mfact +0.05"
"$mod, h, movefocus, l"
"$mod, j, movefocus, d"
"$mod, k, movefocus, u"
"$mod, l, movefocus, r"
"$mod, 1, workspace, 1"
"$mod, 2, workspace, 2"
"$mod, 3, workspace, 3"
"$mod, 4, workspace, 4"
"$mod, 5, workspace, 5"
"$mod, 6, workspace, 6"
"$mod, 7, workspace, 7"
"$mod, 8, workspace, 8"
"$mod, 9, workspace, 9"
"$mod SHIFT, 1, movetoworkspace, 1"
"$mod SHIFT, 2, movetoworkspace, 2"
"$mod SHIFT, 3, movetoworkspace, 3"
"$mod SHIFT, 4, movetoworkspace, 4"
"$mod SHIFT, 5, movetoworkspace, 5"
"$mod SHIFT, 6, movetoworkspace, 6"
"$mod SHIFT, 7, movetoworkspace, 7"
"$mod SHIFT, 8, movetoworkspace, 8"
"$mod SHIFT, 9, movetoworkspace, 9"
];
};
services.hyprpaper = {
enable = true;
settings = {
ipc = "off";
splash = false;
preload = [
"/nix/config/assets/wallpaper.png"
];
wallpaper = [
",/nix/config/assets/wallpaper.png"
];
};
};
}

9
users/hu/packages/nh.nix Normal file
View file

@ -0,0 +1,9 @@
{ ... }:
{
programs.nh = {
enable = true;
flake = "/nix/config";
};
}

View file

@ -0,0 +1,3 @@
require"settings"
require"plugins"

View file

@ -0,0 +1,7 @@
return {
"m4xshen/autoclose.nvim",
config = function()
require"autoclose".setup()
end
}

View file

@ -0,0 +1,55 @@
return {
"hrsh7th/nvim-cmp",
dependencies = {
"L3MON4D3/LuaSnip",
"saadparwaiz1/cmp_luasnip",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"hrsh7th/cmp-nvim-lsp",
{
"tamago324/cmp-zsh",
config = function()
require"cmp_zsh".setup {
zshrc = true,
filetypes = { "bash", "zsh", "sh" },
}
end,
},
"ray-x/cmp-treesitter",
"hrsh7th/cmp-nvim-lua",
"andersevenrud/cmp-tmux",
},
config = function()
local cmp = require"cmp"
cmp.setup {
snippet = {
expand = function(args)
require"luasnip".lsp_expand(args.body)
end,
},
view = {
entries = "native",
},
mapping = cmp.mapping.preset.insert {
['<C-k>'] = cmp.mapping.select_prev_item(),
['<C-j>'] = cmp.mapping.select_next_item(),
['<A-j>'] = cmp.mapping.scroll_docs(4),
['<A-k>'] = cmp.mapping.scroll_docs(-4),
['<S-CR>'] = cmp.mapping.complete(),
['<C-Space>'] = cmp.mapping.confirm({ select = true }),
['<C-e>'] = cmp.mapping.abort(),
},
sources = {
{ name = "path" },
{ name = "luasnip" },
{ name = "zsh" },
{ name = "nvim_lsp" },
{ name = "buffer" },
{ name = "treesitter" },
{ name = "nvim-lua" },
{ name = "tmux" },
},
}
end
}

View file

@ -0,0 +1,5 @@
return {
"numToStr/Comment.nvim",
opts = {},
lazy = false
}

View file

@ -0,0 +1,4 @@
return {
"stevearc/dressing.nvim",
opts = {}
}

View file

@ -0,0 +1,12 @@
return {
"ellisonleao/gruvbox.nvim",
priority = 1000,
config = function()
require"gruvbox".setup {
transparent_mode = true,
contrast = "soft",
}
vim.cmd("colorscheme gruvbox")
end,
}

View file

@ -0,0 +1,11 @@
return {
"lukas-reineke/indent-blankline.nvim",
main = "ibl",
opts = {},
opts = {
indent = {
char = ""
}
}
}

View file

@ -0,0 +1,22 @@
if vim.fn.executable("git") ~= 1 then
vim.notify("git is not installed. Skipping plugins.", vim.log.levels.WARN)
return
end
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
plugins = require"util.require_dir"(vim.fn.stdpath("config").."/lua/plugins/", true)
require"lazy".setup(plugins)

View file

@ -0,0 +1,12 @@
return {}
-- Currently using gruvbox
--[[return {
"rebelot/kanagawa.nvim",
config = function()
require"kanagawa".setup {
transparent = true
}
vim.cmd("colorscheme kanagawa-dragon")
end
}
]]--

View file

@ -0,0 +1,5 @@
return function ()
require"lspconfig".clangd.setup {
capabilities = require"cmp_nvim_lsp".default_capabilities()
}
end

View file

@ -0,0 +1,24 @@
return function()
require'lspconfig'.lua_ls.setup {
capabilities = require"cmp_nvim_lsp".default_capabilities(),
on_init = function(client)
local path = client.workspace_folders[1].name
if vim.loop.fs_stat(path..'/.luarc.json') or vim.loop.fs_stat(path..'/.luarc.jsonc') then
return
end
client.config.settings.Lua = vim.tbl_deep_extend('force', client.config.settings.Lua, {
runtime = {
version = 'LuaJIT'
},
workspace = {
checkThirdParty = false,
library = vim.api.nvim_get_runtime_file("", true)
}
})
end,
settings = {
Lua = {}
}
}
end

View file

@ -0,0 +1,6 @@
return function ()
require"lspconfig".nil_ls.setup {
capabilities = require"cmp_nvim_lsp".default_capabilities()
}
end

View file

@ -0,0 +1,5 @@
return function ()
require"lspconfig".intelephense. setup {
capabilities = require"cmp_nvim_lsp".default_capabilities(),
}
end

View file

@ -0,0 +1,29 @@
return {
"neovim/nvim-lspconfig",
config = function()
local require_dir = require"util.require_dir"
local lspees = require_dir(vim.fn.stdpath("config").."/lua/plugins/lsp/", "plugins.lsp")
for _, lspee in ipairs(lspees) do
lspee()
end
local map = require"util.map"
local vlb = vim.lsp.buf
local format = function()
vlb.format { async = true }
end
vim.api.nvim_create_autocmd("LspAttach", {
group = vim.api.nvim_create_augroup("UserLspConfig", {}),
callback = function()
map("n", "<leader>lgD", vlb.declaration, "[l]sp [g]o to [D]eclaration")
map("n", "<leader>lgd", vlb.definition, "[l]sp [g]o to [d]definition")
map("n", "<leader>lgi", vlb.implementation, "[l]sp [g]o to [i]mplementation")
map("n", "<leader>lgr", vlb.references, "[l]sp [g]o to [r]eferences")
map("n", "<leader>lh", vlb.hover, "[l]sp [h]over over selection")
map("n", "<leader>lfm", format, "[l]sp [f]or[m]at file")
map("n", "<leader>lca", vlb.code_action, "[l]sp [C]ode [a]ction")
end,
})
end
}

View file

@ -0,0 +1,139 @@
return {
"nvim-lualine/lualine.nvim",
dependencies = {
"nvim-tree/nvim-web-devicons",
},
config = function()
-- Inspired by https://github.com/nvim-lualine/lualine.nvim/blob/master/examples/evil_lualine.lua
local rgb_to_hex = require"util.rgb_to_hex"
local hl = require"util.hl"
local config = {
options = {
component_separators = "",
section_separators = "",
theme = {
normal = {
c = {
fg = rgb_to_hex(hl("Normal").fg),
bg = rgb_to_hex(hl("Normal").bg),
},
},
inactive = {
c = {
fg = rgb_to_hex(hl("Normal").fg),
bg = rgb_to_hex(hl("Normal").bg),
},
},
},
},
sections = {
lualine_a = {}, lualine_b = {}, lualine_y = {}, lualine_z = {}, -- Remove defaults
lualine_c = {}, lualine_x = {}, -- Extend these later
},
inactive_sections = {
lualine_a = {}, lualine_b = {}, lualine_c = {}, lualine_x = {}, lualine_y = {}, lualine_z = {},
},
}
local function buffer_not_empty()
return vim.fn.empty(vim.fn.expand("%:t")) ~= 1
end
local function ins_l(component)
table.insert(config.sections.lualine_c, component)
end
local function ins_r(component)
table.insert(config.sections.lualine_x, component)
end
local distro = require"util.get_distro"()
ins_l {
function()
return ""
end,
padding = {
left = 0,
right = 0,
},
color = {
fg = rgb_to_hex(hl("Comment").fg),
},
}
ins_l {
function()
return distro.traits.icon
end,
color = {
fg = distro.traits.color,
},
}
ins_l {
"filename",
cond = buffer_not_empty,
color = {
fg = rgb_to_hex(hl("Operator").fg),
}
}
ins_l {
"filesize",
cond = buffer_not_empty,
}
ins_l {
"o:encoding",
cond = buffer_not_empty,
}
ins_l {
"fileformat",
icons_enabled = false,
cond = buffer_not_empty,
}
ins_r { "diagnostics" }
ins_r { "diff" }
ins_r {
"branch",
padding = {
right = 0,
},
color = {
fg = rgb_to_hex(hl("Constant").fg)
}
}
ins_r {
"location",
}
ins_r {
"mode",
fmt = string.lower,
color = {
fg = rgb_to_hex(hl("String").fg),
}
}
ins_r {
function()
return ""
end,
padding = {
left = 0,
right = 0,
},
color = {
fg = rgb_to_hex(hl("Comment").fg),
}
}
require"lualine".setup(config)
end
}

View file

@ -0,0 +1,6 @@
return {
"norcalli/nvim-colorizer.lua",
config = function()
require"colorizer".setup()
end,
}

View file

@ -0,0 +1,30 @@
return {
"nvim-telescope/telescope.nvim",
dependencies = { "nvim-lua/plenary.nvim" },
config = function()
require"telescope".setup {}
local tb = require"telescope.builtin"
local map = require"util.map"
-- Default pickers
map("n", "<leader>tf", function()
if vim.fn.isdirectory(".git") ~= 0 then
tb.git_files()
else
tb.find_files()
end
end, "[T]elescope [f]iles")
map("n", "<leader>tg", tb.live_grep, "[T]elescope [g]rep")
map("n", "<leader>tb", tb.buffers, "[T]elescope [b]uffers")
map("n", "<leader>tm", function()
tb.man_pages({ "ALL" })
end, "[T]elescope [m]an pages")
map("n", "<leader>tk", tb.keymaps, "[T]elescope [k]eymaps")
map("n", "<leader>tk", tb.keymaps, "[T]elescope [k]eymaps")
-- LSP pickers
map("n", "<leader>tld", tb.diagnostics, "[T]elescope [l]sp [d]iagnostics")
map("n", "<leader>tlr", tb.lsp_references, "[T]elescope [l]sp [r]eferences")
end,
}

View file

@ -0,0 +1,15 @@
return {
"nvim-treesitter/nvim-treesitter",
config = function()
require"nvim-treesitter.configs".setup {
ensure_installed = "all", -- pipebomb
highlight = {
enable = true,
},
indent = {
enable = true,
},
}
end,
run = ":TSUpdate",
}

View file

@ -0,0 +1,10 @@
-- 2 indentation languages
vim.api.nvim_create_autocmd({"BufEnter", "BufWinEnter"}, {
pattern = {"*.lua", "*.nix"},
callback = function()
vim.opt.tabstop = 2
vim.opt.softtabstop = 2
vim.opt.shiftwidth = 2
end
})

View file

@ -0,0 +1,3 @@
require"settings.options"
require"settings.autocmds"
require"settings.keymaps"

View file

@ -0,0 +1,7 @@
local map = require"util.map"
map("n", "<Space>", "<Nop>", "Mapleader")
vim.g.mapleader = " "
map("n", "<leader>df", vim.diagnostic.open_float, "[D]iagnostics [f]loat")

View file

@ -0,0 +1,25 @@
local options = {
tabstop = 4,
softtabstop = 4,
shiftwidth = 4,
expandtab = true,
number = true,
relativenumber = true,
fileencoding = "utf-8",
cursorline = true,
wrap = false,
signcolumn = "yes",
swapfile = false,
errorbells = false,
undofile = true,
incsearch = true,
hlsearch = false,
backup = false,
}
for option, value in pairs(options) do
pcall(function()
vim.opt[option] = value
end)
end

View file

@ -0,0 +1,59 @@
local function distro_traits(name)
local icons = {
[ "unknown" ] = {
icon = "",
color = "#f3be25",
},
[ "debian" ] = {
icon = "",
color = "#d70a53",
},
[ "gentoo" ] = {
icon = "",
color = "#54487A",
},
[ "nixos" ] = {
icon = "",
color = "#5277C3",
},
[ "\"opensuse-tumbleweed\"" ] = {
icon = "",
color = "#73ba25",
},
}
local icon = icons[name]
if icon == nil then
icon = icons["unknown"]
end
return icon
end
return function()
local release_file = io.open("/etc/os-release", "rb")
if release_file == nil then
return {
name = "unknown",
traits = distro_traits("unknown"),
}
end
local content = vim.split(release_file:read("*a"), "\n")
local distro_id = nil
for _, line in ipairs(content) do
if string.sub(line, 0, 3) == "ID=" then
distro_id = string.sub(line, 4, -1)
goto distro_id_found
end
end
::distro_id_found::
release_file:close()
return {
name = distro_id,
traits = distro_traits(distro_id)
}
end

View file

@ -0,0 +1,7 @@
return function (name)
local hl = vim.api.nvim_get_hl(0, { name = name })
while hl.link ~= nil do
hl = vim.api.nvim_get_hl(0, { name = hl.link })
end
return hl
end

View file

@ -0,0 +1,9 @@
return function(mode, key, mapping, comment)
local opts = {
noremap = true,
silent = true,
desc = comment
}
vim.keymap.set(mode, key, mapping, opts)
end

View file

@ -0,0 +1,27 @@
return function(dir, skip_init)
local returns = {}
local lua_files = vim.split(vim.fn.glob(dir.."/*.lua"), "\n")
local namespace = string.gsub(dir, vim.fn.stdpath("config").."/lua/", "")
namespace = string.gsub(namespace, "%/", ".")
for _, file in ipairs(lua_files) do
file = string.gsub(file, "%.lua", "")
file = string.gsub(file, dir.."/", namespace)
if skip_init and file == namespace.."init" then
goto continue
end
local require_ok, require_return = pcall(require, file)
if require_ok then
table.insert(returns, require_return)
else
vim.notify("Could not require file: '"..file.."': "..require_return, vim.log.levels.WARNING)
end
::continue::
end
return returns
end

View file

@ -0,0 +1,11 @@
return function(rgb)
if rgb == nil then
return nil
end
local r = string.format("%02x", (rgb / 65536) % 256)
local g = string.format("%02x", (rgb / 256) % 256)
local b = string.format("%02x", rgb % 256)
return "#"..r..g..b
end

View file

@ -0,0 +1,22 @@
{ pkgs, config, ... }:
{
programs.neovim = {
enable = true;
defaultEditor = true;
extraPackages = with pkgs; [
lua-language-server
nodePackages.intelephense
clang-tools
ripgrep
nil
gcc
];
};
home.file."${config.xdg.configHome}/nvim" = {
source = ./config;
recursive = true;
};
}

View file

@ -0,0 +1,10 @@
{ config, pkgs, stylix, ... }:
{
stylix.targets.rofi.enable = false;
programs.rofi = {
enable = true;
package = pkgs.rofi-wayland;
theme = "gruvbox-dark-hard";
};
}

View file

@ -0,0 +1,39 @@
{ pkgs, ... }:
{
stylix = {
image = ../../../assets/wallpaper.png;
base16Scheme = "${pkgs.base16-schemes}/share/themes/gruvbox-dark-hard.yaml";
fonts = {
monospace = {
package = pkgs.nerdfonts;
name = "Go Mono Nerd Font";
};
};
fonts = {
sizes = {
terminal = 13;
popups = 13;
applications = 10;
};
};
cursor = {
package = pkgs.bibata-cursors;
name = "Bibata-Modern-Classic";
size = 24;
};
targets = {
grub.enable = false;
};
opacity = {
terminal = 0.9;
popups = 0.9;
};
};
}

View file

@ -1,6 +1,7 @@
{ pkgs, ... }:
{ ... }:
{
# TODO: Port changes over from dots and streamline workflow
programs.tmux = {
enable = true;
prefix = "C-Space";

View file

@ -0,0 +1,12 @@
#!/usr/bin/env zsh
# Prefetch paths
source "$ZDOTDIR/conf.d/path.zsh"
for file in $ZDOTDIR/conf.d/*; do
if [[ "$file" == *"path.zsh" ]]; then
continue
fi
source "$file"
done

View file

@ -0,0 +1,4 @@
#!/usr/bin/env zsh
alias reload="exec zsh"

View file

@ -0,0 +1,11 @@
#!/usr/bin/env zsh
alias ls='ls --color=auto'
alias ll='ls -lah --color=auto'
alias grep='grep --color=auto'
term_name=$(ps -o comm= "$PPID")
if [ "$term_name" = "xterm" ] && [ -n "$(command -v "transset")" ]; then
transset -a 0.95 > /dev/null
fi

View file

@ -0,0 +1,18 @@
#!/usr/bin/env zsh
if [ -z "$FZF_TAB_FILE" ] && [ ! -d "$HOME/.cache/fzf-tab" ]; then
echo "Installing fzf-tab"
git clone "https://github.com/Aloxaf/fzf-tab" "$HOME/.cache/fzf-tab"
FZF_TAB_FILE="$HOME/.cache/fzf-tab/fzf-tab.plugin.zsh"
fi
autoload -Uz compinit
compinit
source "$FZF_TAB_FILE"
zstyle ':completion:*:git-checkout:*' sort false
if [ -n "$TMUX" ]; then
zstyle ':fzf-tab:*' fzf-command ftb-tmux-popup
fi

View file

@ -0,0 +1,6 @@
#!/usr/bin/env zsh
if [ -n "$(command -v qt5ct)" ] && [ -z "$DESKTOP_SESSION" ]; then
export QT_QPA_PLATFORMTHEME=qt5ct
fi

View file

@ -0,0 +1,9 @@
#!/usr/bin/env zsh
if [ -n "$(command -v thefuck)" ]; then
fuck() {
eval $(thefuck --alias)
fuck
}
fi

View file

@ -0,0 +1,5 @@
#!/usr/bin/env zsh
GPG_TTY=$(tty)
export GPG_TTY

View file

@ -0,0 +1,6 @@
#!/usr/bin/env zsh
if [ -n "$(command -v "nvim")" ]; then
export MANPAGER='nvim +Man!'
fi

View file

@ -0,0 +1,46 @@
#!/usr/bin/env zsh
add_to_path() {
if [ -d "$1" ] && [[ "$PATH" != *"$1"* ]]; then
PATH="$PATH:$1"
fi
}
add_to_path "$HOME/.local/bin"
# Language package mangers
if [ -n "$(command -v go)" ]; then
export GOPATH="$HOME/.local/share/go"
add_to_path "$HOME/.local/share/go/bin"
fi
if [ -n "$(command -v npm)" ]; then
if [ -f "$HOME/.npmrc" ]; then
if [ -z "$(grep prefix "$HOME/.npmrc")" ]; then
npm config set prefix "$HOME/.local/share/npm"
fi
else
npm config set prefix "$HOME/.local/share/npm"
fi
add_to_path "$HOME/.local/share/npm/bin"
fi
if [ -n "$(command -v cargo)" ]; then
export CARGO_HOME="$HOME/.local/share/cargo"
add_to_path "$HOME/.local/share/cargo/bin"
fi
if [ -n "$(command -v pip3)" ] && [ -n "$(command -v virtualenv)" ]; then
if [ ! -d "$HOME/.local/share/python3-venv" ]; then
python3 -m venv "$HOME/.local/share/python3-venv"
fi
if [ "$(grep "executable" "$HOME/.local/share/python3-venv/pyvenv.cfg" | awk '{print $3}')" \
!= "$(realpath $(command -v python3))" ]; then
python3 -m venv --upgrade "$HOME/.local/share/python3-venv"
fi
export VIRTUAL_ENV_DISABLE_PROMPT=true
source "$HOME/.local/share/python3-venv/bin/activate"
fi

View file

@ -0,0 +1,18 @@
#!/usr/bin/env zsh
distro=$(cat /etc/os-release | grep -w 'ID=.*' | sed -e 's/ID=//g' | awk '{print $1}')
case "$distro" in
"debian") dicon="%F{red}%f" ;;
"gentoo") dicon="%F{magenta}%f" ;;
"\"opensuse-tumbleweed\"") dicon="%F{green} %f" ;;
"nixos") dicon="%F{cyan}%f" ;;
*) dicon="%F{yellow}[󰘧]%f" ;;
esac
setopt prompt_subst
autoload -Uz vcs_info
precmd () { vcs_info }
zstyle ':vcs_info:*' formats ' %F{yellow}(%b)%f'
export PS1='$dicon %n@%m %F{green}%~%f$vcs_info_msg_0_> '

View file

@ -0,0 +1,11 @@
#!/usr/bin/env zsh
if [ -z "$DESKTOP_SESSION" ]; then
if [ -z "$(pidof gnome-keyring-daemon)" ] && [ -n "$(command -v gnome-keyring-daemon)" ]; then
{ eval $(gnome-keyring-daemon --start); } > /dev/null 2>&1
export SSH_AUTH_SOCK
else
{ eval $(ssh-agent -s); } > /dev/null 2>&1
fi
fi

View file

@ -0,0 +1,29 @@
#!/usr/bin/env zsh
export HISTFILE=~/.cache/zsh_history
export HISTSIZE=10000
export SAVEHIST=$HISTSIZE
setopt INC_APPEND_HISTORY
setopt SHARE_HISTORY
setopt HIST_IGNORE_SPACE
setopt HIST_SAVE_NO_DUPS
if [ -z "$AUTOSUGGEST_FILE" ]; then
import_file="/usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh"
else
import_file="$AUTOSUGGEST_FILE"
fi
if [ ! -f "$import_file" ]; then
if [ ! -d "$HOME/.cache/zsh-autosuggestions" ]; then
echo "Installing zsh-autosuggestions..."
git clone "https://github.com/zsh-users/zsh-autosuggestions.git" "$HOME/.cache/zsh-autosuggestions"
fi
import_file="$HOME/.cache/zsh-autosuggestions/zsh-autosuggestions.zsh"
fi
source "$import_file"
ZSH_AUTOSUGGEST_STRATEGY=(history completion)

View file

@ -0,0 +1,18 @@
#!/usr/bin/env zsh
if [ -z "$SYNTAX_FILE" ]; then
import_file="/usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
else
import_file="$SYNTAX_FILE"
fi
if [ ! -f "$import_file" ]; then
if [ ! -d "$HOME/.cache/zsh-syntax-highlighting" ]; then
echo "Installing zsh-syntax-highlighting..."
git clone "https://github.com/zsh-users/zsh-syntax-highlighting.git" "$HOME/.cache/zsh-syntax-highlighting"
fi
import_file="$HOME/.cache/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
fi
source "$import_file"

View file

@ -0,0 +1,9 @@
#!/usr/bin/env zsh
# Disabled until I fix my tmux config
return
if [ "$TERM" = "xterm-256color" ] && [ -x "$(command -v tmux)" ]; then
tmux new-session
fi

View file

@ -0,0 +1,17 @@
{ pkgs, ... }:
{
home.file."/home/hu/.config/zsh/conf.d" = {
source = ./config/conf.d;
recursive = true;
};
home.file."/home/hu/.config/zsh/.zshrc" = {
text = ''
#!/usr/bin/env zsh
SYNTAX_FILE="${pkgs.zsh-syntax-highlighting}/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
FZF_TAB_FILE="${pkgs.zsh-fzf-tab}/share/fzf-tab/fzf-tab.plugin.zsh"
AUTOSUGGEST_FILE="${pkgs.zsh-autosuggestions}/share/zsh-autosuggestions/zsh-autosuggestions.zsh"
'' + (builtins.readFile config/.zshrc);
};
}

View file

@ -0,0 +1,19 @@
{ config, pkgs, ... }:
{
programs.zsh.enable = true;
environment.variables = {
ZDOTDIR = "${config.users.users.hu.home}/.config/zsh";
};
environment.systemPackages = with pkgs; [
fzf
zsh-fzf-tab
zsh-completions
zsh-autosuggestions
zsh-syntax-highlighting
nix-zsh-completions
thefuck
];
}

41
users/hu/persist.nix Normal file
View file

@ -0,0 +1,41 @@
{ pkgs, inputs, impermanence, ... }:
{
environment.persistence."/nix/persist".users.hu = {
directories = [
# Inspired by
# https://github.com/roboyoshi/datacurator-filetree/
"archives"
"audio"
"documents"
"images"
"games"
"literature"
"software"
"video"
# Program files
{ directory = ".gnupg"; mode = "0700"; }
{ directory = ".ssh"; mode = "0700"; }
{ directory = ".nixops"; mode = "0700"; }
{ directory = ".local/share/keyrings"; mode = "0700"; }
".local/share/direnv"
".mozilla/firefox/shaga/bookmarkbackups"
".mozillla/firefox/shaga/chrome"
".config/Signal"
".config/vesktop"
".config/tutanota-desktop"
".config/tuta_integration"
".config/Element"
{ directory = ".pki"; mode = "0700"; }
".local/share/nvim"
".local/state/nvim"
];
files = [
".mozilla/firefox/shaga/places.sqlite"
".mozilla/firefox/shaga/xulstore.json"
# ".mozilla/firefox/shaga/prefs.js"
];
};
}

View file

@ -1,16 +1,15 @@
{ config, lib, pkgs, ... }:
{ config, pkgs, ... }:
{
imports = [
../../packages/sets/communication.nix
../../packages/sets/games.nix
./persist.nix
./packages/stylix.nix
./packages/nh.nix
./packages/zsh/zsh.nix
];
programs.zsh.enable = true;
environment.variables = {
ZDOTDIR = "${config.users.users.hu.home}/.config/zsh";
};
users.users.hu = {
isNormalUser = true;
extraGroups = [ "wheel" ];
@ -18,16 +17,29 @@
hashedPasswordFile = "/nix/config/secrets/hu/pass";
};
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = false;
home-manager.users.hu = { pkgs, ... }: {
# TODO: Figure out a way to run scripts with the user session as a systemd service
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
users.hu = {
home.username = "hu";
home.homeDirectory = "/home/hu";
home.stateVersion = config.system.stateVersion;
imports = [
./packages/zsh/zsh-home.nix
./packages/git.nix
./packages/tmux.nix
# ./packages/tmux.nix
./packages/hyprland.nix
./packages/foot.nix
./packages/firefox.nix
./packages/rofi.nix
./packages/dunst.nix
./packages/nvim/neovim.nix
# ./packages/ags/ags.nix
];
};
};
}