From c41d82df35d11a4b707fb68dea040c49af425438 Mon Sep 17 00:00:00 2001 From: jopejoe1 Date: Fri, 19 May 2023 21:34:43 +0200 Subject: [PATCH] Add home-manager --- flake.nix | 15 ++ modules/users/jopejoe1/default.nix | 4 + modules/users/jopejoe1/home.nix | 218 +++++++++++++++++++++++++++++ 3 files changed, 237 insertions(+) create mode 100644 modules/users/jopejoe1/home.nix diff --git a/flake.nix b/flake.nix index e3c9724..2ae8fb0 100644 --- a/flake.nix +++ b/flake.nix @@ -44,12 +44,27 @@ nixos-hardware.nixosModules.common-pc nixos-hardware.nixosModules.common-hidpi nixos-hardware.nixosModules.common-pc-ssd + nur.nixosModules.nur + home-manager.nixosModules.home-manager { nixpkgs = { config.allowUnfree = true; overlays = [ prismlauncher.overlays.default nur.overlay ]; }; + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + }; + system.stateVersion = "23.05"; + + nix.registry = { + home-manager.flake = home-manager; + nixos-hardware.flake = nixos-hardware; + nur.flake = nur; + nixpkgs.flake = nixpkgs; + }; + nix.nixPath = [ "nixpkgs=/etc/channels/nixpkgs" "nixos-config=/etc/nixos/configuration.nix" "/nix/var/nix/profiles/per-user/root/channels" ]; } ]; }; diff --git a/modules/users/jopejoe1/default.nix b/modules/users/jopejoe1/default.nix index e621cd8..721895b 100644 --- a/modules/users/jopejoe1/default.nix +++ b/modules/users/jopejoe1/default.nix @@ -1,6 +1,10 @@ { pkgs, ... }: { + imports = [ + ./home.nix + ]; + users.users.jopejoe1 = { isNormalUser = true; description = "jopejoe1 🚫"; diff --git a/modules/users/jopejoe1/home.nix b/modules/users/jopejoe1/home.nix new file mode 100644 index 0000000..29e1bad --- /dev/null +++ b/modules/users/jopejoe1/home.nix @@ -0,0 +1,218 @@ +{ config, pkgs, lib, ... }: + +let hcfg = config.home-manager.users.jopejoe1; +in { + home-manager.users.jopejoe1 = { + home = { + # Basic information for home-manager + username = "jopejoe1"; + homeDirectory = "/home/${hcfg.home.username}"; + + # Enviroment variables + sessionVariables = { + XCOMPOSECACHE = "${hcfg.xdg.cacheHome}/X11/xcompos"; + XAUTHORITY = "$XDG_RUNTIME_DIR/Xauthority"; + }; + + stateVersion = config.system.stateVersion; + }; + + accounts.email.accounts = { + main = { + address = "johannes@joens.email"; + flavor = "gmail.com"; + primary = true; + realName = "Johannes Joens"; + thunderbird.enable = true; + }; + }; + + # XDG base dirs + xdg = { + enable = true; + mime.enable = true; + cacheHome = "${hcfg.home.homeDirectory}/.cache"; + configHome = "${hcfg.home.homeDirectory}/.config"; + dataHome = "${hcfg.home.homeDirectory}/.local/share"; + stateHome = "${hcfg.home.homeDirectory}/.local/state"; + userDirs = { + enable = true; + createDirectories = false; + desktop = "${hcfg.home.homeDirectory}/Desktop"; + documents = "${hcfg.home.homeDirectory}/Documents"; + download = "${hcfg.home.homeDirectory}/Downloads"; + music = "${hcfg.home.homeDirectory}/Music"; + pictures = "${hcfg.home.homeDirectory}/Pictures"; + publicShare = "${hcfg.home.homeDirectory}/Public"; + templates = "${hcfg.home.homeDirectory}/Templates"; + videos = "${hcfg.home.homeDirectory}/Videos"; + }; + }; + programs = { + home-manager.enable = true; + git = { + enable = true; + package = pkgs.gitAndTools.gitFull; + userEmail = "johannes@joens.email"; + userName = "jopejoe1"; + }; + direnv = { + enable = true; + nix-direnv.enable = true; + }; + firefox = { + enable = true; + package = pkgs.wrapFirefox pkgs.firefox-devedition-unwrapped { + extraPolicies = { + AppAutoUpdate = false; + BackgroundAppUpdate = false; + CaptivePortal = false; + DefaultDownloadDirectory = "${hcfg.xdg.userDirs.download}"; + DisableAppUpdate = true; + DisableFirefoxAccounts = true; + DisableFirefoxStudies = true; + DisableForgetButton = true; + DisableFormHistory = true; + DisableMasterPasswordCreation = true; + DisablePasswordReveal = true; + DisablePocket = true; + DisableSetDesktopBackground = true; + DisableSystemAddonUpdate = true; + DisableTelemetry = true; + DontCheckDefaultBrowser = true; + ExtensionUpdate = false; + HardwareAcceleration = true; + ManualAppUpdateOnly = true; + NoDefaultBookmarks = true; + OfferToSaveLogins = false; + OfferToSaveLoginsDefault = false; + PasswordManagerEnabled = false; + PrimaryPassword = false; + SearchBar = "unified"; + StartDownloadsInTempDirectory = true; + EnableTrackingProtection = { + Value = true; + EmailTracking = true; + Cryptomining = true; + Fingerprinting = true; + Locked = true; + }; + FirefoxHome = { + Highlights = false; + Pocket = false; + Search = true; + Snippets = false; + SponsoredPocket = false; + SponsoredTopSites = false; + TopSites = true; + Locked = true; + }; + UserMessaging = { + ExtensionRecommendations = false; + SkipOnboarding = true; + }; + }; + nameSuffix = "-devedition"; + pname = "firefox-devedition"; + desktopName = "Firefox DevEdition"; + wmClass = "firefox-devedition"; + }; + profiles = { + default = { + extensions = with pkgs.nur.repos.rycee.firefox-addons; [ + ublock-origin + privacy-badger + bitwarden + clearurls + decentraleyes + duckduckgo-privacy-essentials + ghostery + libredirect + privacy-badger + languagetool + fastforward + return-youtube-dislikes + sponsorblock + augmented-steam + steam-database + refined-github + plasma-integration + bypass-paywalls-clean + lovely-forks + search-by-image + skip-redirect + terms-of-service-didnt-read + unpaywall + wappalyzer + wayback-machine + modrinthify + ]; + id = 0; + isDefault = true; + name = "default"; + search = { + default = "DuckDuckGo"; + force = true; + engines = { + "Nix Packages" = { + urls = [{ + template = "https://search.nixos.org/packages"; + params = [ + { + name = "type"; + value = "packages"; + } + { + name = "query"; + value = "{searchTerms}"; + } + ]; + }]; + icon = + "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; + definedAliases = [ "@np" ]; + }; + "NixOS Wiki" = { + urls = [{ + template = "https://nixos.wiki/index.php"; + params = [{ + name = "search"; + value = "{searchTerms}"; + }]; + }]; + icon = + "${hcfg.programs.firefox.profiles.default.search.engines."Nix Packages".icon}"; + definedAliases = [ "@nw" ]; + }; + "Bing".metaData.hidden = true; + "Google".metaData.hidden = true; + "eBay".metaData.hidden = true; + "Amazon.de".metaData.hidden = true; + "Wikipedia (en)".metaData.alias = "@wiki"; + }; + }; + settings = { + "privacy.resistFingerprinting" = true; + "privacy.trackingprotection.fingerprinting.enabled" = true; + "privacy.trackingprotection.cryptomining.enabled" = true; + "dom.event.clipboardevents.enabled" = false; + "dom.battery.enabled" = false; + "browser.safebrowsing.phishing.enabled" = false; + "browser.safebrowsing.malware.enabled" = false; + "browser.zoom.siteSpecific" = true; + "config.trim_on_minimize" = true; + "pdfjs.annotationEditorMode" = 0; + "pdfjs.annotationmode" = 2; + }; + }; + dev-edition-default = { + id = 1; + isDefault = false; + name = "dev-edition-default"; + path = "default"; + }; + }; + }; + }; + }; +}