From c8959e850db9d9e44d9735f3b4a743723faae0c0 Mon Sep 17 00:00:00 2001 From: Tibo De Peuter Date: Tue, 17 Oct 2023 23:09:40 +0200 Subject: [PATCH] Add user module --- nixos/flake.nix | 4 +- nixos/modules/users/default.nix | 5 ++ nixos/modules/users/tdpeuter/default.nix | 80 ++++++++++++++++++++++++ 3 files changed, 88 insertions(+), 1 deletion(-) create mode 100644 nixos/modules/users/default.nix create mode 100644 nixos/modules/users/tdpeuter/default.nix diff --git a/nixos/flake.nix b/nixos/flake.nix index 988ba1f..59776e4 100644 --- a/nixos/flake.nix +++ b/nixos/flake.nix @@ -55,7 +55,9 @@ modules = [ home-manager.nixosModule sops-nix.nixosModules.sops - ./modules-old + ./modules + + ./modules-old # Wordt stilaan weggewerkt ]; }; diff --git a/nixos/modules/users/default.nix b/nixos/modules/users/default.nix new file mode 100644 index 0000000..a48b2c4 --- /dev/null +++ b/nixos/modules/users/default.nix @@ -0,0 +1,5 @@ +{ + imports = [ + ./tdpeuter + ]; +} diff --git a/nixos/modules/users/tdpeuter/default.nix b/nixos/modules/users/tdpeuter/default.nix new file mode 100644 index 0000000..503f9ba --- /dev/null +++ b/nixos/modules/users/tdpeuter/default.nix @@ -0,0 +1,80 @@ +{ config, lib, pkgs, ... }: + +let + cfg = config.sisyphus.users.tdpeuter; + + installedPkgs = config.home-manager.users.tdpeuter.home.packages; +in { + options.sisyphus.users.tdpeuter.enable = lib.mkEnableOption "user Tibo De Peuter"; + + config = lib.mkIf cfg.enable { + users.users.tdpeuter = { + description = "Tibo De Peuter"; + isNormalUser = true; + extraGroups = [ + config.users.groups.keys.name + config.users.groups.networkmanager.name + config.users.groups.wheel.name + ]; + initialPassword = "ChangeMe"; + }; + + home-manager.users.tdpeuter = lib.mkIf config.sisyphus.programs.home-manager.enable { + programs.home-manager.enable = true; + + home = { + username = "tdpeuter"; + homeDirectory = "/home/tdpeuter"; + stateVersion = config.system.stateVersion; + + # If you specify an application here, it will be detected by the configuration module + # and the configuration files will be put in place for you. + packages = with pkgs; [ + brave + duf + jellyfin-media-player + libreoffice-fresh + nextcloud-client + nsxiv + obsidian + qalculate-gtk + spotify + unzip + zathura + zenith-nvidia + ]; + + file = { + ".config/alacritty" = lib.mkIf (builtins.elem pkgs.alacritty installedPkgs) { + source = ../../../../stow/alacritty/.config/alacritty; + }; + }; + }; + + xdg.mimeApps = { + enable = true; + + defaultApplications = let + browser = "firefox.desktop"; + image-viewer = "nsxiv.desktop"; + pdf-viewer = "org.pwmt.zathura-pdf-mupdf.desktop"; + in { + "application/pdf" = pdf-viewer; + "application/x-extension-htm" = browser; + "application/x-extension-html" = browser; + "application/x-extension-shtml" = browser; + "application/x-extension-xht" = browser; + "application/x-extension-xhtml" = browser; + "application/xhtml+xml" = browser; + "image/jpeg" = image-viewer; + "image/png" = image-viewer; + "image/webp" = image-viewer; + "text/html" = browser; + "x-scheme-handler/chrome" = browser; + "x-scheme-handler/http" = browser; + "x-scheme-handler/https" = browser; + }; + }; + }; + }; +}