treewide: export shared/modules/hjem

This method takes inspiration from how
[hjem-rum](https://github.com/snugnug/hjem-rum) does it
This commit is contained in:
Anthony Rodriguez 2025-02-09 18:31:07 +01:00
parent 1a299516a3
commit c0dda38da1
Signed by: nezia
SSH key fingerprint: SHA256:Ihfpl0rUpqDevYqnzSR34OYfVLbDNkBiUjs3CpX4ykA
5 changed files with 25 additions and 11 deletions

View file

@ -17,6 +17,8 @@
(system: function nixpkgs.legacyPackages.${system}); (system: function nixpkgs.legacyPackages.${system});
treefmtEval = forAllSystems (pkgs: treefmt-nix.lib.evalModule pkgs ./treefmt.nix); treefmtEval = forAllSystems (pkgs: treefmt-nix.lib.evalModule pkgs ./treefmt.nix);
in { in {
checks = builtins.mapAttrs (_: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib;
deploy.nodes = import ./nodes.nix {inherit inputs;};
devShells = forAllSystems (pkgs: { devShells = forAllSystems (pkgs: {
default = pkgs.mkShell { default = pkgs.mkShell {
packages = [ packages = [
@ -29,9 +31,8 @@
}); });
formatter = forAllSystems (pkgs: treefmtEval.${pkgs.system}.config.build.wrapper); formatter = forAllSystems (pkgs: treefmtEval.${pkgs.system}.config.build.wrapper);
nixosConfigurations = import ./hosts {inherit self inputs;}; nixosConfigurations = import ./hosts {inherit self inputs;};
nixosModules.hjemModules = import ./shared/modules/hjem/nixos.nix {inherit (nixpkgs) lib;};
packages = forAllSystems (pkgs: import ./shared/pkgs {inherit inputs pkgs;}); packages = forAllSystems (pkgs: import ./shared/pkgs {inherit inputs pkgs;});
deploy.nodes = import ./nodes.nix {inherit inputs;};
checks = builtins.mapAttrs (_: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib;
}; };
inputs = { inputs = {
# nix related # nix related

View file

@ -1,8 +1,12 @@
{inputs, ...}: let {
self,
inputs,
...
}: let
lib' = import ../lib inputs.nixpkgs.lib; lib' = import ../lib inputs.nixpkgs.lib;
mkSystem = args: mkSystem = args:
inputs.nixpkgs.lib.nixosSystem { inputs.nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs lib';}; specialArgs = {inherit self inputs lib';};
modules = modules =
(args.modules or []) (args.modules or [])
++ [../modules]; ++ [../modules];

View file

@ -1,17 +1,19 @@
{ {
self,
inputs, inputs,
lib, lib,
config, config,
... ...
}: let }: let
inherit (lib.modules) mkIf; inherit (lib.modules) mkIf;
inherit (lib.lists) singleton;
inherit (lib.filesystem) listFilesRecursive;
inherit (config.local.systemVars) username; inherit (config.local.systemVars) username;
inherit (config.local.homeVars) fullName; inherit (config.local.homeVars) fullName;
inherit (config.local.profiles) desktop; inherit (config.local.profiles) desktop;
in { in {
imports = [inputs.hjem.nixosModules.default]; imports = [
inputs.hjem.nixosModules.default
self.outputs.nixosModules.hjemModules
];
users.users.${username} = { users.users.${username} = {
isNormalUser = true; isNormalUser = true;
description = fullName; description = fullName;
@ -31,9 +33,5 @@ in {
directory = "/home/${username}"; directory = "/home/${username}";
user = "${username}"; user = "${username}";
}; };
extraModules = singleton {
imports = listFilesRecursive ../../shared/modules/hjem;
};
}; };
} }

View file

@ -0,0 +1,11 @@
{lib}: let
inherit (lib.filesystem) listFilesRecursive;
in {
config = {
hjem.extraModules = [
{
imports = listFilesRecursive ./collection;
}
];
};
}