Modularize flake outputs

This commit is contained in:
SebastianStork 2024-07-12 00:31:20 +02:00
parent 9b76581f82
commit 63f79df82b
4 changed files with 64 additions and 45 deletions

View file

@ -52,52 +52,14 @@
};
outputs =
inputs:
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
{ flake-parts, ... }@inputs:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = [ "x86_64-linux" ];
flake = {
nixosConfigurations = {
north = inputs.nixpkgs.lib.nixosSystem {
specialArgs = {
inherit (inputs) self;
inherit inputs;
};
modules = [
./hosts/north
"${inputs.self}/users/seb/@north"
imports = [
./flake/nixosConfigurations.nix
./flake/devShells.nix
./flake/formatter.nix
];
};
inspiron = inputs.nixpkgs.lib.nixosSystem {
specialArgs = {
inherit (inputs) self;
inherit inputs;
};
modules = [
./hosts/inspiron
"${inputs.self}/users/seb/@inspiron"
];
};
};
};
perSystem =
{ pkgs, ... }:
{
devShells.sops = pkgs.mkShell {
packages = [
pkgs.sops
pkgs.age
pkgs.ssh-to-age
];
};
formatter =
(inputs.treefmt-nix.lib.evalModule pkgs {
projectRootFile = "flake.nix";
programs.nixfmt.enable = true;
programs.prettier.enable = true;
}).config.build.wrapper;
};
};
}

14
flake/devShells.nix Normal file
View file

@ -0,0 +1,14 @@
{ ... }:
{
perSystem =
{ pkgs, ... }:
{
devShells.sops = pkgs.mkShell {
packages = [
pkgs.sops
pkgs.age
pkgs.ssh-to-age
];
};
};
}

13
flake/formatter.nix Normal file
View file

@ -0,0 +1,13 @@
{ inputs, ... }:
{
perSystem =
{ pkgs, ... }:
{
formatter =
(inputs.treefmt-nix.lib.evalModule pkgs {
projectRootFile = "flake.nix";
programs.nixfmt.enable = true;
programs.prettier.enable = true;
}).config.build.wrapper;
};
}

View file

@ -0,0 +1,30 @@
{
nixpkgs,
self,
inputs,
...
}:
{
flake = {
nixosConfigurations = {
north = inputs.nixpkgs.lib.nixosSystem {
specialArgs = {
inherit self inputs;
};
modules = [
"${self}/hosts/north"
"${self}/users/seb/@north"
];
};
inspiron = inputs.nixpkgs.lib.nixosSystem {
specialArgs = {
inherit self inputs;
};
modules = [
"${self}/hosts/inspiron"
"${self}/users/seb/@inspiron"
];
};
};
};
}