Update flake outputs

- Added overlays both for NixOS and home-manager configs.
- Fixed path for importing home-manager configurations.
- Added more comments for sanity. :)
This commit is contained in:
Gabriel Arazas 2021-12-06 15:33:03 +08:00
parent b8818e04c1
commit a2ed2a95c9

View File

@ -7,11 +7,22 @@
agenix.url = "github:ryantm/agenix"; agenix.url = "github:ryantm/agenix";
agenix.inputs.nixpkgs.follows = "nixpkgs"; agenix.inputs.nixpkgs.follows = "nixpkgs";
# Overlays.
neovim-nightly-overlay.url = "github:nix-community/neovim-nightly-overlay";
}; };
outputs = inputs@{ self, nixpkgs, ... }: outputs = inputs@{ self, nixpkgs, ... }:
let let
# All the target systems. overlays = [
# Put my custom packages to be available.
(self: super: import ./pkgs { pkgs = super; })
# Neovim nightly!
inputs.neovim-nightly-overlay.overlay
];
# All the target systems for my packages.
systems = [ systems = [
"x86_64-linux" "x86_64-linux"
"i686-linux" "i686-linux"
@ -28,12 +39,20 @@
lib = final; lib = final;
})); }));
# The default configuration for our NixOS systems.
hostDefaultConfig = { hostDefaultConfig = {
# Registering several registries.
# I'm narcissistic so I want my config to be one of the flakes in the registry.
nix.registry.config.flake = self;
# This will also prevent the annoying downloads since it always get the latest revision.
nix.registry.nixpkgs.flake = nixpkgs;
# Stallman-senpai will be disappointed. # Stallman-senpai will be disappointed.
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;
# Extend nixpkgs with our own package set. # Extend nixpkgs with our own package set.
nixpkgs.overlays = [ (self: super: import ./pkgs { pkgs = super; }) ]; nixpkgs.overlays = overlays;
# We live in a Unicode world and dominantly English in technical fields so we'll # We live in a Unicode world and dominantly English in technical fields so we'll
# have to go with it. # have to go with it.
@ -55,7 +74,16 @@
''; '';
}; };
userDefaultConfig = { system = "x86_64-linux"; }; # The default config for our home-manager configurations.
userDefaultConfig = {
system = "x86_64-linux";
# To be able to use the most of our config as possible, we want both to use the same overlays.
nixpkgs.overlays = overlays;
# Stallman-senpai will be disappointed. :(
nixpkgs.config.allowUnfree = true;
};
in { in {
# Exposes only my library with the custom functions to make it easier to include in other flakes. # Exposes only my library with the custom functions to make it easier to include in other flakes.
lib = import ./lib { lib = import ./lib {
@ -74,11 +102,16 @@
nixosModules = libExtended.mapAttrsRecursive (_: path: import path) nixosModules = libExtended.mapAttrsRecursive (_: path: import path)
(libExtended.filesToAttr ./modules/nixos); (libExtended.filesToAttr ./modules/nixos);
homeManagerConfigurations = libExtended.mapAttrs (user: path: libExtended.flakeUtils.mkUser path userDefaultConfig) (libExtended.filesToAttr ./users); # This will make importing user-specific configurations even easier on non-NixOS systems!
# NICE!
homeManagerConfigurations = libExtended.mapAttrs (user: path: libExtended.flakeUtils.mkUser path userDefaultConfig) (libExtended.filesToAttr ./users/home-manager);
# In case anybody want my modules for whatever reason, here you go. # In case anybody want my modules for whatever reason, here you go.
homeManagerModules = libExtended.mapAttrsRecursive (_: path: import path) (libExtended.filesToAttr ./modules/home-manager); homeManagerModules = libExtended.mapAttrsRecursive (_: path: import path) (libExtended.filesToAttr ./modules/home-manager);
# My custom packages, available in here as well.
# Though, I mainly support "x86_64-linux".
# I just want to try out supporting other systems.
packages = forAllSystems packages = forAllSystems
(system: import ./pkgs { pkgs = import nixpkgs { inherit system; }; }); (system: import ./pkgs { pkgs = import nixpkgs { inherit system; }; });
}; };