flake: move ouputs logic to 'flake/'

This commit is contained in:
Bruno BELANYI 2023-03-07 14:25:46 +00:00
parent d14f96d584
commit 9f6a9d2ff7
2 changed files with 81 additions and 72 deletions

View file

@ -66,76 +66,5 @@
, nur , nur
, pre-commit-hooks , pre-commit-hooks
}: }:
let import ./flake inputs;
inherit (self) lib;
inherit (futils.lib) eachSystem system;
mySystems = [
system.aarch64-darwin
system.aarch64-linux
system.x86_64-darwin
system.x86_64-linux
];
eachMySystem = eachSystem mySystems;
in
eachMySystem
(system:
rec {
apps = {
diff-flake = futils.lib.mkApp { drv = packages.diff-flake; };
default = apps.diff-flake;
};
checks = import ./flake/checks.nix inputs system;
devShells = import ./flake/dev-shells.nix inputs system;
packages = import ./flake/packages.nix inputs system;
# Work-around for https://github.com/nix-community/home-manager/issues/3075
legacyPackages = {
homeConfigurations = {
ambroisie = home-manager.lib.homeManagerConfiguration {
# Work-around for home-manager
# * not letting me set `lib` as an extraSpecialArgs
# * not respecting `nixpkgs.overlays` [1]
# [1]: https://github.com/nix-community/home-manager/issues/2954
pkgs = import nixpkgs {
inherit system;
overlays = (lib.attrValues self.overlays) ++ [
nur.overlay
];
};
modules = [
./home
{
# The basics
home.username = "ambroisie";
home.homeDirectory = "/home/ambroisie";
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
# This is a generic linux install
targets.genericLinux.enable = true;
}
];
extraSpecialArgs = {
# Inject inputs to use them in global registry
inherit inputs;
};
};
};
};
}) // {
lib = import ./flake/lib.nix inputs;
overlays = import ./flake/overlays.nix inputs;
nixosConfigurations = import ./flake/nixos.nix inputs;
};
} }

80
flake/default.nix Normal file
View file

@ -0,0 +1,80 @@
{ self
, futils
, home-manager
, nixpkgs
, nur
, ...
} @ inputs:
let
inherit (self) lib;
inherit (futils.lib) eachSystem system;
mySystems = [
system.aarch64-darwin
system.aarch64-linux
system.x86_64-darwin
system.x86_64-linux
];
eachMySystem = eachSystem mySystems;
systemDependant = system: {
apps = {
diff-flake = futils.lib.mkApp { drv = self.packages.${system}.diff-flake; };
default = self.apps.${system}.diff-flake;
};
checks = import ./checks.nix inputs system;
devShells = import ./dev-shells.nix inputs system;
packages = import ./packages.nix inputs system;
# Work-around for https://github.com/nix-community/home-manager/issues/3075
legacyPackages = {
homeConfigurations = {
ambroisie = home-manager.lib.homeManagerConfiguration {
# Work-around for home-manager
# * not letting me set `lib` as an extraSpecialArgs
# * not respecting `nixpkgs.overlays` [1]
# [1]: https://github.com/nix-community/home-manager/issues/2954
pkgs = import nixpkgs {
inherit system;
overlays = (lib.attrValues self.overlays) ++ [
nur.overlay
];
};
modules = [
"${self}/home"
{
# The basics
home.username = "ambroisie";
home.homeDirectory = "/home/ambroisie";
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
# This is a generic linux install
targets.genericLinux.enable = true;
}
];
extraSpecialArgs = {
# Inject inputs to use them in global registry
inherit inputs;
};
};
};
};
};
systemIndependant = {
lib = import ./lib.nix inputs;
overlays = import ./overlays.nix inputs;
nixosConfigurations = import ./nixos.nix inputs;
};
in
(eachMySystem systemDependant) // systemIndependant