Modularize home-manager config
This commit is contained in:
@@ -22,6 +22,6 @@ nix run \
|
||||
home-manager/master -- \
|
||||
switch \
|
||||
--extra-experimental-features 'nix-command flakes' \
|
||||
--flake .#artem
|
||||
--flake .#linux-headless
|
||||
stow legacy
|
||||
```
|
||||
|
||||
48
flake.lock
generated
Normal file
48
flake.lock
generated
Normal file
@@ -0,0 +1,48 @@
|
||||
{
|
||||
"nodes": {
|
||||
"home-manager": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1770491427,
|
||||
"narHash": "sha256-8b+0vixdqGnIIcgsPhjdX7EGPdzcVQqYxF+ujjex654=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "cbd8a72e5fe6af19d40e2741dc440d9227836860",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1770197578,
|
||||
"narHash": "sha256-AYqlWrX09+HvGs8zM6ebZ1pwUqjkfpnv8mewYwAo+iM=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "00c21e4c93d963c50d4c0c89bfa84ed6e0694df2",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"home-manager": "home-manager",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
55
flake.nix
55
flake.nix
@@ -15,56 +15,39 @@
|
||||
nixpkgs,
|
||||
home-manager,
|
||||
}:
|
||||
let
|
||||
commonModules = [ ./modules/home.nix ];
|
||||
in
|
||||
{
|
||||
homeConfigurations."artem" = home-manager.lib.homeManagerConfiguration {
|
||||
homeConfigurations."linux-headless" = home-manager.lib.homeManagerConfiguration {
|
||||
pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
||||
modules = commonModules ++ [
|
||||
(
|
||||
{ ... }:
|
||||
{
|
||||
home.username = "artem";
|
||||
home.homeDirectory = "/home/artem";
|
||||
}
|
||||
)
|
||||
];
|
||||
};
|
||||
|
||||
homeConfigurations."mac-portable" = home-manager.lib.homeManagerConfiguration {
|
||||
pkgs = nixpkgs.legacyPackages.x86_64-darwin;
|
||||
|
||||
modules = [
|
||||
modules = commonModules ++ [
|
||||
(
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
home.username = "artem";
|
||||
home.homeDirectory = "/Users/artem";
|
||||
home.stateVersion = "25.11";
|
||||
|
||||
# vscode
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
|
||||
home.packages = with pkgs; [
|
||||
git
|
||||
vim
|
||||
stow
|
||||
secretive
|
||||
];
|
||||
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
initContent = ''
|
||||
. ~/dotfiles/migrated/.zshrc
|
||||
|
||||
# Outside NixOS, we need to load this manually. Same on MacOS, if /etc/zshrc
|
||||
# is reset to its default content (post-upgrade).
|
||||
if [ -r '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then
|
||||
. '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'
|
||||
fi
|
||||
'';
|
||||
};
|
||||
|
||||
programs.home-manager.enable = true;
|
||||
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
programs.vscode.enable = true;
|
||||
|
||||
programs.direnv = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
nix-direnv.enable = true;
|
||||
|
||||
config.global = {
|
||||
warn_timeout = "30s";
|
||||
hide_env_diff = true;
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
)
|
||||
];
|
||||
|
||||
37
modules/home.nix
Normal file
37
modules/home.nix
Normal file
@@ -0,0 +1,37 @@
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
home.packages = with pkgs; [
|
||||
git
|
||||
vim
|
||||
stow
|
||||
screen
|
||||
];
|
||||
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
initContent = ''
|
||||
. ~/dotfiles/migrated/.zshrc
|
||||
|
||||
# Outside NixOS, we need to load this manually. Same on MacOS, if
|
||||
# /etc/zshrc is reset to its default content (post-upgrade).
|
||||
if [ -r /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh ]; then
|
||||
. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
|
||||
fi
|
||||
'';
|
||||
};
|
||||
|
||||
programs.home-manager.enable = true;
|
||||
|
||||
programs.direnv = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
nix-direnv.enable = true;
|
||||
|
||||
config.global = {
|
||||
warn_timeout = "30s";
|
||||
hide_env_diff = true;
|
||||
};
|
||||
};
|
||||
|
||||
home.stateVersion = "25.11"; # never modify
|
||||
}
|
||||
Reference in New Issue
Block a user