run nix format on this repository
This commit is contained in:
parent
1b5b697dfb
commit
d281a23a8a
17 changed files with 354 additions and 165 deletions
|
|
@ -1,3 +1,6 @@
|
|||
{ ... }@flake: { ... }@inputs: { ... }@imports: {
|
||||
imports = builtins.attrValues (flake.hmModules or {});
|
||||
{ ... }@flake:
|
||||
{ ... }@inputs:
|
||||
{ ... }@imports:
|
||||
{
|
||||
imports = builtins.attrValues (flake.hmModules or { });
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,8 @@
|
|||
flake: { ... }@inputs: { ... }@imports: let
|
||||
flake:
|
||||
{ ... }@inputs:
|
||||
{ ... }@imports:
|
||||
let
|
||||
module' = name: imports: builtins.trace "user module: ${name}" { inherit imports; };
|
||||
modules = builtins.mapAttrs module' imports."user/module";
|
||||
in { default = module' "default" (builtins.attrValues modules); } // modules
|
||||
in
|
||||
{ default = module' "default" (builtins.attrValues modules); } // modules
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
{ ... }@flake: { ... }@inputs: { profile, ... }@imports: let
|
||||
{ ... }@flake:
|
||||
{ ... }@inputs:
|
||||
{ profile, ... }@imports:
|
||||
let
|
||||
profile' = name: snippets: builtins.trace "home-manager: profile: ${name}" { imports = snippets; };
|
||||
in builtins.mapAttrs profile' profile
|
||||
|
||||
in
|
||||
builtins.mapAttrs profile' profile
|
||||
|
|
|
|||
|
|
@ -1,32 +1,50 @@
|
|||
{ nixosUsers ? {}, nixosGroups ? {}, nixosModules, hmModules ? { default = {}; }, ...}@flake: { ... }@inputs: { host, ... }@imports: let
|
||||
host' = name: snippets: let
|
||||
{
|
||||
nixosUsers ? { },
|
||||
nixosGroups ? { },
|
||||
nixosModules,
|
||||
hmModules ? {
|
||||
default = { };
|
||||
},
|
||||
...
|
||||
}@flake:
|
||||
{ ... }@inputs:
|
||||
{ host, ... }@imports:
|
||||
let
|
||||
host' =
|
||||
name: snippets:
|
||||
let
|
||||
|
||||
overlay = self: super: {
|
||||
makeModulesClosure = x: super.makeModulesClosure (x // { allowMissing = true; });
|
||||
};
|
||||
|
||||
common = { modulesPath, lib, ... }: {
|
||||
config.nixpkgs.overlays = [ overlay ];
|
||||
config.networking.hostName = lib.mkForce name;
|
||||
config.home-manager = {
|
||||
sharedModules = [ hmModules.default ] ;
|
||||
overlay = self: super: {
|
||||
makeModulesClosure = x: super.makeModulesClosure (x // { allowMissing = true; });
|
||||
};
|
||||
|
||||
imports = [
|
||||
(modulesPath + "/installer/cd-dvd/installation-cd-minimal-new-kernel-no-zfs.nix")
|
||||
nixosModules.default
|
||||
inputs.home-manager.nixosModules.default
|
||||
];
|
||||
};
|
||||
common =
|
||||
{ modulesPath, lib, ... }:
|
||||
{
|
||||
config.nixpkgs.overlays = [ overlay ];
|
||||
config.networking.hostName = lib.mkForce name;
|
||||
config.home-manager = {
|
||||
sharedModules = [ hmModules.default ];
|
||||
};
|
||||
|
||||
system = inputs.nixpkgs.lib.nixosSystem {
|
||||
specialArgs = { inherit inputs flake; };
|
||||
modules = [ common ]
|
||||
imports = [
|
||||
(modulesPath + "/installer/cd-dvd/installation-cd-minimal-new-kernel-no-zfs.nix")
|
||||
nixosModules.default
|
||||
inputs.home-manager.nixosModules.default
|
||||
];
|
||||
};
|
||||
|
||||
system = inputs.nixpkgs.lib.nixosSystem {
|
||||
specialArgs = { inherit inputs flake; };
|
||||
modules = [
|
||||
common
|
||||
]
|
||||
++ snippets
|
||||
++ builtins.attrValues nixosUsers
|
||||
++ builtins.attrValues nixosGroups
|
||||
;
|
||||
};
|
||||
in system.config.system.build.isoImage;
|
||||
++ builtins.attrValues nixosGroups;
|
||||
};
|
||||
in
|
||||
system.config.system.build.isoImage;
|
||||
|
||||
in builtins.mapAttrs host' host
|
||||
in
|
||||
builtins.mapAttrs host' host
|
||||
|
|
|
|||
|
|
@ -1,19 +1,45 @@
|
|||
{ nixosUsers ? {}, nixosGroups ? {}, nixosModules, hmModules ? { default = {}; }, ...}@flake: { ... }@inputs: { host, ... }@imports: let
|
||||
system = hostname: { namespace ? "fbs42", nixpkgs ? "nixpkgs" }: inputs.${nixpkgs}.lib.nixosSystem {
|
||||
specialArgs = { inherit inputs flake namespace; };
|
||||
modules = builtins.concatLists (map (base: builtins.attrValues (flake.lib.scan { base = "${base}/host/${hostname}"; })) flake.lib.schema.base)
|
||||
++ [ { config.networking.hostName = hostname; } ]
|
||||
++ [ nixosModules.default ]
|
||||
++ inputs.${nixpkgs}.lib.optional (inputs ? home-manager) {
|
||||
imports = [ inputs.home-manager.nixosModules.default ];
|
||||
config.home-manager = {
|
||||
sharedModules = [ hmModules.default ];
|
||||
extraSpecialArgs = { inherit flake namespace; };
|
||||
};
|
||||
}
|
||||
++ builtins.attrValues nixosUsers
|
||||
++ builtins.attrValues nixosGroups
|
||||
;
|
||||
};
|
||||
{
|
||||
nixosUsers ? { },
|
||||
nixosGroups ? { },
|
||||
nixosModules,
|
||||
hmModules ? {
|
||||
default = { };
|
||||
},
|
||||
...
|
||||
}@flake:
|
||||
{ ... }@inputs:
|
||||
{ host, ... }@imports:
|
||||
let
|
||||
system =
|
||||
hostname:
|
||||
{
|
||||
namespace ? "fbs42",
|
||||
nixpkgs ? "nixpkgs",
|
||||
}:
|
||||
inputs.${nixpkgs}.lib.nixosSystem {
|
||||
specialArgs = { inherit inputs flake namespace; };
|
||||
modules =
|
||||
builtins.concatLists (
|
||||
map (
|
||||
base: builtins.attrValues (flake.lib.scan { base = "${base}/host/${hostname}"; })
|
||||
) flake.lib.schema.base
|
||||
)
|
||||
++ [ { config.networking.hostName = hostname; } ]
|
||||
++ [ nixosModules.default ]
|
||||
++ inputs.${nixpkgs}.lib.optional (inputs ? home-manager) {
|
||||
imports = [ inputs.home-manager.nixosModules.default ];
|
||||
config.home-manager = {
|
||||
sharedModules = [ hmModules.default ];
|
||||
extraSpecialArgs = { inherit flake namespace; };
|
||||
};
|
||||
}
|
||||
++ builtins.attrValues nixosUsers
|
||||
++ builtins.attrValues nixosGroups;
|
||||
};
|
||||
|
||||
in builtins.mapAttrs (name: value: assert builtins.length value == 1; system name (builtins.head value)) host
|
||||
in
|
||||
builtins.mapAttrs (
|
||||
name: value:
|
||||
assert builtins.length value == 1;
|
||||
system name (builtins.head value)
|
||||
) host
|
||||
|
|
|
|||
|
|
@ -1,10 +1,25 @@
|
|||
flake: { ... }@inputs: { group, ... }@imports: let
|
||||
group' = name: snippets: { pkgs, lib, options, config, ... }@args: let
|
||||
invoke = x: if builtins.isFunction x then x args else x;
|
||||
in {
|
||||
options.fbs42.group.${name} = lib.mkEnableOption name;
|
||||
config.users.groups.${name} = lib.mkIf
|
||||
(config.fbs42.group.${name} || builtins.any (usr: usr.group == name) (builtins.attrValues config.users.users))
|
||||
(lib.mkMerge (map invoke snippets));
|
||||
};
|
||||
in builtins.mapAttrs group' group
|
||||
flake:
|
||||
{ ... }@inputs:
|
||||
{ group, ... }@imports:
|
||||
let
|
||||
group' =
|
||||
name: snippets:
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
options,
|
||||
config,
|
||||
...
|
||||
}@args:
|
||||
let
|
||||
invoke = x: if builtins.isFunction x then x args else x;
|
||||
in
|
||||
{
|
||||
options.fbs42.group.${name} = lib.mkEnableOption name;
|
||||
config.users.groups.${name} = lib.mkIf (
|
||||
config.fbs42.group.${name}
|
||||
|| builtins.any (usr: usr.group == name) (builtins.attrValues config.users.users)
|
||||
) (lib.mkMerge (map invoke snippets));
|
||||
};
|
||||
in
|
||||
builtins.mapAttrs group' group
|
||||
|
|
|
|||
|
|
@ -1,3 +1,14 @@
|
|||
flake: { ... }@inputs: { module, ... }@imports: let
|
||||
modules = builtins.mapAttrs (name: imports: builtins.trace "module: ${name}" { inherit imports; }) module;
|
||||
in { default = { imports = builtins.attrValues modules; }; } // modules
|
||||
flake:
|
||||
{ ... }@inputs:
|
||||
{ module, ... }@imports:
|
||||
let
|
||||
modules = builtins.mapAttrs (
|
||||
name: imports: builtins.trace "module: ${name}" { inherit imports; }
|
||||
) module;
|
||||
in
|
||||
{
|
||||
default = {
|
||||
imports = builtins.attrValues modules;
|
||||
};
|
||||
}
|
||||
// modules
|
||||
|
|
|
|||
|
|
@ -1,2 +1,4 @@
|
|||
{ ... }@flake: { ... }@inputs: { profile, ... }@imports:
|
||||
builtins.mapAttrs (name: imports: builtins.trace "profile: ${name}" { inherit imports; }) profile
|
||||
{ ... }@flake:
|
||||
{ ... }@inputs:
|
||||
{ profile, ... }@imports:
|
||||
builtins.mapAttrs (name: imports: builtins.trace "profile: ${name}" { inherit imports; }) profile
|
||||
|
|
|
|||
|
|
@ -1,5 +1,15 @@
|
|||
self: { ... }@inputs: { user, ... }@imports: let
|
||||
user' = name: snippets: { pkgs, lib, config, ... }@args:
|
||||
self:
|
||||
{ ... }@inputs:
|
||||
{ user, ... }@imports:
|
||||
let
|
||||
user' =
|
||||
name: snippets:
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}@args:
|
||||
builtins.trace "user: ${name}" {
|
||||
options.fbs42.user.${name} = lib.mkEnableOption name;
|
||||
## no longer with nixos-24.11
|
||||
|
|
@ -7,11 +17,15 @@ self: { ... }@inputs: { user, ... }@imports: let
|
|||
# group = lib.mkDefault name;
|
||||
#};
|
||||
|
||||
imports = map ({ user, home-manager}: {
|
||||
config = lib.mkIf config.fbs42.user.${name} {
|
||||
users.users.${name} = (user args);
|
||||
home-manager.users.${name} = home-manager;
|
||||
};
|
||||
}) snippets;
|
||||
imports = map (
|
||||
{ user, home-manager }:
|
||||
{
|
||||
config = lib.mkIf config.fbs42.user.${name} {
|
||||
users.users.${name} = (user args);
|
||||
home-manager.users.${name} = home-manager;
|
||||
};
|
||||
}
|
||||
) snippets;
|
||||
};
|
||||
in builtins.mapAttrs user' user
|
||||
in
|
||||
builtins.mapAttrs user' user
|
||||
|
|
|
|||
|
|
@ -1,34 +1,52 @@
|
|||
{ nixosUsers ? {}, nixosGroups ? {}, nixosModules, hmModules ? { default = {}; }, ...}@flake: { ... }@inputs: { host, ... }@imports: let
|
||||
host' = name: snippets: let
|
||||
{
|
||||
nixosUsers ? { },
|
||||
nixosGroups ? { },
|
||||
nixosModules,
|
||||
hmModules ? {
|
||||
default = { };
|
||||
},
|
||||
...
|
||||
}@flake:
|
||||
{ ... }@inputs:
|
||||
{ host, ... }@imports:
|
||||
let
|
||||
host' =
|
||||
name: snippets:
|
||||
let
|
||||
|
||||
overlay = self: super: {
|
||||
makeModulesClosure = x: super.makeModulesClosure (x // { allowMissing = true; });
|
||||
};
|
||||
|
||||
common = { modulesPath, lib, ... }: {
|
||||
config.nixpkgs.overlays = [ overlay ];
|
||||
config.networking.hostName = lib.mkForce name;
|
||||
config.home-manager = {
|
||||
sharedModules = [ hmModules.default ] ;
|
||||
overlay = self: super: {
|
||||
makeModulesClosure = x: super.makeModulesClosure (x // { allowMissing = true; });
|
||||
};
|
||||
|
||||
imports = [
|
||||
#(modulesPath + "/installer/cd-dvd/installation-cd-minimal-new-kernel-no-zfs.nix")
|
||||
#(modulesPath + "/installer/sd-card/sd-image-aarch64.nix")
|
||||
(modulesPath + "/installer/sd-card/sd-image-raspberrypi.nix")
|
||||
nixosModules.default
|
||||
inputs.home-manager.nixosModules.default
|
||||
];
|
||||
};
|
||||
common =
|
||||
{ modulesPath, lib, ... }:
|
||||
{
|
||||
config.nixpkgs.overlays = [ overlay ];
|
||||
config.networking.hostName = lib.mkForce name;
|
||||
config.home-manager = {
|
||||
sharedModules = [ hmModules.default ];
|
||||
};
|
||||
|
||||
system = inputs.nixpkgs.lib.nixosSystem {
|
||||
specialArgs = { inherit inputs flake; };
|
||||
modules = [ common ]
|
||||
imports = [
|
||||
#(modulesPath + "/installer/cd-dvd/installation-cd-minimal-new-kernel-no-zfs.nix")
|
||||
#(modulesPath + "/installer/sd-card/sd-image-aarch64.nix")
|
||||
(modulesPath + "/installer/sd-card/sd-image-raspberrypi.nix")
|
||||
nixosModules.default
|
||||
inputs.home-manager.nixosModules.default
|
||||
];
|
||||
};
|
||||
|
||||
system = inputs.nixpkgs.lib.nixosSystem {
|
||||
specialArgs = { inherit inputs flake; };
|
||||
modules = [
|
||||
common
|
||||
]
|
||||
++ snippets
|
||||
++ builtins.attrValues nixosUsers
|
||||
++ builtins.attrValues nixosGroups
|
||||
;
|
||||
};
|
||||
in system.config.system.build.sdImage;
|
||||
++ builtins.attrValues nixosGroups;
|
||||
};
|
||||
in
|
||||
system.config.system.build.sdImage;
|
||||
|
||||
in builtins.mapAttrs host' host
|
||||
in
|
||||
builtins.mapAttrs host' host
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue