diff --git a/.config/nixpkgs/home.nix b/.config/nixpkgs/home.nix new file mode 120000 index 0000000..13ccbad --- /dev/null +++ b/.config/nixpkgs/home.nix @@ -0,0 +1 @@ +/home/vis/utils/dotfiles/home.nix \ No newline at end of file diff --git a/.zprofile b/.zprofile index 2c93119..ef3d198 100644 --- a/.zprofile +++ b/.zprofile @@ -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 diff --git a/.zshenv b/.zshenv index 52c398d..bb4b4d0 100644 --- a/.zshenv +++ b/.zshenv @@ -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" diff --git a/.zshrc b/.zshrc index 964d11d..227d1ae 100644 --- a/.zshrc +++ b/.zshrc @@ -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 diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..7d4a7dd --- /dev/null +++ b/flake.lock @@ -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 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..969c202 --- /dev/null +++ b/flake.nix @@ -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 + }; + }; +} diff --git a/home.nix b/home.nix new file mode 100644 index 0000000..86ab24a --- /dev/null +++ b/home.nix @@ -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"; +}