dotfiles/nixos/flake.nix

89 lines
2.6 KiB
Nix
Raw Normal View History

2021-07-11 04:19:34 -06:00
{
inputs = {
2021-07-20 20:42:46 -06:00
nixos-hardware.url = github:IvanMalison/nixos-hardware;
nix = {
url = github:IvanMalison/nix/master;
2021-07-17 15:47:04 -06:00
inputs.nixpkgs.follows = "nixpkgs";
};
2021-07-17 15:47:04 -06:00
nixpkgs = {
url = path:./nixpkgs;
2021-07-11 04:19:34 -06:00
};
home-manager = {
url = path:./home-manager;
2021-07-17 15:47:04 -06:00
inputs.nixpkgs.follows = "nixpkgs";
2021-07-11 04:19:34 -06:00
};
xmonad-contrib = {
url = path:../dotfiles/config/xmonad/xmonad-contrib;
2021-07-17 15:47:04 -06:00
inputs.nixpkgs.follows = "nixpkgs";
2021-07-11 04:19:34 -06:00
};
xmonad = {
url = path:../dotfiles/config/xmonad/xmonad;
2021-07-17 15:47:04 -06:00
inputs.nixpkgs.follows = "nixpkgs";
2021-07-11 04:19:34 -06:00
};
taffybar = {
2021-07-24 18:16:19 -06:00
url = path:../dotfiles/config/taffybar/taffybar;
2021-07-17 15:47:04 -06:00
inputs.nixpkgs.follows = "nixpkgs";
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/master;
};
2021-07-11 04:19:34 -06:00
};
outputs = inputs@{
2021-07-17 15:47:04 -06:00
self, nix, nixpkgs, nixos-hardware, home-manager, taffybar, xmonad,
2021-07-19 19:38:04 -06:00
xmonad-contrib, notifications-tray-icon
}:
let forAll = ({ ... }: {
nix = {
extraOptions = ''
2021-07-17 23:00:46 -06:00
experimental-features = nix-command flakes ca-references
'';
2021-07-17 15:47:04 -06:00
registry.nixpkgs.flake = nixpkgs;
};
nixpkgs.overlays = [
2021-07-23 23:44:42 -06:00
nix.overlay xmonad.overlay xmonad-contrib.overlay
2021-07-24 18:16:19 -06:00
notifications-tray-icon.overlay (import ../dotfiles/config/taffybar/overlay.nix)
2021-08-03 10:09:34 -06:00
(import ./overlay.nix)
2021-07-23 23:44:42 -06:00
] ++ taffybar.overlays;
2021-07-13 03:37:03 -06:00
imports = [
home-manager.nixosModule
];
2021-07-18 20:19:06 -06:00
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.imalison = import ./home-manager.nix;
2021-07-11 04:19:34 -06:00
});
mkConfig = args@{ system ? "x86_64-linux", baseModules ? [ forAll ], modules ? [], specialArgs ? {}, ... }:
nixpkgs.lib.nixosSystem (args // {
inherit system;
modules = baseModules ++ modules;
specialArgs = { inherit inputs; } // specialArgs;
});
machineFilenames = builtins.attrNames (builtins.readDir ./machines);
machineNameFromFilename = filename: builtins.head (builtins.split "\\." filename);
mkConfigurationParams = filename: {
name = machineNameFromFilename filename;
value = {
modules = [ (./machines + ("/" + filename)) ];
};
};
defaultConfigurationParams =
builtins.listToAttrs (map mkConfigurationParams machineFilenames);
customParams = {
biskcomp = {
system = "aarch64-linux";
};
air-gapped-pi = {
system = "aarch64-linux";
};
};
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
};
}