mirror of
https://github.com/JulienMalka/snowfield.git
synced 2025-07-03 07:47:20 +02:00
Added utils function to clean code
This commit is contained in:
parent
e84ad90ba8
commit
3a701f454d
2 changed files with 36 additions and 33 deletions
33
utils.nix
Normal file
33
utils.nix
Normal file
|
@ -0,0 +1,33 @@
|
|||
{ nixpkgs, home-manager, inputs }:
|
||||
with builtins;
|
||||
|
||||
let mapAttrNames = f: set:
|
||||
listToAttrs (map (attr: { name = f attr; value = set.${attr}; }) (attrNames set));
|
||||
in
|
||||
{
|
||||
|
||||
mkMachine = host: host-config: modules: nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
specialArgs = {
|
||||
inherit inputs;
|
||||
};
|
||||
modules = builtins.attrValues modules ++ [
|
||||
./configuration.nix
|
||||
host-config
|
||||
home-manager.nixosModules.home-manager
|
||||
{
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
home-manager.users.julien = import ./config/home/home-lisa.nix;
|
||||
nixpkgs.overlays = [
|
||||
inputs.neovim-nightly-overlay.overlay
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
|
||||
importConfig = path: (mapAttrNames (name: nixpkgs.lib.removeSuffix ".nix" name)) ((builtins.mapAttrs (name: value: import (path + "/${name}")) (builtins.readDir path)));
|
||||
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue