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

View File

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

View File

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

View File

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

View File

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