nixos-config/flake.nix
Kiana Sheibani fb7b45f98d
feat!: change machine hostnames
Instead of merely naming my systems "laptop", "desktop", etc. (boring),
I now have them named after Aristotelian elements (cool).

This also gives me an excuse to refactor my flake file.
2024-10-15 03:25:56 -04:00

93 lines
2.5 KiB
Nix

{
description = "System conf";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
nixos-hardware.url = "github:NixOS/nixos-hardware";
mobile-nixos.url = "github:mobile-nixos/mobile-nixos";
mobile-nixos.flake = false;
sxmo.url = "github:wentam/sxmo-nix";
sxmo.flake = false;
home-manager.url = "github:nix-community/home-manager/master";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
tokyo-night-sddm-src.url = "github:rototrash/tokyo-night-sddm";
tokyo-night-sddm-src.flake = false;
};
outputs = { self,
nixpkgs,
home-manager,
nixos-hardware,
mobile-nixos,
sxmo,
...}@inputs:
let
username = "kiana";
fullname = "Kiana Sheibani";
email = "kiana.a.sheibani@gmail.com";
moduleArgs = { inherit username fullname email; } // inputs;
mkConfig =
{ machine,
system ? "x86_64-linux",
configModules ? [ ./config ],
configExtraModules ? [],
homeModules ? [ ./home-manager ],
homeExtraModules ? []
}:
{
"toki-${machine}" = nixpkgs.lib.nixosSystem {
inherit system;
modules =
configModules ++
configExtraModules ++
[
./machine.nix
{ _module.args = moduleArgs;
inherit machine; }
./hardware-configuration/${machine}.nix
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = moduleArgs;
home-manager.sharedModules = [ ./machine.nix { inherit machine; } ];
home-manager.users.${username} = {
imports = homeModules ++ homeExtraModules;
};
}
];
};
};
in {
nixosConfigurations =
mkConfig {
machine = "earth";
} //
mkConfig {
machine = "fire";
configExtraModules = [
nixos-hardware.nixosModules.microsoft-surface-pro-intel
];
} //
mkConfig {
machine = "air";
system = "aarch64-linux";
configExtraModules = [
./mobile/config.nix
(import (mobile-nixos + /lib/configuration.nix)
{ device = "pine64-pinephonepro"; })
(sxmo + /modules/sxmo)
(sxmo + /modules/tinydm)
];
homeModules = [
./mobile/home-manager.nix
];
};
};
}