nix-config/flake.nix

91 lines
2.8 KiB
Nix
Raw Normal View History

{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
2023-05-17 05:07:14 +02:00
home-manager = {
url = "github:nix-community/home-manager";
2023-05-17 05:07:14 +02:00
inputs.nixpkgs.follows = "nixpkgs";
};
2023-05-17 05:07:14 +02:00
stylix = {
url = "github:danth/stylix";
2023-05-17 05:35:52 +02:00
inputs = {
nixpkgs.follows = "nixpkgs";
home-manager.follows = "home-manager";
};
2023-05-17 05:07:14 +02:00
};
sakaya = {
url = "github:donovanglover/sakaya";
inputs.nixpkgs.follows = "nixpkgs";
};
2023-06-21 08:41:38 +02:00
};
outputs = { self, nixpkgs, home-manager, stylix, ... } @ attrs: let
inherit (nixpkgs.lib) nixosSystem;
inherit (nixpkgs.legacyPackages.x86_64-linux) nixpkgs-fmt callPackage;
checkArgs = {
pkgs = nixpkgs.legacyPackages.x86_64-linux;
inherit self;
};
flakeOutputs = [ "overlays" "nixosModules" "homeManagerModules" "packages" ];
flakeDirectories = [ "overlays" "modules" "home" "packages" ];
packageDirectory = "packages";
in {
formatter.x86_64-linux = nixpkgs-fmt;
nixosConfigurations = {
nixos = nixosSystem {
system = "x86_64-linux";
specialArgs = attrs;
modules = [
home-manager.nixosModules.home-manager
stylix.nixosModules.stylix
./hardware/laptop.nix
{
environment.pathsToLink = [
"/share/backgrounds"
"/share/eww"
"/share/thumbnailers"
"/share/fonts"
];
nixpkgs.overlays = builtins.attrValues self.overlays;
imports = builtins.attrValues self.nixosModules;
home-manager.sharedModules = builtins.attrValues self.homeManagerModules;
environment.systemPackages = builtins.attrValues self.packages.x86_64-linux;
modules.hardware = {
disableLaptopKeyboard = true;
lidIgnore = true;
powerIgnore = true;
};
}
];
};
2023-06-21 08:41:38 +02:00
};
checks.x86_64-linux = {
hyprland = import ./tests/hyprland.nix checkArgs;
neovim = import ./tests/neovim.nix checkArgs;
};
} //
(builtins.listToAttrs
(builtins.map
(attributeName: {
name = attributeName;
value = let
directory = builtins.replaceStrings flakeOutputs flakeDirectories attributeName;
attributeValue = (builtins.listToAttrs
(builtins.map
(file: {
2024-04-01 21:29:40 +02:00
name = builtins.replaceStrings [ ".nix" ] [ "" ] file;
value = if directory == packageDirectory then callPackage ./${directory}/${file} { } else import ./${directory}/${file}; })
(builtins.attrNames (builtins.readDir ./${directory}))));
attributeSet = if directory == packageDirectory then { x86_64-linux = attributeValue; } else attributeValue;
in (attributeSet); })
2024-04-01 21:29:40 +02:00
(flakeOutputs)));
}