mirror of
https://github.com/donovanglover/nix-config.git
synced 2024-11-07 17:04:00 +01:00
eac686339b
Using @attrs for the flake was cool at first, but this doesn't actually work if we want to use our nix-config inside NixOS containers due to how `self` works. Because of this, it's easier to simply ban @attrs altogether and use `nix-config` for everything since it's possible to access *all* the inputs of nix-config from itself instead of having to manually inherit each input we want (which could be any of them).
122 lines
2.7 KiB
Nix
122 lines
2.7 KiB
Nix
{
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
|
|
home-manager = {
|
|
url = "github:donovanglover/home-manager";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
|
|
stylix = {
|
|
url = "github:donovanglover/stylix";
|
|
inputs = {
|
|
nixpkgs.follows = "nixpkgs";
|
|
home-manager.follows = "home-manager";
|
|
};
|
|
};
|
|
|
|
sakaya = {
|
|
url = "github:donovanglover/sakaya";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
|
|
mobile-nixos = {
|
|
url = "github:donovanglover/mobile-nixos";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
};
|
|
|
|
outputs =
|
|
{
|
|
self,
|
|
nixpkgs,
|
|
...
|
|
}:
|
|
let
|
|
inherit (nixpkgs.lib) nixosSystem;
|
|
inherit (nixpkgs.lib.filesystem) packagesFromDirectoryRecursive listFilesRecursive;
|
|
inherit (builtins) listToAttrs map replaceStrings;
|
|
|
|
forAllSystems =
|
|
function:
|
|
nixpkgs.lib.genAttrs [
|
|
"x86_64-linux"
|
|
"aarch64-linux"
|
|
] (system: function nixpkgs.legacyPackages.${system});
|
|
|
|
nameOf = path: replaceStrings [ ".nix" ] [ "" ] (baseNameOf (toString path));
|
|
in
|
|
{
|
|
packages = forAllSystems (
|
|
pkgs:
|
|
packagesFromDirectoryRecursive {
|
|
inherit (pkgs) callPackage;
|
|
|
|
directory = ./packages;
|
|
}
|
|
);
|
|
|
|
nixosModules = listToAttrs (
|
|
map (file: {
|
|
name = nameOf file;
|
|
value = import file;
|
|
}) (listFilesRecursive ./modules)
|
|
);
|
|
|
|
homeModules = listToAttrs (
|
|
map (file: {
|
|
name = nameOf file;
|
|
value = import file;
|
|
}) (listFilesRecursive ./home)
|
|
);
|
|
|
|
overlays = listToAttrs (
|
|
map (file: {
|
|
name = nameOf file;
|
|
value = import file;
|
|
}) (listFilesRecursive ./overlays)
|
|
);
|
|
|
|
checks.x86_64-linux = listToAttrs (
|
|
map (file: {
|
|
name = nameOf file;
|
|
|
|
value = import file {
|
|
inherit self;
|
|
pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
|
};
|
|
}) (listFilesRecursive ./tests)
|
|
);
|
|
|
|
nixosConfigurations = {
|
|
nixos = nixosSystem {
|
|
system = "x86_64-linux";
|
|
|
|
specialArgs = {
|
|
nix-config = self;
|
|
};
|
|
|
|
modules = [
|
|
./hosts/laptop/configuration.nix
|
|
./hosts/laptop/hardware-configuration.nix
|
|
];
|
|
};
|
|
|
|
mobile-nixos = nixosSystem {
|
|
system = "aarch64-linux";
|
|
|
|
specialArgs = {
|
|
nix-config = self;
|
|
};
|
|
|
|
modules = [
|
|
./hosts/phone/configuration.nix
|
|
./hosts/phone/hardware-configuration.nix
|
|
];
|
|
};
|
|
};
|
|
|
|
formatter = forAllSystems (pkgs: pkgs.nixfmt-rfc-style);
|
|
};
|
|
}
|