nix-config/flake.nix

80 lines
2.5 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:bluskript/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, ... } @ attrs: with nixpkgs.lib; {
nixosConfigurations = {
nixos = nixosSystem {
system = "x86_64-linux";
specialArgs = attrs;
modules = [
./.
{
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;
}
];
};
2023-06-21 08:41:38 +02:00
};
} //
(builtins.listToAttrs
(builtins.map
(attr: {
name = attr;
value = let
directory = builtins.replaceStrings
["nixosModules" "homeManagerModules"]
["modules" "home"]
attr;
function = if directory == "packages"
then nixpkgs.legacyPackages.x86_64-linux.callPackage
else import;
filesMap = (builtins.listToAttrs
(builtins.map
(filename: {
name = builtins.replaceStrings [".nix"] [""] filename;
value = function ./${directory}/${filename}; })
(builtins.attrNames
(builtins.readDir ./${directory}))));
callP = (builtins.listToAttrs
(builtins.map
(filename: {
name = builtins.replaceStrings [".nix"] [""] filename;
value = function ./${directory}/${filename} { }; })
(builtins.attrNames
(builtins.readDir ./${directory}))));
val = if directory == "packages"
then { x86_64-linux = callP; }
else filesMap;
in (val); })
["overlays" "nixosModules" "homeManagerModules" "packages"]));
}