Run linter+formatter.

This commit is contained in:
Kevin Baensch 2023-09-11 21:20:14 +02:00
parent 8fd1b6c982
commit e2330f01fc
Signed by: derped
GPG key ID: C0F1D326C7626543
16 changed files with 58 additions and 54 deletions

View file

@ -11,13 +11,14 @@
fi
exit 0;
'');
in (pkgs.writeText "rofi.rasi" ''
configuration {
modi: "combi,window,drun,ssh,tabFinder:${tabMode}";
font: "hack 10";
combi-modi: "window,drun,ssh,tabFinder";
icon-theme: "Papirus";
show-icons: true;
}
@theme "solarized"
'')
in
pkgs.writeText "rofi.rasi" ''
configuration {
modi: "combi,window,drun,ssh,tabFinder:${tabMode}";
font: "hack 10";
combi-modi: "window,drun,ssh,tabFinder";
icon-theme: "Papirus";
show-icons: true;
}
@theme "solarized"
''

View file

@ -4,10 +4,10 @@
...
}:
with lib; let
networkD = config.machine.networkD;
inherit (config.machine) networkD;
in {
networking = {
hostName = config.machine.hostName;
inherit (config.machine) hostName;
useNetworkd = networkD.enable;
useDHCP = !networkD.enable;
dhcpcd.enable = !networkD.enable;

View file

@ -9,13 +9,13 @@ with lib; let
withDocker = config.virtualisation.docker.enable;
withPodman = config.virtualisation.podman.enable;
administrators = user: {
name = user.name;
inherit (user) name;
value = let
cfg = config.services;
passPath = config.sops.secrets."users/${user.name}/password".path;
in {
isNormalUser = true;
name = user.name;
inherit (user) name;
uid = user.id;
subUidRanges = optional withPodman {
startUid = 100000;
@ -41,9 +41,9 @@ with lib; let
};
mkusergroup = user: {
name = user.name;
inherit (user) name;
value = {
name = user.name;
inherit (user) name;
gid = user.id;
members = [user.name];
};

View file

@ -6,7 +6,7 @@ with lib; let
# hostName and secretPtah can be set with -I hostName=$HOSTNAME and -I secretPath=$SECRETPATH respectively
# , defaults to the contents of /secret/hostName
secretPath =
fn.ifelse ((tryEval (toString <secretPath>)).value != false)
fn.ifelse (tryEval (toString <secretPath>)).value
(toString <secretPath>)
(toString /secret);
hostName =

View file

@ -6,12 +6,12 @@
nixpkgs-unstable.url = "github:/NixOS/nixpkgs/nixos-unstable";
nixpkgs.url = "github:/NixOS/nixpkgs/nixos-unstable";
alejandra = {
url = github:kamadorueda/alejandra/3.0.0;
url = "github:kamadorueda/alejandra/3.0.0";
inputs.nixpkgs.follows = "nixpkgs";
};
mailserver.url = "gitlab:/simple-nixos-mailserver/nixos-mailserver";
sops-nix = {
url = github:Mic92/sops-nix;
url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
@ -23,15 +23,17 @@
sops-nix,
...
} @ attrs: let
lib = nixpkgs.lib;
inherit (nixpkgs) lib;
fn = import ./fn.nix {inherit lib;};
mappedFormatter = builtins.mapAttrs (arch: packages: packages.default) alejandra.packages;
mappedApps = builtins.mapAttrs (_arch: packages: {
"lint" = {
type = "app";
program = "${packages.statix}/bin/statix";
};
}) nixpkgs.legacyPackages;
mappedApps =
builtins.mapAttrs (_arch: packages: {
"lint" = {
type = "app";
program = "${packages.statix}/bin/statix";
};
})
nixpkgs.legacyPackages;
system = "x86_64-linux";
machineList = fn.lst {
p = toString ./machines;
@ -54,14 +56,14 @@
name = machine;
value = let
machinePath = lib.concatStringsSep "/" [(toString ./.) "machines" machine];
machineFiles = lib.filter (name: lib.strings.hasSuffix ".nix" name) (fn.lst {
machineFiles = lib.filter (lib.strings.hasSuffix ".nix") (fn.lst {
p = machinePath;
b = true;
});
in
nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = attrs // {fn = fn;};
specialArgs = attrs // {inherit fn;};
modules =
[
(toString ./options/machine.nix)

16
fn.nix
View file

@ -21,17 +21,17 @@ with lib; rec {
(filterAttrs (n: v: v == t)
(readDir p)))
(v: ((optionalString b "${p}/") + v)));
lsf = p: (lst {p = p;});
lsf = p: (lst {inherit p;});
lsd = p: (lst {
p = p;
inherit p;
t = "directory";
b = true;
});
lsfRec = p: b:
flatten ((map (np: lsfRec np b) (lsd p))
++ (lst {
p = p;
b = b;
inherit p;
inherit b;
}));
hasAttrs = aList: d: (map
(a: (ifelse (isList a)
@ -53,11 +53,11 @@ with lib; rec {
(meetsConDo cond do t));
deps = p:
ifelse (isAttrs p) (
filter (p: isAttrs p)
filter isAttrs
(p.buildInputs ++ p.nativeBuildInputs ++ p.propagatedBuildInputs ++ p.propagatedNativeBuildInputs)
) [];
importFilter = l: p: filter (n: elem (nameFromURL (toString n) ".") l) p;
depsRec = ld: ifelse (ld == []) [] ((toList ld) ++ (depsRec (lists.unique (lists.flatten (map (d: deps d) (toList ld))))));
importFilter = l: filter (n: elem (nameFromURL (toString n) ".") l);
depsRec = ld: ifelse (ld == []) [] ((toList ld) ++ (depsRec (lists.unique (lists.flatten (map deps (toList ld))))));
isBroken = p:
meetsConDo (s: ((hasAttrByPath s.path p) && (s.check (getAttrFromPath s.path p)))) (s: s.msg)
[
@ -113,7 +113,7 @@ with lib; rec {
makeOptionTypeList = path: (
lists.forEach
# get a list of all files ending in .nix in path
(filter (filePath: hasSuffix ".nix" filePath)
(filter (hasSuffix ".nix")
(lsfRec path true))
# remove leading path and trailing ".nix", replace every slash with "::"
(replaceStrings ["${path}/" "/" ".nix"] ["" "::" ""])

View file

@ -200,7 +200,7 @@ with lib; let
mkMode = map (v: ":mode ${v}");
mkBind = mkBindHelper "bind" "";
mkBindLocal = bs: let
mkMap = n: v: mkBindHelper "bind" ":map ${n}" v;
mkMap = n: mkBindHelper "bind" ":map ${n}";
in
flatten (mapAttrsToList mkMap bs);
mkBindKeyMap = mkBindHelper "bind-keymap" "";
@ -430,21 +430,23 @@ in {
++ optional hasDiminish epkgs.diminish
++ optional hasChords epkgs.use-package-chords
++ (
concatMap (v: getPkg (v.package))
concatMap (v: getPkg v.package)
(builtins.attrValues cfg.usePackage)
);
# use lucid as toolkit; emacs will otherwise crash quite frequently when run in daemon mode
# https://gitlab.gnome.org/GNOME/gtk/issues/221
machine.pkgsets.emacs.pkgwrap = let
emacsWithPackages =
(pkgs.emacsPackagesFor
inherit
((pkgs.emacsPackagesFor
(pkgs.emacs.override {
withGTK2 = false;
withGTK3 = false;
}))
.emacsWithPackages;
in (emacsWithPackages config.machine.pkgsets.emacs.pkgs);
})))
emacsWithPackages
;
in
emacsWithPackages config.machine.pkgsets.emacs.pkgs;
environment.systemPackages = [
((pkgs.emacsPackagesFor config.machine.pkgsets.emacs.pkgwrap).trivialBuild {

View file

@ -69,6 +69,6 @@ buildPythonPackage rec {
description = "GNU Mailman, a mailing list management system";
license = licenses.gpl3;
maintainers = with maintainers; [];
homepage = http://list.org/;
homepage = "http://list.org/";
};
}

View file

@ -7,7 +7,7 @@
nixpkgs-git,
...
}: let
callPackage = pkgs.callPackage;
inherit (pkgs) callPackage;
in {
nixpkgs = {
config = {

View file

@ -28,7 +28,7 @@
];
}
// {src = nightly.rust-src;};
cargo = nightly.cargo;
inherit (nightly) cargo;
};
rustPNightly = stablepkgs.recurseIntoAttrs (stablepkgs.makeRustPlatform {
inherit (rustNightly) rustc cargo;

View file

@ -8,7 +8,7 @@ with lib;
services = {
gitea = let
cfg = config.machine;
domain = (findFirst (s: s.service == "gitea") cfg cfg.vHosts).domain;
inherit ((findFirst (s: s.service == "gitea") cfg cfg.vHosts)) domain;
in {
enable = true;
user = "git";

View file

@ -25,7 +25,7 @@ in
services = let
cfg = config.machine;
domain = (findFirst (s: s.service == "hydra") cfg cfg.vHosts).domain;
inherit ((findFirst (s: s.service == "hydra") cfg cfg.vHosts)) domain;
in {
hydra = {
enable = true;

View file

@ -14,7 +14,7 @@ with lib;
// mkIf (elem "mailserver" config.machine.services) {
mailserver = let
cfg = config.machine;
domain = cfg.domain;
inherit (cfg) domain;
fdomain = (findFirst (s: s.service == "mail") cfg cfg.vHosts).domain;
mkFqdnAlias = name: ["${name}@${domain}" "${name}@${fdomain}"];
mkExDomAlias = name: (map (exDom: "${name}@${exDom}") cfg.extraDomains);

View file

@ -9,7 +9,7 @@ with lib;
mkIf (elem "nextcloud" config.machine.services) {
services = let
cfg = config.machine;
domain = (findFirst (s: s.service == "nextcloud") cfg cfg.vHosts).domain;
inherit ((findFirst (s: s.service == "nextcloud") cfg cfg.vHosts)) domain;
in {
nextcloud = {
enable = true;

View file

@ -6,7 +6,7 @@
...
}:
with lib;
if (config.services.nextcloud.enable == true)
if config.services.nextcloud.enable
then
{
vHost = {

View file

@ -31,13 +31,12 @@ with lib;
};
# Add public keys to /etc/ssh/authorized_keys.d
# This replaces users.users.*.openssh.authorizedKeys.*
sops.secrets = (
sops.secrets =
fn.sopsHelper
(user: "users/${user.name}/publicKey")
config.machine.administrators
(user: {
path = "/etc/ssh/authorized_keys.d/${user.name}";
mode = "444";
})
);
});
}