Skip to content

Commit

Permalink
Nix: refactor flake
Browse files Browse the repository at this point in the history
  • Loading branch information
fufexan committed Feb 29, 2024
1 parent 6ea4e04 commit cc465d0
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 19 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.

37 changes: 20 additions & 17 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,43 @@

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
systems.url = "github:nix-systems/default-linux";

hyprlang = {
url = "github:hyprwm/hyprlang";
inputs.nixpkgs.follows = "nixpkgs";
};
};

outputs = inputs: let
inherit (inputs.nixpkgs) lib;
genSystems = lib.genAttrs [
# Add more systems if they are supported
"x86_64-linux"
"aarch64-linux"
];
pkgsFor = genSystems (system:
import inputs.nixpkgs {
overlays = [inputs.self.overlays.default];
inherit system;
outputs = {
self,
nixpkgs,
systems,
...
} @ inputs: let
inherit (nixpkgs) lib;
eachSystem = lib.genAttrs (import systems);

pkgsFor = eachSystem (system:
import nixpkgs {
localSystem.system = system;
overlays = with self.overlays; [default];
});
in {
overlays = import ./nix/overlays.nix {inherit inputs lib;};

packages = genSystems (system: {
packages = eachSystem (system: {
default = self.packages.${system}.hypridle;
inherit (pkgsFor.${system}) hypridle;
default = inputs.self.packages.${system}.hypridle;
});

homeManagerModules = {
hypridle = import ./nix/hm-module.nix inputs.self;
default = inputs.self.homeManagerModules.hypridle;
default = self.homeManagerModules.hypridle;
hypridle = import ./nix/hm-module.nix self;
};

checks = genSystems (system: inputs.self.packages.${system});
checks = eachSystem (system: self.packages.${system});

formatter = genSystems (system: pkgsFor.${system}.alejandra);
formatter = eachSystem (system: pkgsFor.${system}.alejandra);
};
}
4 changes: 3 additions & 1 deletion nix/overlays.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
(builtins.substring 6 2 longDate)
]);
in {
default = lib.composeManyExtensions [
default = inputs.self.overlays.hypridle;

hypridle = lib.composeManyExtensions [
inputs.hyprlang.overlays.default
(final: prev: {
hypridle = prev.callPackage ./default.nix {
Expand Down

0 comments on commit cc465d0

Please sign in to comment.