dotfiles/nixos/flake.nix

173 lines
4.8 KiB
Nix
Raw Normal View History

2021-07-11 04:19:34 -06:00
{
inputs = {
nixos-hardware = { url = "github:NixOS/nixos-hardware"; };
nixpkgs = {
url = "github:NixOS/nixpkgs/nixos-unstable";
};
home-manager = {
2023-08-21 22:30:36 -06:00
url = "github:nix-community/home-manager";
2021-07-17 15:47:04 -06:00
inputs.nixpkgs.follows = "nixpkgs";
2021-07-11 04:19:34 -06:00
};
2021-07-11 04:19:34 -06:00
xmonad-contrib = {
url = "github:IvanMalison/xmonad-contrib/withMyChanges";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-utils.follows = "flake-utils";
git-ignore-nix.follows = "git-ignore-nix";
xmonad.follows = "xmonad";
};
2021-07-11 04:19:34 -06:00
};
2021-07-11 04:19:34 -06:00
xmonad = {
url = "path:../dotfiles/config/xmonad/xmonad";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-utils.follows = "flake-utils";
git-ignore-nix.follows = "git-ignore-nix";
};
2021-07-11 04:19:34 -06:00
};
taffybar = {
url = "path:../dotfiles/config/taffybar/taffybar";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-utils.follows = "flake-utils";
git-ignore-nix.follows = "git-ignore-nix";
xmonad.follows = "xmonad";
gtk-sni-tray.follows = "gtk-sni-tray";
gtk-strut.follows = "gtk-strut";
};
};
imalison-taffybar = {
url = "path:../dotfiles/config/taffybar";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-utils.follows = "flake-utils";
xmonad.follows = "xmonad";
taffybar.follows = "taffybar";
};
2021-07-13 03:37:03 -06:00
};
2021-07-19 19:38:04 -06:00
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";
2021-07-19 19:38:04 -06:00
};
2022-10-07 18:42:34 -06:00
nix = {
url = "github:IvanMalison/nix/my2.15.1";
2022-10-07 18:42:34 -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";
};
gtk-sni-tray = {
url = "github:taffybar/gtk-sni-tray";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-utils.follows = "flake-utils";
git-ignore-nix.follows = "git-ignore-nix";
status-notifier-item.follows = "status-notifier-item";
};
};
status-notifier-item = {
url = "github:taffybar/status-notifier-item";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-utils.follows = "flake-utils";
git-ignore-nix.follows = "git-ignore-nix";
};
};
gtk-strut = {
url = "github:taffybar/gtk-strut";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-utils.follows = "flake-utils";
git-ignore-nix.follows = "git-ignore-nix";
};
};
nixpkgs-regression = { url = "github:NixOS/nixpkgs"; };
2023-06-29 11:20:13 -06:00
nixified-ai = { url = "github:nixified-ai/flake"; };
nixos-wsl = { url = "github:nix-community/NixOS-WSL"; };
agenix.url = "github:ryantm/agenix";
2021-07-11 04:19:34 -06:00
};
outputs = inputs@{
2022-09-16 16:28:56 -06:00
self, nixpkgs, nixos-hardware, home-manager, taffybar, xmonad,
xmonad-contrib, notifications-tray-icon, nix, agenix, imalison-taffybar, ...
}:
2021-08-20 19:28:51 -06:00
let
machinesFilepath = ./machines;
machineFilenames = builtins.attrNames (builtins.readDir machinesFilepath);
2021-08-20 19:28:51 -06:00
machineNameFromFilename = filename: builtins.head (builtins.split "\\." filename);
machineNames = map machineNameFromFilename machineFilenames;
2021-08-20 19:28:51 -06:00
mkConfigurationParams = filename: {
name = machineNameFromFilename filename;
value = {
modules = [
(machinesFilepath + ("/" + filename)) agenix.nixosModules.default
];
2021-08-20 19:28:51 -06:00
};
};
2021-08-20 19:28:51 -06:00
defaultConfigurationParams =
builtins.listToAttrs (map mkConfigurationParams machineFilenames);
2023-06-28 21:43:55 -06:00
customParams = {
biskcomp = {
system = "aarch64-linux";
2021-08-20 19:28:51 -06:00
};
2023-06-28 21:43:55 -06:00
air-gapped-pi = {
system = "aarch64-linux";
};
};
mkConfig =
args@
{ system ? "x86_64-linux"
, baseModules ? []
, modules ? []
, specialArgs ? {}
, ...
}:
nixpkgs.lib.nixosSystem (args // {
inherit system;
modules = baseModules ++ modules;
specialArgs = rec {
inherit inputs machineNames;
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;
2023-10-03 14:50:43 -06:00
keys = (import ./keys.nix);
} // specialArgs;
});
2021-07-11 04:19:34 -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;
2021-07-11 04:19:34 -06:00
};
}