From 53dc4ac09f201725e8295e085f910688174b92d7 Mon Sep 17 00:00:00 2001 From: Tibo De Peuter Date: Tue, 17 Oct 2023 23:14:25 +0200 Subject: [PATCH] Add home-manager module --- nixos/hosts/Tibo-NixFat/default.nix | 45 +++++++----- nixos/modules-old/default.nix | 69 ------------------- nixos/modules-old/utils/default.nix | 19 ----- nixos/modules/default.nix | 8 +++ nixos/modules/programs/default.nix | 5 ++ .../modules/programs/home-manager/default.nix | 15 ++++ 6 files changed, 55 insertions(+), 106 deletions(-) create mode 100644 nixos/modules/default.nix create mode 100644 nixos/modules/programs/default.nix create mode 100644 nixos/modules/programs/home-manager/default.nix diff --git a/nixos/hosts/Tibo-NixFat/default.nix b/nixos/hosts/Tibo-NixFat/default.nix index 46f8125..9337f45 100644 --- a/nixos/hosts/Tibo-NixFat/default.nix +++ b/nixos/hosts/Tibo-NixFat/default.nix @@ -8,17 +8,17 @@ ../../modules-old/apps/virtualbox ../../modules-old/des/gnome ]; - - boot = { - # Use the systemd-boot EFI boot loader.] - loader = { - systemd-boot.enable = true; - efi = { - canTouchEfiVariables = true; - efiSysMountPoint = "/boot/efi"; - }; - }; + sisyphus = { + users.tdpeuter.enable = true; + + programs = { + home-manager.enable = true; + }; + }; + + boot = { + # Encryption initrd = { # Setup keyfile secrets."/crypto_keyfile.bin" = null; @@ -29,8 +29,25 @@ keyFile = "/crypto_keyfile.bin"; }; }; + + # Use the systemd-boot EFI boot loader.] + loader = { + systemd-boot.enable = true; + efi = { + canTouchEfiVariables = true; + efiSysMountPoint = "/boot/efi"; + }; + }; }; + environment.systemPackages = with pkgs; [ + wget + ]; + + system.stateVersion = "23.05"; + + # --- Barrier --- + networking = { hostName = "Tibo-NixFat"; networkmanager.enable = true; @@ -78,12 +95,4 @@ # Allow unfree packages nixpkgs.config.allowUnfree = true; - - # Copy the NixOS configuration file and link it from the resulting system - # (/run/current-system/configuration.nix). This is useful in case you - # accidentally delete configuration.nix. - # system.copySystemConfiguration = true; - - system.stateVersion = "23.05"; } - diff --git a/nixos/modules-old/default.nix b/nixos/modules-old/default.nix index 570872c..6f44b7a 100644 --- a/nixos/modules-old/default.nix +++ b/nixos/modules-old/default.nix @@ -22,20 +22,6 @@ letter # Personal font ]; - 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"; - packages = with pkgs; [ - home-manager - ]; - }; - # Select internationalisation properties. i18n.defaultLocale = "en_GB.UTF-8"; console = { @@ -47,59 +33,4 @@ layout = "us"; xkbVariant = "altgr-intl"; }; - - home-manager.useGlobalPkgs = true; - - home-manager.users.tdpeuter = { pkgs, ... }: { - home = { - username = "tdpeuter"; - homeDirectory = "/home/tdpeuter"; - stateVersion = "23.05"; - - packages = with pkgs; [ - gnupg - - icosystem - ]; - }; - - programs = { - home-manager.enable = true; - gpg.enable = true; - }; - - services = { - gpg-agent = { - enable = true; - pinentryFlavor = "qt"; - }; - - }; - - xdg.mimeApps = - let - browser = "firefox.desktop"; - image-viewer = "nsxiv.desktop"; - in { - enable = true; - - defaultApplications = { - "application/pdf" = "org.pwmt.zathura-pdf-mupdf.desktop"; - "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; - }; - }; - }; - } diff --git a/nixos/modules-old/utils/default.nix b/nixos/modules-old/utils/default.nix index aeab42c..4b4a5df 100644 --- a/nixos/modules-old/utils/default.nix +++ b/nixos/modules-old/utils/default.nix @@ -9,23 +9,4 @@ ./vim ./zellij ]; - - home-manager.users.tdpeuter = { pkgs, ... }: { - home.packages = with pkgs; [ - direnv - duf - lynx - nsxiv - w3m - wget - zenith-nvidia - ]; - - programs = { - direnv = { - enable = true; - nix-direnv.enable = true; - }; - }; - }; } diff --git a/nixos/modules/default.nix b/nixos/modules/default.nix new file mode 100644 index 0000000..d89efe6 --- /dev/null +++ b/nixos/modules/default.nix @@ -0,0 +1,8 @@ +{ lib, ... }: + +{ + imports = [ + ./programs + ./users + ]; +} diff --git a/nixos/modules/programs/default.nix b/nixos/modules/programs/default.nix new file mode 100644 index 0000000..73b1132 --- /dev/null +++ b/nixos/modules/programs/default.nix @@ -0,0 +1,5 @@ +{ + imports = [ + ./home-manager + ]; +} diff --git a/nixos/modules/programs/home-manager/default.nix b/nixos/modules/programs/home-manager/default.nix new file mode 100644 index 0000000..65e3bf6 --- /dev/null +++ b/nixos/modules/programs/home-manager/default.nix @@ -0,0 +1,15 @@ +{ config, lib, pkgs, ... }: + +let + cfg = config.sisyphus.programs.home-manager; +in { + options.sisyphus.programs.home-manager.enable = lib.mkEnableOption "Home-manager"; + + config = lib.mkIf cfg.enable { + environment.systemPackages = with pkgs; [ + home-manager + ]; + + home-manager.useGlobalPkgs = true; + }; +}