From 7545255f78b71a9665a6d153384778716bebdc7c Mon Sep 17 00:00:00 2001 From: Mihai Fufezan Date: Fri, 9 Sep 2022 17:53:49 +0300 Subject: [PATCH] Nix: add HM install info --- pages/Nix/_index.md | 44 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/pages/Nix/_index.md b/pages/Nix/_index.md index 5e827dd..be95f53 100644 --- a/pages/Nix/_index.md +++ b/pages/Nix/_index.md @@ -70,10 +70,50 @@ in { You can use the Home Manager module by adding it to your configuration: +### With flakes + ```nix -{ config, pkgs, inputs, ... }: { +# flake.nix +{ + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + hyprland = { + url = "github:hyprwm/Hyprland"; + # build with your own instance of nixpkgs + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = { self, nixpkgs, home-manager, hyprland }: { + homeConfigurations."USER@HOSTNAME"= home-manager.lib.homeManagerConfiguration { + pkgs = nixpkgs.legacyPackages.x86_64-linux; + modules = [ + hyprland.homeManagerModules.default + { wayland.windowManager.hyprland.enable = true; } + # ... + ]; + }; + }; +``` + +Don't forget to replace `USER@HOSTNAME` with your username and hostname! + +### Without flakes + +```nix +# home config +{ config, pkgs, inputs, ... }: let + flake-compat = builtins.fetchTarball "https://github.com/edolstra/flake-compat/archive/master.tar.gz"; + hyprland = (import flake-compat { + src = builtins.fetchTarball "https://github.com/hyprwm/Hyprland/archive/master.tar.gz"; + }).defaultNix; +in { imports = [ - inputs.hyprland.homeManagerModules.default + hyprland.homeManagerModules.default ]; wayland.windowManager.hyprland.enable = true;