diff --git a/flake.nix b/flake.nix index e69de29..52ea7c0 100644 --- a/flake.nix +++ b/flake.nix @@ -0,0 +1,88 @@ +{ + description = "NixOS configuration of Ryan Yin"; + + ################################################################################################################## + # + # Want to know Nix in details? Looking for a beginner-friendly tutorial? + # Check out https://github.com/ryan4yin/nixos-and-flakes-book ! + # + ################################################################################################################## + + # the nixConfig here only affects the flake itself, not the system configuration! + nixConfig = { + # substituers will be appended to the default substituters when fetching packages + # nix com extra-substituters = [munity's cache server + extra-substituters = [ + "https://nix-community.cachix.org" + ]; + extra-trusted-public-keys = [ + "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" + ]; + }; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05"; + home-manager.url = "github:nix-community/home-manager/release-24.05"; + home-manager.inputs.nixpkgs.follows = "nixpkgs"; + + catppuccin-bat = { + url = "github:catppuccin/bat"; + flake = false; + }; + }; + + outputs = inputs @ { + self, + nixpkgs, + home-manager, + ... + }: { + nixosConfigurations = { + nixos-test = let + username = "phil"; + specialArgs = {inherit username;}; + in + nixpkgs.lib.nixosSystem { + inherit specialArgs; + system = "x86_64-linux"; + + modules = [ + ./hosts/nixos-test + ./users/${username}/nixos.nix + + home-manager.nixosModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + + home-manager.extraSpecialArgs = inputs // specialArgs; + home-manager.users.${username} = import ./users/${username}/home.nix; + } + ]; + }; + + msi-rtx4090 = let + username = "suzi"; # another username for this machine + specialArgs = {inherit username;}; + in + nixpkgs.lib.nixosSystem { + inherit specialArgs; + system = "x86_64-linux"; + + modules = [ + ./hosts/msi-rtx4090 + ./users/${username}/nixos.nix + + home-manager.nixosModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + + home-manager.extraSpecialArgs = inputs // specialArgs; + home-manager.users.${username} = import ./users/${username}/home.nix; + } + ]; + }; + }; + }; +}