Skip to content

Commit

Permalink
refactor!: update flake outputs to current standard using flake-parts
Browse files Browse the repository at this point in the history
BREAKING CHANGE: this commit removes several flake outputs which have
been marked as deprecated upstream for quite a while:

- `nixosModule` -> `nixosModules.default`
- `overlay` -> `overlays.default`
- `defaultPackage.<system>` -> `packages.<system>.default`
  • Loading branch information
montchr committed Oct 15, 2022
1 parent 0c7c731 commit 49af60e
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 37 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ To install the `agenix` binary:
system = "x86_64-linux";
modules = [
./configuration.nix
agenix.nixosModule
agenix.nixosModules.age
];
};
};
Expand All @@ -187,7 +187,7 @@ but, if you want to (change the system based on your system):

```nix
{
environment.systemPackages = [ agenix.defaultPackage.x86_64-linux ];
environment.systemPackages = [ agenix.packages.x86_64-linux.default ];
}
```

Expand Down Expand Up @@ -511,11 +511,12 @@ can use the reference implementation `age` with Flakes like this:
```nix
{pkgs, self, ...}:
let
inherit (self.inputs) agenix;
inherit (pkgs.stdenv.hostPlatform) system;
inherit (self.inputs.agenix.packages.${system}) agenix;
in
{
environment.systemPackages = [
(agenix.defaultPackage.x86_64-linux.override { ageBin = "${pkgs.age}/bin/age"; })
(agenix.override { ageBin = "${pkgs.age}/bin/age"; })
];
}
```
Expand Down
37 changes: 37 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

61 changes: 32 additions & 29 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,39 @@

inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-21.11";
flake-parts.url = "github:hercules-ci/flake-parts";
};

outputs = { self, nixpkgs }:
let
agenix = system: nixpkgs.legacyPackages.${system}.callPackage ./pkgs/agenix.nix {};
in {

nixosModules.age = import ./modules/age.nix;
nixosModule = self.nixosModules.age;

overlay = import ./overlay.nix;

packages."aarch64-linux".agenix = agenix "aarch64-linux";
defaultPackage."aarch64-linux" = self.packages."aarch64-linux".agenix;

packages."i686-linux".agenix = agenix "i686-linux";
defaultPackage."i686-linux" = self.packages."i686-linux".agenix;

packages."x86_64-darwin".agenix = agenix "x86_64-darwin";
defaultPackage."x86_64-darwin" = self.packages."x86_64-darwin".agenix;

packages."aarch64-darwin".agenix = agenix "aarch64-darwin";
defaultPackage."aarch64-darwin" = self.packages."aarch64-darwin".agenix;

packages."x86_64-linux".agenix = agenix "x86_64-linux";
defaultPackage."x86_64-linux" = self.packages."x86_64-linux".agenix;
checks."x86_64-linux".integration = import ./test/integration.nix {
inherit nixpkgs; pkgs = nixpkgs.legacyPackages."x86_64-linux"; system = "x86_64-linux";
outputs = {
self,
flake-parts,
nixpkgs,
}:
flake-parts.lib.mkFlake {inherit self;} {
systems = [
"aarch64-linux"
"i686-linux"
"x86_64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
perSystem = ctx @ {
system,
pkgs,
...
}: {
packages.default = ctx.config.packages.agenix;
packages.agenix = pkgs.callPackage ./pkgs/agenix.nix {};
checks.integration = import ./test/integration.nix {
inherit system pkgs nixpkgs;
};
};
flake.nixosModules = {
default = self.nixosModules.age;
age = import ./modules/age.nix;
};
flake.overlays.default = final: prev: {
agenix = prev.callPackage ./pkgs/agenix.nix {};
};
};

};

}
4 changes: 0 additions & 4 deletions overlay.nix

This file was deleted.

0 comments on commit 49af60e

Please sign in to comment.