|
60 | 60 | }; |
61 | 61 |
|
62 | 62 | outputs = inputs @ { self, ... }: |
63 | | - with self.lib; |
| 63 | + let |
| 64 | + inherit (self.lib) dotfiles; |
| 65 | + inherit (self.lib) pkgs; |
| 66 | + inherit (dotfiles) system; |
| 67 | + in |
64 | 68 | { |
65 | 69 | lib = inputs.nixpkgs.lib // import ./lib { inherit inputs; }; |
66 | 70 |
|
67 | | - packages = foreachSystem (system: |
68 | | - { |
| 71 | + packages = { |
| 72 | + ${system} = { |
69 | 73 | default = |
70 | 74 | if dotfiles.profile == "home" then |
71 | 75 | inputs.home-manager.packages.${system}.home-manager |
72 | 76 | else if dotfiles.profile == "darwin" then |
73 | 77 | inputs.darwin.packages.${system}.darwin-rebuild |
74 | 78 | else if dotfiles.profile == "nixos" then |
75 | | - pkgsBySystem.${system}.nixos-rebuild |
| 79 | + pkgs.nixos-rebuild |
76 | 80 | else if dotfiles.profile == "" then |
77 | 81 | builtins.abort "Empty profile type, please run setup.py with `--bootstrap`" |
78 | 82 | else |
79 | 83 | builtins.abort "Unknown profile type: '${dotfiles.profile}'" |
80 | 84 | ; |
81 | | - } |
82 | | - ); |
| 85 | + }; |
| 86 | + }; |
83 | 87 |
|
84 | | - homeConfigurations = mkHome; |
| 88 | + homeConfigurations = self.lib.mkHome { }; |
85 | 89 |
|
86 | | - nixosConfigurations = mkSystem { |
| 90 | + nixosConfigurations = self.lib.mkSystem { |
87 | 91 | isDarwin = false; |
88 | 92 | }; |
89 | 93 |
|
90 | | - darwinConfigurations = mkSystem { |
| 94 | + darwinConfigurations = self.lib.mkSystem { |
91 | 95 | # NOTE: home manager activation is showing following error |
92 | 96 | # error: profile '/Users/william/.local/state/nix/profiles/profile' is incompatible with 'nix-env'; please use 'nix profile' instead |
93 | 97 | # temporary workaround is to synlink ~/.local/state/nix/profile to ~/.nix-profile |
94 | 98 | # ref: https://discourse.nixos.org/t/home-manager-insists-on-using-nix-profile/57708 |
95 | 99 | isDarwin = true; |
96 | 100 | }; |
97 | 101 |
|
98 | | - checks = foreachSystem (system: { |
| 102 | + checks = { |
99 | 103 | pre-commit-check = inputs.git-hooks.lib.${system}.run { |
100 | | - src = cleanSource ./.; |
| 104 | + src = self.lib.cleanSource ./.; |
101 | 105 | hooks = { |
102 | 106 | # TODO: treefmt, selene, shellcheck |
103 | 107 | editorconfig-checker.enable = true; |
104 | 108 | nixpkgs-fmt.enable = true; |
105 | 109 | stylua = { |
106 | 110 | enable = true; |
107 | | - entry = "${pkgsBySystem.${system}.stylua}/bin/stylua --config-path ./config/nvim/stylua.toml"; |
| 111 | + entry = "${pkgs.stylua}/bin/stylua --config-path ${dotfiles.directory}/config/nvim/stylua.toml"; |
108 | 112 | }; |
109 | 113 | }; |
110 | 114 | }; |
111 | | - }); |
| 115 | + }; |
112 | 116 |
|
113 | | - devShells = foreachSystem (system: { |
114 | | - default = pkgsBySystem.${system}.mkShell { |
| 117 | + devShells = { |
| 118 | + default = pkgs.mkShell { |
115 | 119 | inherit (self.checks.${system}.pre-commit-check) shellHook; |
116 | 120 | buildInputs = self.checks.${system}.pre-commit-check.enabledPackages; |
117 | 121 | }; |
118 | | - }); |
| 122 | + }; |
119 | 123 | }; |
120 | 124 | } |
0 commit comments