move home to directory

This commit is contained in:
Noa Aarts 2024-11-22 21:07:06 +01:00
parent 3d79cf4cb3
commit ac3fb7562d
Signed by: noa
GPG key ID: 1850932741EFF672
6 changed files with 16 additions and 36 deletions

322
common/home/default.nix Normal file
View file

@ -0,0 +1,322 @@
{
enableGraphical ? false,
enableFlut ? false,
enableGames ? false,
displays ? [ ],
extraConfig ? { },
}:
{
config,
pkgs,
inputs,
lib,
...
}:
let
me = {
nickname = "noa";
fullName = "Noa Aarts";
email = "noa@voorwaarts.nl";
};
cursor_name = "Bibata-Rainbow-Modern";
cursor_src = pkgs.fetchzip {
name = cursor_name;
url = "https://github.com/ful1e5/Bibata_Cursor_Rainbow/releases/download/v1.1.2/Bibata-Rainbow-Modern.tar.gz";
hash = "sha256-Ps+IKPwQoRwO9Mqxwc/1nHhdBT2R25IoeHLKe48uHB8=";
};
in
{
imports =
[
../../modules
../nvim/nvim.nix
extraConfig
]
++ lib.optionals enableGraphical [
../discord/discord.nix
../spotify.nix
];
home = {
file = {
".gnupg/scdaemon.conf".text = "disable-ccid";
"programming".source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/Documents/programming/";
};
homeDirectory = "/home/${me.nickname}";
packages =
with pkgs;
[
file
unzip
zip
dig
mtr
]
++ lib.optionals enableFlut [
inputs.flurry.packages.${system}.flurry
inputs.tsunami.packages.${system}.tsunami
]
++ lib.optionals enableGraphical [
signal-desktop
dconf
pipewire
localsend
blueberry
qbittorrent
keepassxc
yubico-piv-tool
libreoffice-qt6
# for niri
wl-clipboard
libnotify
playerctl
];
pointerCursor = lib.mkIf enableGraphical {
gtk.enable = true;
name = cursor_name;
size = 32;
package = pkgs.runCommandNoCC "${cursor_name}" { } ''
mkdir -p $out/share/icons
ln -s ${cursor_src} $out/share/icons/${cursor_name}
'';
};
preferXdgDirectories = true;
sessionVariables =
{
EDITOR = "nvim";
TERM = "kitty";
}
// lib.mkIf enableGraphical {
DISPLAY = ":0";
GDK_BACKEND = "wayland,x11";
QT_QPA_PLATFORM = "wayland;xcb";
CLUTTER_BACKEND = "wayland";
XDG_CURRENT_DESKTOP = "niri";
XDG_SESSION_TYPE = "wayland";
XDG_SESSION_DESKTOP = "niri";
WLR_NO_HARDWARE_CURSORS = "1";
};
stateVersion = "23.11"; # Do not change :3
username = me.nickname;
};
xdg.configFile = lib.mkIf enableGraphical {
"niri/config.kdl".source = import ../../packages/niri-config/default.nix {
inherit pkgs inputs displays;
self-pkgs = inputs.self.packages.${pkgs.system};
};
};
nixpkgs.config.allowUnfree = true;
modules = {
games.enable = enableGraphical && enableGames;
apps = {
zsh.enable = true;
firefox.enable = enableGraphical;
kitty.enable = enableGraphical;
git = {
enable = true;
name = me.fullName;
email = me.email;
do_sign = true;
};
thunderbird.enable = enableGraphical;
neovim.enableLanguages = true;
};
};
systemd.user = {
enable = enableGraphical;
startServices = "sd-switch";
services = lib.mkMerge [
(builtins.listToAttrs (
builtins.map (
{
name,
horizontal,
vertical,
...
}:
let
display_config =
let
display-shader = pkgs.substituteAll {
src = ../../modules/automapaper/display-with_vars.glsl;
background = inputs.nix-colors.lib.conversions.hexToGLSLVec "0a000a";
foreground = inputs.nix-colors.lib.conversions.hexToGLSLVec "192291";
};
state-shader = ../../modules/automapaper/state-game_of_life.glsl;
init-shader = ../../modules/automapaper/init.glsl;
# General configurations
cycles = 2000;
tps = 30;
horizontal-dot-size = 10;
vertical-dot-size = 10;
in
(import ../../modules/automapaper/config.nix {
inherit (pkgs) writeTextFile;
inherit
init-shader
state-shader
display-shader
tps
cycles
;
display = name;
horizontal = builtins.div horizontal horizontal-dot-size;
vertical = builtins.div vertical vertical-dot-size;
});
in
lib.attrsets.nameValuePair "automapaper-${name}" ({
Install = {
WantedBy = [ "niri.service" ];
};
Unit = {
Description = "Automapaper for display ${name}";
PartOf = "graphical-session.target";
After = "graphical-session.target";
Requisite = "graphical-session.target";
};
Service = {
ExecStart = "${
inputs.automapaper.packages.${pkgs.system}.automapaper
}/bin/automapaper -C ${display_config}/config.toml";
Restart = "on-failure";
};
})
) displays
))
];
};
xdg = {
enable = true;
userDirs = {
enable = true;
createDirectories = true;
};
};
dconf = {
enable = enableGraphical;
settings = {
"org/gnome/desktop/interface" = {
color-scheme = "prefer-dark";
};
};
};
gtk = {
enable = enableGraphical;
gtk2.extraConfig = ''
gtk-enable-animations=1
gtk-primary-button-warps-slider=1
gtk-toolbar-style=3
gtk-menu-images=1
gtk-button-images=1
gtk-sound-theme-name="ocean"
gtk-font-name="Noto Sans, 10"
'';
theme = {
name = "Adwaita-dark";
package = pkgs.gnome-themes-extra;
};
};
programs = {
btop = {
enable = true;
settings = {
color_theme = "ayu";
theme_background = false;
truecolor = true;
vim_keys = true;
rounded_corners = true;
update_ms = 500;
proc_mem_bytes = true;
proc_per_core = true;
};
};
direnv = {
enable = true;
enableZshIntegration = true;
nix-direnv.enable = true;
};
# FIX: gpg should be declarative, but is more work than I have time for rn
gpg = {
enable = false;
};
# Let Home Manager install and manage itself.
home-manager.enable = true;
# add `play funny video` as alias because why not
zsh.shellAliases.bzzt = lib.mkIf enableGraphical ''nix-shell -p mpv --command "mpv ~/Videos/BZZZM.mp4"'';
# lsd makes files look better
lsd = {
enable = true;
enableAliases = true;
};
# manpages can be quite useful
man.enable = true;
obs-studio.enable = enableGraphical;
ssh = {
enable = true;
compression = true;
matchBlocks = {
"aur" = {
host = "aur.archlinux.org";
hostname = "aur.archlinux.org";
addressFamily = "any";
identityFile = "~/.ssh/aur";
identitiesOnly = true;
port = 22;
user = "aur";
};
"nuos" = {
host = "nuos";
hostname = "nuos";
addressFamily = "inet";
identityFile = "~/.ssh/id_rsa_yubikey.pub";
identitiesOnly = true;
port = 22;
user = "noa";
};
"github" = {
host = "github.com";
hostname = "github.com";
identityFile = "~/.ssh/id_rsa_yubikey.pub";
identitiesOnly = true;
port = 22;
user = "git";
};
};
};
};
qt = {
enable = enableGraphical;
platformTheme.name = "adwaita";
style.name = "adwaita-dark";
};
services = {
syncthing = {
enable = true;
};
gpg-agent = {
enable = true;
enableZshIntegration = true;
enableSshSupport = true;
pinentryPackage = lib.mkIf enableGraphical pkgs.pinentry-qt;
};
};
}