Skip to content

Commit

Permalink
Nix: corrections for overlays, overrideable system (#6)
Browse files Browse the repository at this point in the history
* flake: change formatter to use legacyPackages

* flake: add overlay with explicit name

* flake: make systems overrideable

* flake: inherit packages from pkgsFor
  • Loading branch information
spikespaz committed Aug 11, 2023
1 parent 8c279b9 commit 0c2ce70
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 15 deletions.
18 changes: 17 additions & 1 deletion flake.lock

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

34 changes: 20 additions & 14 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
{
description = "Hyprland Protocols";

inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
# <https://github.com/nix-systems/nix-systems>
systems.url = "github:nix-systems/default-linux";
};

outputs = {
self,
nixpkgs,
systems,
...
}: let
inherit (nixpkgs) lib;
genSystems = lib.genAttrs [
"aarch64-linux"
"x86_64-linux"
];
pkgsFor = genSystems (system:
eachSystem = lib.genAttrs (import systems);
pkgsFor = eachSystem (system:
import nixpkgs {
inherit system;
overlays = [self.overlays.default];
localSystem = system;
overlays = [self.overlays.hyprland-protocols];
});
mkDate = longDate: (lib.concatStringsSep "-" [
(builtins.substring 0 4 longDate)
Expand All @@ -25,14 +27,18 @@
]);
version = "0.1" + "+date=" + (mkDate (self.lastModifiedDate or "19700101")) + "_" + (self.shortRev or "dirty");
in {
overlays.default = final: prev: {
hyprland-protocols = final.callPackage ./nix/default.nix {inherit version;};
overlays = {
hyprland-protocols = final: prev: {
hyprland-protocols = final.callPackage ./nix/default.nix {inherit version;};
};
default = self.overlays.hyprland-protocols;
};

packages = genSystems (system:
(self.overlays.default pkgsFor.${system} pkgsFor.${system})
// {default = self.packages.${system}.hyprland-protocols;});
packages = eachSystem (system: {
inherit (pkgsFor.${system}) hyprland-protocols;
default = self.packages.${system}.hyprland-protocols;
});

formatter = genSystems (system: pkgsFor.${system}.alejandra);
formatter = eachSystem (system: nixpkgs.legacyPackages.${system}.alejandra);
};
}

0 comments on commit 0c2ce70

Please sign in to comment.