From 251a7bacac7ed2aeb9e6806d003e916ad65b448b Mon Sep 17 00:00:00 2001 From: Miran Bastaja Date: Fri, 10 Nov 2023 19:57:21 +0100 Subject: Refactor shared module --- hosts/sagittarius/home.nix | 8 +---- hosts/wonderland/default.nix | 3 +- hosts/wonderland/home.nix | 78 +++++++------------------------------------- share/home/default.nix | 77 ------------------------------------------- share/home/hyprdesktop.nix | 70 +++++++++++++++++++++++++++++++++++++++ share/home/minimal.nix | 51 +++++++++++++++++++++++++++++ 6 files changed, 135 insertions(+), 152 deletions(-) delete mode 100644 share/home/default.nix create mode 100644 share/home/hyprdesktop.nix create mode 100644 share/home/minimal.nix diff --git a/hosts/sagittarius/home.nix b/hosts/sagittarius/home.nix index 24d742d..11d2b06 100644 --- a/hosts/sagittarius/home.nix +++ b/hosts/sagittarius/home.nix @@ -3,13 +3,7 @@ useGlobalPkgs = true; useUserPackages = true; sharedModules = [ - { imports = [ (flakeRoot + /share/home) ]; } - { - programs.direnv = { - enable = true; - nix-direnv.enable = true; - }; - } + { imports = [ (flakeRoot + /share/home/minimal.nix) ]; } ]; users = { diff --git a/hosts/wonderland/default.nix b/hosts/wonderland/default.nix index a314706..2510696 100644 --- a/hosts/wonderland/default.nix +++ b/hosts/wonderland/default.nix @@ -1,4 +1,4 @@ -{ config, pkgs, flakeRoot, ... }: { +{ config, pkgs, flakeRoot, inputs, ... }: { imports = [ # Include the results of the hardware scan. ./hardware.nix @@ -7,6 +7,7 @@ (flakeRoot + /share/system/steam.nix) (flakeRoot + /share/system/hyprland.nix) #(flakeRoot + /share/system/spotifyd.nix) + { _module.args = { inherit inputs; }; } ]; nixpkgs.config.allowUnfree = true; diff --git a/hosts/wonderland/home.nix b/hosts/wonderland/home.nix index 05d726e..3ca97a0 100644 --- a/hosts/wonderland/home.nix +++ b/hosts/wonderland/home.nix @@ -2,85 +2,29 @@ , flakeRoot , inputs , ... -}: -let - desktop-pkgs = with pkgs; [ - mullvad - calibre - beekeeper-studio - thunderbird - brightnessctl - cmus # music player - - libreoffice-qt - discord - - nsxiv - inputs.scripts.packages.${pkgs.system}.image-move - - wineWowPackages.full - winetricks - ]; -in -{ +}: { home-manager = { useGlobalPkgs = true; useUserPackages = true; - sharedModules = [{ imports = [ (flakeRoot + /share/home) ]; }]; + sharedModules = [{ imports = [ (flakeRoot + /share/home/hyprdesktop.nix) ]; }]; + extraSpecialArgs = { inherit inputs; }; }; home-manager.users.alice = { - imports = - let - home = flakeRoot + /share/home; - in - [ - # Config - (home + /hyprland.nix) - (home + /git.nix) - (home + /gallery-dl.nix) - (home + /mpv.nix) - (home + /firefox) - ]; - home.packages = with pkgs; - [ - signal-desktop - tdesktop # Telegram desktop - qbittorrent - emacs - # spotify-qt librespot - fluffychat # matrix client - - # Various utils - # qemu_kvm - tokei # counts lines of code - btop # modern top - qemu_kvm - - # Gaming - jdk17_headless - superTuxKart - ] - ++ desktop-pkgs; + imports = [ + (flakeRoot + /share/home/gallery-dl.nix) + ]; services.poweralertd.enable = true; + home.packages = with pkgs; [ + emacs + mullvad + ]; + home.stateVersion = "22.05"; }; # End of users.alice home-manager.users.madhatter = { - home.packages = desktop-pkgs; - imports = - let - home = flakeRoot + /share/home; - in - [ - # Config - (home + /kitty.nix) - (home + /git.nix) - (home + /mpv.nix) - (home + /firefox) - ]; - home.stateVersion = "23.05"; }; diff --git a/share/home/default.nix b/share/home/default.nix deleted file mode 100644 index 6213e8b..0000000 --- a/share/home/default.nix +++ /dev/null @@ -1,77 +0,0 @@ -# Minimal home configuration containing everything that I want on all of -# my machines -{ pkgs, config, ... }: { - imports = [ ./helix.nix ./zsh.nix ]; - - home.packages = with pkgs; [ - wget - git - age - gnupg - xh - - # Modern unix - ripgrep # grep - fd # find - sd # sed - dua # du - - bc # CLI calculator - ffmpeg - amfora # Gemini CLI browser - trashy # Trash CLI - git-annex - git-remote-gcrypt - - # tools for dealing with all sorts archives - atool - unzip - gnutar - - # Useful nix tooling - nix-tree - ]; - - programs.direnv = { - enable = true; - nix-direnv.enable = true; - }; - - xdg = { - enable = true; - systemDirs.data = - let - gds = pkgs.gsettings-desktop-schemas; - gtk3 = pkgs.gtk3; - in - [ - "${gds}/share/gsettings-schemas/${gds.name}" - "${gtk3}/share/gsettings-schemas/${gtk3.name}" - ]; - userDirs = - let - home = config.home.homeDirectory; - in - { - enable = true; - createDirectories = true; - pictures = "${home}/Annex/Pictures"; - music = "${home}/Annex/Music"; - }; - }; - - # Lots of these are courtesy of xdg-ninja - # https://github.com/b3nj5m1n/xdg-ninja - home.sessionVariables = with config.xdg; { - CARGO_HOME = "${dataHome}/cargo"; - GOPATH = "${dataHome}/go"; - WINEPREFIX = "${dataHome}/wine"; - XCOMPOSECACHE = "${cacheHome}/X11/xcompose"; - GTK2_RC_FILES = "${configHome}/gtk-2.0/gtkrc"; - NODE_REPL_HISTORY = "${dataHome}/node_repl_history"; - NPM_CONFIG_USERCONFIG = "${configHome}/npm/npmrc"; - # shell - HISTFILE = "${stateHome}/shell/history"; - ZDOTDIR = "${configHome}/zsh"; - }; -} diff --git a/share/home/hyprdesktop.nix b/share/home/hyprdesktop.nix new file mode 100644 index 0000000..fc657ea --- /dev/null +++ b/share/home/hyprdesktop.nix @@ -0,0 +1,70 @@ +# Module containing a bunch of things that make up a `desktop environment` built +# off of hyprland. I install this on all my desktop/laptop machines. +{ pkgs, config, inputs, ... }: { + imports = [ + ./minimal.nix + ./hyprland.nix + ./git.nix + ./mpv.nix + ./kitty.nix + ./firefox + ]; + + home.packages = with pkgs; [ + xh # Nice to use HTTP client + bc # CLI calculator + amfora # Gemini CLI browser + trashy # Trash CLI + tokei # counts lines of code + btop # modern top + brightnessctl + wineWowPackages.full + winetricks + inputs.scripts.packages.${pkgs.system}.image-move + qemu_kvm + + # TUI/GUI programs + cmus # music player + calibre # Document organisation/reading program + libreoffice-qt + beekeeper-studio # SQL database client + thunderbird # email client + nsxiv # image viewer + discord + signal-desktop + tdesktop # Telegram desktop + fluffychat # matrix client + qbittorrent # bittorrent client + + # Gaming + jdk17_headless + superTuxKart + ]; + + programs.direnv = { + enable = true; + nix-direnv.enable = true; + }; + + xdg = { + systemDirs.data = + let + gds = pkgs.gsettings-desktop-schemas; + gtk3 = pkgs.gtk3; + in + [ + "${gds}/share/gsettings-schemas/${gds.name}" + "${gtk3}/share/gsettings-schemas/${gtk3.name}" + ]; + userDirs = + let + home = config.home.homeDirectory; + in + { + enable = true; + createDirectories = true; + pictures = "${home}/Annex/Pictures"; + music = "${home}/Annex/Music"; + }; + }; +} diff --git a/share/home/minimal.nix b/share/home/minimal.nix new file mode 100644 index 0000000..c844000 --- /dev/null +++ b/share/home/minimal.nix @@ -0,0 +1,51 @@ +# This module contains a bunch of things that make up a minimal environment that +# I want on ALL of my machines. +{ pkgs, config, ... }: { + imports = [ ./helix.nix ./zsh.nix ]; + + home.packages = with pkgs; [ + wget + git + age + gnupg + ffmpeg + + # Modern unix + ripgrep # grep + fd # find + sd # sed + dua # du + + git-annex + git-remote-gcrypt + + # tools for dealing with all sorts archives + atool + unzip + gnutar + + # Useful nix tooling + nix-tree + ]; + + xdg.enable = true; + + # Lots of these are courtesy of xdg-ninja + # https://github.com/b3nj5m1n/xdg-ninja + # + # Even though these tools may or may not be installed on any particular system + # having these variables here is a preventative measure to make sure that + # $HOME doesn't get polluted + home.sessionVariables = with config.xdg; { + CARGO_HOME = "${dataHome}/cargo"; + GOPATH = "${dataHome}/go"; + WINEPREFIX = "${dataHome}/wine"; + XCOMPOSECACHE = "${cacheHome}/X11/xcompose"; + GTK2_RC_FILES = "${configHome}/gtk-2.0/gtkrc"; + NODE_REPL_HISTORY = "${dataHome}/node_repl_history"; + NPM_CONFIG_USERCONFIG = "${configHome}/npm/npmrc"; + # shell + HISTFILE = "${stateHome}/shell/history"; + ZDOTDIR = "${configHome}/zsh"; + }; +} -- cgit v1.3.1