Use home-manager directly from flake.nix for non-NixOS (#10)

* wip

* put in same flake.nix

* use home.nix directly

* home2

* finalize
This commit is contained in:
Sridhar Ratnakumar 2021-09-11 22:46:36 -04:00 committed by GitHub
parent bce719e79d
commit e9b3e28af6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 98 additions and 46 deletions

View file

@ -1,6 +1,14 @@
all:
sudo nixos-rebuild switch -j auto && systemctl restart --user emanote
# Not sure why this doesn't reliably work
homeBroken:
nix build --no-link ".#homeConfigurations."`whoami`@`hostname`".activationPackage"
./result/activate
# This requires the symlink to be setup; see README
home:
PATH="${HOME}/.nix-profile/bin/:${PATH}" home-manager switch
freeupboot:
# Delete all but the last few generations

View file

@ -5,6 +5,17 @@ This repository contains the Nix / NixOS configuration for all of my systems. St
VSCode note: <kbd>Ctrl+Shift+B</kbd> will run `sudo nixos-rebuild switch`.
## Non-NixOS
First time run,
```
ln -s /path/to/here ~/.config/nixpkgs # Why? See Makefile
make home
```
Afterwards, feel free to use `home-manager switch`.
## Install notes
- Hetzner dedicated from Linux Rescue system: https://github.com/serokell/nixos-install-scripts/pull/1#pullrequestreview-746593205

View file

@ -57,35 +57,56 @@
{
# The "name" in nixosConfigurations.${name} should match the `hostname`
#
nixosConfigurations.p71 = mkHomeMachine
false
./hosts/p71.nix
[
inputs.nixos-hardware.nixosModules.lenovo-thinkpad-p53
./features/desktopish
#./features/gnome.nix
./features/desktopish/guiapps.nix
./features/server/devserver.nix
./features/ema/emanote.nix
#./features/virtualbox.nix
./features/lxd.nix
#./features/server-mode.nix
# ./features/postgrest.nix
./features/server/devserver.nix
];
nixosConfigurations.x1c7 = mkHomeMachine
./hosts/x1c7.nix
[
inputs.nixos-hardware.nixosModules.lenovo-thinkpad-x1-7th-gen
./features/distributed-build.nix
./features/gnome.nix
./features/desktopish/guiapps.nix
];
nixosConfigurations.facade = mkHomeMachine
true
./hosts/facade.nix
[
];
nixosConfigurations = {
p71 = mkHomeMachine
false
./hosts/p71.nix
[
inputs.nixos-hardware.nixosModules.lenovo-thinkpad-p53
./features/desktopish
#./features/gnome.nix
./features/desktopish/guiapps.nix
./features/server/devserver.nix
./features/ema/emanote.nix
#./features/virtualbox.nix
./features/lxd.nix
#./features/server-mode.nix
# ./features/postgrest.nix
./features/server/devserver.nix
];
x1c7 = mkHomeMachine
./hosts/x1c7.nix
[
inputs.nixos-hardware.nixosModules.lenovo-thinkpad-x1-7th-gen
./features/distributed-build.nix
./features/gnome.nix
./features/desktopish/guiapps.nix
];
facade = mkHomeMachine
true
./hosts/facade.nix
[
];
};
# non-NixOS systems
homeConfigurations =
let
username = "srid";
hostname = "P71";
in
{
# WSL ubuntu
"${username}@${hostname}" = home-manager.lib.homeManagerConfiguration {
inherit username system;
homeDirectory = "/home/${username}";
configuration = import ./home.nix {
inherit inputs system;
bare = false;
pkgs = import nixpkgs { inherit system; };
};
};
};
};
}

View file

@ -1,7 +1,6 @@
# HACK: bare
{ bare ? false, pkgs, inputs, system, ... }:
let
nix-thunk =
(import (builtins.fetchTarball "https://github.com/obsidiansystems/nix-thunk/archive/master.tar.gz") { }).command;
#himalayaSrc = inputs.himalaya;
#himalaya = import ./features/email/himalaya.nix { inherit pkgs inputs system; };
neovim-nightly = inputs.neovim-nightly-overlay.packages.${system}.neovim;
@ -40,11 +39,6 @@ rec {
# latex
# texlive.combined.scheme-full
git-remote-gcrypt
nodePackages.mermaid-cli
asciidoctor
];
programs = {
@ -130,19 +124,37 @@ rec {
bash = {
enable = true;
shellAliases = {
g = "git";
t = "tig";
g = "${pkgs.git}/bin/git";
t = "${pkgs.tig}/bin/tig";
l = "${pkgs.exa}/bin/exa";
ll = "${pkgs.exa}/bin/exa -l";
ls = "l";
#h = "himalaya";
};
sessionVariables = { };
bashrcExtra = ''
. ~/.nix-profile/etc/profile.d/nix.sh
export PATH=$HOME/.nix-profile/bin:$PATH
'';
};
starship = {
enable = true;
};
starship =
{
enable = true;
settings = {
username = {
format = "[$user](bold blue) ";
disabled = false;
show_always = true;
};
hostname = {
ssh_only = false;
format = "on [$hostname](bold red) ";
trim_at = ".companyname.com";
disabled = false;
};
};
};
bat.enable = true;
autojump.enable = false;
@ -154,9 +166,9 @@ rec {
programs.ssh = {
enable = true;
matchBlocks = {
"p71" = {
hostname = "192.168.2.76";
};
#"p71" = {
# hostname = "192.168.2.76";
#};
};
};
@ -168,5 +180,5 @@ rec {
# You can update Home Manager without changing this value. See
# the Home Manager release notes for a list of state version
# changes in each release.
home.stateVersion = "21.03";
# home.stateVersion = "21.03";
}