nix fmt
Signed-off-by: Harald Hoyer <harald@hoyer.xyz>
This commit is contained in:
parent
a3187e163d
commit
900f95169f
83 changed files with 1134 additions and 705 deletions
|
@ -1,15 +1,23 @@
|
|||
{ options, config, pkgs, lib, inputs, ... }:
|
||||
{
|
||||
options,
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
inputs,
|
||||
...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
with lib.metacfg;
|
||||
let cfg = config.metacfg.home;
|
||||
let
|
||||
cfg = config.metacfg.home;
|
||||
in
|
||||
{
|
||||
options.metacfg.home = with types; {
|
||||
file = mkOpt attrs { }
|
||||
(mdDoc "A set of files to be managed by home-manager's `home.file`.");
|
||||
configFile = mkOpt attrs { }
|
||||
(mdDoc "A set of files to be managed by home-manager's `xdg.configFile`.");
|
||||
file = mkOpt attrs { } (mdDoc "A set of files to be managed by home-manager's `home.file`.");
|
||||
configFile = mkOpt attrs { } (
|
||||
mdDoc "A set of files to be managed by home-manager's `xdg.configFile`."
|
||||
);
|
||||
extraOptions = mkOpt attrs { } "Options to pass directly to home-manager.";
|
||||
};
|
||||
|
||||
|
@ -25,8 +33,7 @@ in
|
|||
useUserPackages = true;
|
||||
useGlobalPkgs = true;
|
||||
|
||||
users.${config.metacfg.user.name} =
|
||||
mkAliasDefinitions options.metacfg.home.extraOptions;
|
||||
users.${config.metacfg.user.name} = mkAliasDefinitions options.metacfg.home.extraOptions;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,8 +1,15 @@
|
|||
{ options, config, lib, pkgs, ... }:
|
||||
{
|
||||
options,
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
with lib.metacfg;
|
||||
let cfg = config.metacfg.nix-ld;
|
||||
let
|
||||
cfg = config.metacfg.nix-ld;
|
||||
in
|
||||
{
|
||||
options.metacfg.nix-ld = with types; {
|
||||
|
|
|
@ -1,15 +1,25 @@
|
|||
{ options, config, pkgs, lib, inputs, ... }:
|
||||
{
|
||||
options,
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
inputs,
|
||||
...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
with lib.metacfg;
|
||||
let
|
||||
cfg = config.metacfg.nix;
|
||||
|
||||
substituters-submodule = types.submodule ({ name, ... }: {
|
||||
options = with types; {
|
||||
key = mkOpt (nullOr str) null "The trusted public key for this substituter.";
|
||||
};
|
||||
});
|
||||
substituters-submodule = types.submodule (
|
||||
{ name, ... }:
|
||||
{
|
||||
options = with types; {
|
||||
key = mkOpt (nullOr str) null "The trusted public key for this substituter.";
|
||||
};
|
||||
}
|
||||
);
|
||||
in
|
||||
{
|
||||
options.metacfg.nix = with types; {
|
||||
|
@ -18,25 +28,23 @@ in
|
|||
|
||||
default-substituter = {
|
||||
url = mkOpt str "https://cache.nixos.org" "The url for the substituter.";
|
||||
key = mkOpt str "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" "The trusted public key for the substituter.";
|
||||
key =
|
||||
mkOpt str "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
|
||||
"The trusted public key for the substituter.";
|
||||
};
|
||||
|
||||
extra-substituters = mkOpt (attrsOf substituters-submodule) { } "Extra substituters to configure.";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
assertions = mapAttrsToList
|
||||
(name: value: {
|
||||
assertion = value.key != null;
|
||||
message = "metacfg.nix.extra-substituters.${name}.key must be set";
|
||||
})
|
||||
cfg.extra-substituters;
|
||||
assertions = mapAttrsToList (name: value: {
|
||||
assertion = value.key != null;
|
||||
message = "metacfg.nix.extra-substituters.${name}.key must be set";
|
||||
}) cfg.extra-substituters;
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
metacfg.nixos-revision
|
||||
(metacfg.nixos-hosts.override {
|
||||
hosts = inputs.self.nixosConfigurations;
|
||||
})
|
||||
(metacfg.nixos-hosts.override { hosts = inputs.self.nixosConfigurations; })
|
||||
deploy-rs
|
||||
nixfmt
|
||||
nix-index
|
||||
|
@ -48,8 +56,10 @@ in
|
|||
|
||||
nix =
|
||||
let
|
||||
users = [ "root" config.metacfg.user.name ] ++
|
||||
optional config.services.hydra.enable "hydra";
|
||||
users = [
|
||||
"root"
|
||||
config.metacfg.user.name
|
||||
] ++ optional config.services.hydra.enable "hydra";
|
||||
extra-substituters = cfg.extra-substituters // {
|
||||
"https://attic.teepot.org/tee-pot".key = "tee-pot:SS6HcrpG87S1M6HZGPsfo7d1xJccCGev7/tXc5+I4jg=";
|
||||
};
|
||||
|
@ -57,29 +67,29 @@ in
|
|||
{
|
||||
package = cfg.package;
|
||||
|
||||
settings = {
|
||||
experimental-features = "nix-command flakes";
|
||||
http-connections = 50;
|
||||
warn-dirty = false;
|
||||
log-lines = 50;
|
||||
sandbox = true;
|
||||
auto-optimise-store = true;
|
||||
trusted-users = users;
|
||||
allowed-users = users;
|
||||
settings =
|
||||
{
|
||||
experimental-features = "nix-command flakes";
|
||||
http-connections = 50;
|
||||
warn-dirty = false;
|
||||
log-lines = 50;
|
||||
sandbox = true;
|
||||
auto-optimise-store = true;
|
||||
trusted-users = users;
|
||||
allowed-users = users;
|
||||
|
||||
substituters =
|
||||
[ cfg.default-substituter.url ]
|
||||
++
|
||||
(mapAttrsToList (name: value: name) extra-substituters);
|
||||
trusted-public-keys =
|
||||
[ cfg.default-substituter.key ]
|
||||
++
|
||||
(mapAttrsToList (name: value: value.key) extra-substituters);
|
||||
substituters = [
|
||||
cfg.default-substituter.url
|
||||
] ++ (mapAttrsToList (name: value: name) extra-substituters);
|
||||
trusted-public-keys = [
|
||||
cfg.default-substituter.key
|
||||
] ++ (mapAttrsToList (name: value: value.key) extra-substituters);
|
||||
|
||||
} // (lib.optionalAttrs config.metacfg.tools.direnv.enable {
|
||||
keep-outputs = true;
|
||||
keep-derivations = true;
|
||||
});
|
||||
}
|
||||
// (lib.optionalAttrs config.metacfg.tools.direnv.enable {
|
||||
keep-outputs = true;
|
||||
keep-derivations = true;
|
||||
});
|
||||
|
||||
gc = {
|
||||
automatic = true;
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
{ options
|
||||
, config
|
||||
, lib
|
||||
, pkgs
|
||||
, ...
|
||||
{
|
||||
options,
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
with lib.metacfg;
|
||||
|
@ -39,7 +40,9 @@ in
|
|||
};
|
||||
|
||||
environment = {
|
||||
sessionVariables = { PATH = "$HOME/bin"; };
|
||||
sessionVariables = {
|
||||
PATH = "$HOME/bin";
|
||||
};
|
||||
systemPackages = with pkgs; [
|
||||
age
|
||||
bash
|
||||
|
@ -73,7 +76,10 @@ in
|
|||
"$@"
|
||||
'')
|
||||
];
|
||||
shells = [ pkgs.fish pkgs.bash ];
|
||||
shells = [
|
||||
pkgs.fish
|
||||
pkgs.bash
|
||||
];
|
||||
};
|
||||
|
||||
hardware = {
|
||||
|
|
|
@ -1,8 +1,15 @@
|
|||
{ options, config, lib, pkgs, ... }:
|
||||
{
|
||||
options,
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
with lib.metacfg;
|
||||
let cfg = config.metacfg.gui;
|
||||
let
|
||||
cfg = config.metacfg.gui;
|
||||
in
|
||||
{
|
||||
options.metacfg.gui = with types; {
|
||||
|
@ -150,7 +157,13 @@ in
|
|||
noto-fonts-emoji
|
||||
liberation_ttf
|
||||
freefont_ttf
|
||||
(nerdfonts.override { fonts = [ "FiraCode" "DroidSansMono" "JetBrainsMono" ]; })
|
||||
(nerdfonts.override {
|
||||
fonts = [
|
||||
"FiraCode"
|
||||
"DroidSansMono"
|
||||
"JetBrainsMono"
|
||||
];
|
||||
})
|
||||
];
|
||||
|
||||
fontconfig = {
|
||||
|
|
|
@ -1,8 +1,15 @@
|
|||
{ options, config, lib, pkgs, ... }:
|
||||
{
|
||||
options,
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
with lib.metacfg;
|
||||
let cfg = config.metacfg.homeprinter;
|
||||
let
|
||||
cfg = config.metacfg.homeprinter;
|
||||
in
|
||||
{
|
||||
options.metacfg.homeprinter = with types; {
|
||||
|
|
|
@ -1,8 +1,15 @@
|
|||
{ options, config, lib, pkgs, ... }:
|
||||
{
|
||||
options,
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
with lib.metacfg;
|
||||
let cfg = config.metacfg.podman;
|
||||
let
|
||||
cfg = config.metacfg.podman;
|
||||
in
|
||||
{
|
||||
options.metacfg.podman = with types; {
|
||||
|
@ -18,7 +25,9 @@ in
|
|||
dockerCompat = lib.mkDefault true;
|
||||
|
||||
# For Nixos version > 22.11
|
||||
defaultNetwork.settings = { dns_enabled = true; };
|
||||
defaultNetwork.settings = {
|
||||
dns_enabled = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,8 +1,15 @@
|
|||
{ options, config, lib, pkgs, ... }:
|
||||
{
|
||||
options,
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
with lib.metacfg;
|
||||
let cfg = config.metacfg.secureboot;
|
||||
let
|
||||
cfg = config.metacfg.secureboot;
|
||||
in
|
||||
{
|
||||
options.metacfg.secureboot = with types; {
|
||||
|
|
|
@ -1,4 +1,10 @@
|
|||
{ options, config, lib, pkgs, ... }:
|
||||
{
|
||||
options,
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
with lib.metacfg;
|
||||
|
@ -21,14 +27,15 @@ in
|
|||
quoteProviderLibrary = pkgs.nixsgx.sgx-dcap.default_qpl;
|
||||
};
|
||||
systemd.services.aesmd = {
|
||||
environment.LD_LIBRARY_PATH = lib.mkForce (lib.makeLibraryPath [ pkgs.nixsgx.sgx-dcap.default_qpl pkgs.curl.out ]);
|
||||
environment.LD_LIBRARY_PATH = lib.mkForce (
|
||||
lib.makeLibraryPath [
|
||||
pkgs.nixsgx.sgx-dcap.default_qpl
|
||||
pkgs.curl.out
|
||||
]
|
||||
);
|
||||
serviceConfig = {
|
||||
BindReadOnlyPaths = [
|
||||
"/etc/sgx_default_qcnl.conf"
|
||||
];
|
||||
BindPaths = [
|
||||
"/dev/log"
|
||||
];
|
||||
BindReadOnlyPaths = [ "/etc/sgx_default_qcnl.conf" ];
|
||||
BindPaths = [ "/dev/log" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,4 +1,10 @@
|
|||
{ options, config, lib, pkgs, ... }:
|
||||
{
|
||||
options,
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
with lib.metacfg;
|
||||
|
@ -49,21 +55,19 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
systemd.services.pccs-secret =
|
||||
{
|
||||
description = "Inject pccs secret";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
before = [ "podman-pccs.service" ];
|
||||
systemd.services.pccs-secret = {
|
||||
description = "Inject pccs secret";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
before = [ "podman-pccs.service" ];
|
||||
|
||||
serviceConfig = {
|
||||
EnvironmentFile = cfg.secret;
|
||||
ExecStart = ''
|
||||
-${pkgs.podman}/bin/podman secret create --env PCCS_CONFIG PCCS_CONFIG
|
||||
'';
|
||||
RemainAfterExit = true;
|
||||
};
|
||||
serviceConfig = {
|
||||
EnvironmentFile = cfg.secret;
|
||||
ExecStart = ''
|
||||
-${pkgs.podman}/bin/podman secret create --env PCCS_CONFIG PCCS_CONFIG
|
||||
'';
|
||||
RemainAfterExit = true;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,8 +1,15 @@
|
|||
{ options, config, lib, pkgs, ... }:
|
||||
{
|
||||
options,
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
with lib.metacfg;
|
||||
let cfg = config.metacfg.tools.direnv;
|
||||
let
|
||||
cfg = config.metacfg.tools.direnv;
|
||||
in
|
||||
{
|
||||
options.metacfg.tools.direnv = with types; {
|
||||
|
|
|
@ -1,4 +1,10 @@
|
|||
{ options, config, pkgs, lib, ... }:
|
||||
{
|
||||
options,
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
with lib.metacfg;
|
||||
|
@ -12,8 +18,7 @@ in
|
|||
enable = mkBoolOpt false "Whether or not to install and configure git.";
|
||||
userName = mkOpt types.str user.fullName "The name to configure git with.";
|
||||
userEmail = mkOpt types.str user.email "The email to configure git with.";
|
||||
signingKey =
|
||||
mkOpt types.str "9762169A1B35EA68" "The key ID to sign commits with.";
|
||||
signingKey = mkOpt types.str "9762169A1B35EA68" "The key ID to sign commits with.";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
@ -29,10 +34,18 @@ in
|
|||
signByDefault = mkIf gpg.enable true;
|
||||
};
|
||||
extraConfig = {
|
||||
init = { defaultBranch = "main"; };
|
||||
pull = { rebase = true; };
|
||||
push = { autoSetupRemote = true; };
|
||||
core = { whitespace = "trailing-space,space-before-tab"; };
|
||||
init = {
|
||||
defaultBranch = "main";
|
||||
};
|
||||
pull = {
|
||||
rebase = true;
|
||||
};
|
||||
push = {
|
||||
autoSetupRemote = true;
|
||||
};
|
||||
core = {
|
||||
whitespace = "trailing-space,space-before-tab";
|
||||
};
|
||||
safe = {
|
||||
directory = "${user.home}/git";
|
||||
};
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
{ options
|
||||
, config
|
||||
, pkgs
|
||||
, lib
|
||||
, ...
|
||||
{
|
||||
options,
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
with lib.metacfg; let
|
||||
with lib.metacfg;
|
||||
let
|
||||
cfg = config.metacfg.user;
|
||||
defaultIconFileName = "profile.jpg";
|
||||
defaultIcon = pkgs.stdenvNoCC.mkDerivation {
|
||||
|
@ -18,11 +20,17 @@ with lib.metacfg; let
|
|||
cp $src $out
|
||||
'';
|
||||
|
||||
passthru = { fileName = defaultIconFileName; };
|
||||
passthru = {
|
||||
fileName = defaultIconFileName;
|
||||
};
|
||||
};
|
||||
propagatedIcon =
|
||||
pkgs.runCommandNoCC "propagated-icon"
|
||||
{ passthru = { fileName = cfg.icon.fileName; }; }
|
||||
{
|
||||
passthru = {
|
||||
fileName = cfg.icon.fileName;
|
||||
};
|
||||
}
|
||||
''
|
||||
local target="$out/share/metacfg-icons/user/${cfg.name}"
|
||||
mkdir -p "$target"
|
||||
|
@ -38,9 +46,7 @@ in
|
|||
initialPassword =
|
||||
mkOpt str "password"
|
||||
"The initial password to use when the user is first created.";
|
||||
icon =
|
||||
mkOpt (nullOr package) defaultIcon
|
||||
"The profile picture to use for the user.";
|
||||
icon = mkOpt (nullOr package) defaultIcon "The profile picture to use for the user.";
|
||||
prompt-init = mkBoolOpt true "Whether or not to show an initial message when opening a new shell.";
|
||||
extraGroups = mkOpt (listOf str) [ ] "Groups for the user to be assigned.";
|
||||
sshKeys = mkOpt (listOf str) [
|
||||
|
@ -49,14 +55,11 @@ in
|
|||
"ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBAYbUTKpy4QR3s944/hjJ1UK05asFEs/SmWeUbtS0cdA660sT4xHnRfals73FicOoz+uIucJCwn/SCM804j+wtM="
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMNsmP15vH8BVKo7bdvIiiEjiQboPGcRPqJK0+bH4jKD harald@lenovo.fritz.box"
|
||||
] "ssh keys";
|
||||
extraOptions =
|
||||
mkOpt attrs { }
|
||||
(mdDoc "Extra options passed to `users.users.<name>`.");
|
||||
extraOptions = mkOpt attrs { } (mdDoc "Extra options passed to `users.users.<name>`.");
|
||||
};
|
||||
|
||||
config = {
|
||||
environment.systemPackages = with pkgs; [
|
||||
];
|
||||
environment.systemPackages = with pkgs; [ ];
|
||||
|
||||
metacfg.home = {
|
||||
file = {
|
||||
|
@ -68,10 +71,7 @@ in
|
|||
"Videos/.keep".text = "";
|
||||
"work/.keep".text = "";
|
||||
".face".source = cfg.icon;
|
||||
"Pictures/${
|
||||
cfg.icon.fileName or (builtins.baseNameOf cfg.icon)
|
||||
}".source =
|
||||
cfg.icon;
|
||||
"Pictures/${cfg.icon.fileName or (builtins.baseNameOf cfg.icon)}".source = cfg.icon;
|
||||
};
|
||||
|
||||
extraOptions.programs.bash.initExtra = ''
|
||||
|
@ -85,27 +85,25 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
users.users.${cfg.name} =
|
||||
{
|
||||
isNormalUser = true;
|
||||
users.users.${cfg.name} = {
|
||||
isNormalUser = true;
|
||||
|
||||
# inherit (cfg) name initialPassword;
|
||||
# inherit (cfg) name initialPassword;
|
||||
|
||||
openssh.authorizedKeys.keys = cfg.sshKeys;
|
||||
home = "/home/${cfg.name}";
|
||||
group = "users";
|
||||
openssh.authorizedKeys.keys = cfg.sshKeys;
|
||||
home = "/home/${cfg.name}";
|
||||
group = "users";
|
||||
|
||||
shell = pkgs.bash;
|
||||
shell = pkgs.bash;
|
||||
|
||||
# Arbitrary user ID to use for the user. Since I only
|
||||
# have a single user on my machines this won't ever collide.
|
||||
# However, if you add multiple users you'll need to change this
|
||||
# so each user has their own unique uid (or leave it out for the
|
||||
# system to select).
|
||||
uid = 1000;
|
||||
# Arbitrary user ID to use for the user. Since I only
|
||||
# have a single user on my machines this won't ever collide.
|
||||
# However, if you add multiple users you'll need to change this
|
||||
# so each user has their own unique uid (or leave it out for the
|
||||
# system to select).
|
||||
uid = 1000;
|
||||
|
||||
extraGroups = [ "wheel" ] ++ cfg.extraGroups;
|
||||
}
|
||||
// cfg.extraOptions;
|
||||
extraGroups = [ "wheel" ] ++ cfg.extraGroups;
|
||||
} // cfg.extraOptions;
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue