flakes/flake.nix

96 lines
3.2 KiB
Nix
Raw Normal View History

2021-05-11 14:32:58 +07:00
{
inputs = {
nixpkgs = { url = "github:NixOS/nixpkgs/nixos-unstable"; };
home-manager = { url = "github:LavaDesu/home-manager/aa"; };
2021-05-11 14:32:58 +07:00
secrets = { url = "github:LavaDesu/flakes-secrets"; };
home-manager.inputs.nixpkgs.follows = "nixpkgs";
2021-05-11 14:32:58 +07:00
};
outputs = inputs: with inputs;
2021-05-13 17:59:46 +07:00
let
getPaths = root: builtins.map
(path: root + ("/" + path)) # Prepends root path
(builtins.attrNames (builtins.readDir root)); # Reads root path
customPackages = pkgs:
let
callPackage = pkgs.callPackage;
2021-06-28 08:48:08 +07:00
in rec {
linux_lava = callPackage ./packages/linux-lava {};
linux_tkg = callPackage ./packages/linux-tkg {
kernelPatches = with pkgs.kernelPatches; [
bridge_stp_helper
request_key_helper
];
};
linuxPackages_tkg = args: pkgs.recurseIntoAttrs (pkgs.linuxPackagesFor (linux_tkg.override args));
wine-osu = callPackage ./packages/wine-osu { inherit getPaths; };
2021-06-28 08:48:08 +07:00
}
# For github workflow tests
// builtins.listToAttrs (builtins.map (e: {
2021-06-28 08:57:18 +07:00
name = "linux_tkg-${e.scheduler}-${pkgs.lib.stringAsChars (x: if x == "." then "" else x) e.version}";
2021-06-28 08:48:08 +07:00
value = callPackage ./packages/linux-tkg {
inherit (e) scheduler version;
kernelPatches = with pkgs.kernelPatches; [
bridge_stp_helper
request_key_helper
];
};
}) (pkgs.lib.cartesianProductOfSets {
scheduler = ["bmq" "cfs" "cacule" "muqss" "pds"];
version = ["5.4" "5.10" "5.12"];
2021-06-28 08:48:08 +07:00
})) // {
2021-06-28 08:57:18 +07:00
"linux_tkg-upds-510" = callPackage ./packages/linux-tkg {
2021-06-28 08:48:08 +07:00
version = "5.10";
scheduler = "upds";
kernelPatches = with pkgs.kernelPatches; [
bridge_stp_helper
request_key_helper
];
};
};
overlays = (builtins.map
(path: import path) # Imports path
(builtins.filter
(path: nixpkgs.lib.hasSuffix ".nix" path) # Checks file extension
(getPaths ./overlays)
)
) ++ [(self: super: customPackages super)];
revCount = "297098";
2021-06-16 16:08:10 +07:00
base = { config, ... }: {
system = {
configurationRevision = nixpkgs.lib.mkIf (self ? rev) self.rev;
nixos = rec {
version = config.system.nixos.release + versionSuffix;
versionSuffix = ".${nixpkgs.lib.substring 0 8 (nixpkgs.lastModifiedDate or nixpkgs.lastModified or "19700101")}.r${revCount}-${nixpkgs.lib.substring 0 11 (nixpkgs.rev or "dirty")}";
};
};
2021-05-13 17:59:46 +07:00
nix.registry.nixpkgs.flake = nixpkgs;
nixpkgs.overlays = overlays;
2021-05-13 17:59:46 +07:00
};
2021-05-26 21:05:59 +07:00
hm-base = {
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
};
2021-05-13 17:59:46 +07:00
};
in
{
nixosConfigurations."winter" = nixpkgs.lib.nixosSystem {
2021-05-13 17:59:46 +07:00
system = "x86_64-linux";
modules = [
base
2021-05-26 21:05:59 +07:00
home-manager.nixosModules.home-manager
hm-base
./hosts/winter
secrets.nixosModules.winter
2021-05-13 17:59:46 +07:00
];
};
packages.x86_64-linux = customPackages nixpkgs.legacyPackages.x86_64-linux;
2021-05-11 14:32:58 +07:00
};
}