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 @@...@@ -78,7 +78,7 @@
78 ];78 ];
7979
80 # ----- USER SETTINGS ----- #80 # ----- USER SETTINGS ----- #
81 userSettings = rec {81 users.nmarks = rec {
82 #enable if you want to use a tiling wm on macos82 #enable if you want to use a tiling wm on macos
83 darwinTiling = true;83 darwinTiling = true;
8484
...@@ -94,24 +94,56 @@...@@ -94,24 +94,56 @@
94 spawnEditor = "exec" + term + " -e " + editor;94 spawnEditor = "exec" + term + " -e " + editor;
95 timeZone = "America/Los_Angeles";95 timeZone = "America/Los_Angeles";
96 sexuality = "bisexual";96 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";102 username = "clo"; # username
99 nixosHost = "desktop";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";
100 };114 };
101115
102 mkSystem = import ./lib/mkSystem.nix {116 mkSystem = import ./lib/mkSystem.nix {
103 inherit overlays nixpkgs inputs userSettings;117 inherit overlays nixpkgs inputs;
104 };118 };
105 in {119 in {
120 # natalie's desktop computer
106 nixosConfigurations.nixos = mkSystem "nixos" {121 nixosConfigurations.nixos = mkSystem "nixos" {
122 userSettings = users.nmarks;
123 configDir = ./hosts/desktop;
107 system = "x86_64-linux";124 system = "x86_64-linux";
108 extraModules = [125 extraModules = [
109 nixos-cosmic.nixosModules.default126 nixos-cosmic.nixosModules.default
110 ];127 ];
111 };128 };
129 # natalie's laptop
112 darwinConfigurations."Natalies-MacBook-Air" = mkSystem "Natalies-MacBook-Air" {130 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;
113 system = "aarch64-darwin";146 system = "aarch64-darwin";
114 darwin = true;
115 };147 };
116 };148 };
117}149}
lib/mkSystem.nix+28-32
...@@ -4,12 +4,14 @@...@@ -4,12 +4,14 @@
4 nixpkgs,4 nixpkgs,
5 overlays,5 overlays,
6 inputs,6 inputs,
7 userSettings,
8}: name: {7}: name: {
8 userSettings,
9 system,9 system,
10 darwin ? false,10 configDir, # base host config
11 extraModules ? [],11 extraModules ? [],
12}: let12}: let
13 darwin = nixpkgs.lib.strings.hasSuffix "-darwin" system;
14
13 nixindex =15 nixindex =
14 if darwin16 if darwin
15 then inputs.nix-index-database.darwinModules.nix-index17 then inputs.nix-index-database.darwinModules.nix-index
...@@ -25,40 +27,36 @@...@@ -25,40 +27,36 @@
25 then "macos"27 then "macos"
26 else "nixos";28 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
45 # NixOS vs nix-darwin functions30 # NixOS vs nix-darwin functions
46 systemFunc =31 systemFunc =
47 if darwin32 if darwin
48 then inputs.darwin.lib.darwinSystem33 then inputs.darwin.lib.darwinSystem
49 else nixpkgs.lib.nixosSystem;34 else nixpkgs.lib.nixosSystem;
5035
36
37 # The config files for this system.
38 hostConfig = configDir + "/configuration.nix";
39 homeConfig = configDir + "/home.nix";
40
51 hmModules =41 hmModules =
52 if darwin42 if darwin
53 then inputs.home-manager.darwinModules43 then inputs.home-manager.darwinModules
54 else inputs.home-manager.nixosModules;44 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
55 };54 };
56in55in
57 with systemSettings;56 systemFunc {
58 systemFunc rec {
59 inherit system;57 inherit system;
6058
61 #gross and ugly hack do NOT like59 # TODO: gross and ugly hack do NOT like
62 specialArgs = {60 specialArgs = {
63 inherit (userSettings) darwinTiling;61 inherit (userSettings) darwinTiling;
64 };62 };
...@@ -70,23 +68,21 @@ in...@@ -70,23 +68,21 @@ in
70 # the overlays are available globally.68 # the overlays are available globally.
71 {nixpkgs.overlays = overlays;}69 {nixpkgs.overlays = overlays;}
7270
73 # Enable caching for nix-index so we dont have to rebuild it71 # Shared modules
74
75 #shared modules
76 ../modules/shared72 ../modules/shared
7773
78 #system specific modules74 # System specific modules
79 ../modules/${systemModuleDir}75 ../modules/${systemModuleDir}
8076
81 # Link to config.nix77 # Link to configuration.nix
82 hostConfig78 hostConfig
8379
84 #Set up nix-index and enable comma for easy one-shot command use80 # Set up nix-index and enable comma for easy one-shot command use
85 #https://github.com/nix-community/comma81 # https://github.com/nix-community/comma
86 nixindex82 nixindex
87 {programs.nix-index-database.comma.enable = true;}83 {programs.nix-index-database.comma.enable = true;}
8884
89 #style programs85 # Themes for all programs
90 stylix86 stylix
9187
92 hmModules.home-manager88 hmModules.home-manager
...@@ -99,7 +95,7 @@ in...@@ -99,7 +95,7 @@ in
99 users.${userSettings.username} = homeConfig;95 users.${userSettings.username} = homeConfig;
100 };96 };
10197
102 users.users.${userSettings.username}.home = homeDir;98 users.users.${userSettings.username}.home = systemSettings.homeDir;
103 }99 }
104100
105 # We expose some extra arguments so that our modules can parameterize101 # We expose some extra arguments so that our modules can parameterize
...@@ -114,6 +110,6 @@ in...@@ -114,6 +110,6 @@ in
114 };110 };
115 }111 }
116 ]112 ]
117 #Add extra modules depending on system113 # Add extra modules specified from config
118 ++ extraModules;114 ++ extraModules;
119 }115 }