support multiple users, add chloe's machines

This commit is contained in:
chloe caruso 2025-05-05 18:53:09 -07:00
parent 1a7858b68b
commit 8cf0abc715
2 changed files with 65 additions and 37 deletions

View file

@ -78,7 +78,7 @@
]; ];
# ----- USER SETTINGS ----- # # ----- USER SETTINGS ----- #
userSettings = rec { users.nmarks = rec {
#enable if you want to use a tiling wm on macos #enable if you want to use a tiling wm on macos
darwinTiling = true; darwinTiling = true;
@ -94,24 +94,56 @@
spawnEditor = "exec" + term + " -e " + editor; spawnEditor = "exec" + term + " -e " + editor;
timeZone = "America/Los_Angeles"; timeZone = "America/Los_Angeles";
sexuality = "bisexual"; sexuality = "bisexual";
};
users.paper_clover = rec {
#enable if you want to use a tiling wm on macos
darwinTiling = true;
darwinHost = "laptop"; username = "clo"; # username
nixosHost = "desktop"; name = "chloe caruso"; # name/identifier
email = "account@paperclover.net"; # email (used for certain configurations)
dotfilesDir = "~/config"; # absolute path of the local repo
theme = "catppuccin-mocha"; #name of theme that stylix will use
browser = "firefox"; # Default browser; must select one from ./user/app/browser/
term = "ghostty"; # Default terminal command;
font = "iosevka"; # Selected font
editor = "neovim"; # Default editor;
spawnEditor = "exec" + term + " -e " + editor;
timeZone = "America/Los_Angeles";
sexuality = "lesbian";
}; };
mkSystem = import ./lib/mkSystem.nix { mkSystem = import ./lib/mkSystem.nix {
inherit overlays nixpkgs inputs userSettings; inherit overlays nixpkgs inputs;
}; };
in { in {
# natalie's desktop computer
nixosConfigurations.nixos = mkSystem "nixos" { nixosConfigurations.nixos = mkSystem "nixos" {
userSettings = users.nmarks;
configDir = ./hosts/desktop;
system = "x86_64-linux"; system = "x86_64-linux";
extraModules = [ extraModules = [
nixos-cosmic.nixosModules.default nixos-cosmic.nixosModules.default
]; ];
}; };
# natalie's laptop
darwinConfigurations."Natalies-MacBook-Air" = mkSystem "Natalies-MacBook-Air" { darwinConfigurations."Natalies-MacBook-Air" = mkSystem "Natalies-MacBook-Air" {
userSettings = users.nmarks;
configDir = ./hosts/laptop;
system = "aarch64-darwin";
};
# chloe's mac studio "sandwich"
darwinConfigurations.sandwich = mkSystem "sandwich" {
userSettings = users.paper_clover;
configDir = ./hosts/laptop;
system = "aarch64-darwin";
};
# chloe's macbook air "paperback"
darwinConfigurations.paperback = mkSystem "paperback" {
userSettings = users.paper_clover;
configDir = ./hosts/laptop;
system = "aarch64-darwin"; system = "aarch64-darwin";
darwin = true;
}; };
}; };
} }

View file

@ -4,12 +4,14 @@
nixpkgs, nixpkgs,
overlays, overlays,
inputs, inputs,
userSettings,
}: name: { }: name: {
userSettings,
system, system,
darwin ? false, configDir, # base host config
extraModules ? [], extraModules ? [],
}: let }: let
darwin = nixpkgs.lib.strings.hasSuffix "-darwin" system;
nixindex = nixindex =
if darwin if darwin
then inputs.nix-index-database.darwinModules.nix-index then inputs.nix-index-database.darwinModules.nix-index
@ -25,40 +27,36 @@
then "macos" then "macos"
else "nixos"; else "nixos";
systemSettings = rec {
inherit darwin;
host =
if darwin
then userSettings.darwinHost
else userSettings.nixosHost;
# The config files for this system.
hostConfig = ../hosts/${host}/configuration.nix;
homeConfig = ../hosts/${host}/home.nix;
homeDir =
if darwin
then "/Users/" + userSettings.username + "/"
else "/home/" + userSettings.username + "/";
# NixOS vs nix-darwin functions # NixOS vs nix-darwin functions
systemFunc = systemFunc =
if darwin if darwin
then inputs.darwin.lib.darwinSystem then inputs.darwin.lib.darwinSystem
else nixpkgs.lib.nixosSystem; else nixpkgs.lib.nixosSystem;
# The config files for this system.
hostConfig = configDir + "/configuration.nix";
homeConfig = configDir + "/home.nix";
hmModules = hmModules =
if darwin if darwin
then inputs.home-manager.darwinModules then inputs.home-manager.darwinModules
else inputs.home-manager.nixosModules; else inputs.home-manager.nixosModules;
systemSettings = rec {
inherit darwin;
homeDir =
if darwin
then "/Users/" + userSettings.username + "/"
else "/home/" + userSettings.username + "/";
}; };
in in
with systemSettings; systemFunc {
systemFunc rec {
inherit system; inherit system;
#gross and ugly hack do NOT like # TODO: gross and ugly hack do NOT like
specialArgs = { specialArgs = {
inherit (userSettings) darwinTiling; inherit (userSettings) darwinTiling;
}; };
@ -70,15 +68,13 @@ in
# the overlays are available globally. # the overlays are available globally.
{nixpkgs.overlays = overlays;} {nixpkgs.overlays = overlays;}
# Enable caching for nix-index so we dont have to rebuild it # Shared modules
#shared modules
../modules/shared ../modules/shared
#system specific modules # System specific modules
../modules/${systemModuleDir} ../modules/${systemModuleDir}
# Link to config.nix # Link to configuration.nix
hostConfig hostConfig
# Set up nix-index and enable comma for easy one-shot command use # Set up nix-index and enable comma for easy one-shot command use
@ -86,7 +82,7 @@ in
nixindex nixindex
{programs.nix-index-database.comma.enable = true;} {programs.nix-index-database.comma.enable = true;}
#style programs # Themes for all programs
stylix stylix
hmModules.home-manager hmModules.home-manager
@ -99,7 +95,7 @@ in
users.${userSettings.username} = homeConfig; users.${userSettings.username} = homeConfig;
}; };
users.users.${userSettings.username}.home = homeDir; users.users.${userSettings.username}.home = systemSettings.homeDir;
} }
# We expose some extra arguments so that our modules can parameterize # We expose some extra arguments so that our modules can parameterize
@ -114,6 +110,6 @@ in
}; };
} }
] ]
#Add extra modules depending on system # Add extra modules specified from config
++ extraModules; ++ extraModules;
} }