home-manager-ext: init
To allow using my home-manager config on Darwin (and other non-NixOS machines), I introduce the concept of home-manager-ext, which gives me a much easier hook to import my config elsewhere.
This commit is contained in:
parent
0f86867d05
commit
80e85feede
5 changed files with 42 additions and 11 deletions
1
home-manager-ext.nix
Normal file
1
home-manager-ext.nix
Normal file
|
@ -0,0 +1 @@
|
|||
(import ./. {}).ops.home-manager-ext
|
|
@ -6,4 +6,6 @@ args: {
|
|||
nixos = import ./nixos args;
|
||||
maint = import ./maint args;
|
||||
secrets = import ./secrets args;
|
||||
|
||||
home-manager-ext = import ./home-manager-ext.nix args;
|
||||
}
|
||||
|
|
13
ops/home-manager-ext.nix
Normal file
13
ops/home-manager-ext.nix
Normal file
|
@ -0,0 +1,13 @@
|
|||
{ depot, ... }@args:
|
||||
let
|
||||
cfg = configName: configPath: { ... }: {
|
||||
_module.args = args // {
|
||||
inherit configName;
|
||||
};
|
||||
imports = [ configPath ];
|
||||
};
|
||||
in
|
||||
{
|
||||
base = cfg "base" nixos/lib/home-manager/common.nix;
|
||||
client = cfg "client" nixos/lib/home-manager/client.nix;
|
||||
}
|
|
@ -1,4 +1,7 @@
|
|||
{ depot, lib, pkgs, ... }:
|
||||
let
|
||||
inherit (pkgs.stdenv.hostPlatform) isDarwin isLinux;
|
||||
in
|
||||
{
|
||||
imports = [ ./common.nix ];
|
||||
|
||||
|
@ -13,7 +16,6 @@
|
|||
};
|
||||
};
|
||||
programs.direnv.enable = true;
|
||||
programs.bash.enableVteIntegration = true;
|
||||
programs.vim = {
|
||||
plugins = (with pkgs.vimPlugins; [
|
||||
vim-go
|
||||
|
@ -35,15 +37,16 @@
|
|||
ssh-add -q -l >/dev/null || ssh-add -c -q
|
||||
'';
|
||||
|
||||
home.packages = lib.mkAfter (with pkgs; [
|
||||
depot.nix.pkgs.copybara
|
||||
home.packages = lib.mkAfter (with pkgs; ([
|
||||
iftop
|
||||
htop
|
||||
iotop
|
||||
go
|
||||
gopls
|
||||
goimports
|
||||
graphicsmagick-imagemagick-compat
|
||||
youtube-dl
|
||||
]);
|
||||
] ++ lib.optionals isLinux [
|
||||
depot.nix.pkgs.copybara
|
||||
iotop
|
||||
]));
|
||||
}
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
{ depot, lib, pkgs, ... }:
|
||||
{ config, configName, depot, lib, pkgs, ... }:
|
||||
let
|
||||
inherit (pkgs.stdenv.hostPlatform) isDarwin isLinux;
|
||||
in
|
||||
{
|
||||
programs.home-manager.enable = true;
|
||||
programs.home-manager.enable = !isDarwin;
|
||||
|
||||
home.username = "lukegb";
|
||||
home.homeDirectory = "/home/lukegb";
|
||||
home.homeDirectory = if isDarwin then "/Users/lukegb" else "/home/lukegb";
|
||||
home.file = {
|
||||
".hgrc".source = ./hgrc;
|
||||
};
|
||||
|
@ -32,7 +35,7 @@
|
|||
|
||||
programs.bash = {
|
||||
enable = true;
|
||||
enableVteIntegration = true;
|
||||
enableVteIntegration = !isDarwin;
|
||||
|
||||
initExtra = ''
|
||||
function join_by { local IFS="$1"; shift; echo "$*"; }
|
||||
|
@ -68,11 +71,20 @@
|
|||
};
|
||||
programs.vim.enable = true;
|
||||
|
||||
home.packages = (with pkgs; [
|
||||
home.packages = (with pkgs; ([
|
||||
ripgrep
|
||||
whois
|
||||
dnsutils
|
||||
]);
|
||||
] ++ lib.optionals isDarwin [
|
||||
(writeShellScriptBin "home-manager" ''
|
||||
#!/bin/sh
|
||||
exec "${home-manager}/bin/home-manager" -f "${config.home.homeDirectory}/depot/home-manager-ext.nix" -A "${configName}" "$@"
|
||||
'')
|
||||
rxvt_unicode.terminfo tmux rsync libarchive tcpdump restic
|
||||
(mercurial.overridePythonAttrs (origAttrs: {
|
||||
propagatedBuildInputs = origAttrs.propagatedBuildInputs ++ [python3Packages.hg-evolve depot.nix.pkgs.hg-git];
|
||||
}))
|
||||
]));
|
||||
|
||||
home.stateVersion = "20.09";
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue