feat(flake): use nix-systems and make sure all inputs use the same one
All checks were successful
Discord / discord commits (push) Has been skipped
All checks were successful
Discord / discord commits (push) Has been skipped
This commit is contained in:
parent
c5c1dfe63b
commit
9ea4b26421
4 changed files with 52 additions and 37 deletions
BIN
flake.lock
BIN
flake.lock
Binary file not shown.
BIN
flake.nix
BIN
flake.nix
Binary file not shown.
79
inputs.nix
79
inputs.nix
|
@ -1,30 +1,36 @@
|
|||
let
|
||||
inherit (builtins) listToAttrs map removeAttrs;
|
||||
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
|
||||
lib = import "${builtins.fetchTarball {
|
||||
url = "https://github.com/NixOS/nixpkgs/archive/${lock.nodes.nixpkgs.locked.rev}.tar.gz";
|
||||
sha256 = lock.nodes.nixpkgs.locked.narHash;
|
||||
}}/lib";
|
||||
|
||||
inherit (lib) attrValues findFirst foldl' hasAttr listToAttrs matchAttrs map optionalAttrs recursiveUpdate removeAttrs;
|
||||
|
||||
recursiveUpdateList = list: foldl' recursiveUpdate {} list;
|
||||
|
||||
# Misc functions
|
||||
mkInput = {type ? "github", ...} @ info: info // {inherit type;};
|
||||
mkDep = info:
|
||||
mkInput (info
|
||||
// {
|
||||
inputs =
|
||||
{nixpkgs.follows = "nixpkgs";}
|
||||
// (
|
||||
if builtins.hasAttr "inputs" info
|
||||
then info.inputs
|
||||
else {}
|
||||
);
|
||||
});
|
||||
mkHyprDep = info:
|
||||
mkInput (info
|
||||
// {
|
||||
inputs =
|
||||
{hyprland.follows = "hyprland";}
|
||||
// (
|
||||
if builtins.hasAttr "inputs" info
|
||||
then info.inputs
|
||||
else {}
|
||||
);
|
||||
});
|
||||
mkInput = {type ? "github", ...} @ info: let
|
||||
input =
|
||||
findFirst
|
||||
(x: matchAttrs (removeAttrs info ["inputs"]) (x.original or {})) {}
|
||||
(attrValues lock.nodes);
|
||||
|
||||
mkOverride = i:
|
||||
optionalAttrs
|
||||
(hasAttr i (input.inputs or {}))
|
||||
{inputs.${i}.follows = i;};
|
||||
in
|
||||
recursiveUpdateList [
|
||||
info
|
||||
{inherit type;}
|
||||
(mkOverride "systems")
|
||||
(mkOverride "flake-utils")
|
||||
(mkOverride "lib-aggregate")
|
||||
];
|
||||
|
||||
mkDep = info: mkInput (recursiveUpdate info {inputs.nixpkgs.follows = "nixpkgs";});
|
||||
mkHyprDep = info: mkInput (recursiveUpdate info {inputs.hyprland.follows = "hyprland";});
|
||||
mkSrc = info: mkInput (info // {flake = false;});
|
||||
|
||||
# Inputs
|
||||
|
@ -54,10 +60,14 @@ let
|
|||
repo = "nix-melt";
|
||||
};
|
||||
|
||||
mozilla-addons-to-nix = mkDep {
|
||||
type = "sourcehut";
|
||||
owner = "~rycee";
|
||||
repo = "mozilla-addons-to-nix";
|
||||
# These are here to make sure all 'systems' are the same
|
||||
flake-utils = mkInput {
|
||||
owner = "numtide";
|
||||
repo = "flake-utils";
|
||||
};
|
||||
lib-aggregate = mkInput {
|
||||
owner = "nix-community";
|
||||
repo = "lib-aggregate";
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -151,11 +161,6 @@ let
|
|||
# path = "/home/matt/git/hyprland-plugins";
|
||||
};
|
||||
|
||||
Hyprspace = mkHyprDep {
|
||||
owner = "KZDKM";
|
||||
repo = "Hyprspace";
|
||||
};
|
||||
|
||||
hyprgrass = mkHyprDep {
|
||||
owner = "horriblename";
|
||||
repo = "hyprgrass";
|
||||
|
@ -304,7 +309,13 @@ in {
|
|||
inherit mkDep mkInput mkSrc;
|
||||
|
||||
otherInputs =
|
||||
nixTools
|
||||
{
|
||||
flakegen = {
|
||||
url = "github:jorsn/flakegen";
|
||||
inputs.systems.follows = "systems";
|
||||
};
|
||||
}
|
||||
// nixTools
|
||||
// overlays
|
||||
// nvimInputs
|
||||
// clusterInputs
|
||||
|
|
10
outputs.nix
10
outputs.nix
|
@ -3,6 +3,11 @@
|
|||
inherit (import ./inputs.nix) mkDep mkInput otherInputs;
|
||||
|
||||
mainInputs = {
|
||||
systems = mkInput {
|
||||
owner = "nix-systems";
|
||||
repo = "default-linux";
|
||||
};
|
||||
|
||||
nixpkgs = mkInput {
|
||||
owner = "NixOS";
|
||||
repo = "nixpkgs";
|
||||
|
@ -45,14 +50,13 @@
|
|||
nixpkgs,
|
||||
secrets,
|
||||
self,
|
||||
systems,
|
||||
...
|
||||
}: let
|
||||
inherit (import "${self}/lib.nix" inputs) mkVersion mkNixOS mkNixOnDroid mkPkgs;
|
||||
|
||||
supportedSystems = ["x86_64-linux" "aarch64-linux"];
|
||||
|
||||
perSystem = attrs:
|
||||
nixpkgs.lib.genAttrs supportedSystems (system:
|
||||
nixpkgs.lib.genAttrs (import systems) (system:
|
||||
attrs (mkPkgs system nixpkgs));
|
||||
in {
|
||||
nixosModules = import ./nixosModules self;
|
||||
|
|
Loading…
Reference in a new issue