2023-06-06 23:18:09 +05:00
|
|
|
{ inputs, config, lib, pkgs, ... }:
|
|
|
|
with lib;
|
|
|
|
with lib.custom;
|
|
|
|
{
|
|
|
|
imports = [
|
|
|
|
inputs.home-manager.nixosModules.home-manager
|
|
|
|
] ++ (mapModulesRec' (toString ./modules) import);
|
|
|
|
|
|
|
|
# Common config for all nixos machines
|
|
|
|
environment.variables = {
|
|
|
|
DOTFILES = config.dotfiles.dir;
|
|
|
|
DOTFILES_BIN = config.dotfiles.binDir;
|
|
|
|
};
|
|
|
|
|
|
|
|
# Configure nix and nixpkgs
|
|
|
|
environment.variables.NIXPKGS_ALLOW_UNFREE = "1";
|
|
|
|
nix =
|
2023-06-15 11:05:31 +05:00
|
|
|
let
|
|
|
|
filteredInputs = filterAttrs (n: _: n != "self") inputs;
|
|
|
|
nixPathInputs = mapAttrsToList (n: v: "${n}=${v}") filteredInputs;
|
|
|
|
registryInputs = mapAttrs (_: v: { flake = v; }) filteredInputs;
|
|
|
|
in {
|
|
|
|
package = pkgs.nixFlakes;
|
|
|
|
extraOptions = "experimental-features = nix-command flakes";
|
|
|
|
nixPath = nixPathInputs ++ [
|
|
|
|
"nixpkgs-overlays=${config.dotfiles.dir}/overlays"
|
|
|
|
"dotfiles=${config.dotfiles.dir}"
|
2023-06-06 23:18:09 +05:00
|
|
|
];
|
2023-06-15 11:05:31 +05:00
|
|
|
registry = registryInputs // { dotfiles.flake = inputs.self; };
|
|
|
|
settings = {
|
|
|
|
substituters = [
|
|
|
|
"https://nix-community.cachix.org"
|
|
|
|
];
|
|
|
|
trusted-public-keys = [
|
|
|
|
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
|
|
|
|
];
|
|
|
|
auto-optimise-store = true;
|
|
|
|
};
|
|
|
|
gc = {
|
|
|
|
automatic = mkDefault true;
|
|
|
|
dates = mkDefault "weekly";
|
|
|
|
options = mkDefault "--delete-older-than 14d";
|
|
|
|
};
|
2023-06-06 23:18:09 +05:00
|
|
|
};
|
|
|
|
|
|
|
|
system.configurationRevision = with inputs; mkIf (self ? rev) self.rev;
|
2023-06-07 01:28:05 +05:00
|
|
|
system.stateVersion = "22.11";
|
2023-06-06 23:18:09 +05:00
|
|
|
|
|
|
|
## Some reasonable, global defaults
|
|
|
|
# This is here to appease 'nix flake check' for generic hosts with no
|
|
|
|
# hardware-configuration.nix or fileSystem config.
|
|
|
|
fileSystems."/".device = mkDefault "/dev/disk/by-label/nixos";
|
|
|
|
|
|
|
|
# The global useDHCP flag is deprecated, therefore explicitly set to false
|
|
|
|
# here. Per-interface useDHCP will be mandatory in the future, so we enforce
|
|
|
|
# this default behavior here.
|
|
|
|
networking.useDHCP = mkDefault false;
|
|
|
|
|
|
|
|
# Use the latest kernel
|
|
|
|
boot = {
|
|
|
|
kernelPackages = mkDefault pkgs.linuxPackages_latest;
|
|
|
|
loader = {
|
|
|
|
efi.canTouchEfiVariables = mkDefault true;
|
|
|
|
systemd-boot.configurationLimit = 10;
|
|
|
|
systemd-boot.enable = mkDefault true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
|
|
bind
|
|
|
|
cached-nix-shell
|
|
|
|
coreutils
|
|
|
|
git
|
|
|
|
vim
|
|
|
|
wget
|
|
|
|
curl
|
|
|
|
gnumake
|
|
|
|
unzip
|
2023-06-15 11:05:31 +05:00
|
|
|
cachix
|
2023-06-06 23:18:09 +05:00
|
|
|
];
|
|
|
|
}
|