mirror of
https://github.com/donovanglover/nix-config.git
synced 2024-11-22 00:03:55 +01:00
63797c4259
I originally wanted to avoid maintaining my own forks of flake inputs to simplify usage with the actual upstream if wanted, however the lack of flakes supporting patches means that it's actually *easier* to maintain my own repositories with the changes I want. The main advantage of this is not having to wait for upstream. This also means that I'm able to easily control which things I want to update and when.
167 lines
4.0 KiB
Nix
167 lines
4.0 KiB
Nix
{
|
|
inputs = {
|
|
nixpkgs.url = "github:donovanglover/nixpkgs";
|
|
|
|
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";
|
|
flake = false;
|
|
};
|
|
};
|
|
|
|
outputs =
|
|
{
|
|
self,
|
|
nixpkgs,
|
|
mobile-nixos,
|
|
...
|
|
}@attrs:
|
|
let
|
|
inherit (nixpkgs.lib) nixosSystem;
|
|
inherit (nixpkgs.legacyPackages) x86_64-linux aarch64-linux;
|
|
|
|
inherit (builtins)
|
|
attrNames
|
|
listToAttrs
|
|
map
|
|
replaceStrings
|
|
readDir
|
|
;
|
|
|
|
flakeOutputs = [
|
|
"overlays"
|
|
"nixosModules"
|
|
"homeModules"
|
|
"packages"
|
|
"checks"
|
|
];
|
|
|
|
flakeDirectories = [
|
|
"overlays"
|
|
"modules"
|
|
"home"
|
|
"packages"
|
|
"tests"
|
|
];
|
|
in
|
|
{
|
|
nixosConfigurations =
|
|
let
|
|
phoneModules = [
|
|
./hosts/phone/configuration.nix
|
|
./hosts/phone/hardware-configuration.nix
|
|
];
|
|
in
|
|
{
|
|
nixos = nixosSystem {
|
|
system = "x86_64-linux";
|
|
|
|
specialArgs = attrs // {
|
|
nix-config = self;
|
|
};
|
|
|
|
modules = [
|
|
./hosts/laptop/configuration.nix
|
|
./hosts/laptop/hardware-configuration.nix
|
|
];
|
|
};
|
|
|
|
mobile-nixos = nixosSystem {
|
|
system = "aarch64-linux";
|
|
|
|
specialArgs = attrs // {
|
|
nix-config = self;
|
|
};
|
|
|
|
modules = phoneModules ++ [
|
|
(import "${mobile-nixos}/lib/configuration.nix" { device = "pine64-pinephone"; })
|
|
|
|
{
|
|
mobile.beautification = {
|
|
silentBoot = true;
|
|
splash = true;
|
|
};
|
|
}
|
|
];
|
|
};
|
|
|
|
mobile-nixos-vm = nixosSystem {
|
|
system = "x86_64-linux";
|
|
|
|
specialArgs = attrs // {
|
|
nix-config = self;
|
|
};
|
|
|
|
modules = phoneModules;
|
|
};
|
|
};
|
|
|
|
formatter = {
|
|
x86_64-linux = x86_64-linux.nixfmt-rfc-style;
|
|
aarch64-linux = aarch64-linux.nixfmt-rfc-style;
|
|
};
|
|
}
|
|
// (listToAttrs (
|
|
map (attributeName: {
|
|
name = attributeName;
|
|
value =
|
|
let
|
|
directory = replaceStrings flakeOutputs flakeDirectories attributeName;
|
|
|
|
attributeValue = listToAttrs (
|
|
map (file: {
|
|
name = replaceStrings [ ".nix" ] [ "" ] file;
|
|
value =
|
|
if directory == "packages" then
|
|
x86_64-linux.callPackage ./${directory}/${file} { }
|
|
else if directory == "tests" then
|
|
import ./${directory}/${file} {
|
|
inherit self;
|
|
pkgs = x86_64-linux;
|
|
}
|
|
else
|
|
import ./${directory}/${file};
|
|
}) (attrNames (readDir ./${directory}))
|
|
);
|
|
|
|
aarch64Packages = listToAttrs (
|
|
map (file: {
|
|
name = replaceStrings [ ".nix" ] [ "" ] file;
|
|
value =
|
|
if directory == "packages" then aarch64-linux.callPackage ./${directory}/${file} { } else null;
|
|
}) (attrNames (readDir ./${directory}))
|
|
);
|
|
|
|
attributeSet =
|
|
if directory == "packages" then
|
|
{
|
|
x86_64-linux = attributeValue;
|
|
aarch64-linux = aarch64Packages;
|
|
}
|
|
else if directory == "tests" then
|
|
{ x86_64-linux = attributeValue; }
|
|
else
|
|
attributeValue;
|
|
in
|
|
attributeSet;
|
|
}) flakeOutputs
|
|
));
|
|
}
|