dotfiles/nixos/bootstrap/flake.nix

116 lines
3.2 KiB
Nix
Raw Normal View History

2023-06-28 20:25:04 -06:00
{
inputs = {
nixos-hardware = { url = github:NixOS/nixos-hardware; };
2023-06-28 20:26:30 -06:00
nixpkgs = { url = github:NixOS/nixpkgs/nixos-unstable; };
2023-06-28 20:25:04 -06:00
home-manager = {
url = github:nix-community/home-manager;
inputs.nixpkgs.follows = "nixpkgs";
};
nix = {
2023-07-28 10:02:12 -06:00
url = github:IvanMalison/nix/my2.15.1;
2023-06-28 20:25:04 -06:00
};
flake-utils = {
url = github:numtide/flake-utils;
inputs.systems.follows = "systems";
};
systems = { url = github:nix-systems/default; };
git-ignore-nix = {
url = github:hercules-ci/gitignore.nix;
inputs.nixpkgs.follows = "nixpkgs";
};
nixos-wsl = { url = github:nix-community/NixOS-WSL; };
2023-08-20 05:23:21 -06:00
taffybar = {
url = "github:taffybar/taffybar";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-utils.follows = "flake-utils";
git-ignore-nix.follows = "git-ignore-nix";
xmonad.follows = "xmonad";
};
};
xmonad = {
url = "github:xmonad/xmonad";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-utils.follows = "flake-utils";
git-ignore-nix.follows = "git-ignore-nix";
};
};
xmonad-contrib = {
url = "github:xmonad/xmonad-contrib";
};
notifications-tray-icon = {
url = "github:IvanMalison/notifications-tray-icon";
inputs.flake-utils.follows = "flake-utils";
inputs.git-ignore-nix.follows = "git-ignore-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
nixified-ai = { url = "github:nixified-ai/flake"; };
2023-06-28 20:25:04 -06:00
};
outputs = inputs@{
self, nixpkgs, nixos-hardware, home-manager, nix, ...
2023-06-28 20:25:04 -06:00
}:
let
machinesPath = ../machines;
machineFilenames = builtins.attrNames (builtins.readDir machinesPath);
machineNameFromFilename = filename: builtins.head (builtins.split "\\." filename);
machineNames = map machineNameFromFilename machineFilenames;
mkConfigurationParams = filename: {
name = machineNameFromFilename filename;
value = {
modules = [ (machinesPath + ("/" + filename)) ];
};
};
defaultConfigurationParams =
builtins.listToAttrs (map mkConfigurationParams machineFilenames);
customParams = {
biskcomp = {
system = "aarch64-linux";
};
air-gapped-pi = {
system = "aarch64-linux";
};
};
2023-06-28 20:25:04 -06:00
mkConfig =
args@
{ system ? "x86_64-linux"
, baseModules ? []
, modules ? []
, specialArgs ? {}
, ...
}:
nixpkgs.lib.nixosSystem (args // {
inherit system;
modules = baseModules ++ modules;
2023-08-20 05:23:21 -06:00
specialArgs = rec {
inherit inputs machineNames;
2023-08-20 05:23:21 -06:00
makeEnable = (import ../make-enable.nix) nixpkgs.lib;
mapValueToKeys = keys: value: builtins.listToAttrs (map (name: { inherit name value; }) keys);
realUsers = [ "root" "imalison" "kat" "dean" "alex" ];
forEachUser = mapValueToKeys realUsers;
} // specialArgs // (import ../keys.nix);
2023-06-28 20:25:04 -06:00
});
in
{
nixosConfigurations = builtins.mapAttrs (machineName: params:
let machineParams =
if builtins.hasAttr machineName customParams
then (builtins.getAttr machineName customParams)
else {};
in mkConfig (params // machineParams)
) defaultConfigurationParams;
};
}