diff --git a/config/etc/rofi.rasi.nix b/config/etc/rofi.rasi.nix index 57a7d6c..6025b1a 100644 --- a/config/etc/rofi.rasi.nix +++ b/config/etc/rofi.rasi.nix @@ -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" + '' diff --git a/config/networking.nix b/config/networking.nix index f6f7660..cf421c0 100644 --- a/config/networking.nix +++ b/config/networking.nix @@ -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; diff --git a/config/users.nix b/config/users.nix index b80174c..3d7d1f7 100644 --- a/config/users.nix +++ b/config/users.nix @@ -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]; }; diff --git a/configuration.nix b/configuration.nix index 19f2150..74d6a29 100644 --- a/configuration.nix +++ b/configuration.nix @@ -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 )).value != false) + fn.ifelse (tryEval (toString )).value (toString ) (toString /secret); hostName = diff --git a/flake.nix b/flake.nix index 195996a..32349f7 100644 --- a/flake.nix +++ b/flake.nix @@ -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) diff --git a/fn.nix b/fn.nix index 72d2c59..b2b79dd 100644 --- a/fn.nix +++ b/fn.nix @@ -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"] ["" "::" ""]) diff --git a/options/emacs-init.nix b/options/emacs-init.nix index 2cc13dc..a605c62 100644 --- a/options/emacs-init.nix +++ b/options/emacs-init.nix @@ -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 { diff --git a/options/mailman3/core.nix b/options/mailman3/core.nix index 41afd0f..ff65b72 100644 --- a/options/mailman3/core.nix +++ b/options/mailman3/core.nix @@ -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/"; }; } diff --git a/pkgs/nixpkgs.nix b/pkgs/nixpkgs.nix index 93f5e27..841b89a 100644 --- a/pkgs/nixpkgs.nix +++ b/pkgs/nixpkgs.nix @@ -7,7 +7,7 @@ nixpkgs-git, ... }: let - callPackage = pkgs.callPackage; + inherit (pkgs) callPackage; in { nixpkgs = { config = { diff --git a/pkgsets/rustpkgs.nix b/pkgsets/rustpkgs.nix index 28de6df..f3a49a0 100644 --- a/pkgsets/rustpkgs.nix +++ b/pkgsets/rustpkgs.nix @@ -28,7 +28,7 @@ ]; } // {src = nightly.rust-src;}; - cargo = nightly.cargo; + inherit (nightly) cargo; }; rustPNightly = stablepkgs.recurseIntoAttrs (stablepkgs.makeRustPlatform { inherit (rustNightly) rustc cargo; diff --git a/services/gitea.nix b/services/gitea.nix index 4f4da32..29b46aa 100644 --- a/services/gitea.nix +++ b/services/gitea.nix @@ -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"; diff --git a/services/hydra.nix b/services/hydra.nix index a55d192..dae890a 100644 --- a/services/hydra.nix +++ b/services/hydra.nix @@ -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; diff --git a/services/mailserver.nix b/services/mailserver.nix index 89d3e7c..33d4c40 100644 --- a/services/mailserver.nix +++ b/services/mailserver.nix @@ -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); diff --git a/services/nextcloud.nix b/services/nextcloud.nix index 38aa47b..aa4ea96 100644 --- a/services/nextcloud.nix +++ b/services/nextcloud.nix @@ -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; diff --git a/services/nginx_vHosts/nextcloud.nix b/services/nginx_vHosts/nextcloud.nix index cfd8971..750aad9 100644 --- a/services/nginx_vHosts/nextcloud.nix +++ b/services/nginx_vHosts/nextcloud.nix @@ -6,7 +6,7 @@ ... }: with lib; - if (config.services.nextcloud.enable == true) + if config.services.nextcloud.enable then { vHost = { diff --git a/services/openssh.nix b/services/openssh.nix index feb3439..4774d6c 100644 --- a/services/openssh.nix +++ b/services/openssh.nix @@ -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"; - }) - ); + }); }