Refactor flake configuration

This commit is contained in:
foo-dogsquared 2022-01-02 22:30:00 +08:00
parent 916c231bbb
commit 45c074771d

View File

@ -31,6 +31,7 @@
outputs = inputs@{ self, nixpkgs, home-manager, ... }: outputs = inputs@{ self, nixpkgs, home-manager, ... }:
let let
# The order here is important(?).
overlays = [ overlays = [
# Put my custom packages to be available. # Put my custom packages to be available.
(self: super: import ./pkgs { pkgs = super; }) (self: super: import ./pkgs { pkgs = super; })
@ -111,15 +112,17 @@
userDefaultConfig = { userDefaultConfig = {
system = "x86_64-linux"; system = "x86_64-linux";
# To be able to use the most of our config as possible, we want both to extraModules = [{
# use the same overlays. # To be able to use the most of our config as possible, we want both to
nixpkgs.overlays = overlays; # use the same overlays.
nixpkgs.overlays = overlays;
# Stallman-senpai will be disappointed. :( # Stallman-senpai will be disappointed. :(
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;
# Let home-manager to manage itself. # Let home-manager to manage itself.
programs.home-manager.enable = true; programs.home-manager.enable = true;
}];
}; };
in { in {
# Exposes only my library with the custom functions to make it easier to # Exposes only my library with the custom functions to make it easier to
@ -141,7 +144,7 @@
(libExtended.filesToAttr ./modules/nixos); (libExtended.filesToAttr ./modules/nixos);
# I can now install home-manager users in non-NixOS systems. # I can now install home-manager users in non-NixOS systems.
# NICE! # NICE? (TODO: Please test it in the future before saying these things.)
homeManagerConfigurations = libExtended.mapAttrs homeManagerConfigurations = libExtended.mapAttrs
(_: path: libExtended.flakeUtils.mkUser path userDefaultConfig) (_: path: libExtended.flakeUtils.mkUser path userDefaultConfig)
(libExtended.filesToAttr ./users/home-manager); (libExtended.filesToAttr ./users/home-manager);
@ -152,12 +155,12 @@
# My custom packages, available in here as well. Though, I mainly support # My custom packages, available in here as well. Though, I mainly support
# "x86_64-linux". I just want to try out supporting other systems. # "x86_64-linux". I just want to try out supporting other systems.
packages = forAllSystems packages = forAllSystems (system:
(system: import ./pkgs { pkgs = import nixpkgs { inherit system; }; }); import ./pkgs { pkgs = import nixpkgs { inherit system overlays; }; });
# The development environment for this flake. # The development environment for this flake.
devShell = forAllSystems (system: devShell = forAllSystems (system:
import ./shell.nix { pkgs = import nixpkgs { inherit system; }; }); import ./shell.nix { pkgs = import nixpkgs { inherit system overlays; }; });
# My several development shells for usual type of projects. This is much # My several development shells for usual type of projects. This is much
# more preferable than installing all of the packages at the system # more preferable than installing all of the packages at the system