modified config for more modularity

This commit is contained in:
Wyatt J. Miller 2024-09-07 01:52:43 -04:00
parent 9350ff271f
commit cfa75cb28a
5 changed files with 49 additions and 54 deletions

View File

@ -23,7 +23,7 @@
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs-darwin"
"nixpkgs"
]
},
"locked": {
@ -43,25 +43,27 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1722141560,
"narHash": "sha256-Ul3rIdesWaiW56PS/Ak3UlJdkwBrD4UcagCmXZR9Z7Y=",
"owner": "NixOS",
"lastModified": 1725407940,
"narHash": "sha256-tiN5Rlg/jiY0tyky+soJZoRzLKbPyIdlQ77xVgREDNM=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "038fb464fcfa79b4f08131b07f2d8c9a6bcc4160",
"rev": "6f6c45b5134a8ee2e465164811e451dcb5ad86e3",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
"owner": "nixos",
"ref": "nixos-24.05",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-darwin": {
"locked": {
"lastModified": 1722153173,
"narHash": "sha256-S46RmS9WkBOTLORpnWsNth4Ae6TlfJS9TKXqB55YQy4=",
"lastModified": 1725498621,
"narHash": "sha256-m12se55InZz03onhRji85deKJp4i0jrw980aDdxT0IM=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "7bba2df68503b68634e0070483ddaf6d59dc6530",
"rev": "0409a1b650bb50c225485f2ca21c325eb33f45c7",
"type": "github"
},
"original": {

View File

@ -1,8 +1,8 @@
{
description = "Wyatt's nix configuration suite";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-24.05";
# nixpkgs-darwin.url = "github:nixos/nixpkgs/nixpkgs-24.05-darwin";
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
nixpkgs-darwin.url = "github:nixos/nixpkgs/nixpkgs-24.05-darwin";
home-manager = {
url = "github:nix-community/home-manager/release-24.05";
inputs.nixpkgs.follows = "nixpkgs";
@ -22,21 +22,18 @@
}: let
userName = "wyatt";
userEmail = "wyatt@wyattjmiller.com";
# supportedSystems = ["x86_64-linux" "aarch64-darwin"];
# system = "aarch64-darwin"; # aarch64-darwin or x86_64-darwin
# hostname = "sephiroth";
# forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
specialArgs =
inputs
// {
inherit userName userEmail;
};
extraSpecialArgs = {
inherit userName userEmail;
};
in {
# Primary laptop - MacBook Pro (2023, M3)
darwinConfigurations."sephiroth" = darwin.lib.darwinSystem {
inherit specialArgs;
system = "aarch64-darwin";
specialArgs = {
inherit userName userEmail;
hostname = "sephiroth";
};
# nixpkgs = inputs.nixpkgs-darwin;
modules = [
./modules/nix-core.nix
./modules/darwinSystem.nix
@ -47,7 +44,7 @@
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = specialArgs;
home-manager.extraSpecialArgs = extraSpecialArgs;
home-manager.users.${userName} = import ./home;
}
];
@ -55,8 +52,11 @@
# Primary desktop computer
nixosConfiguration."cloud" = nixpkgs.lib.nixosSystem {
inherit specialArgs;
system = "x86_64-linux";
specialArgs = {
inherit userName userEmail;
hostname = "cloud";
};
modules = [
/etc/nixos/configuration.nix
./modules/nix-core.nix
@ -67,6 +67,7 @@
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = extraSpecialArgs;
home-manager.users.${userName} = import ./home;
}
];

View File

@ -1,11 +1,8 @@
{
pkgs,
lib,
userName,
...
}: let
username = userName;
in {
}: {
# import sub modules
imports = [
./atuin.nix
@ -20,24 +17,14 @@ in {
# Home Manager needs a bit of information about you and the
# paths it should manage.
home = lib.mkMerge [
(lib.mkIf pkgs.stdenv.isDarwin {
homeDirectory = "/Users/${username}";
})
(lib.mkIf pkgs.stdenv.isLinux {
homeDirectory = "/home/${username}";
})
];
# This value determines the Home Manager release that your
# configuration is compatible with. This helps avoid breakage
# when a new Home Manager release introduces backwards
# incompatible changes.
#
# 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.
stateVersion = "24.05";
home = {
username = userName;
homeDirectory =
if pkgs.stdenv.isDarwin
then "/Users/${userName}"
else "/home/${userName}";
stateVersion = "24.05";
};
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;

View File

@ -1,6 +1,6 @@
{
lib,
useremail,
userEmail,
...
}: {
# `programs.git` will generate the config file: ~/.config/git/config
@ -14,7 +14,7 @@
programs.git = {
enable = true;
userName = "Wyatt J. Miller";
userEmail = useremail;
userEmail = userEmail;
extraConfig = {
init.defaultBranch = "master";

View File

@ -1,5 +1,7 @@
{
username,
lib,
pkgs,
userName,
hostname,
...
} @ args:
@ -14,10 +16,13 @@
system.defaults.smb.NetBIOSName = hostname;
# Define a user account. Don't forget to set a password with passwd.
users.users."${username}" = {
home = "/Users/${username}";
description = username;
users.users."${userName}" = {
home =
if pkgs.stdenv.isDarwin
then "/Users/${userName}"
else "/home/${userName}";
description = userName;
};
nix.settings.trusted-users = [username];
nix.settings.trusted-users = [userName];
}