diff --git a/flake.nix b/flake.nix index d4c75d6..faad74d 100644 --- a/flake.nix +++ b/flake.nix @@ -78,7 +78,7 @@ ]; # ----- USER SETTINGS ----- # - userSettings = rec { + users.nmarks = rec { #enable if you want to use a tiling wm on macos darwinTiling = true; @@ -94,24 +94,56 @@ spawnEditor = "exec" + term + " -e " + editor; timeZone = "America/Los_Angeles"; sexuality = "bisexual"; + }; + users.paper_clover = rec { + #enable if you want to use a tiling wm on macos + darwinTiling = true; - darwinHost = "laptop"; - nixosHost = "desktop"; + username = "clo"; # username + 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 { - inherit overlays nixpkgs inputs userSettings; + inherit overlays nixpkgs inputs; }; in { + # natalie's desktop computer nixosConfigurations.nixos = mkSystem "nixos" { + userSettings = users.nmarks; + configDir = ./hosts/desktop; system = "x86_64-linux"; extraModules = [ nixos-cosmic.nixosModules.default ]; }; + # natalie's laptop 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"; - darwin = true; }; }; } diff --git a/lib/mkSystem.nix b/lib/mkSystem.nix index e3da27f..43fd903 100644 --- a/lib/mkSystem.nix +++ b/lib/mkSystem.nix @@ -4,12 +4,14 @@ nixpkgs, overlays, inputs, - userSettings, }: name: { + userSettings, system, - darwin ? false, + configDir, # base host config extraModules ? [], }: let + darwin = nixpkgs.lib.strings.hasSuffix "-darwin" system; + nixindex = if darwin then inputs.nix-index-database.darwinModules.nix-index @@ -25,40 +27,36 @@ then "macos" 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 systemFunc = if darwin then inputs.darwin.lib.darwinSystem else nixpkgs.lib.nixosSystem; + + # The config files for this system. + hostConfig = configDir + "/configuration.nix"; + homeConfig = configDir + "/home.nix"; + hmModules = if darwin then inputs.home-manager.darwinModules else inputs.home-manager.nixosModules; + + systemSettings = rec { + inherit darwin; + + homeDir = + if darwin + then "/Users/" + userSettings.username + "/" + else "/home/" + userSettings.username + "/"; + }; in - with systemSettings; - systemFunc rec { + systemFunc { inherit system; - #gross and ugly hack do NOT like + # TODO: gross and ugly hack do NOT like specialArgs = { inherit (userSettings) darwinTiling; }; @@ -70,23 +68,21 @@ in # the overlays are available globally. {nixpkgs.overlays = overlays;} - # Enable caching for nix-index so we dont have to rebuild it - - #shared modules + # Shared modules ../modules/shared - #system specific modules + # System specific modules ../modules/${systemModuleDir} - # Link to config.nix + # Link to configuration.nix hostConfig - #Set up nix-index and enable comma for easy one-shot command use - #https://github.com/nix-community/comma + # Set up nix-index and enable comma for easy one-shot command use + # https://github.com/nix-community/comma nixindex {programs.nix-index-database.comma.enable = true;} - #style programs + # Themes for all programs stylix hmModules.home-manager @@ -99,7 +95,7 @@ in 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 @@ -114,6 +110,6 @@ in }; } ] - #Add extra modules depending on system + # Add extra modules specified from config ++ extraModules; }