diff --git a/flake.lock b/flake.lock index 6e1b77d..e5f1042 100644 --- a/flake.lock +++ b/flake.lock @@ -7,11 +7,11 @@ ] }, "locked": { - "lastModified": 1651916036, - "narHash": "sha256-UuD9keUGm4IuVEV6wdSYbuRm7CwfXE63hVkzKDjVsh4=", + "lastModified": 1673295039, + "narHash": "sha256-AsdYgE8/GPwcelGgrntlijMg4t3hLFJFCRF3tL5WVjA=", "owner": "lnl7", "repo": "nix-darwin", - "rev": "2f2bdf658d2b79bada78dc914af99c53cad37cba", + "rev": "87b9d090ad39b25b2400029c64825fc2a8868943", "type": "github" }, "original": { @@ -24,11 +24,11 @@ "flake-compat": { "flake": false, "locked": { - "lastModified": 1650374568, - "narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=", + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", "owner": "edolstra", "repo": "flake-compat", - "rev": "b4a34015c698c7793d592d66adbab377907a2be8", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", "type": "github" }, "original": { @@ -39,11 +39,11 @@ }, "flake-utils": { "locked": { - "lastModified": 1653893745, - "narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=", + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", "owner": "numtide", "repo": "flake-utils", - "rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", "type": "github" }, "original": { @@ -59,11 +59,11 @@ ] }, "locked": { - "lastModified": 1654113405, - "narHash": "sha256-VpK+0QaWG2JRgB00lw77N9TjkE3ec0iMYIX1TzGpxa4=", + "lastModified": 1667907331, + "narHash": "sha256-bHkAwkYlBjkupPUFcQjimNS8gxWSWjOTevEuwdnp5m0=", "owner": "rycee", "repo": "home-manager", - "rev": "ac2287df5a2d6f0a44bbcbd11701dbbf6ec43675", + "rev": "6639e3a837fc5deb6f99554072789724997bc8e5", "type": "github" }, "original": { @@ -82,11 +82,11 @@ ] }, "locked": { - "lastModified": 1655723343, - "narHash": "sha256-J95qdF7m30dEioJZE8fsmaOusqIp57SMJyG4U/ZKfJk=", + "lastModified": 1675351082, + "narHash": "sha256-4Oi4k4Qp1vOvKoACHDcz0xiVj7DuMaCL57fP3W77eA0=", "owner": "nix-community", "repo": "NixOS-WSL", - "rev": "e178b6df72d79324a8446cd175d9d091223585ae", + "rev": "52cadf92e1bfdef235d5cd77b9a4b2ab848baa8a", "type": "github" }, "original": { @@ -97,26 +97,26 @@ }, "nixpkgs": { "locked": { - "lastModified": 1655456688, - "narHash": "sha256-j2trI5gv2fnHdfUQFBy957avCPxxzCqE8R+TOYHPSRE=", + "lastModified": 1675757258, + "narHash": "sha256-pIRer8vdsoherlRKpzfnHbMZ5TsAcvRlXHCIaHkIUbg=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "d17a56d90ecbd1b8fc908d49598fb854ef188461", + "rev": "af96094e9b8eb162d70a84fa3b39f4b7a8b264d2", "type": "github" }, "original": { "id": "nixpkgs", - "ref": "nixos-22.05", + "ref": "nixos-22.11", "type": "indirect" } }, "nur": { "locked": { - "lastModified": 1655739339, - "narHash": "sha256-ykV5RQgltIJl5EXbGdndf6IcncfCP8RnyH57TyKFazE=", + "lastModified": 1675950569, + "narHash": "sha256-v6p+D8e7GVcAlVoJGrAqjwjfAglKS9+GzbQFxd8d0Rc=", "owner": "nix-community", "repo": "NUR", - "rev": "0cadcae82c23de1ec4b4a5bbe1e2f75e59752317", + "rev": "1ed7701bc2f5c91454027067872037272812e7a3", "type": "github" }, "original": { @@ -138,11 +138,11 @@ }, "unstable": { "locked": { - "lastModified": 1655567057, - "narHash": "sha256-Cc5hQSMsTzOHmZnYm8OSJ5RNUp22bd5NADWLHorULWQ=", + "lastModified": 1675763311, + "narHash": "sha256-bz0Q2H3mxsF1CUfk26Sl9Uzi8/HFjGFD/moZHz1HebU=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "e0a42267f73ea52adc061a64650fddc59906fc99", + "rev": "fab09085df1b60d6a0870c8a89ce26d5a4a708c2", "type": "github" }, "original": { @@ -153,11 +153,11 @@ }, "utils": { "locked": { - "lastModified": 1653893745, - "narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=", + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", "owner": "numtide", "repo": "flake-utils", - "rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index cf81d1c..b194831 100644 --- a/flake.nix +++ b/flake.nix @@ -1,167 +1,174 @@ { - description = "Michael Thomas's NixOS configuration"; + description = "Michael Thomas's NixOS configuration"; - inputs = { - nixpkgs.url = "nixpkgs/nixos-22.05"; - unstable.url = "nixpkgs/nixos-unstable"; - nur.url = "github:nix-community/NUR"; + inputs = { + nixpkgs.url = "nixpkgs/nixos-22.11"; + unstable.url = "nixpkgs/nixos-unstable"; + nur.url = "github:nix-community/NUR"; - utils.url = "github:numtide/flake-utils"; + utils.url = "github:numtide/flake-utils"; - nixos-wsl = { - url = "github:nix-community/NixOS-WSL"; - inputs = { - nixpkgs.follows = "nixpkgs"; - }; - }; + nixos-wsl = { + url = "github:nix-community/NixOS-WSL"; + inputs = { + nixpkgs.follows = "nixpkgs"; + }; + }; - darwin = { - url = "github:lnl7/nix-darwin/master"; - inputs.nixpkgs.follows = "nixpkgs"; - }; + darwin = { + url = "github:lnl7/nix-darwin/master"; + inputs.nixpkgs.follows = "nixpkgs"; + }; - home-manager = { - url = "github:rycee/home-manager/release-22.05"; - inputs = { - nixpkgs.follows = "nixpkgs"; - }; - }; - }; + home-manager = { + url = "github:rycee/home-manager/release-22.05"; + inputs = { + nixpkgs.follows = "nixpkgs"; + }; + }; + }; - outputs = { self, nixpkgs, unstable, nur, utils, nixos-wsl, darwin, home-manager, ... }@inputs: { + outputs = { self, nixpkgs, unstable, nur, utils, nixos-wsl, darwin, home-manager, ... }@inputs: { - # This repo's overlay plus any other overlays you use + # This repo's overlay plus any other overlays you use # If you want to use packages from flakes that are not nixpkgs (such as NUR), add their overlays here.\ - overlays = { - default = import ./overlays inputs; - }; + overlays = { + default = import ./overlays inputs; + pkg-sets = ( + final: prev: { + unstable = import inputs.unstable { system = final.system; }; + trunk = import inputs.trunk { system = final.system; }; + } + ); + }; - overlaysModule = { - nixpkgs.overlays = [ self.overlays.default ]; - }; + overlaysModule = { + nixpkgs.overlays = builtins.attrValues self.overlays; + }; - nixosConfigurations = { - - loft = nixpkgs.lib.nixosSystem { - system = utils.lib.system.x86_64-linux; - modules = [ - self.overlaysModule - home-manager.nixosModules.home-manager - ./modules/common.nix - ./modules/containers.nix + nixosConfigurations = { - ./machines/loft/configuration.nix - ]; - specialArgs = { inherit inputs; }; - }; + loft = nixpkgs.lib.nixosSystem { + system = utils.lib.system.x86_64-linux; + modules = [ + self.overlaysModule + home-manager.nixosModules.home-manager + ./modules/common.nix + ./modules/containers.nix - kitchen = nixpkgs.lib.nixosSystem { - system = utils.lib.system.x86_64-linux; - modules = [ - self.overlaysModule - home-manager.nixosModules.home-manager - ./modules/common.nix - ./modules/containers.nix + ./machines/loft/configuration.nix + ]; + specialArgs = { inherit inputs; }; + }; - ./machines/kitchen/configuration.nix - ]; - specialArgs = { inherit inputs; }; - }; + kitchen = nixpkgs.lib.nixosSystem { + system = utils.lib.system.x86_64-linux; + modules = [ + self.overlaysModule + home-manager.nixosModules.home-manager + ./modules/common.nix + ./modules/containers.nix - # WSL environment - work = inputs.nixpkgs.lib.nixosSystem { - system = utils.lib.system.x86_64-linux; - modules = [ - self.overlaysModule - home-manager.nixosModules.home-manager - { - nixpkgs.overlays = [ - (import ./overlays/iptables) - ]; - } - ./modules/containers.nix - ./modules/nix.nix - ./modules/vscode-server.nix + ./machines/kitchen/configuration.nix + ]; + specialArgs = { inherit inputs; }; + }; - ./machines/work/configuration.nix - ]; - specialArgs = { inherit inputs; }; - }; + # WSL environment + work = inputs.nixpkgs.lib.nixosSystem { + system = utils.lib.system.x86_64-linux; + modules = [ + self.overlaysModule + home-manager.nixosModules.home-manager + { + nixpkgs.overlays = [ + (import ./overlays/iptables) + ]; + } + ./modules/containers.nix + ./modules/nix.nix + ./modules/vscode-server.nix - }; + ./machines/work/configuration.nix + ]; + specialArgs = { inherit inputs; }; + }; - darwinConfigurations = { - mac = darwin.lib.darwinSystem { - system = "aarch64-darwin"; - specialArgs = { inherit inputs; }; - modules = [ - self.overlaysModule - home-manager.darwinModules.home-manager { - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - home-manager.users.michael = import ./user/environments/mac/home.nix; - } + }; - ./machines/mac/configuration.nix - ]; - }; - }; + darwinConfigurations = { + mac = darwin.lib.darwinSystem { + system = "aarch64-darwin"; + specialArgs = { inherit inputs; }; + modules = [ + self.overlaysModule + home-manager.darwinModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users.michael = import ./user/environments/mac/home.nix; + } - homeConfigurations = { - nixos = inputs.home-manager.lib.homeManagerConfiguration { - system = "x86_64-linux"; - homeDirectory = "/home/michael"; - username = "michael"; - stateVersion = "21.05"; - configuration = { config, pkgs, ... }: - { - programs.home-manager.enable = true; + ./machines/mac/configuration.nix + ]; + }; + }; - imports = [ - ./user/environments/nixos/home.nix - ]; - }; - }; + homeConfigurations = { + nixos = inputs.home-manager.lib.homeManagerConfiguration { + system = "x86_64-linux"; + homeDirectory = "/home/michael"; + username = "michael"; + stateVersion = "21.05"; + configuration = { config, pkgs, ... }: + { + programs.home-manager.enable = true; - wsl = inputs.home-manager.lib.homeManagerConfiguration { - system = "x86_64-linux"; - homeDirectory = "/home/michael"; - username = "michael"; - stateVersion = "21.05"; - configuration = { config, pkgs, ... }: - { - programs.home-manager.enable = true; + imports = [ + ./user/environments/nixos/home.nix + ]; + }; + }; - imports = [ - ./user/environments/wsl/home.nix - ]; - }; - }; + wsl = inputs.home-manager.lib.homeManagerConfiguration { + system = "x86_64-linux"; + homeDirectory = "/home/michael"; + username = "michael"; + stateVersion = "21.05"; + configuration = { config, pkgs, ... }: + { + programs.home-manager.enable = true; - mac = inputs.home-manager.lib.homeManagerConfiguration { - system = "aarch64-darwin"; - homeDirectory = "/Users/michael"; - username = "michael"; - stateVersion = "22.05"; - configuration = { config, pkgs, ... }: - { - programs.home-manager.enable = true; + imports = [ + ./user/environments/wsl/home.nix + ]; + }; + }; - imports = [ - ./user/environments/mac/home.nix - ]; - }; - }; - }; + mac = inputs.home-manager.lib.homeManagerConfiguration { + system = "aarch64-darwin"; + homeDirectory = "/Users/michael"; + username = "michael"; + stateVersion = "22.05"; + configuration = { config, pkgs, ... }: + { + programs.home-manager.enable = true; - }; - # // utils.lib.eachSystem [ "aarch64-linux" "x86_64-darwin" "x86_64-linux" ] (system: { - # nixpkgs = import nixpkgs { - # inherit system; - # overlays = [ - # self.overlays.default - # ]; - # config.allowUnfree = true; - # }; - # }); + imports = [ + ./user/environments/mac/home.nix + ]; + }; + }; + }; + + }; + # // utils.lib.eachSystem [ "aarch64-linux" "x86_64-darwin" "x86_64-linux" ] (system: { + # nixpkgs = import nixpkgs { + # inherit system; + # overlays = [ + # self.overlays.default + # ]; + # config.allowUnfree = true; + # }; + # }); } diff --git a/machines/mac/configuration.nix b/machines/mac/configuration.nix index 65ae383..13505c7 100644 --- a/machines/mac/configuration.nix +++ b/machines/mac/configuration.nix @@ -21,32 +21,63 @@ # Terminal git micro + # Containers + colima + docker-client + docker-compose + # Video + ffmpeg + # Spotify + unstable.spicetify-cli + # Java + checkstyle ]; }; programs = { - zsh.enable = true; + zsh = { + enable = true; + # Make zsh installation work properly with macOS path + loginShellInit = '' + if [ -x /usr/libexec/path_helper ]; then + eval `/usr/libexec/path_helper -s` + fi + ''; + }; }; services = { nix-daemon.enable = true; - }; + }; homebrew = { enable = true; - autoUpdate = true; # Auto update packages - cleanup = "zap"; # Uninstall not listed packages and casks + onActivation = { + # Auto update packages + autoUpdate = true; + # Uninstall not listed packages and casks + cleanup = "zap"; + # Upgrade outdated formulae on activation + upgrade = true; + }; brews = [ + "cocoapods" + "openjdk@17" + "bash" # Required for nix-shell to function properly ]; casks = [ + "hiddenbar" + "android-platform-tools" + "mactex" ]; }; - nixpkgs = { - config.allowBroken = true; # Workaround for pyopenssl being marked broken - }; + nixpkgs = { + # Workaround for pyopenssl being marked broken + config.allowBroken = true; + }; - nix = { + nix = { package = pkgs.nix; gc = { automatic = true; @@ -57,10 +88,12 @@ auto-optimise-store = true experimental-features = nix-command flakes ''; + settings.auto-optimise-store = false; }; system = { - activationScripts.postActivation.text = ''sudo chsh -s ${pkgs.zsh}/bin/zsh''; # Since it's not possible to declare default shell, run this command after build + # Since it's not possible to declare default shell, run this command after build + activationScripts.postActivation.text = ''sudo chsh -s ${pkgs.zsh}/bin/zsh''; stateVersion = 4; }; } diff --git a/overlays/default.nix b/overlays/default.nix index 78b9a43..d3d7d72 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -3,13 +3,8 @@ let inherit (nixpkgs.lib) composeManyExtensions; inherit (builtins) attrNames readDir; - overlay-unstable = self: super: { - unstable = unstable.legacyPackages.x86_64-linux; - }; localOverlays = map (f: import (./default + "/${f}")) (attrNames (readDir ./default)); in -composeManyExtensions (localOverlays ++ [ - overlay-unstable -]) \ No newline at end of file +composeManyExtensions (localOverlays) diff --git a/user/environments/mac/home.nix b/user/environments/mac/home.nix index 3e912bd..c49b616 100644 --- a/user/environments/mac/home.nix +++ b/user/environments/mac/home.nix @@ -1,4 +1,4 @@ -{ config, pkgs, ... }: +{ config, pkgs, inputs, ... }: { imports = [ ../../modules/zsh.nix @@ -11,6 +11,26 @@ bitwarden-cli ]; + # Add homebrew applications to path + programs.zsh = { + profileExtra = '' + PATH=/opt/homebrew/bin:$PATH + ''; + prezto.pmodules = [ + "osx" + ]; + }; + + # iterm2 integration + home.file = { + ".zprezto/contrib/zsh-iterm2".source = pkgs.fetchFromGitHub { + owner = "laggardkernel"; + repo = "zsh-iterm2"; + rev = "6f9d8951b3330593ceb66972a71a067793b0981e"; + hash = "sha256-wh9Rltajlb5FlxW1WKGdufnPkikn4gRJZ+fbPO3rVWc="; + }; + }; + programs.git.extraConfig.credential.helper = "osxkeychain"; # Let Home Manager install and manage itself. diff --git a/user/modules/dev.nix b/user/modules/dev.nix index dc17abc..413099e 100644 --- a/user/modules/dev.nix +++ b/user/modules/dev.nix @@ -1,17 +1,20 @@ -{ config, pkgs, libs, ... }: +{ pkgs, ... }: { - home.packages = with pkgs; [ - # Javascript - nodejs - nodePackages.yarn - nodePackages.pnpm - # PHP - php - # Kubernetes - azure-cli - kubectl - kubernetes-helm - # Nix - rnix-lsp - ]; + home.packages = with pkgs; [ + # Javascript + nodejs + nodePackages.yarn + nodePackages.pnpm + # PHP + php + # Python + python3 + # Kubernetes + azure-cli + kubectl + kubernetes-helm + # Nix + rnix-lsp + nixpkgs-fmt + ]; }