users/ryan/linux/guix.nix

2e30121671a730a2b4bc2f82d2e30ed5c9ff70e5 · 2.7 KB · 72 lines raw

1 { config, pkgs, lib, inputs, ... }:
2
3 {
4 systemd.user.startServices = false;
5
6 programs.zsh.profileExtra = ''
7 if [ -f "$HOME/.guix-home/setup-environment" ]; then
8 HOME_ENVIRONMENT="$HOME/.guix-home"
9 . "$HOME_ENVIRONMENT/setup-environment"
10 "$HOME_ENVIRONMENT/on-first-login"
11 unset HOME_ENVIRONMENT
12 fi
13
14 # /etc/profile normally puts ~/.config/guix/current (the guix pull
15 # profile with our actual channels: nonguix, rosenthal, ...) ahead of
16 # /run/current-system/profile on PATH, but that only happens for bash
17 # login shells -- zsh never sources /etc/profile. Without this, `guix`
18 # resolves to the bare system profile's guix, which doesn't know about
19 # our channels.
20 if [ -d "$HOME/.config/guix/current" ]; then
21 export PATH="$HOME/.config/guix/current/bin:$PATH"
22 export INFOPATH="$HOME/.config/guix/current/share/info''${INFOPATH:+:}$INFOPATH"
23 fi
24 '';
25
26 dconf.enable = false;
27
28 wayland.windowManager.hyprland.extraConfig = ''
29 exec-once = sh -c 'gpgconf --launch gpg-agent; hyprctl setenv SSH_AUTH_SOCK "$(gpgconf --list-dirs agent-ssh-socket)"'
30 '';
31
32 programs.gpg.scdaemonSettings.disable-ccid = true;
33
34 # Guix needs a special fonts.conf file in the user env since it doesn't
35 # have one in /etc/fonts/fonts.conf from nixos
36 xdg.configFile."fontconfig-nix/fonts.conf".text = ''
37 <?xml version='1.0'?>
38 <!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
39 <fontconfig>
40 <include ignore_missing="yes">${pkgs.fontconfig.out}/etc/fonts/conf.d</include>
41 <include ignore_missing="yes">${config.home.homeDirectory}/.config/fontconfig/conf.d</include>
42 <dir>${config.home.homeDirectory}/.guix-home/profile/share/fonts</dir>
43 <cachedir>${config.home.homeDirectory}/.cache/fontconfig</cachedir>
44 </fontconfig>
45 '';
46
47 home.sessionVariables.FONTCONFIG_FILE = "${config.home.homeDirectory}/.config/fontconfig-nix/fonts.conf";
48
49 home.packages = [
50 (pkgs.writeScriptBin "hyprlock" ''
51 #! ${pkgs.bash}/bin/bash
52 export LD_PRELOAD="/run/current-system/profile/lib/libpam.so.0:$LD_PRELOAD"
53 exec ${pkgs.hyprlock}/bin/hyprlock "$@"
54 '')
55
56 # Guix's mesa doesn't match nixpkgs', so GL apps built by nix need nixGL.
57 inputs.nixgl.packages.${pkgs.stdenv.hostPlatform.system}.nixGLIntel
58 ];
59
60 # We need to correct the ssh config file's permissions on guix
61 # Remove the symlink and just install the store file directly
62 home.activation = {
63 fixSshPermissions = lib.hm.dag.entryAfter [ "linkGeneration" ] ''
64 run install -d -m 0700 "$HOME/.ssh"
65 if [ -L "$HOME/.ssh/config" ]; then
66 src="$(readlink -f "$HOME/.ssh/config")"
67 run rm -f "$HOME/.ssh/config"
68 run install -m 0600 "$src" "$HOME/.ssh/config"
69 fi
70 '';
71 };
72 }