| author | |
| committer | |
| log | 8cf0abc7150dd35a56f82b8fbf9fa8c529151962 |
| tree | f283c2799cb11899bb5148139a48f4215eea6132 |
| parent | 1a7858b68b3ce21b4fd2c887441b1c537fd49bd7 |
2 files changed, 65 insertions(+), 37 deletions(-)
flake.nix+37-5| ... | ... | @@ -78,7 +78,7 @@ |
| 78 | 78 | ]; |
| 79 | 79 | |
| 80 | 80 | # ----- USER SETTINGS ----- # |
| 81 | userSettings = rec { | |
| 81 | users.nmarks = rec { | |
| 82 | 82 | #enable if you want to use a tiling wm on macos |
| 83 | 83 | darwinTiling = true; |
| 84 | 84 | |
| ... | ... | @@ -94,24 +94,56 @@ |
| 94 | 94 | spawnEditor = "exec" + term + " -e " + editor; |
| 95 | 95 | timeZone = "America/Los_Angeles"; |
| 96 | 96 | sexuality = "bisexual"; |
| 97 | }; | |
| 98 | users.paper_clover = rec { | |
| 99 | #enable if you want to use a tiling wm on macos | |
| 100 | darwinTiling = true; | |
| 97 | 101 | |
| 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"; | |
| 100 | 114 | }; |
| 101 | 115 | |
| 102 | 116 | mkSystem = import ./lib/mkSystem.nix { |
| 103 | inherit overlays nixpkgs inputs userSettings; | |
| 117 | inherit overlays nixpkgs inputs; | |
| 104 | 118 | }; |
| 105 | 119 | in { |
| 120 | # natalie's desktop computer | |
| 106 | 121 | nixosConfigurations.nixos = mkSystem "nixos" { |
| 122 | userSettings = users.nmarks; | |
| 123 | configDir = ./hosts/desktop; | |
| 107 | 124 | system = "x86_64-linux"; |
| 108 | 125 | extraModules = [ |
| 109 | 126 | nixos-cosmic.nixosModules.default |
| 110 | 127 | ]; |
| 111 | 128 | }; |
| 129 | # natalie's laptop | |
| 112 | 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 | 146 | system = "aarch64-darwin"; |
| 114 | darwin = true; | |
| 115 | 147 | }; |
| 116 | 148 | }; |
| 117 | 149 | } |
lib/mkSystem.nix+28-32| ... | ... | @@ -4,12 +4,14 @@ |
| 4 | 4 | nixpkgs, |
| 5 | 5 | overlays, |
| 6 | 6 | inputs, |
| 7 | userSettings, | |
| 8 | 7 | }: name: { |
| 8 | userSettings, | |
| 9 | 9 | system, |
| 10 | darwin ? false, | |
| 10 | configDir, # base host config | |
| 11 | 11 | extraModules ? [], |
| 12 | 12 | }: let |
| 13 | darwin = nixpkgs.lib.strings.hasSuffix "-darwin" system; | |
| 14 | ||
| 13 | 15 | nixindex = |
| 14 | 16 | if darwin |
| 15 | 17 | then inputs.nix-index-database.darwinModules.nix-index |
| ... | ... | @@ -25,40 +27,36 @@ |
| 25 | 27 | then "macos" |
| 26 | 28 | else "nixos"; |
| 27 | 29 | |
| 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 | 30 | # NixOS vs nix-darwin functions |
| 46 | 31 | systemFunc = |
| 47 | 32 | if darwin |
| 48 | 33 | then inputs.darwin.lib.darwinSystem |
| 49 | 34 | else nixpkgs.lib.nixosSystem; |
| 50 | 35 | |
| 36 | ||
| 37 | # The config files for this system. | |
| 38 | hostConfig = configDir + "/configuration.nix"; | |
| 39 | homeConfig = configDir + "/home.nix"; | |
| 40 | ||
| 51 | 41 | hmModules = |
| 52 | 42 | if darwin |
| 53 | 43 | then inputs.home-manager.darwinModules |
| 54 | 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 | }; |
| 56 | 55 | in |
| 57 | with systemSettings; | |
| 58 | systemFunc rec { | |
| 56 | systemFunc { | |
| 59 | 57 | inherit system; |
| 60 | 58 | |
| 61 | #gross and ugly hack do NOT like | |
| 59 | # TODO: gross and ugly hack do NOT like | |
| 62 | 60 | specialArgs = { |
| 63 | 61 | inherit (userSettings) darwinTiling; |
| 64 | 62 | }; |
| ... | ... | @@ -70,23 +68,21 @@ in |
| 70 | 68 | # the overlays are available globally. |
| 71 | 69 | {nixpkgs.overlays = overlays;} |
| 72 | 70 | |
| 73 | # Enable caching for nix-index so we dont have to rebuild it | |
| 74 | ||
| 75 | #shared modules | |
| 71 | # Shared modules | |
| 76 | 72 | ../modules/shared |
| 77 | 73 | |
| 78 | #system specific modules | |
| 74 | # System specific modules | |
| 79 | 75 | ../modules/${systemModuleDir} |
| 80 | 76 | |
| 81 | # Link to config.nix | |
| 77 | # Link to configuration.nix | |
| 82 | 78 | hostConfig |
| 83 | 79 | |
| 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 | |
| 86 | 82 | nixindex |
| 87 | 83 | {programs.nix-index-database.comma.enable = true;} |
| 88 | 84 | |
| 89 | #style programs | |
| 85 | # Themes for all programs | |
| 90 | 86 | stylix |
| 91 | 87 | |
| 92 | 88 | hmModules.home-manager |
| ... | ... | @@ -99,7 +95,7 @@ in |
| 99 | 95 | users.${userSettings.username} = homeConfig; |
| 100 | 96 | }; |
| 101 | 97 | |
| 102 | users.users.${userSettings.username}.home = homeDir; | |
| 98 | users.users.${userSettings.username}.home = systemSettings.homeDir; | |
| 103 | 99 | } |
| 104 | 100 | |
| 105 | 101 | # We expose some extra arguments so that our modules can parameterize |
| ... | ... | @@ -114,6 +110,6 @@ in |
| 114 | 110 | }; |
| 115 | 111 | } |
| 116 | 112 | ] |
| 117 | #Add extra modules depending on system | |
| 113 | # Add extra modules specified from config | |
| 118 | 114 | ++ extraModules; |
| 119 | 115 | } |