dotfiles/nix-conf/home-manager/flake.nix

279 lines
9.1 KiB
Nix
Raw Normal View History

2022-11-06 20:23:10 +00:00
{
2023-01-15 09:54:40 +00:00
nixConfig = {
accept-flake-config = true;
experimental-features = "nix-command flakes";
2023-01-19 21:30:25 +00:00
extra-substituters = [
"https://nix-community.cachix.org"
"https://cache.nixos.org"
];
extra-trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
];
2023-03-23 01:11:00 +00:00
max-jobs = 4;
2023-01-15 09:54:40 +00:00
};
2022-11-06 20:23:10 +00:00
description = "simple home-manager config";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-utils.url = "github:numtide/flake-utils";
2023-01-03 20:10:04 +00:00
nixgl.url = "path:./../../out-of-tree/nixGL";
2022-11-09 11:35:28 +00:00
rust-overlay.url = "github:oxalica/rust-overlay";
# Allows default.nix to call onto flake.nix. Useful for nix eval and automations
flake-compat = {
url = "path:../../out-of-tree/flake-compat";
flake = false;
};
kpcli-py = {
url = "github:rebkwok/kpcli";
flake = false;
};
2023-01-12 01:55:28 +00:00
neovim-nightly-overlay = {
url = "github:nix-community/neovim-nightly-overlay";
# Pin to a nixpkgs revision that doesn't have NixOS/nixpkgs#208103 yet
inputs.nixpkgs.url = "github:nixos/nixpkgs?rev=fad51abd42ca17a60fc1d4cb9382e2d79ae31836";
};
nix-index-database = {
url = "github:mic92/nix-index-database";
inputs.nixpkgs.follows = "nixpkgs";
};
2023-02-14 17:06:39 +00:00
nickel.url = "github:tweag/nickel";
2022-11-06 20:23:10 +00:00
};
2022-11-09 13:00:23 +00:00
outputs =
flake_inputs@{ nixpkgs
2022-11-09 13:00:23 +00:00
, home-manager
, nixgl
, rust-overlay
, flake-utils
, kpcli-py
2023-01-10 15:30:52 +00:00
, neovim-nightly-overlay
2023-02-14 17:06:39 +00:00
, nickel
2022-11-09 13:00:23 +00:00
, ...
}:
2022-11-07 18:36:01 +00:00
let
2023-01-13 06:42:21 +00:00
# config_fn:: system -> config
cross_platform = config_fn: ({
packages = builtins.foldl'
(prev: system: prev // {
"${system}" = config_fn system;
})
{ }
flake-utils.lib.defaultSystems;
});
in
cross_platform (system:
let
2023-03-20 04:25:41 +00:00
overlays = import ./../../overlays.nix (flake_inputs // { inherit system; });
2022-11-09 11:35:28 +00:00
# pkgs = nixpkgs.legacyPackages.${system}.appendOverlays overlays;
2022-12-01 02:17:06 +00:00
pkgs = import nixpkgs {
inherit system overlays;
config = { allowUnfree = true; };
2022-12-01 02:17:06 +00:00
};
# lib = (import ../lib { inherit pkgs; lib = pkgs.lib; });
2023-01-15 09:54:40 +00:00
base = import ./base flake_inputs;
inherit (base) mkModuleArgs;
2023-01-13 06:42:21 +00:00
2023-01-14 14:37:40 +00:00
nerd_font_module = { config, pkgs, ... }: {
2022-12-21 11:18:01 +00:00
fonts.fontconfig.enable = true;
2022-12-21 22:49:03 +00:00
home.packages = [
2023-01-13 06:42:21 +00:00
(pkgs.nerdfonts.override { fonts = [ "DroidSansMono" ]; })
2022-12-21 22:49:03 +00:00
];
2022-12-21 11:18:01 +00:00
# For some reasons, Windows es in the font name as DroidSansMono NF
# so we need to override this
base.alacritty.font.family = "DroidSansMono Nerd Font";
};
2022-11-07 18:36:01 +00:00
in
{
2022-12-30 08:45:15 +00:00
debug = {
inherit overlays pkgs base;
};
homeConfigurations =
2023-01-13 06:42:21 +00:00
let
x11_wsl = ''
# x11 output for WSL
export DISPLAY=$(ip route list default | awk '{print $3}'):0
export LIBGL_ALWAYS_INDIRECT=1
'';
in
2023-01-13 06:42:21 +00:00
{
"hungtr" = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = base.modules ++ [
./home.nix
];
# optionally pass inarguments to module
# we migrate this from in-place modules to allow flexibility
# in this case, we can add "home" to input arglist of home.nix
extraSpecialArgs = mkModuleArgs {
inherit pkgs;
myHome = {
username = "hungtr";
homeDirectory = "/home/hungtr";
};
};
2022-11-14 07:50:02 +00:00
};
2022-12-21 11:18:01 +00:00
"hungtr@bao" = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = base.modules ++ [
./home.nix
2023-01-14 14:37:40 +00:00
nerd_font_module
2022-12-28 02:08:07 +00:00
./base/productive_desktop.nix
2023-01-13 00:33:53 +00:00
{
# since home.nix forces us to use keepass, and base.keepass.path
# defaults to a bad value (on purpose), we should configure a
# it to be the proper path
base.keepass.path = "/perso/garden/keepass.kdbx";
2023-01-13 07:24:32 +00:00
base.graphics.useNixGL.defaultPackage = "nixGLNvidia";
base.graphics.useNixGL.enable = true;
2023-01-13 00:33:53 +00:00
}
2022-12-21 11:18:01 +00:00
];
# optionally pass inarguments to module
# we migrate this from in-place modules to allow flexibility
# in this case, we can add "home" to input arglist of home.nix
extraSpecialArgs = mkModuleArgs {
inherit pkgs;
myHome = {
username = "hungtr";
homeDirectory = "/home/hungtr";
};
};
};
2023-01-19 15:28:54 +00:00
# Personal darwin, effectively serves as the Darwin edge channel
2023-03-20 04:25:41 +00:00
"hungtran" = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = base.modules ++ [
./home.nix
{
base.graphics.enable = false;
# don't want to deal with GL stuffs on mac yet :/
base.graphics.useNixGL.defaultPackage = null;
# NOTE: this actually does not exist
2023-01-19 15:28:54 +00:00
base.keepass.path = "/Users/hungtran/keepass.kdbx";
base.alacritty.font.size = 11.0;
}
nerd_font_module
2023-01-19 15:28:54 +00:00
./base/productive_desktop.nix
{
base.private_chromium.enable = false;
}
2023-03-20 04:25:41 +00:00
{
home.packages = [
pkgs.postman
];
}
];
extraSpecialArgs = mkModuleArgs {
inherit pkgs;
myHome = {
username = "hungtran";
homeDirectory = "/Users/hungtran";
};
};
};
2023-01-19 15:28:54 +00:00
# Work darwin
2023-03-20 04:25:41 +00:00
"htran" = home-manager.lib.homeManagerConfiguration {
2023-01-13 06:47:43 +00:00
inherit pkgs;
2023-01-14 14:37:40 +00:00
modules = base.modules ++ [
2023-01-13 06:47:43 +00:00
./home.nix
2023-02-04 21:48:08 +00:00
./base/productive_desktop.nix
./base/darwin-spotlight.nix
2023-02-04 21:48:08 +00:00
{
base.private_chromium.enable = false;
}
2023-01-13 06:47:43 +00:00
{
base.graphics.enable = false;
2023-01-14 14:37:40 +00:00
# don't want to deal with GL stuffs on mac yet :/
2023-01-13 06:56:58 +00:00
base.graphics.useNixGL.defaultPackage = null;
2023-03-20 04:25:41 +00:00
# FIXME: this actually does not exist
2023-01-13 06:47:43 +00:00
base.keepass.path = "/Users/htran/keepass.kdbx";
2023-01-14 14:37:40 +00:00
base.alacritty.font.size = 11.0;
2023-01-19 21:32:03 +00:00
base.git.name = "Hung";
base.git.email = "htran@egihosting.com";
2023-01-13 06:47:43 +00:00
}
{
home.packages = [
pkgs.postman
];
}
2023-01-14 14:37:40 +00:00
nerd_font_module
2023-01-13 06:47:43 +00:00
];
extraSpecialArgs = mkModuleArgs {
inherit pkgs;
myHome = {
username = "htran";
homeDirectory = "/Users/htran";
};
};
};
"nixos@Felia" = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = [
./home.nix
2022-12-11 07:34:36 +00:00
{
base.shells = {
shellInitExtra = ''
'' + x11_wsl;
};
}
];
# optionally pass inarguments to module
# we migrate this from in-place modules to allow flexibility
# in this case, we can add "home" to input arglist of home.nix
extraSpecialArgs = mkModuleArgs {
inherit pkgs;
myHome = {
username = "nixos";
homeDirectory = "/home/nixos";
};
};
};
# NOTE: This is never actually tested. This is for Ubuntu@Felia
# "ubuntu_admin" = home-manager.lib.homeManagerConfiguration {
# inherit pkgs;
# modules = [
# ./home.nix
# ];
# extraSpecialArgs = {
# myLib = lib;
# myHome = {
# username = "ubuntu_admin";
# homeDirectory = "/home/ubuntu_admin";
# shellInitExtra = ''
# '' + x11_wsl;
# };
# };
# };
# Personal laptop
hwtr = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = base.modules ++ [
./home.nix
2022-12-30 08:45:15 +00:00
./base/graphics.nix
{
2022-12-30 08:45:15 +00:00
base.graphics.enable = true;
base.alacritty.font.family = "BitstreamVeraSansMono Nerd Font";
base.keepass.path = "/media/homelab/f/PersistentHotStorage/keepass.kdbx";
}
./base/productive_desktop.nix
];
2023-01-13 06:42:21 +00:00
extraSpecialArgs = mkModuleArgs {
inherit pkgs;
myHome = {
username = "hwtr";
homeDirectory = "/home/hwtr";
2022-12-01 02:17:06 +00:00
packages = [
pkgs.postman
];
};
};
};
};
2023-01-13 06:42:21 +00:00
});
2022-11-06 20:23:10 +00:00
}