reformat all
14 files changed, 230 insertions(+), 165 deletions(-)
changed files
- ci.nix
- default.nix
- flake.nix
- lib/default.nix
- modules/darwin/caddy/default.nix
- modules/darwin/caddy/vhost-options.nix
- modules/nixos/laminar.nix
- overlay.nix
- pkgs/dirstat-rs/default.nix
- pkgs/emacs-unlimited-select/default.nix
- pkgs/go-instrument/default.nix
- pkgs/htmlformat/default.nix
- pkgs/porto/default.nix
- pkgs/projectdo/default.nix
M ci.nix → ci.nix
@@ -9,7 +9,9 @@ # # then your CI will be able to build and cache only those packages for # which this is possible. -{ pkgs ? import <nixpkgs> { } }: +{ + pkgs ? import <nixpkgs> { }, +}: with builtins; let@@ -19,16 +21,24 @@ isBuildable = p: !(p.meta.broken or false) && p.meta.license.free or true; isCacheable = p: !(p.preferLocalBuild or false); shouldRecurseForDerivations = p: isAttrs p && p.recurseForDerivations or false; - nameValuePair = n: v: { name = n; value = v; }; + nameValuePair = n: v: { + name = n; + value = v; + }; concatMap = builtins.concatMap or (f: xs: concatLists (map f xs)); - flattenPkgs = s: + flattenPkgs = + s: let - f = p: - if shouldRecurseForDerivations p then flattenPkgs p - else if isDerivation p then [ p ] - else [ ]; + f = + p: + if shouldRecurseForDerivations p then + flattenPkgs p + else if isDerivation p then + [ p ] + else + [ ]; in concatMap f (attrValues s);@@ -36,12 +46,11 @@ outputsOf = p: map (o: p.${o}) p.outputs; nurAttrs = import ./default.nix { inherit pkgs; }; - nurPkgs = - flattenPkgs - (listToAttrs - (map (n: nameValuePair n nurAttrs.${n}) - (filter (n: !isReserved n) - (attrNames nurAttrs)))); + nurPkgs = flattenPkgs ( + listToAttrs ( + map (n: nameValuePair n nurAttrs.${n}) (filter (n: !isReserved n) (attrNames nurAttrs)) + ) + ); in rec {
M default.nix → default.nix
@@ -6,7 +6,9 @@ # Having pkgs default to <nixpkgs> is fine though, and it lets you use short # commands such as: # nix-build -A mypackage -{ pkgs ? import <nixpkgs> { } }: +{ + pkgs ? import <nixpkgs> { }, +}: { # The `lib`, `modules`, and `overlays` names are special
M flake.nix → flake.nix
@@ -1,7 +1,8 @@ { description = "My personal NUR repository"; inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; - outputs = { self, nixpkgs }: + outputs = + { self, nixpkgs }: let systems = [ "x86_64-linux"@@ -18,31 +19,38 @@ { overlays = { default = import ./overlay.nix; }; - legacyPackages = forAllSystems (system: (import ./default.nix { - pkgs = import nixpkgs { inherit system; }; - })); + legacyPackages = forAllSystems ( + system: + (import ./default.nix { + pkgs = import nixpkgs { inherit system; }; + }) + ); nixosModules = { laminar = ./modules/nixos/laminar.nix; }; darwinModules = { caddy = ./modules/darwin/caddy; }; - packages = forAllSystems (system: + packages = forAllSystems ( + system: let pkgs = import nixpkgs { inherit system; }; - lpkgs = nixpkgs.lib.filterAttrs - (_: v: nixpkgs.lib.isDerivation v) - self.legacyPackages.${system}; + lpkgs = nixpkgs.lib.filterAttrs (_: v: nixpkgs.lib.isDerivation v) self.legacyPackages.${system}; all = pkgs.symlinkJoin { name = "all"; paths = (import ./ci.nix { inherit pkgs; }).cachePkgs; }; in - (lpkgs // { - inherit all; - default = all; - })); + ( + lpkgs + // { + inherit all; + default = all; + } + ) + ); + formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.nixfmt-tree); }; }
M lib/default.nix → lib/default.nix
@@ -1,6 +1,7 @@ { pkgs }: -with pkgs.lib; { +with pkgs.lib; +{ # Add your library functions here # # hexint = x: hexvals.${toLower x};
M modules/darwin/caddy/default.nix → modules/darwin/caddy/default.nix
@@ -1,7 +1,8 @@ -{ config -, lib -, pkgs -, ... +{ + config, + lib, + pkgs, + ... }: with lib;@@ -11,17 +12,18 @@ cfg = config.services.caddy; virtualHosts = attrValues cfg.virtualHosts; - mkVHostConf = hostOpts: - '' - ${hostOpts.hostName} ${concatStringsSep " " hostOpts.serverAliases} { - ${optionalString (hostOpts.listenAddresses != [ ]) "bind ${concatStringsSep " " hostOpts.listenAddresses}"} - log { - ${hostOpts.logFormat} - } - - ${hostOpts.extraConfig} + mkVHostConf = hostOpts: '' + ${hostOpts.hostName} ${concatStringsSep " " hostOpts.serverAliases} { + ${optionalString ( + hostOpts.listenAddresses != [ ] + ) "bind ${concatStringsSep " " hostOpts.listenAddresses}"} + log { + ${hostOpts.logFormat} } - ''; + + ${hostOpts.extraConfig} + } + ''; configFile = let@@ -33,13 +35,17 @@ ${cfg.extraConfig} ${concatMapStringsSep "\n" mkVHostConf virtualHosts} ''; - Caddyfile-formatted = pkgs.runCommand "Caddyfile-formatted" { nativeBuildInputs = [ cfg.package ]; } '' - mkdir -p $out - cp --no-preserve=mode ${Caddyfile}/Caddyfile $out/Caddyfile - caddy fmt --overwrite $out/Caddyfile - ''; + Caddyfile-formatted = + pkgs.runCommand "Caddyfile-formatted" { nativeBuildInputs = [ cfg.package ]; } + '' + mkdir -p $out + cp --no-preserve=mode ${Caddyfile}/Caddyfile $out/Caddyfile + caddy fmt --overwrite $out/Caddyfile + ''; in - "${if pkgs.stdenv.buildPlatform == pkgs.stdenv.hostPlatform then Caddyfile-formatted else Caddyfile}/Caddyfile"; + "${ + if pkgs.stdenv.buildPlatform == pkgs.stdenv.hostPlatform then Caddyfile-formatted else Caddyfile + }/Caddyfile"; etcConfigFile = "caddy/caddy_config";@@ -149,7 +155,11 @@ ''; }; adapter = mkOption { - default = if ((cfg.configFile != configFile) || (builtins.baseNameOf cfg.configFile) == "Caddyfile") then "caddyfile" else null; + default = + if ((cfg.configFile != configFile) || (builtins.baseNameOf cfg.configFile) == "Caddyfile") then + "caddyfile" + else + null; defaultText = literalExpression '' if ((cfg.configFile != configFile) || (builtins.baseNameOf cfg.configFile) == "Caddyfile") then "caddyfile" else null '';@@ -321,7 +331,9 @@ ''; launchd.daemons.caddy = let - runOptions = ''--config ${configPath} ${optionalString (cfg.adapter != null) "--adapter ${cfg.adapter}"}''; + runOptions = ''--config ${configPath} ${ + optionalString (cfg.adapter != null) "--adapter ${cfg.adapter}" + }''; in { command = ''${cfg.package}/bin/caddy run ${runOptions} ${optionalString cfg.resume "--resume"}'';
M modules/darwin/caddy/vhost-options.nix → modules/darwin/caddy/vhost-options.nix
@@ -1,5 +1,10 @@ { cfg }: -{ config, lib, name, ... }: +{ + config, + lib, + name, + ... +}: let inherit (lib) literalExpression mkOption types; in@@ -15,7 +20,10 @@ serverAliases = mkOption { type = with types; listOf str; default = [ ]; - example = [ "www.example.org" "example.org" ]; + example = [ + "www.example.org" + "example.org" + ]; description = '' Additional names of virtual hosts served by this virtual host configuration. '';@@ -27,7 +35,10 @@ description = '' A list of host interfaces to bind to for this virtual host. ''; default = [ ]; - example = [ "127.0.0.1" "::1" ]; + example = [ + "127.0.0.1" + "::1" + ]; }; useACMEHost = mkOption {
M modules/nixos/laminar.nix → modules/nixos/laminar.nix
@@ -1,7 +1,8 @@ -{ config -, lib -, pkgs -, ... +{ + config, + lib, + pkgs, + ... }: let cfg = config.services.laminar;@@ -14,7 +15,8 @@ mkEnableOption mkPackageOption mkOption mkIf - types; + types + ; in { options.services.laminar = {@@ -61,38 +63,40 @@ description = '' Nightly jobs to run ''; - type = with types; attrsOf (submodule { - options = { - name = mkOption { - type = types.str; - default = name; - description = "Name of the timer."; - }; + type = + with types; + attrsOf (submodule { + options = { + name = mkOption { + type = types.str; + default = name; + description = "Name of the timer."; + }; - reason = mkOption { - type = with types; nullOr str; - example = "Nightly build"; - default = null; - description = "optional human-readable string that will be displayed in the web UI as the cause of the build."; - }; + reason = mkOption { + type = with types; nullOr str; + example = "Nightly build"; + default = null; + description = "optional human-readable string that will be displayed in the web UI as the cause of the build."; + }; - startAt = mkOption { - type = with types; either str (listOf str); - default = "daily"; - description = '' - How often this job is started. See {manpage}`systemd.time(7)` for more information about the format. - ''; - }; + startAt = mkOption { + type = with types; either str (listOf str); + default = "daily"; + description = '' + How often this job is started. See {manpage}`systemd.time(7)` for more information about the format. + ''; + }; - accuracy = mkOption { - type = types.str; - default = "10 min"; - description = '' - How close to `startAt` time the job is actually run. See {manpage}`systemd.time(7)` for more information about the format. - ''; + accuracy = mkOption { + type = types.str; + default = "10 min"; + description = '' + How close to `startAt` time the job is actually run. See {manpage}`systemd.time(7)` for more information about the format. + ''; + }; }; - }; - }); + }); }; settings = mkOption {@@ -143,49 +147,49 @@ }; }; config = mkIf cfg.enable { - systemd.services = { - laminar = { - description = "Laminar continuous integration service"; - wantedBy = [ "multi-user.target" ]; - after = [ "network.target" ]; - inherit (cfg) path; - environment = { - XDG_RUNTIME_DIR = "%t/laminar"; - }; - serviceConfig = { - User = cfg.user; - Group = cfg.group; - ExecStart = "${cfg.package}/bin/laminard -v"; - RuntimeDirectory = "laminar"; - EnvironmentFile = pkgs.writeText "laminar.conf" '' - LAMINAR_HOME=${cfg.homeDir} - LAMINAR_BIND_HTTP=${cfg.settings.bindHTTP} - LAMINAR_BIND_RPC=${cfg.settings.bindRPC} - LAMINAR_TITLE=${cfg.settings.title} - LAMINAR_KEEP_RUNDIRS=${toString cfg.settings.keepRundirs} - LAMINAR_BASE_URL=${cfg.settings.baseURL} - ${lib.optionalString (cfg.settings.archiveURL != null) - "LAMINAR_ARCHIVE_URL=${cfg.settings.archiveURL}" - } - ''; - }; - unitConfig = { - Documentation = [ - "man:laminard(8)" - "https://laminar.ohwg.net/docs.html" - ]; + systemd.services = + { + laminar = { + description = "Laminar continuous integration service"; + wantedBy = [ "multi-user.target" ]; + after = [ "network.target" ]; + inherit (cfg) path; + environment = { + XDG_RUNTIME_DIR = "%t/laminar"; + }; + serviceConfig = { + User = cfg.user; + Group = cfg.group; + ExecStart = "${cfg.package}/bin/laminard -v"; + RuntimeDirectory = "laminar"; + EnvironmentFile = pkgs.writeText "laminar.conf" '' + LAMINAR_HOME=${cfg.homeDir} + LAMINAR_BIND_HTTP=${cfg.settings.bindHTTP} + LAMINAR_BIND_RPC=${cfg.settings.bindRPC} + LAMINAR_TITLE=${cfg.settings.title} + LAMINAR_KEEP_RUNDIRS=${toString cfg.settings.keepRundirs} + LAMINAR_BASE_URL=${cfg.settings.baseURL} + ${lib.optionalString ( + cfg.settings.archiveURL != null + ) "LAMINAR_ARCHIVE_URL=${cfg.settings.archiveURL}"} + ''; + }; + unitConfig = { + Documentation = [ + "man:laminard(8)" + "https://laminar.ohwg.net/docs.html" + ]; + }; }; - }; - } // (mapAttrs' - (name: job: { + } + // (mapAttrs' (name: job: { name = "laminar-job-${name}"; value = { description = "Runs laminar CI job."; path = [ cfg.package "/run/wrappers" - ] - ++ cfg.path; + ] ++ cfg.path; environment = { LAMINAR_REASON = job.reason; };@@ -196,10 +200,9 @@ Type = "oneshot"; ExecStart = "${cfg.package}/bin/laminarc run ${name}"; }; }; - }) - cfg.timers); - systemd.timers = (mapAttrs' - (name: job: { + }) cfg.timers); + systemd.timers = ( + mapAttrs' (name: job: { name = "laminar-job-${name}"; value = { wantedBy = [ "timers.target" ];@@ -209,8 +212,8 @@ AccuracySec = job.accuracy; Persistent = true; }; }; - }) - cfg.timers); + }) cfg.timers + ); environment.systemPackages = [ pkgs.laminar
M overlay.nix → overlay.nix
@@ -5,11 +5,15 @@ self: super: let isReserved = n: n == "lib" || n == "overlays" || n == "modules"; - nameValuePair = n: v: { name = n; value = v; }; + nameValuePair = n: v: { + name = n; + value = v; + }; nurAttrs = import ./default.nix { pkgs = super; }; in -builtins.listToAttrs - (map (n: nameValuePair n nurAttrs.${n}) - (builtins.filter (n: !isReserved n) - (builtins.attrNames nurAttrs))) +builtins.listToAttrs ( + map (n: nameValuePair n nurAttrs.${n}) ( + builtins.filter (n: !isReserved n) (builtins.attrNames nurAttrs) + ) +)
M pkgs/dirstat-rs/default.nix → pkgs/dirstat-rs/default.nix
@@ -1,7 +1,7 @@ -{ lib -, rustPlatform -, fetchFromGitHub -, +{ + lib, + rustPlatform, + fetchFromGitHub, }: rustPlatform.buildRustPackage rec {
M pkgs/emacs-unlimited-select/default.nix → pkgs/emacs-unlimited-select/default.nix
@@ -1,14 +1,18 @@ -{ stdenv -, lib -, emacs +{ + stdenv, + lib, + emacs, }: emacs.overrideAttrs (old: { - NIX_CFLAGS_COMPILE = (old.NIX_CFLAGS_COMPILE or "") + - " -DFD_SETSIZE=10000 -DDARWIN_UNLIMITED_SELECT"; + NIX_CFLAGS_COMPILE = + (old.NIX_CFLAGS_COMPILE or "") + " -DFD_SETSIZE=10000 -DDARWIN_UNLIMITED_SELECT"; - meta = with lib; old.meta // { - broken = !stdenv.isDarwin; - platforms = platforms.darwin; - }; + meta = + with lib; + old.meta + // { + broken = !stdenv.isDarwin; + platforms = platforms.darwin; + }; })
M pkgs/go-instrument/default.nix → pkgs/go-instrument/default.nix
@@ -17,7 +17,10 @@ }; vendorHash = "sha256-BIzeNT9UGHR1318NC83ptT92JUet/5Pjz/zBHL7PR9Y="; - ldflags = [ "-s" "-w" ]; + ldflags = [ + "-s" + "-w" + ]; meta = { description = "Automatically add Trace Spans to Go methods and functions";
M pkgs/htmlformat/default.nix → pkgs/htmlformat/default.nix
@@ -1,6 +1,7 @@ -{ lib -, buildGoModule -, fetchFromGitHub +{ + lib, + buildGoModule, + fetchFromGitHub, }: buildGoModule {@@ -17,7 +18,10 @@ }; vendorHash = "sha256-mJ6O8y/qg6GkiKZioOov8w4KcpIxG8KdA9PPeRvA/I0="; - ldflags = [ "-s" "-w" ]; + ldflags = [ + "-s" + "-w" + ]; meta = with lib; { description = "Htmlformat";
M pkgs/porto/default.nix → pkgs/porto/default.nix
@@ -1,6 +1,7 @@ -{ lib -, buildGoModule -, fetchFromGitHub +{ + lib, + buildGoModule, + fetchFromGitHub, }: buildGoModule rec {@@ -17,7 +18,10 @@ vendorHash = "sha256-MTuwMP3pnaIBt3FPNPJNaEncpTBVTlTxScQuRKj5b/U="; subPackages = [ "cmd/porto" ]; - ldflags = [ "-s" "-w" ]; + ldflags = [ + "-s" + "-w" + ]; meta = with lib; { description = "Tool for adding vanity import to Go code";
M pkgs/projectdo/default.nix → pkgs/projectdo/default.nix
@@ -1,14 +1,14 @@ -{ lib -, stdenv -, fetchFromGitHub -, ncurses -, nodejs -, bun -, pnpm -, yarn -, just -, nix -, +{ + lib, + stdenv, + fetchFromGitHub, + ncurses, + nodejs, + bun, + pnpm, + yarn, + just, + nix, }: let rev = "8de1acb1975d3811b8c3a8f175c8dfabd800da10";