···11# Used by "mix format"
22[
33 inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"],
44- import_deps: [:xema]
44+ import_deps: [:typedstruct]
55]
+5-7
apps/nix/lib/nix/profile.ex
···1212 caller = __CALLER__.module
13131414 quote do
1515- use Xema
1515+ use TypedStruct
16161717 @derive Jason.Encoder
18181919- xema_struct do
2020- field :current, Nix.Profile.Generation
1919+ typedstruct do
2020+ field :current, Nix.Profile.Generation, enforce: true
2121 field :latest, Nix.Profile.Generation
2222- field :profiles, :list, items: Nix.Profile.Generation
2323- field :tags, :map
2424-2525- required [:current]
2222+ field :profiles, list(Nix.Profile.Generation), default: []
2323+ field :tags, map(), default: %{}
2624 end
27252826 @behaviour Nix.Profile
+5-7
apps/nix/lib/nix/profile/generation.ex
···11defmodule Nix.Profile.Generation do
22- use Xema
22+ use TypedStruct
3344 @derive {Jason.Encoder, only: [:created, :link, :path]}
5566- xema_struct do
77- field :created, DateTime
88- field :link, :string
99- field :path, :string
1010-1111- required [:created, :link, :path]
66+ typedstruct do
77+ field :created, DateTime.t(), enforce: true
88+ field :link, String.t(), enforce: true
99+ field :path, String.t(), enforce: true
1210 end
1311end
+3-5
apps/nix/lib/nix/store_path.ex
···11defmodule Nix.StorePath do
22- use Xema
33-44- xema_struct do
55- field :path, :string
22+ use TypedStruct
6377- required [:path]
44+ typedstruct do
55+ field :path, String.t(), enforce: true
86 end
97end