nix: set up home-manager

This commit is contained in:
surtur 2022-08-29 00:30:29 +02:00
parent d9ef984661
commit a907d42366
Signed by: wanderer
GPG Key ID: 19CE1EC1D9E0486D
7 changed files with 113 additions and 0 deletions

1
.config/nixpkgs/home.nix Symbolic link
View File

@ -0,0 +1 @@
/home/vis/utils/dotfiles/home.nix

View File

@ -1,6 +1,10 @@
export GOPATH=$HOME/utils/go
export CGO_ENABLED="1"
# make home-manager not manage the shell configuration
HMVARSFILE="$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh"
if [ -f "$HMVARSFILE" ]; then . "$HMVARSFILE"; fi
add_to_path() {
local p=$1
if [[ ! "$PATH" == *"$p"* ]]; then

View File

@ -12,6 +12,10 @@ export AndroidNdkPath=$ANDROID_NDK_PATH
export CCACHE_DISABLE="true"
# https://github.com/NixOS/nix/issues/2033
# https://discourse.nixos.org/t/where-is-nix-path-supposed-to-be-set/16434/8
export NIX_PATH=$HOME/.nix-defexpr/channels:/nix/var/nix/profiles/per-user/vis/channels${NIX_PATH:+:$NIX_PATH}
[ -z "$IN_NIX_SHELL" ] && export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin"

4
.zshrc
View File

@ -157,4 +157,8 @@
eval "$(starship init zsh)"
# make home-manager not manage the shell configuration
HMVARSFILE="$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh"
if [ -f "$HMVARSFILE" ]; then . "$HMVARSFILE"; fi
if [ -e ~/.nix-profile/etc/profile.d/nix.sh ]; then . ~/.nix-profile/etc/profile.d/nix.sh; fi # added by Nix installer...and kept by me

64
flake.lock Normal file
View File

@ -0,0 +1,64 @@
{
"nodes": {
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
],
"utils": "utils"
},
"locked": {
"lastModified": 1661573386,
"narHash": "sha256-pBEg8iY00Af/SAtU2dlmOAv+2x7kScaGlFRDjNoVJO8=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "d89bdff445eadff03fe414e9c30486bc8166b72b",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1661541451,
"narHash": "sha256-LALyT63vpo1sftSmHAbbrj+emfCOo93Jv4xVOIcmnl0=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "38e16b192af13ff6cffc8a35a25f390f1e96b585",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"home-manager": "home-manager",
"nixpkgs": "nixpkgs"
}
},
"utils": {
"locked": {
"lastModified": 1653893745,
"narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

29
flake.nix Normal file
View File

@ -0,0 +1,29 @@
{
description = "Home Manager configuration";
inputs = {
# Specify the source of Home Manager and Nixpkgs.
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { nixpkgs, home-manager, ... }:
let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
in {
homeConfigurations.vis = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
# Specify your home configuration modules here, for example,
# the path to your home.nix.
modules = [ ./home.nix ];
# Optionally use extraSpecialArgs
# to pass through arguments to home.nix
};
};
}

7
home.nix Normal file
View File

@ -0,0 +1,7 @@
{pkgs, ...}: {
home.username = "vis";
home.homeDirectory = "/home/vis";
home.stateVersion = "22.11";
programs.home-manager.enable = true;
programs.home-manager.path = "$HOME/utils/dotfiles";
}