diff --git a/flake.nix b/flake.nix index d22386e..45241cc 100644 --- a/flake.nix +++ b/flake.nix @@ -28,19 +28,53 @@ ... } @ inputs: let inherit (self) outputs; + worklaptopTheme = pkgs: { + theme = { + name = "Tokyonight-Dark"; + package = pkgs.tokyonight-gtk-theme; + }; + iconTheme = { + name = "Tokyonight-Light"; + package = pkgs.tokyonight-gtk-theme; + }; + cursorTheme = { + name = "phinger-cursors-dark"; + package = pkgs.phinger-cursors; + }; + fonts = { + serif = "NotoSerifNerdFont"; + sansSerif = "NotoSansNerdFont"; + monospace = "MonaspiceArNerdFontMono"; + }; + wallpaperSource = "/home/cianh/Pictures/Wallpapers/City_1_Upscaled.png"; + wallpaper = "/var/lib/AccountsService/wallpaper/cianh"; + avatarSource = "/home/cianh/Pictures/face.png"; + avatar = "/var/lib/AccountsService/icons/cianh"; + }; in { # NixOS configuration entrypoint # Available through 'nixos-rebuild --flake .#your-hostname' nixosConfigurations = { - worklaptop = nixpkgs.lib.nixosSystem { - specialArgs = { - inherit inputs outputs; - unstablePkgs = inputs.nixpkgs-unstable.legacyPackages.x86_64-linux; + worklaptop = let + pkgs = import nixpkgs { + system = "x86_64-linux"; + config = { + allowUnfree = true; + cudaSupport = true; + allowUnfreePredicate = _: true; + }; + }; + in + nixpkgs.lib.nixosSystem { + specialArgs = { + inherit inputs outputs; + unstablePkgs = inputs.nixpkgs-unstable.legacyPackages.x86_64-linux; + theme = worklaptopTheme pkgs; + }; + modules = [ + ./nixos/worklaptop.nix + ]; }; - modules = [ - ./nixos/worklaptop.nix - ]; - }; homeserver = nixpkgs.lib.nixosSystem { specialArgs = { inherit inputs outputs; @@ -80,33 +114,36 @@ ./home-manager/core.nix ]; }; - "cianh@worklaptop" = home-manager.lib.homeManagerConfiguration { + "cianh@worklaptop" = let pkgs = import nixpkgs { - # Home-manager requires 'pkgs' instance system = "x86_64-linux"; config = { allowUnfree = true; cudaSupport = true; - # Workaround for https://github.com/nix-community/home-manager/issues/2942 allowUnfreePredicate = _: true; }; }; - extraSpecialArgs = { - inherit inputs outputs; - unstablePkgs = import nixpkgs-unstable { - # We also need to do the same for unstable - system = "x86_64-linux"; - cudaSupport = true; - config = { - allowUnfree = true; - allowUnfreePredicate = _: true; + in + home-manager.lib.homeManagerConfiguration { + inherit pkgs; + + extraSpecialArgs = { + inherit inputs outputs; + unstablePkgs = import nixpkgs-unstable { + system = "x86_64-linux"; + cudaSupport = true; + config = { + allowUnfree = true; + allowUnfreePredicate = _: true; + }; }; + theme = worklaptopTheme pkgs; }; + + modules = [ + ./home-manager/worklaptop.nix + ]; }; - modules = [ - ./home-manager/worklaptop.nix - ]; - }; "cianh@homeserver" = home-manager.lib.homeManagerConfiguration { pkgs = import nixpkgs { # Home-manager requires 'pkgs' instance diff --git a/home-manager/core/dotfiles b/home-manager/core/dotfiles index b7a2325..54a02c7 160000 --- a/home-manager/core/dotfiles +++ b/home-manager/core/dotfiles @@ -1 +1 @@ -Subproject commit b7a2325ee1de9cb4a3f6a324df0a570c137035ce +Subproject commit 54a02c71021c50f074009046bbbc1fedec42aec2 diff --git a/home-manager/worklaptop/theming.nix b/home-manager/worklaptop/theming.nix index e6dea5e..27faf28 100644 --- a/home-manager/worklaptop/theming.nix +++ b/home-manager/worklaptop/theming.nix @@ -5,22 +5,23 @@ config, pkgs, unstablePkgs, + theme, ... }: { # GTK theming gtk = { enable = true; iconTheme = { - name = "Tokyonight-Light"; - package = pkgs.tokyonight-gtk-theme; + name = theme.iconTheme.name; + package = theme.iconTheme.package; }; theme = { - name = "Tokyonight-Dark"; - package = pkgs.tokyonight-gtk-theme; + name = theme.theme.name; + package = theme.theme.package; }; cursorTheme = { - name = "phinger-cursors-dark"; - package = pkgs.phinger-cursors; + name = theme.cursorTheme.name; + package = theme.cursorTheme.package; }; gtk2.extraConfig = '' gtk-theme-name="Tokyonight-Dark" @@ -42,9 +43,9 @@ dconf.settings = { "org/gnome/desktop/interface" = { color-scheme = "prefer-dark"; - gtk-theme = "Tokyonight-Dark"; - icon-theme = "Tokyonight-Light"; - cursor-theme = "phinger-cursors-dark"; + gtk-theme = theme.theme.name; + icon-theme = theme.iconTheme.name; + cursor-theme = theme.cursorTheme.name; }; }; } diff --git a/nixos/worklaptop/packages.nix b/nixos/worklaptop/packages.nix index 189f599..4336d79 100644 --- a/nixos/worklaptop/packages.nix +++ b/nixos/worklaptop/packages.nix @@ -9,7 +9,7 @@ environment.systemPackages = [ pkgs.cargo pkgs.flatpak - pkgs.gdm + pkgs.greetd pkgs.grim pkgs.grub2_efi pkgs.nix-ld @@ -20,6 +20,7 @@ pkgs.qmk pkgs.qmk-udev-rules pkgs.qmk_hid + pkgs.regreet pkgs.seahorse pkgs.wayland pkgs.wayland-utils diff --git a/nixos/worklaptop/programs.nix b/nixos/worklaptop/programs.nix index 78078ee..66134de 100644 --- a/nixos/worklaptop/programs.nix +++ b/nixos/worklaptop/programs.nix @@ -4,66 +4,101 @@ config, pkgs, unstablePkgs, + theme, ... -}: { +}: let + username = "cianh"; +in { # Activate DEs - programs.uwsm.enable = true; - programs.hyprland = { - enable = true; - withUWSM = true; - xwayland.enable = true; + programs = { + uwsm.enable = true; + regreet = { + enable = true; + theme = { + name = theme.theme.name; + package = theme.theme.package; + }; + cursorTheme = { + name = theme.cursorTheme.name; + package = theme.cursorTheme.package; + }; + iconTheme.name = "Adwaita"; + # iconTheme = { + # name = theme.iconTheme.name; + # package = theme.iconTheme.package; + # }; + font = { + name = "Noto Sans"; + size = 16; + package = pkgs.noto-fonts; + }; + settings = { + GTK.application_prefer_dark_theme = true; + appearance.greeting_msg = "Hello ${username}, welcome back to '${config.networking.hostName}'!"; + background.path = theme.wallpaper; + }; + }; + hyprland = { + enable = true; + withUWSM = true; + xwayland.enable = true; + }; + + # Enable my preferred DE utilities + thunar = { + enable = true; + plugins = [ + pkgs.xfce.thunar-volman + pkgs.xfce.thunar-archive-plugin + pkgs.xfce.thunar-media-tags-plugin + ]; + }; + xfconf.enable = true; + + # Disable automatically activated programs i dont want + foot.enable = false; + + # Lets also activate some handy devenv tools + direnv = { + enable = true; + nix-direnv.enable = true; + }; + nix-ld = { + enable = true; + libraries = [ + pkgs.acl + pkgs.alsa-lib + pkgs.at-spi2-core + pkgs.attr + pkgs.bzip2 + pkgs.curl + pkgs.dbus + pkgs.eget + pkgs.expat + pkgs.glib + pkgs.libsodium + pkgs.libssh + pkgs.libxml2 + pkgs.nspr + pkgs.nss + pkgs.openssl + pkgs.pango + pkgs.stdenv.cc + pkgs.systemd + pkgs.util-linux + pkgs.vulkan-loader + pkgs.xz + pkgs.zlib + pkgs.zstd + ]; + }; + + seahorse.enable = true; # enable the graphical frontend + gnupg.agent = { + enable = true; + pinentryPackage = pkgs.pinentry-gnome3; + enableSSHSupport = true; + }; + virt-manager.enable = true; }; - - # Enable my preferred DE utilities - programs.thunar.enable = true; - programs.thunar.plugins = [ - pkgs.xfce.thunar-volman - pkgs.xfce.thunar-archive-plugin - pkgs.xfce.thunar-media-tags-plugin - ]; - programs.xfconf.enable = true; - - # Disable automatically activated programs i dont want - programs.foot.enable = false; - - # Lets also activate some handy devenv tools - programs.direnv.enable = true; - programs.direnv.nix-direnv.enable = true; - programs.nix-ld = { - enable = true; - libraries = [ - pkgs.acl - pkgs.alsa-lib - pkgs.at-spi2-core - pkgs.attr - pkgs.bzip2 - pkgs.curl - pkgs.dbus - pkgs.eget - pkgs.expat - pkgs.glib - pkgs.libsodium - pkgs.libssh - pkgs.libxml2 - pkgs.nspr - pkgs.nss - pkgs.openssl - pkgs.pango - pkgs.stdenv.cc - pkgs.systemd - pkgs.util-linux - pkgs.vulkan-loader - pkgs.xz - pkgs.zlib - pkgs.zstd - ]; - }; - - programs.seahorse.enable = true; # enable the graphical frontend - programs.gnupg.agent = { - enable = true; - pinentryPackage = pkgs.pinentry-gnome3; - enableSSHSupport = true; - }; - programs.virt-manager.enable = true; } diff --git a/nixos/worklaptop/services.nix b/nixos/worklaptop/services.nix index a10c714..e16985d 100644 --- a/nixos/worklaptop/services.nix +++ b/nixos/worklaptop/services.nix @@ -4,12 +4,14 @@ config, pkgs, unstablePkgs, + theme, ... }: { services = { displayManager.defaultSession = "hyprland-uwsm"; desktopManager.gnome.enable = false; - displayManager.gdm.enable = true; + displayManager.gdm.enable = false; + greetd.enable = true; xserver = { videoDrivers = ["nvidia"]; # or "nvidiaLegacy470 etc. enable = true; @@ -44,21 +46,31 @@ # Add custom services systemd.services = { - setup-user-icon = { - description = "Set user profile icon"; - wantedBy = ["multi-user.target"]; + greetd = { + after = ["setup-user-vars.service"]; + requires = ["setup-user-vars.service"]; + }; + setup-user-vars = { + description = "Set user profile vars"; + wantedBy = [ + "multi-user.target" + "graphical-session.target" + ]; after = ["home.mount"]; serviceConfig = { Type = "oneshot"; ExecStart = '' ${pkgs.bash}/bin/bash -c " \ - mkdir -p /var/lib/AccountsService/{icons,users} && \ - cp /home/cianh/Pictures/face.png /var/lib/AccountsService/icons/cianh && \ - echo '[User]\nSession=\nIcon=/var/lib/AccountsService/icons/cianh\nSystemAccount=false' > /var/lib/AccountsService/users/cianh && \ + mkdir -p /var/lib/AccountsService/{icons,users,wallpaper} && \ + cp ${theme.avatarSource} ${theme.avatar} && \ + echo '[User]\nSession=\nIcon=${theme.avatar}\nSystemAccount=false' > /var/lib/AccountsService/users/cianh && \ chown root:root /var/lib/AccountsService/users/cianh && \ chmod 0600 /var/lib/AccountsService/users/cianh && \ - chown root:root /var/lib/AccountsService/icons/cianh && \ - chmod 0444 /var/lib/AccountsService/icons/cianh \ + chown root:root ${theme.avatar} && \ + chmod 0444 ${theme.avatar} && \ + cp ${theme.wallpaperSource} ${theme.wallpaper} && \ + chown root:root ${theme.wallpaper} && \ + chmod 0444 ${theme.wallpaper} \ " ''; }; diff --git a/nixos/worklaptop/theming.nix b/nixos/worklaptop/theming.nix index 147a7be..f6baa10 100644 --- a/nixos/worklaptop/theming.nix +++ b/nixos/worklaptop/theming.nix @@ -3,10 +3,11 @@ lib, pkgs, modulesPath, + theme, ... }: { # GTK theming - environment.sessionVariables.GTK_THEME = "Tokyonight-Dark"; + environment.sessionVariables.GTK_THEME = theme.theme.name; # Delegate QT theming to kvantum environment.sessionVariables.QT_STYLE_OVERRIDE = "kvantum"; @@ -18,9 +19,9 @@ fontconfig = { defaultFonts = { - serif = ["NotoSerifNerdFont"]; - sansSerif = ["NotoSansNerdFont"]; - monospace = ["MonaspiceArNerdFontMono"]; + serif = [theme.fonts.serif]; + sansSerif = [theme.fonts.sansSerif]; + monospace = [theme.fonts.monospace]; }; };