When using `files` on a NixOS option in the `nix repl` it fails to
follow the attribute of agenix module.
Discussing with @roberth has explained that this is a "common bug" on
account of mis-using the `import` for modules.
From what I understand, the `import` statement brings it into the
current context so you lose the attribute of where it's defined.
Here is what I currently see:
```
nix-repl> options.age.ageBin.files
[
"/nix/store/8kpmdb63f5i9mwdyirqki7hvvglgy1va-source/machines/nyx/configuration.nix"
]
```
After this change, the value in agenix is reported instead.
```
❯ nix repl --extra-experimental-features 'flakes repl-flake' \
--override-input agenix /home/fmzakari/code/github.com/ryantm/agenix .
nix-repl> options.age.ageBin.files
[
"/nix/store/99gc8rhgw43k201k34pshcsygdvbhmpy-source/modules/age.nix"
]
```
nix-darwin is detecting `/etc/nix/nix.conf` from the
cachix/install-nix-action and refusing to overwrite it, failing the
nix-darwin activation and therefore the rest of CI.
This commit `mv`s the existing `nix.conf` to avoid the above, and then
adds support for new-style nix commands and flakes to the nix-darwin
configuration to allow their subsequent use in CI.
It also removes the nix config from the `cachix/install-nix-action`
step, which was duplicated effort since we are blowing it away with
nix-darwin anyway.
Relevant:
- https://github.com/LnL7/nix-darwin/issues/149
Why
===
* flake.nix had a lot of almost redundant lines in it.
* i686 support is probably being dropped soon in nixpkgs
https://github.com/NixOS/nixpkgs/pull/266164
What changed
==
* Add new input nix-systems/default which represents the default
systems typically used in the Nix community
* Define and use an eachSystem function that simplifies the flake.nix file
This adds a “default” NixOS module in flake.nix. This makes using this in flakes a little less verbose and repetitive.
Before this change:
```nix
nixpkgs.lib.nixosSystem {
modules = [
./configuration.nix
agenix.nixosModules.age
];
}
After this change:
```nix
nixpkgs.lib.nixosSystem {
modules = [
./configuration.nix
agenix.nixosModule
];
}
```
flake.lock previously included a "indirect" reference to nixpkgs.
I am not sure what this means but I added `inputs.nixpkgs` and updated nixpkgs because this old version of nixpkgs didn't have any support for aarch64-darwin at all.
Now on a aarch64-darwin I can type `nix build` and get a working version of agenix.
Flake outputs are a mixture of system-dependent and system-independent
sets, and flake-utils doesn't do much to distinguish one from the other.
Because of that, the `age` NixOS module currently has to be acessed as
`agenix.nixosModules.${system}.age`, rather than the documented
`agenix.nixosModules.age`.
To remedy that, (conceptually) split `outputs` in two, let flake-utils
handle the system-dependent half, and merge them to form the actual
outputs. The names for the two halves were taken from [1].
[1]: https://github.com/NixOS/nix/issues/3843#issuecomment-661720562