Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Canonical home manager configurations #112

Draft
wants to merge 15 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions home/baseline.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[
./profiles/core/default.nix
./profiles/atuin.nix
./profiles/development/nix-tools.nix
./profiles/direnv.nix
./profiles/fzf.nix
./profiles/git/default.nix
./profiles/helix.nix
./profiles/navi.nix
./profiles/nnn.nix
./profiles/nvim/default.nix
./profiles/rclone.nix
./profiles/shells/zsh/default.nix
./profiles/shells/zsh/with-grml.nix
./profiles/ssh.nix
./profiles/zellij.nix
./profiles/zoxide.nix
]
67 changes: 41 additions & 26 deletions home/default.nix
Original file line number Diff line number Diff line change
@@ -1,22 +1,53 @@
{
config,
self,
ops,
inputs,
flake-parts-lib,
withSystem,
...
}:
let
inherit (self) inputs;
inherit (self.lib.hm) makeHomeConfiguration;
inherit (inputs.apparat.lib.hm) mkHomeConfigurations;
inherit (inputs) home-manager;
inherit (flake-parts-lib) importApply;

# features = import ./features.nix { homeProfiles = profiles; };
profiles = import ./profiles.nix { inherit (inputs) haumea; };
initUserModule =
{ username }:
{ lib, ... }:
{
# TODO: imports = [ ../users/${username}/identity.nix ];

home.username = username;
home.homeDirectory = lib.mkDefault "/home/${username}";
};

initNixpkgsModule = importApply ../packages/nixpkgs-config.nix;

makeHomeConfiguration =
username: system:
{
modules ? [ ],
overlays ? [ ],
allowUnfree ? false,
}:
(home-manager.lib.homeManagerConfiguration {
pkgs = withSystem system (ctx: ctx.pkgs);
modules =
modules
++ (import ./modules-list.nix)
++ (import ./baseline.nix)
++ [
(initUserModule { inherit username; })
(initNixpkgsModule { inherit allowUnfree overlays; })
];
extraSpecialArgs = self.lib.specialArgsFor system;
});
in
{
flake = {
# TODO: invert this approach -- make system configs import pre-defined home
# configs or something like that. see ~misterio77/nixos-config
homeConfigurations = (mkHomeConfigurations config.flake.nixosConfigurations);
homeConfigurations = {
"cdom@tuvok" = makeHomeConfiguration "cdom" "aarch64-linux" {
modules = [ ../users/cdom/at-tuvok.nix ];
};
};

homeModules = {
"theme" = import ./modules/theme/default.nix;
Expand All @@ -26,20 +57,4 @@ in
"programs/liquidprompt" = import ./modules/programs/liquidprompt.nix;
};
};

perSystem = _perSystem: {
homeConfigurations = {
traveller = makeHomeConfiguration "cdom" {
modules = [
profiles.development.work

{
_module.args = {
inherit ops;
};
}
];
};
};
};
}
105 changes: 42 additions & 63 deletions home/features.nix
Original file line number Diff line number Diff line change
@@ -1,68 +1,47 @@
{ homeProfiles }:
let
base = [
homeProfiles.core.default
homeProfiles.atuin
homeProfiles.development.nix-tools
homeProfiles.direnv
homeProfiles.fzf
homeProfiles.git.default
homeProfiles.helix
homeProfiles.navi
homeProfiles.nnn
homeProfiles.nvim.default
homeProfiles.rclone
homeProfiles.shells.zsh.default
homeProfiles.shells.zsh.with-grml
homeProfiles.ssh
homeProfiles.zellij
homeProfiles.zoxide
];

developer = base ++ [
homeProfiles.difftools.delta
homeProfiles.emacs.default
homeProfiles.git-sync
homeProfiles.just
homeProfiles.python
homeProfiles.zellij
developer = [
./profiles/difftools/delta.nix
./profiles/emacs/default.nix
./profiles/git-sync.nix
./profiles/just.nix
./profiles/python.nix
./profiles/zellij.nix
];

graphical = [
homeProfiles.chromium
homeProfiles.desktop.common
homeProfiles.firefox.default
homeProfiles.keyboard.default
homeProfiles.kitty.default
homeProfiles.foot
homeProfiles.media-client
homeProfiles.spotify
homeProfiles.theme.default
homeProfiles.yt-dlp
./profiles/chromium.nix
./profiles/desktop/common.nix
./profiles/firefox/default.nix
./profiles/keyboard/default.nix
./profiles/kitty/default.nix
./profiles/foot.nix
./profiles/media-client.nix
./profiles/spotify.nix
./profiles/theme/default.nix
./profiles/yt-dlp.nix
# FIXME: nix-managed preferences don't work well with stateful changes (e.g. font size, theme, etc.)
# vscode
];

# TODO: move to user-specific dir -- "personalisation" depends on preference anyway
personalised = [
homeProfiles.apple-music
homeProfiles.espanso.default
homeProfiles.newsboat
homeProfiles.obs-studio
homeProfiles.rclone
homeProfiles.spotify
homeProfiles.sync
./profiles/apple-music.nix
./profiles/espanso/default.nix
./profiles/newsboat.nix
./profiles/obs-studio.nix
./profiles/rclone.nix
./profiles/spotify.nix
./profiles/sync.nix
];

trusted = [
homeProfiles.gpg.default
homeProfiles.secrets.password-store
homeProfiles.secrets.rbw
./profiles/gpg/default.nix
./profiles/secrets/password-store.nix
./profiles/secrets/rbw.nix
];

features = {
inherit
base
developer
graphical
personalised
Expand All @@ -75,21 +54,21 @@ let
++ personalised
++ trusted
++ [
homeProfiles.desktop.applications.okular
homeProfiles.desktop.applications.xournal
homeProfiles.development.common
homeProfiles.development.data-wrangling
homeProfiles.emacs.default
homeProfiles.emacs.org-protocol
homeProfiles.git.repo-manager
homeProfiles.git.with-pgp-signing
homeProfiles.kitty.default
homeProfiles.ledger
homeProfiles.pandoc
homeProfiles.sync
homeProfiles.vhs
homeProfiles.writing
homeProfiles.yubikey
./profiles/desktop/applications/okular.nix
./profiles/desktop/applications/xournal.nix
./profiles/development/common.nix
./profiles/development/data-wrangling.nix
./profiles/emacs/default.nix
./profiles/emacs/org-protocol.nix
./profiles/git/repo-manager.nix
./profiles/git/with-pgp-signing.nix
./profiles/kitty/default.nix
./profiles/ledger.nix
./profiles/pandoc.nix
./profiles/sync.nix
./profiles/vhs.nix
./profiles/writing.nix
./profiles/yubikey.nix
];
};
in
Expand Down
1 change: 1 addition & 0 deletions home/modules-list.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[
./modules/dotfield/features.nix
./modules/dotfield/paths.nix
./modules/dotfield/whoami.nix
./modules/theme/default.nix
Expand Down
13 changes: 13 additions & 0 deletions home/modules/dotfield/features.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
moduleArgs@{ config, ... }:
let
inherit (config.home) homeDirectory;
osCfg = moduleArgs.osConfig.dotfield or false;
fsPath = osCfg.paths.fsPath or "${homeDirectory}/.config/dotfield";
in
{
options.dotfield.features = { };

config = {
home.sessionVariables."DOTFIELD_DIR" = fsPath;
};
}
2 changes: 1 addition & 1 deletion home/modules/theme/__colorScheme.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{ flake }:
{ config, ... }:
let
inherit (flake.self.lib.theme) derivePolarity;
inherit (flake.lib.theme) derivePolarity;
inherit (flake.inputs) apparat;
inherit (apparat.lib.color) fromHex toHex2;
inherit (apparat.types.color) rgbChannelDec rgbChannelHex rgbHex;
Expand Down
2 changes: 1 addition & 1 deletion home/modules/theme/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
}:
let
inherit (flake.inputs) apparat base16-schemes;
inherit (flake.self.lib.theme) mkColorScheme;
inherit (flake.lib.theme) mkColorScheme;
inherit (apparat.lib) mkOpt;
inherit (base16-schemes.lib) schemes;
inherit (l.types) str int;
Expand Down
2 changes: 1 addition & 1 deletion home/profiles/core/home-packages.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{ pkgs, flake, ... }:
{
home.packages = [
flake.perSystem.packages.ddi # <- "nice dd setup for most cases" => <https://git.sr.ht/~rycee/configurations/tree/1af2ef3d4c8778b0fb2b12934d3a3f1766ce1d9f/item/user/common.nix#L62-66>
flake.packages.ddi # <- "nice dd setup for most cases" => <https://git.sr.ht/~rycee/configurations/tree/1af2ef3d4c8778b0fb2b12934d3a3f1766ce1d9f/item/user/common.nix#L62-66>

pkgs.fx # <- interactive terminal json viewer => <https://github.com/antonmedv/fx>
pkgs.glow # <- charmbracelet's markdown cli renderer
Expand Down
2 changes: 1 addition & 1 deletion home/profiles/development/php.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
pkgs.wp-cli

# Provides DAP connection to Xdebug for editor support
flake.perSystem.packages.vscode-php-debug
flake.packages.vscode-php-debug
];

home.sessionVariables = {
Expand Down
2 changes: 1 addition & 1 deletion home/profiles/emacs/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
}:
let
inherit (pkgs.stdenv.hostPlatform) isDarwin;
inherit (flake.perSystem.inputs') emacs-overlay nil-lsp;
inherit (flake.inputs') emacs-overlay nil-lsp;

cfg = config.programs.emacs;

Expand Down
2 changes: 1 addition & 1 deletion home/profiles/firefox/profiles.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ hmArgs@{
}:
let
inherit (flake.inputs) apparat haumea;
inherit (flake.perSystem.inputs') firefox-addons;
inherit (flake.inputs') firefox-addons;
inherit (apparat.lib.firefox) evalSettings;
inherit (pkgs.stdenv) hostPlatform;
inherit (pkgs.stdenv.hostPlatform) isLinux;
Expand Down
4 changes: 1 addition & 3 deletions home/profiles/firefox/settings/common.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# TODO: add docs for all "magical" numeric values
{
flake,
theme,
osConfig,
lib,
Expand All @@ -9,8 +8,7 @@
let
# FIXME: only do theme stuff if theme enabled for user
inherit (theme) fonts;
l = flake.inputs.nixpkgs.lib // builtins;
hostName = osConfig.networking.hostName or (l.getEnv "HOSTNAME");
hostName = osConfig.networking.hostName or (builtins.getEnv "HOSTNAME");
in
{
"browser.bookmarks.showMobileBookmarks" = true;
Expand Down
2 changes: 1 addition & 1 deletion home/profiles/fzf.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ let
dirPreviewCommand = l.getExe pkgs.eza + " --tree {} | head -n 200";
in
{
home.packages = [ flake.perSystem.packages.igr ];
home.packages = [ flake.packages.igr ];

programs.fzf = {
enable = true;
Expand Down
2 changes: 1 addition & 1 deletion home/profiles/git/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
...
}:
let
inherit (flake.perSystem) packages;
inherit (flake) packages;
inherit (config.dotfield.whoami) email fullName githubUserName;
in
{
Expand Down
2 changes: 1 addition & 1 deletion home/profiles/git/repo-manager.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ lib, flake, ... }:
{
home.packages = lib.singleton flake.perSystem.packages.git-repo-manager;
home.packages = lib.singleton flake.packages.git-repo-manager;
}
1 change: 0 additions & 1 deletion home/profiles/media-client.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ in
imports = [
./mpv.nix
./jellyfin-client.nix
./plex-client.nix
];

xdg.mimeApps.defaultApplications =
Expand Down
Loading
Loading