authorgravatar for git@paperclover.netclover caruso <git@paperclover.net> 2025-05-05 18:53:09-07:00
committergravatar for git@paperclover.netclover caruso <git@paperclover.net> 2025-05-05 18:53:09-07:00
log8cf0abc7150dd35a56f82b8fbf9fa8c529151962
treef283c2799cb11899bb5148139a48f4215eea6132
parent1a7858b68b3ce21b4fd2c887441b1c537fd49bd7

support multiple users, add chloe's machines


2 files changed, 65 insertions(+), 37 deletions(-)

flake.nix+37-5
......@@ -78,7 +78,7 @@
7878 ];
7979
8080 # ----- USER SETTINGS ----- #
81 userSettings = rec {
81 users.nmarks = rec {
8282 #enable if you want to use a tiling wm on macos
8383 darwinTiling = true;
8484
......@@ -94,24 +94,56 @@
9494 spawnEditor = "exec" + term + " -e " + editor;
9595 timeZone = "America/Los_Angeles";
9696 sexuality = "bisexual";
97 };
98 users.paper_clover = rec {
99 #enable if you want to use a tiling wm on macos
100 darwinTiling = true;
97101
98 darwinHost = "laptop";
99 nixosHost = "desktop";
102 username = "clo"; # username
103 name = "chloe caruso"; # name/identifier
104 email = "account@paperclover.net"; # email (used for certain configurations)
105 dotfilesDir = "~/config"; # absolute path of the local repo
106 theme = "catppuccin-mocha"; #name of theme that stylix will use
107 browser = "firefox"; # Default browser; must select one from ./user/app/browser/
108 term = "ghostty"; # Default terminal command;
109 font = "iosevka"; # Selected font
110 editor = "neovim"; # Default editor;
111 spawnEditor = "exec" + term + " -e " + editor;
112 timeZone = "America/Los_Angeles";
113 sexuality = "lesbian";
100114 };
101115
102116 mkSystem = import ./lib/mkSystem.nix {
103 inherit overlays nixpkgs inputs userSettings;
117 inherit overlays nixpkgs inputs;
104118 };
105119 in {
120 # natalie's desktop computer
106121 nixosConfigurations.nixos = mkSystem "nixos" {
122 userSettings = users.nmarks;
123 configDir = ./hosts/desktop;
107124 system = "x86_64-linux";
108125 extraModules = [
109126 nixos-cosmic.nixosModules.default
110127 ];
111128 };
129 # natalie's laptop
112130 darwinConfigurations."Natalies-MacBook-Air" = mkSystem "Natalies-MacBook-Air" {
131 userSettings = users.nmarks;
132 configDir = ./hosts/laptop;
133 system = "aarch64-darwin";
134 };
135
136 # chloe's mac studio "sandwich"
137 darwinConfigurations.sandwich = mkSystem "sandwich" {
138 userSettings = users.paper_clover;
139 configDir = ./hosts/laptop;
140 system = "aarch64-darwin";
141 };
142 # chloe's macbook air "paperback"
143 darwinConfigurations.paperback = mkSystem "paperback" {
144 userSettings = users.paper_clover;
145 configDir = ./hosts/laptop;
113146 system = "aarch64-darwin";
114 darwin = true;
115147 };
116148 };
117149}
lib/mkSystem.nix+28-32
......@@ -4,12 +4,14 @@
44 nixpkgs,
55 overlays,
66 inputs,
7 userSettings,
87}: name: {
8 userSettings,
99 system,
10 darwin ? false,
10 configDir, # base host config
1111 extraModules ? [],
1212}: let
13 darwin = nixpkgs.lib.strings.hasSuffix "-darwin" system;
14
1315 nixindex =
1416 if darwin
1517 then inputs.nix-index-database.darwinModules.nix-index
......@@ -25,40 +27,36 @@
2527 then "macos"
2628 else "nixos";
2729
28 systemSettings = rec {
29 inherit darwin;
30 host =
31 if darwin
32 then userSettings.darwinHost
33 else userSettings.nixosHost;
34
35 # The config files for this system.
36
37 hostConfig = ../hosts/${host}/configuration.nix;
38 homeConfig = ../hosts/${host}/home.nix;
39
40 homeDir =
41 if darwin
42 then "/Users/" + userSettings.username + "/"
43 else "/home/" + userSettings.username + "/";
44
4530 # NixOS vs nix-darwin functions
4631 systemFunc =
4732 if darwin
4833 then inputs.darwin.lib.darwinSystem
4934 else nixpkgs.lib.nixosSystem;
5035
36
37 # The config files for this system.
38 hostConfig = configDir + "/configuration.nix";
39 homeConfig = configDir + "/home.nix";
40
5141 hmModules =
5242 if darwin
5343 then inputs.home-manager.darwinModules
5444 else inputs.home-manager.nixosModules;
45
46 systemSettings = rec {
47 inherit darwin;
48
49 homeDir =
50 if darwin
51 then "/Users/" + userSettings.username + "/"
52 else "/home/" + userSettings.username + "/";
53
5554 };
5655in
57 with systemSettings;
58 systemFunc rec {
56 systemFunc {
5957 inherit system;
6058
61 #gross and ugly hack do NOT like
59 # TODO: gross and ugly hack do NOT like
6260 specialArgs = {
6361 inherit (userSettings) darwinTiling;
6462 };
......@@ -70,23 +68,21 @@ in
7068 # the overlays are available globally.
7169 {nixpkgs.overlays = overlays;}
7270
73 # Enable caching for nix-index so we dont have to rebuild it
74
75 #shared modules
71 # Shared modules
7672 ../modules/shared
7773
78 #system specific modules
74 # System specific modules
7975 ../modules/${systemModuleDir}
8076
81 # Link to config.nix
77 # Link to configuration.nix
8278 hostConfig
8379
84 #Set up nix-index and enable comma for easy one-shot command use
85 #https://github.com/nix-community/comma
80 # Set up nix-index and enable comma for easy one-shot command use
81 # https://github.com/nix-community/comma
8682 nixindex
8783 {programs.nix-index-database.comma.enable = true;}
8884
89 #style programs
85 # Themes for all programs
9086 stylix
9187
9288 hmModules.home-manager
......@@ -99,7 +95,7 @@ in
9995 users.${userSettings.username} = homeConfig;
10096 };
10197
102 users.users.${userSettings.username}.home = homeDir;
98 users.users.${userSettings.username}.home = systemSettings.homeDir;
10399 }
104100
105101 # We expose some extra arguments so that our modules can parameterize
......@@ -114,6 +110,6 @@ in
114110 };
115111 }
116112 ]
117 #Add extra modules depending on system
113 # Add extra modules specified from config
118114 ++ extraModules;
119115 }