Skip to main content

Home Manager Setup

Manage user environments with Home Manager

Manage personal configuration files and profiles with Home Manager, similar to the way that system configuration is performed, but don't require users to have root access.

This is a work in progress.

TODO

  • Optimize path when first installing via nix-shell

Make sure NixOS can handle Nix Flakes and nix-command

# ~/etc/nixos/configuration.nix.config/nix/nix.conf

  nix = {
    package = pkgs.nixFlakes;
    extraOptions = ''
      experimental-features = nix-command flakes
    '';
  };

As the user add home manager channel

nix-channel --add https://github.com/nix-community/home-manager/archive/release-23.05.tar.gz home-manager
nix-channel --update

Logout and log back in to install

nix-shell '<home-manager>' -A install

This will create a default configuration flie at ~/.config/home-manager/home.nix. Clone a repository into the folder like so.

rm -rf ~/.config/home-manager
git clone https://github.com/tiredofit/home.git ~/.config/home-manager

If no repo, there should be at the very least the following:

# ~.config/home-manager/flake.nix

{
  description = "Tired of I.T! Home Manager NixOS configuration";

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05";
    home-manager.manager = {
      url = "github:nix-community/home-manager/release-23.05"manager";
      home-manager.inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs = inputs@{ self,{ nixpkgs, nixpkgs-unstable, home-manager, ... }:
    {
      homeConfigurations = {
        dave = inputs.home-manager.lib.homeManagerConfiguration {let
      system = "x86_64-linux";
      homeDirectorypkgs = "/home/dave"nixpkgs.legacyPackages.${system};
          username = "dave";
          stateVersion = "23.05";
          configuration = { config, pkgs, ... }:
    in {
      nixpkgs.overlayshomeConfigurations.dave = [ ];
              nixpkgs.config =home-manager.lib.homeManagerConfiguration {
        allowUnfreeinherit =pkgs;

        true;
                allowBroken = true;
              };

              importsmodules = [
          ./home.nix
        ];
      };
        };
      };
          dave = self.homeConfigurations.dave.activationPackage;
          defaultPackage.x86_64-linux = self.dave;
    };
}

# ~/.config/home-manager/home.nix

{ config, pkgs, ... }:

  {

  imports = [
  home =];

{
  home = {
    packagesusername = with"dave";
    pkgs;homeDirectory [= ]))"/home/dave";
    ]stateVersion = "23.05";

    language = {
      base = "en_US.UTF-8";
      address = "en_US.UTF-8";
      collate = "en_US.UTF-8";
      ctype = "en_US.UTF-8";
      measurement ="en_US.UTF-8";
      messages ="en_US.UTF-8";
      monetary ="en_US.UTF-8";
      name = "en_US.UTF-8";
      numeric ="en_US.UTF-8";
      paper = "en_US.UTF-8";
      time = "en_US.UTF-8";
    };
  };

  nixpkgs = {
    config = {
      allowUnfree = true;
      allowUnfreePredicate = (_: true);
    };
  };

  programs = {
    home-manager.enable = true;
    direnv = {
      enable = true;
      nix-direnv = {
        enable = true;
      };
    };
  };
}

Activate Home Manager

home-manager switch --flake ~/.config/nixpkgs/home-manager/#dave -v

Keeping things up to date

Update Repository changes

nix flake update ~/.config/home-manager