chore: reformat codebase

This commit is contained in:
Gabriel Arazas 2023-01-07 16:06:34 +08:00
parent d9e7f7c67e
commit 4c34a87366
7 changed files with 88 additions and 77 deletions

View File

@ -340,9 +340,12 @@
networking.hostName = lib.mkOverride 2000 host';
})
(lib'.optionalAttrs (lib'.hasAttr host' images)
(let
imageFormat = images.${host'}.format;
in inputs.nixos-generators.nixosModules.${imageFormat}))
(
let
imageFormat = images.${host'}.format;
in
inputs.nixos-generators.nixosModules.${imageFormat}
))
hostSharedConfig
path
];
@ -388,24 +391,25 @@
# My custom packages, available in here as well. Though, I mainly support
# "x86_64-linux". I just want to try out supporting other systems.
packages = forAllSystems (system: let
pkgs = import nixpkgs { inherit system overlays; };
in
packages = forAllSystems (system:
let
pkgs = import nixpkgs { inherit system overlays; };
in
inputs.flake-utils.lib.flattenTree (import ./pkgs { inherit pkgs; })
// lib'.mapAttrs'
(name: value:
lib'.nameValuePair "${name}-${value.format}" (mkImage {
inherit system pkgs extraArgs;
inherit (value) format;
extraModules = [
({ lib, ... }: {
networking.hostName = lib.mkOverride 2000 name;
})
hostSharedConfig
./hosts/${name}
];
}))
images);
(name: value:
lib'.nameValuePair "${name}-${value.format}" (mkImage {
inherit system pkgs extraArgs;
inherit (value) format;
extraModules = [
({ lib, ... }: {
networking.hostName = lib.mkOverride 2000 name;
})
hostSharedConfig
./hosts/${name}
];
}))
images);
# My several development shells for usual type of projects. This is much
# more preferable than installing all of the packages at the system
@ -445,31 +449,33 @@
# sensitive info such as the hostname and such. A helpful tip would be
# ignoring the shell entry by simply prefixing it with a space which most
# command-line shells have support for (e.g., Bash, zsh, fish).
deploy.nodes = let
nixosConfigurations = lib'.mapAttrs'
(name: value:
lib'.nameValuePair "nixos-${name}" {
hostname = name;
fastConnection = true;
profiles.system = {
sshUser = "admin";
user = "root";
path = inputs.deploy.lib.${defaultSystem}.activate.nixos value;
};
})
self.nixosConfigurations;
homeManagerConfigurations = lib'.mapAttrs'
(name: value:
lib'.nameValuePair "home-manager-${name}" {
hostname = name;
fastConnection = true;
profiles.home = {
sshUser = name;
path = inputs.deploy.lib.${defaultSystem}.activate.home-manager value;
};
})
self.homeManagerConfigurations;
in nixosConfigurations // homeManagerConfigurations;
deploy.nodes =
let
nixosConfigurations = lib'.mapAttrs'
(name: value:
lib'.nameValuePair "nixos-${name}" {
hostname = name;
fastConnection = true;
profiles.system = {
sshUser = "admin";
user = "root";
path = inputs.deploy.lib.${defaultSystem}.activate.nixos value;
};
})
self.nixosConfigurations;
homeManagerConfigurations = lib'.mapAttrs'
(name: value:
lib'.nameValuePair "home-manager-${name}" {
hostname = name;
fastConnection = true;
profiles.home = {
sshUser = name;
path = inputs.deploy.lib.${defaultSystem}.activate.home-manager value;
};
})
self.homeManagerConfigurations;
in
nixosConfigurations // homeManagerConfigurations;
# How to make yourself slightly saner than before. So far the main checks
# are for deploy nodes.

View File

@ -27,19 +27,20 @@
type = "ed25519";
}];
sops.secrets = let
getKey = key: {
inherit key;
sopsFile = ./secrets/secrets.yaml;
};
getSecrets = secrets:
lib.mapAttrs'
(secret: config:
lib.nameValuePair
"ni/${secret}"
((getKey secret) // config))
secrets;
in
sops.secrets =
let
getKey = key: {
inherit key;
sopsFile = ./secrets/secrets.yaml;
};
getSecrets = secrets:
lib.mapAttrs'
(secret: config:
lib.nameValuePair
"ni/${secret}"
((getKey secret) // config))
secrets;
in
getSecrets {
ssh-key = { };
"ldap/password" = { };

View File

@ -220,7 +220,8 @@ in
CREATE SCHEMA AUTHORIZATION ${user.name};
'')
config.services.postgresql.ensureUsers;
in pkgs.writeText "plover-initial-postgresql-script" ''
in
pkgs.writeText "plover-initial-postgresql-script" ''
${lib.concatStringsSep "\n" perUserSchemas}
'';
@ -554,14 +555,16 @@ in
IdentityFile ${config.sops.secrets."plover/borg/ssh-key".path}
'';
systemd.tmpfiles.rules = let
# To be used similarly to $GITEA_CUSTOM variable.
giteaCustomDir = "${config.services.gitea.stateDir}/custom";
in [
"L+ ${giteaCustomDir}/templates/home.tmpl - - - - ${./files/gitea/home.tmpl}"
"L+ ${giteaCustomDir}/public/img/logo.svg - - - - ${./files/gitea/logo.svg}"
"L+ ${giteaCustomDir}/public/img/logo.png - - - - ${./files/gitea/logo.png}"
];
systemd.tmpfiles.rules =
let
# To be used similarly to $GITEA_CUSTOM variable.
giteaCustomDir = "${config.services.gitea.stateDir}/custom";
in
[
"L+ ${giteaCustomDir}/templates/home.tmpl - - - - ${./files/gitea/home.tmpl}"
"L+ ${giteaCustomDir}/public/img/logo.svg - - - - ${./files/gitea/logo.svg}"
"L+ ${giteaCustomDir}/public/img/logo.png - - - - ${./files/gitea/logo.png}"
];
system.stateVersion = "22.11";
}

View File

@ -126,9 +126,10 @@ in
withDependencies = true;
webserver.enable = true;
jobs = mkJobs {
db = lib.importJSON ./data/jobs.archivebox.json;
} // {
jobs = mkJobs
{
db = lib.importJSON ./data/jobs.archivebox.json;
} // {
computer = {
urls = [
"https://blog.mozilla.org/en/feed/"

View File

@ -170,7 +170,9 @@ class Outline(object):
if not category:
continue
category_hierarchy = filter(lambda split: split.strip(), category.split("/"))
category_hierarchy = filter(
lambda split: split.strip(), category.split("/")
)
first_category_split = first(None, category_hierarchy)
if first_category_split is None:
continue
@ -231,10 +233,7 @@ def create_jobs_from_outline(root_outline: Outline, categories=[]):
for subscription in outline.subscriptions:
# There are some things that are meant not to be shown (i.e.,
# `categories`) so we're putting it in a data template.
subscription_data = {
"name": subscription.name,
"url": subscription.url
}
subscription_data = {"name": subscription.name, "url": subscription.url}
if subscription.description:
subscription_data["description"] = subscription.description

View File

@ -26,7 +26,8 @@ stdenv.mkDerivation rec {
};
nativeBuildInputs = with qt5; [
autoreconfHook pkg-config
autoreconfHook
pkg-config
wrapQtAppsHook
qtbase
qtwebchannel

View File

@ -36,6 +36,6 @@ in
# Allow the user to easily enter into several services such as the database
# services to allowing some debugging.
services.postgresql.ensureUsers = [ { inherit name; } ];
services.mysql.ensureUsers = [ { inherit name; } ];
services.postgresql.ensureUsers = [{ inherit name; }];
services.mysql.ensureUsers = [{ inherit name; }];
}