From aa122cbae78ce97d60c0c98ba14df753d97e40b1 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 30 Jan 2022 19:06:58 +0300 Subject: style: format entire depot with nixpkgs-fmt This CL can be used to compare the style of nixpkgs-fmt against other formatters (nixpkgs, alejandra). Change-Id: I87c6abff6bcb546b02ead15ad0405f81e01b6d9e Reviewed-on: https://cl.tvl.fyi/c/depot/+/4397 Tested-by: BuildkiteCI Reviewed-by: sterni Reviewed-by: lukegb Reviewed-by: wpcarro Reviewed-by: Profpatsch Reviewed-by: kanepyork Reviewed-by: tazjin Reviewed-by: cynthia Reviewed-by: edef Reviewed-by: eta Reviewed-by: grfn --- users/wpcarro/assessments/brilliant/default.nix | 2 +- users/wpcarro/buildHaskell/default.nix | 40 +-- users/wpcarro/ci/pipelines/post-receive.nix | 3 +- users/wpcarro/clients/monsterpoker/default.nix | 2 +- users/wpcarro/common.nix | 3 +- users/wpcarro/configs/default.nix | 3 +- users/wpcarro/emacs/default.nix | 12 +- users/wpcarro/haskell-file/shell.nix | 2 +- users/wpcarro/nixos/diogenes/default.nix | 13 +- users/wpcarro/nixos/marcus/default.nix | 3 +- users/wpcarro/nixos/marcus/hardware.nix | 4 +- users/wpcarro/playbooks/nix_gcr/cloud_run.nix | 2 +- users/wpcarro/scratch/blockchain/default.nix | 3 +- users/wpcarro/scratch/groceries/shell.nix | 2 +- .../scratch/picoctf/challenge_166/shell.nix | 5 +- users/wpcarro/terraform/default.nix | 336 +++++++++++---------- users/wpcarro/tools/monzo_ynab/job.nix | 3 +- users/wpcarro/tools/monzo_ynab/tokens.nix | 3 +- users/wpcarro/tools/rfcToKindle/default.nix | 2 +- users/wpcarro/tools/symlinkManager/default.nix | 3 +- users/wpcarro/tools/url-blocker/default.nix | 13 +- users/wpcarro/utils/builder.nix | 3 +- users/wpcarro/utils/default.nix | 5 +- users/wpcarro/utils/fs.nix | 9 +- users/wpcarro/website/blog/default.nix | 7 +- users/wpcarro/website/default.nix | 15 +- users/wpcarro/website/habit-screens/default.nix | 41 +-- users/wpcarro/website/habit-screens/elm-srcs.nix | 120 ++++---- .../website/sandbox/learnpianochords/default.nix | 41 +-- .../website/sandbox/learnpianochords/elm-srcs.nix | 104 +++---- 30 files changed, 418 insertions(+), 386 deletions(-) (limited to 'users/wpcarro') diff --git a/users/wpcarro/assessments/brilliant/default.nix b/users/wpcarro/assessments/brilliant/default.nix index 536e54d3650a..0628679c0127 100644 --- a/users/wpcarro/assessments/brilliant/default.nix +++ b/users/wpcarro/assessments/brilliant/default.nix @@ -12,5 +12,5 @@ depot.users.wpcarro.buildHaskell.program { split rio ]; - ghcExtensions = []; + ghcExtensions = [ ]; } diff --git a/users/wpcarro/buildHaskell/default.nix b/users/wpcarro/buildHaskell/default.nix index 5958b1ea26ae..2f0fd9e1c2d1 100644 --- a/users/wpcarro/buildHaskell/default.nix +++ b/users/wpcarro/buildHaskell/default.nix @@ -2,11 +2,13 @@ { # Create a nix-shell for Haskell development. - shell = { deps }: let - ghc = pkgs.haskellPackages.ghcWithPackages (hpkgs: deps hpkgs); - in pkgs.mkShell { - buildInputs = [ghc]; - }; + shell = { deps }: + let + ghc = pkgs.haskellPackages.ghcWithPackages (hpkgs: deps hpkgs); + in + pkgs.mkShell { + buildInputs = [ ghc ]; + }; # Build a Haskell executable. This assumes a project directory with a # top-level Main.hs. @@ -15,17 +17,19 @@ # - `deps`: A function that accepts `hpkgs` and returns a list of Haskell # - `ghcExtensions`: A list of strings representing the language extensions to # use. - program = { name, srcs, deps, ghcExtensions }: let - ghc = pkgs.haskellPackages.ghcWithPackages (hpkgs: deps hpkgs); - in pkgs.stdenv.mkDerivation { - name = name; - buildInputs = []; - srcs = srcs; - buildPhase = '' - ${ghc}/bin/ghc -Wall Main.hs ${pkgs.lib.concatMapStrings (x: "-X${x} ") ghcExtensions} - ''; - installPhase = '' - mkdir -p $out && mv Main $out/${name} - ''; - }; + program = { name, srcs, deps, ghcExtensions }: + let + ghc = pkgs.haskellPackages.ghcWithPackages (hpkgs: deps hpkgs); + in + pkgs.stdenv.mkDerivation { + name = name; + buildInputs = [ ]; + srcs = srcs; + buildPhase = '' + ${ghc}/bin/ghc -Wall Main.hs ${pkgs.lib.concatMapStrings (x: "-X${x} ") ghcExtensions} + ''; + installPhase = '' + mkdir -p $out && mv Main $out/${name} + ''; + }; } diff --git a/users/wpcarro/ci/pipelines/post-receive.nix b/users/wpcarro/ci/pipelines/post-receive.nix index cb7501bdeacf..09b8990e13e2 100644 --- a/users/wpcarro/ci/pipelines/post-receive.nix +++ b/users/wpcarro/ci/pipelines/post-receive.nix @@ -10,4 +10,5 @@ let label = ":broom: lint secrets"; } ]; -in pkgs.writeText "pipeline.yaml" (toJSON pipeline) +in +pkgs.writeText "pipeline.yaml" (toJSON pipeline) diff --git a/users/wpcarro/clients/monsterpoker/default.nix b/users/wpcarro/clients/monsterpoker/default.nix index 0e079261fb6a..e5dca4bca21c 100644 --- a/users/wpcarro/clients/monsterpoker/default.nix +++ b/users/wpcarro/clients/monsterpoker/default.nix @@ -1,6 +1,6 @@ { depot, pkgs, ... }: -pkgs.runCommandNoCC "monsterpoker.app" {} '' +pkgs.runCommandNoCC "monsterpoker.app" { } '' mkdir -p $out cp ${./index.html} $out/index.html '' diff --git a/users/wpcarro/common.nix b/users/wpcarro/common.nix index 829c3394d1e2..d88b83b9d2b8 100644 --- a/users/wpcarro/common.nix +++ b/users/wpcarro/common.nix @@ -2,7 +2,8 @@ let inherit (depot.users) wpcarro; -in { +in +{ programs = { fish.enable = true; diff --git a/users/wpcarro/configs/default.nix b/users/wpcarro/configs/default.nix index 81ba5b4d48ac..681f976052c7 100644 --- a/users/wpcarro/configs/default.nix +++ b/users/wpcarro/configs/default.nix @@ -3,7 +3,8 @@ let inherit (pkgs) writeShellScript; inherit (pkgs.lib.strings) makeBinPath; -in { +in +{ install = writeShellScript "install-configs" '' cd "$WPCARRO/configs" && ${pkgs.stow}/bin/stow --target="$HOME" . ''; diff --git a/users/wpcarro/emacs/default.nix b/users/wpcarro/emacs/default.nix index c2669f6949e5..b751849eab9c 100644 --- a/users/wpcarro/emacs/default.nix +++ b/users/wpcarro/emacs/default.nix @@ -18,7 +18,8 @@ let pass scrot xorg.xset - ])); + ]) + ); emacsWithPackages = (emacsPackagesGen emacs27).emacsWithPackages; @@ -128,7 +129,7 @@ let makeEnvVars = env: concatStringsSep "\n" (mapAttrsToList (k: v: "export ${k}=\"${v}\"") env); - withEmacsPath = { emacsBin, env ? {}, load ? [] }: + withEmacsPath = { emacsBin, env ? { }, load ? [ ] }: writeShellScriptBin "wpcarros-emacs" '' export XMODIFIERS=emacs export PATH="${emacsBinPath}:$PATH" @@ -143,16 +144,17 @@ let ${concatStringsSep "\n" (map (el: "--load ${el} \\") load)} "$@" ''; -in { +in +{ inherit withEmacsPath; - nixos = { load ? [] }: withEmacsPath { + nixos = { load ? [ ] }: withEmacsPath { inherit load; emacsBin = "${wpcarrosEmacs}/bin/emacs"; }; # Script that asserts my Emacs can initialize without warnings or errors. - check = runCommand "check-emacs" {} '' + check = runCommand "check-emacs" { } '' # Even though Buildkite defines this, I'd still like still be able to test # this locally without depending on my ability to remember to set CI=true. export CI=true diff --git a/users/wpcarro/haskell-file/shell.nix b/users/wpcarro/haskell-file/shell.nix index 7682e8246cac..0c6a298bf2b0 100644 --- a/users/wpcarro/haskell-file/shell.nix +++ b/users/wpcarro/haskell-file/shell.nix @@ -1,5 +1,5 @@ { depot, ... }: depot.users.wpcarro.buildHaskell.shell { - deps = hpkgs: []; + deps = hpkgs: [ ]; } diff --git a/users/wpcarro/nixos/diogenes/default.nix b/users/wpcarro/nixos/diogenes/default.nix index d1246de4f34f..f92de19d18bf 100644 --- a/users/wpcarro/nixos/diogenes/default.nix +++ b/users/wpcarro/nixos/diogenes/default.nix @@ -4,7 +4,8 @@ let inherit (depot.users) wpcarro; name = "diogenes"; domainName = "billandhiscomputer.com"; -in wpcarro.terraform.googleCloudVM { +in +wpcarro.terraform.googleCloudVM { project = "wpcarros-infrastructure"; name = "diogenes"; region = "us-central1"; @@ -23,7 +24,7 @@ in wpcarro.terraform.googleCloudVM { type = "A"; ttl = 300; # 5m managed_zone = "\${google_dns_managed_zone.${name}.name}"; - rrdatas = ["\${google_compute_instance.${name}.network_interface[0].access_config[0].nat_ip}"]; + rrdatas = [ "\${google_compute_instance.${name}.network_interface[0].access_config[0].nat_ip}" ]; }; resource.google_compute_instance."${name}" = { @@ -43,7 +44,7 @@ in wpcarro.terraform.googleCloudVM { type = "A"; ttl = 300; # 5m managed_zone = "\${google_dns_managed_zone.monsterpoker.name}"; - rrdatas = ["\${google_compute_instance.${name}.network_interface[0].access_config[0].nat_ip}"]; + rrdatas = [ "\${google_compute_instance.${name}.network_interface[0].access_config[0].nat_ip}" ]; }; }; @@ -54,9 +55,9 @@ in wpcarro.terraform.googleCloudVM { networking = { firewall.allowedTCPPorts = [ - 22 # ssh - 80 # http - 443 # https + 22 # ssh + 80 # http + 443 # https 6698 # quassel ]; firewall.allowedUDPPortRanges = [ diff --git a/users/wpcarro/nixos/marcus/default.nix b/users/wpcarro/nixos/marcus/default.nix index 1de320f10c20..a84d33ead75b 100644 --- a/users/wpcarro/nixos/marcus/default.nix +++ b/users/wpcarro/nixos/marcus/default.nix @@ -13,7 +13,8 @@ let enableDaemon = false; monolithic = false; }; -in { +in +{ imports = [ (depot.path + "/users/wpcarro/nixos/marcus/hardware.nix") "${pkgs.home-manager.src}/nixos" diff --git a/users/wpcarro/nixos/marcus/hardware.nix b/users/wpcarro/nixos/marcus/hardware.nix index a5735bc8e22b..cd80685abe13 100644 --- a/users/wpcarro/nixos/marcus/hardware.nix +++ b/users/wpcarro/nixos/marcus/hardware.nix @@ -6,9 +6,9 @@ ]; boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "usb_storage" "sd_mod" ]; - boot.initrd.kernelModules = []; + boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-intel" ]; - boot.extraModulePackages = []; + boot.extraModulePackages = [ ]; fileSystems."/" = { device = "/dev/disk/by-uuid/b8b911ee-e9b9-40ea-89d6-551f11350e7b"; diff --git a/users/wpcarro/playbooks/nix_gcr/cloud_run.nix b/users/wpcarro/playbooks/nix_gcr/cloud_run.nix index 3d981611817b..1f473b5f59fa 100644 --- a/users/wpcarro/playbooks/nix_gcr/cloud_run.nix +++ b/users/wpcarro/playbooks/nix_gcr/cloud_run.nix @@ -4,7 +4,7 @@ pkgs.dockerTools.buildLayeredImage { name = "gemma"; tag = "latest"; config.ExposedPorts = { - "4242" = {}; + "4242" = { }; }; config.Env = [ "GEMMA_CONFIG=${./config.lisp}" diff --git a/users/wpcarro/scratch/blockchain/default.nix b/users/wpcarro/scratch/blockchain/default.nix index 745e7a5ab490..c02f9a9c8108 100644 --- a/users/wpcarro/scratch/blockchain/default.nix +++ b/users/wpcarro/scratch/blockchain/default.nix @@ -2,7 +2,8 @@ let pypkgs = pkgs.python3Packages; -in pkgs.python3Packages.buildPythonApplication { +in +pkgs.python3Packages.buildPythonApplication { pname = "main"; src = ./.; version = "0.0.1"; diff --git a/users/wpcarro/scratch/groceries/shell.nix b/users/wpcarro/scratch/groceries/shell.nix index 7682e8246cac..0c6a298bf2b0 100644 --- a/users/wpcarro/scratch/groceries/shell.nix +++ b/users/wpcarro/scratch/groceries/shell.nix @@ -1,5 +1,5 @@ { depot, ... }: depot.users.wpcarro.buildHaskell.shell { - deps = hpkgs: []; + deps = hpkgs: [ ]; } diff --git a/users/wpcarro/scratch/picoctf/challenge_166/shell.nix b/users/wpcarro/scratch/picoctf/challenge_166/shell.nix index 07a3a2e281b4..85d3865a51bf 100644 --- a/users/wpcarro/scratch/picoctf/challenge_166/shell.nix +++ b/users/wpcarro/scratch/picoctf/challenge_166/shell.nix @@ -1,7 +1,8 @@ { pkgs, ... }: let - python =pkgs.python3.withPackages (pypkgs: with pypkgs; [ + python = pkgs.python3.withPackages (pypkgs: with pypkgs; [ cryptography ]); -in python.env +in +python.env diff --git a/users/wpcarro/terraform/default.nix b/users/wpcarro/terraform/default.nix index be35785a54d0..d73d46dbf91e 100644 --- a/users/wpcarro/terraform/default.nix +++ b/users/wpcarro/terraform/default.nix @@ -7,179 +7,183 @@ let images = import "${pkgs.path}/nixos/modules/virtualisation/gce-images.nix"; nixosImage = images."20.09"; -in { - googleCloudVM = { - project, - name, - region, - zone, - configuration, - extraConfig ? {}, - }: let - inherit (configuration.users.users) root; - inherit (configuration.networking) firewall; - - # Convert NixOS-style port numbers to Terraform-style. - asStrings = xs: map toString xs; - asRanges = xs: map (x: "${toString x.from}-${toString x.to}") xs; - - sshKeys = concatStringsSep "\n" - (map (key: "root:${key}") root.openssh.authorizedKeys.keys); - - os = depot.ops.nixos.nixosFor (_: { - imports = [ - "${pkgs.path}/nixos/modules/virtualisation/google-compute-image.nix" - configuration - ]; - - networking.hostName = name; - - fileSystems."/nix" = { - device = "/dev/disk/by-label/google-${name}-disk"; - fsType = "ext4"; +in +{ + googleCloudVM = + { project + , name + , region + , zone + , configuration + , extraConfig ? { } + , + }: + let + inherit (configuration.users.users) root; + inherit (configuration.networking) firewall; + + # Convert NixOS-style port numbers to Terraform-style. + asStrings = xs: map toString xs; + asRanges = xs: map (x: "${toString x.from}-${toString x.to}") xs; + + sshKeys = concatStringsSep "\n" + (map (key: "root:${key}") root.openssh.authorizedKeys.keys); + + os = depot.ops.nixos.nixosFor (_: { + imports = [ + "${pkgs.path}/nixos/modules/virtualisation/google-compute-image.nix" + configuration + ]; + + networking.hostName = name; + + fileSystems."/nix" = { + device = "/dev/disk/by-label/google-${name}-disk"; + fsType = "ext4"; + }; + }); + + osRoot = os.config.system.build.toplevel; + osPath = unsafeDiscardStringContext (toString osRoot.outPath); + drvPath = unsafeDiscardStringContext (toString osRoot.drvPath); + in + writeText "terraform.tf.json" (toJSON (lib.recursiveUpdate extraConfig { + provider.google = { + inherit project region zone; }; - }); - - osRoot = os.config.system.build.toplevel; - osPath = unsafeDiscardStringContext (toString osRoot.outPath); - drvPath = unsafeDiscardStringContext (toString osRoot.drvPath); - in writeText "terraform.tf.json" (toJSON (lib.recursiveUpdate extraConfig { - provider.google = { - inherit project region zone; - }; - - resource.google_compute_instance."${name}" = { - inherit name zone; - machine_type = "e2-standard-2"; - - tags = [ - "http-server" - "https-server" - "${name}-firewall" - ]; - - boot_disk = { - device_name = "boot"; - initialize_params = { - size = 10; - image = "projects/nixos-cloud/global/images/${nixosImage.name}"; + + resource.google_compute_instance."${name}" = { + inherit name zone; + machine_type = "e2-standard-2"; + + tags = [ + "http-server" + "https-server" + "${name}-firewall" + ]; + + boot_disk = { + device_name = "boot"; + initialize_params = { + size = 10; + image = "projects/nixos-cloud/global/images/${nixosImage.name}"; + }; + }; + + attached_disk = { + source = "\${google_compute_disk.${name}.id}"; + device_name = "${name}-disk"; + }; + + network_interface = { + network = "default"; + subnetwork = "default"; + access_config = { }; + }; + + # Copy root's SSH keys from the NixOS configuration and expose them to the + # metadata server. + metadata = { + inherit sshKeys; + ssh-keys = sshKeys; + + # NixOS's fetch-instance-ssh-keys.bash relies on these fields being + # available on the metadata server. + ssh_host_ed25519_key = "\${tls_private_key.${name}.private_key_pem}"; + ssh_host_ed25519_key_pub = "\${tls_private_key.${name}.public_key_pem}"; + + # Even though we have SSH access, having oslogin can still be useful for + # troubleshooting in the browser if for some reason SSH isn't working as + # expected. + enable-oslogin = "TRUE"; }; + + service_account.scopes = [ "cloud-platform" ]; }; - - attached_disk = { - source = "\${google_compute_disk.${name}.id}"; - device_name = "${name}-disk"; + + resource.tls_private_key."${name}" = { + algorithm = "ECDSA"; + ecdsa_curve = "P384"; }; - - network_interface = { + + resource.google_compute_firewall."${name}" = { + name = "${name}-firewall"; network = "default"; - subnetwork = "default"; - access_config = {}; - }; - - # Copy root's SSH keys from the NixOS configuration and expose them to the - # metadata server. - metadata = { - inherit sshKeys; - ssh-keys = sshKeys; - - # NixOS's fetch-instance-ssh-keys.bash relies on these fields being - # available on the metadata server. - ssh_host_ed25519_key = "\${tls_private_key.${name}.private_key_pem}"; - ssh_host_ed25519_key_pub = "\${tls_private_key.${name}.public_key_pem}"; - - # Even though we have SSH access, having oslogin can still be useful for - # troubleshooting in the browser if for some reason SSH isn't working as - # expected. - enable-oslogin = "TRUE"; - }; - - service_account.scopes = ["cloud-platform"]; - }; - - resource.tls_private_key."${name}" = { - algorithm = "ECDSA"; - ecdsa_curve = "P384"; - }; - - resource.google_compute_firewall."${name}" = { - name = "${name}-firewall"; - network = "default"; - - # Read the firewall configuration from the NixOS configuration. - allow = [ - { - protocol = "tcp"; - ports = concatLists [ - (asStrings (firewall.allowedTCPPorts or [])) - (asRanges (firewall.allowedTCPPortRanges or [])) - ]; - } - { - protocol = "udp"; - ports = concatLists [ - (asStrings (firewall.allowedUDPPorts or [])) - (asRanges (firewall.allowedUDPPortRanges or [])) - ]; - } - ]; - source_ranges = ["0.0.0.0/0"]; - }; - - resource.google_compute_disk."${name}" = { - inherit zone; - name = "${name}-disk"; - size = 100; - }; - - resource.null_resource.deploy_nixos = { - triggers = { - # Redeploy when the NixOS configuration changes. - os = "${osPath}"; - # Redeploy when a new machine is provisioned. - machine_id = "\${google_compute_instance.${name}.id}"; + + # Read the firewall configuration from the NixOS configuration. + allow = [ + { + protocol = "tcp"; + ports = concatLists [ + (asStrings (firewall.allowedTCPPorts or [ ])) + (asRanges (firewall.allowedTCPPortRanges or [ ])) + ]; + } + { + protocol = "udp"; + ports = concatLists [ + (asStrings (firewall.allowedUDPPorts or [ ])) + (asRanges (firewall.allowedUDPPortRanges or [ ])) + ]; + } + ]; + source_ranges = [ "0.0.0.0/0" ]; }; - connection = { - host = "\${google_compute_instance.${name}.network_interface[0].access_config[0].nat_ip}"; + resource.google_compute_disk."${name}" = { + inherit zone; + name = "${name}-disk"; + size = 100; }; - provisioner = [ - { remote-exec.inline = ["true"]; } - { - local-exec.command = '' - export PATH="${pkgs.openssh}/bin:$PATH" - - scratch="$(mktemp -d)" - function cleanup() { - rm -rf $scratch - } - trap cleanup EXIT - - # write out ssh key - echo -n "''${tls_private_key.${name}.private_key_pem}" > $scratch/id_rsa.pem - chmod 0600 $scratch/id_rsa.pem - - export NIX_SSHOPTS="\ - -o StrictHostKeyChecking=no\ - -o UserKnownHostsFile=/dev/null\ - -o GlobalKnownHostsFile=/dev/null\ - -o IdentityFile=$scratch/id_rsa.pem - " - - nix-build ${drvPath} - nix-copy-closure --to \ - root@''${google_compute_instance.${name}.network_interface[0].access_config[0].nat_ip} \ - ${osPath} --gzip --use-substitutes - ''; - } - { - remote-exec.inline = [ - "nix-env --profile /nix/var/nix/profiles/system --set ${osPath}" - "${osPath}/bin/switch-to-configuration switch" - ]; - } - ]; - }; - })); + resource.null_resource.deploy_nixos = { + triggers = { + # Redeploy when the NixOS configuration changes. + os = "${osPath}"; + # Redeploy when a new machine is provisioned. + machine_id = "\${google_compute_instance.${name}.id}"; + }; + + connection = { + host = "\${google_compute_instance.${name}.network_interface[0].access_config[0].nat_ip}"; + }; + + provisioner = [ + { remote-exec.inline = [ "true" ]; } + { + local-exec.command = '' + export PATH="${pkgs.openssh}/bin:$PATH" + + scratch="$(mktemp -d)" + function cleanup() { + rm -rf $scratch + } + trap cleanup EXIT + + # write out ssh key + echo -n "''${tls_private_key.${name}.private_key_pem}" > $scratch/id_rsa.pem + chmod 0600 $scratch/id_rsa.pem + + export NIX_SSHOPTS="\ + -o StrictHostKeyChecking=no\ + -o UserKnownHostsFile=/dev/null\ + -o GlobalKnownHostsFile=/dev/null\ + -o IdentityFile=$scratch/id_rsa.pem + " + + nix-build ${drvPath} + nix-copy-closure --to \ + root@''${google_compute_instance.${name}.network_interface[0].access_config[0].nat_ip} \ + ${osPath} --gzip --use-substitutes + ''; + } + { + remote-exec.inline = [ + "nix-env --profile /nix/var/nix/profiles/system --set ${osPath}" + "${osPath}/bin/switch-to-configuration switch" + ]; + } + ]; + }; + })); } diff --git a/users/wpcarro/tools/monzo_ynab/job.nix b/users/wpcarro/tools/monzo_ynab/job.nix index c2c8baab3b45..f710b73cefdb 100644 --- a/users/wpcarro/tools/monzo_ynab/job.nix +++ b/users/wpcarro/tools/monzo_ynab/job.nix @@ -2,7 +2,8 @@ let inherit (depot.users.wpcarro) gopkgs; -in depot.nix.buildGo.program { +in +depot.nix.buildGo.program { name = "job"; srcs = [ ./main.go diff --git a/users/wpcarro/tools/monzo_ynab/tokens.nix b/users/wpcarro/tools/monzo_ynab/tokens.nix index b58c272bde02..4e2761bc7882 100644 --- a/users/wpcarro/tools/monzo_ynab/tokens.nix +++ b/users/wpcarro/tools/monzo_ynab/tokens.nix @@ -12,7 +12,8 @@ let utils ]; }; -in depot.nix.buildGo.program { +in +depot.nix.buildGo.program { name = "token-server"; srcs = [ ./tokens.go diff --git a/users/wpcarro/tools/rfcToKindle/default.nix b/users/wpcarro/tools/rfcToKindle/default.nix index 4ea271943950..ca87abdee012 100644 --- a/users/wpcarro/tools/rfcToKindle/default.nix +++ b/users/wpcarro/tools/rfcToKindle/default.nix @@ -7,5 +7,5 @@ depot.nix.buildGo.program { srcs = [ ./main.go ]; - deps = []; + deps = [ ]; } diff --git a/users/wpcarro/tools/symlinkManager/default.nix b/users/wpcarro/tools/symlinkManager/default.nix index 4e261d730932..7d022828ee97 100644 --- a/users/wpcarro/tools/symlinkManager/default.nix +++ b/users/wpcarro/tools/symlinkManager/default.nix @@ -2,7 +2,8 @@ let inherit (depot.users.wpcarro) gopkgs; -in depot.nix.buildGo.program { +in +depot.nix.buildGo.program { name = "symlink-mgr"; srcs = [ ./main.go diff --git a/users/wpcarro/tools/url-blocker/default.nix b/users/wpcarro/tools/url-blocker/default.nix index 943644e5f542..ae24aa41b7ca 100644 --- a/users/wpcarro/tools/url-blocker/default.nix +++ b/users/wpcarro/tools/url-blocker/default.nix @@ -12,11 +12,11 @@ let name = "url-blocker"; src = builtins.path { path = ./.; name = "url-blocker"; }; buildPhase = '' - ${ghc}/bin/ghc Main.hs - ''; + ${ghc}/bin/ghc Main.hs + ''; installPhase = '' - mv ./Main $out - ''; + mv ./Main $out + ''; }; # This is the systemd timer unit. @@ -26,8 +26,9 @@ let systemd = { timers.simple-timer = { wantedBy = [ "timers.target" ]; - partOf = []; + partOf = [ ]; }; }; }; -in null +in +null diff --git a/users/wpcarro/utils/builder.nix b/users/wpcarro/utils/builder.nix index 45e783cf0ba8..2bc061d3661b 100644 --- a/users/wpcarro/utils/builder.nix +++ b/users/wpcarro/utils/builder.nix @@ -2,7 +2,8 @@ let inherit (pkgs) writeShellScriptBin; -in { +in +{ # Create a derivation that creates an executable shell script named `as` that # calls the program located at `path`, forwarding all of the arguments. wrapNonNixProgram = { path, as }: writeShellScriptBin as '' diff --git a/users/wpcarro/utils/default.nix b/users/wpcarro/utils/default.nix index 59aa322076b4..46d30acfa24e 100644 --- a/users/wpcarro/utils/default.nix +++ b/users/wpcarro/utils/default.nix @@ -8,7 +8,8 @@ args@{ pkgs, ... }: let builder = import ./builder.nix args; - fs = import ./fs.nix args; -in { + fs = import ./fs.nix args; +in +{ inherit builder fs; } diff --git a/users/wpcarro/utils/fs.nix b/users/wpcarro/utils/fs.nix index 6305e705b141..d7d5e34e991b 100644 --- a/users/wpcarro/utils/fs.nix +++ b/users/wpcarro/utils/fs.nix @@ -5,7 +5,8 @@ let inherit (builtins) attrNames hasAttr map readDir; inherit (pkgs.lib) filterAttrs; -in { +in +{ # Returns a list of all of the regular files in `dir`. files = dir: map (name: dir + "/${name}") @@ -31,11 +32,11 @@ in { if hasAttr name (readDir dir) then dir + "/${name}" else - # This prevents the function from infinitely recursing and eventually - # stack overflowing. + # This prevents the function from infinitely recursing and eventually + # stack overflowing. if (dirOf dir) == dir then null else resolve name (dirOf dir); - }; +}; } diff --git a/users/wpcarro/website/blog/default.nix b/users/wpcarro/website/blog/default.nix index 4ccf200223ce..d87b714b6fe1 100644 --- a/users/wpcarro/website/blog/default.nix +++ b/users/wpcarro/website/blog/default.nix @@ -17,7 +17,7 @@ let posts = sort (x: y: x.date > y.date) (filter includePost (list post (import ./posts.nix))); - rendered = pkgs.runCommandNoCC "blog-posts" {} '' + rendered = pkgs.runCommandNoCC "blog-posts" { } '' mkdir -p $out ${lib.concatStringsSep "\n" (map (post: @@ -25,7 +25,7 @@ let ) posts)} ''; - formatDate = date: readFile (pkgs.runCommandNoCC "date" {} '' + formatDate = date: readFile (pkgs.runCommandNoCC "date" { } '' date --date='@${toString date}' '+%B %e, %Y' > $out ''); @@ -38,7 +38,8 @@ let postTitle = post.title; postDate = formatDate post.date; }); -in pkgs.runCommandNoCC "blog" {} '' +in +pkgs.runCommandNoCC "blog" { } '' mkdir -p $out cp ${withBrand (readFile postsHtml)} $out/index.html cp -r ${rendered} $out/posts diff --git a/users/wpcarro/website/default.nix b/users/wpcarro/website/default.nix index 9694aad17d60..19229aab5a35 100644 --- a/users/wpcarro/website/default.nix +++ b/users/wpcarro/website/default.nix @@ -8,11 +8,11 @@ let globalVars = { inherit domain; - homepage = "https://${domain}/"; - blog = "https://${domain}/blog"; - habits = "https://${domain}/habits"; - github = "https://github.com/wpcarro"; - linkedin = "https://linkedin.com/in/williampatrickcarroll"; + homepage = "https://${domain}/"; + blog = "https://${domain}/blog"; + habits = "https://${domain}/habits"; + github = "https://github.com/wpcarro"; + linkedin = "https://linkedin.com/in/williampatrickcarroll"; depotWork = "https://cs.tvl.fyi/depot/-/blob/users/wpcarro"; }; @@ -23,10 +23,11 @@ let withBrand = contentHtml: renderTemplate ./fragments/template.html { inherit contentHtml; }; -in { +in +{ inherit domain renderTemplate withBrand; - root = pkgs.runCommandNoCC "wpcarro.dev" {} '' + root = pkgs.runCommandNoCC "wpcarro.dev" { } '' mkdir -p $out # / diff --git a/users/wpcarro/website/habit-screens/default.nix b/users/wpcarro/website/habit-screens/default.nix index 345e6f010d48..3036ba1821cb 100644 --- a/users/wpcarro/website/habit-screens/default.nix +++ b/users/wpcarro/website/habit-screens/default.nix @@ -8,7 +8,7 @@ let , src , name , srcdir ? "./src" - , targets ? [] + , targets ? [ ] , registryDat ? ./registry.dat , outputJavaScript ? false }: @@ -24,33 +24,36 @@ let inherit registryDat; }; - installPhase = let - elmfile = module: "${srcdir}/${builtins.replaceStrings ["."] ["/"] module}.elm"; - extension = if outputJavaScript then "js" else "html"; - in '' - mkdir -p $out/share/doc - ${lib.concatStrings (map (module: '' - echo "compiling ${elmfile module}" - elm make ${elmfile module} --output $out/${module}.${extension} --docs $out/share/doc/${module}.json - ${lib.optionalString outputJavaScript '' - echo "minifying ${elmfile module}" - uglifyjs $out/${module}.${extension} --compress 'pure_funcs="F2,F3,F4,F5,F6,F7,F8,F9,A2,A3,A4,A5,A6,A7,A8,A9",pure_getters,keep_fargs=false,unsafe_comps,unsafe' \ - | uglifyjs --mangle --output $out/${module}.min.${extension} - ''} - '') targets)} - ''; + installPhase = + let + elmfile = module: "${srcdir}/${builtins.replaceStrings ["."] ["/"] module}.elm"; + extension = if outputJavaScript then "js" else "html"; + in + '' + mkdir -p $out/share/doc + ${lib.concatStrings (map (module: '' + echo "compiling ${elmfile module}" + elm make ${elmfile module} --output $out/${module}.${extension} --docs $out/share/doc/${module}.json + ${lib.optionalString outputJavaScript '' + echo "minifying ${elmfile module}" + uglifyjs $out/${module}.${extension} --compress 'pure_funcs="F2,F3,F4,F5,F6,F7,F8,F9,A2,A3,A4,A5,A6,A7,A8,A9",pure_getters,keep_fargs=false,unsafe_comps,unsafe' \ + | uglifyjs --mangle --output $out/${module}.min.${extension} + ''} + '') targets)} + ''; }; mainDotElm = mkDerivation { name = "elm-app-0.1.0"; srcs = ./elm-srcs.nix; src = ./.; - targets = ["Main"]; + targets = [ "Main" ]; srcdir = "./src"; outputJavaScript = true; }; -in stdenv.mkDerivation { +in +stdenv.mkDerivation { name = "habit-screens"; - buildInputs = []; + buildInputs = [ ]; src = builtins.path { path = ./.; name = "habit-screens"; }; buildPhase = '' mkdir -p $out diff --git a/users/wpcarro/website/habit-screens/elm-srcs.nix b/users/wpcarro/website/habit-screens/elm-srcs.nix index 167708e072b0..7f6f77741a9c 100644 --- a/users/wpcarro/website/habit-screens/elm-srcs.nix +++ b/users/wpcarro/website/habit-screens/elm-srcs.nix @@ -1,77 +1,77 @@ { - "elm-community/maybe-extra" = { - sha256 = "0qslmgswa625d218djd3p62pnqcrz38f5p558mbjl6kc1ss0kzv3"; - version = "5.2.0"; - }; + "elm-community/maybe-extra" = { + sha256 = "0qslmgswa625d218djd3p62pnqcrz38f5p558mbjl6kc1ss0kzv3"; + version = "5.2.0"; + }; - "elm/html" = { - sha256 = "1n3gpzmpqqdsldys4ipgyl1zacn0kbpc3g4v3hdpiyfjlgh8bf3k"; - version = "1.0.0"; - }; + "elm/html" = { + sha256 = "1n3gpzmpqqdsldys4ipgyl1zacn0kbpc3g4v3hdpiyfjlgh8bf3k"; + version = "1.0.0"; + }; - "elm-community/random-extra" = { - sha256 = "1dg2nz77w2cvp16xazbdsxkkw0xc9ycqpkd032faqdyky6gmz9g6"; - version = "3.1.0"; - }; + "elm-community/random-extra" = { + sha256 = "1dg2nz77w2cvp16xazbdsxkkw0xc9ycqpkd032faqdyky6gmz9g6"; + version = "3.1.0"; + }; - "elm/svg" = { - sha256 = "1cwcj73p61q45wqwgqvrvz3aypjyy3fw732xyxdyj6s256hwkn0k"; - version = "1.0.1"; - }; + "elm/svg" = { + sha256 = "1cwcj73p61q45wqwgqvrvz3aypjyy3fw732xyxdyj6s256hwkn0k"; + version = "1.0.1"; + }; - "justinmimbs/date" = { - sha256 = "1f0wcl8yhlvp3x4rj53rdy4r4ga7lkl6n8fdfh6b96scz2rnxmd4"; - version = "3.2.1"; - }; + "justinmimbs/date" = { + sha256 = "1f0wcl8yhlvp3x4rj53rdy4r4ga7lkl6n8fdfh6b96scz2rnxmd4"; + version = "3.2.1"; + }; - "elm/browser" = { - sha256 = "0nagb9ajacxbbg985r4k9h0jadqpp0gp84nm94kcgbr5sf8i9x13"; - version = "1.0.2"; - }; + "elm/browser" = { + sha256 = "0nagb9ajacxbbg985r4k9h0jadqpp0gp84nm94kcgbr5sf8i9x13"; + version = "1.0.2"; + }; - "elm/core" = { - sha256 = "19w0iisdd66ywjayyga4kv2p1v9rxzqjaxhckp8ni6n8i0fb2dvf"; - version = "1.0.5"; - }; + "elm/core" = { + sha256 = "19w0iisdd66ywjayyga4kv2p1v9rxzqjaxhckp8ni6n8i0fb2dvf"; + version = "1.0.5"; + }; - "elm-community/list-extra" = { - sha256 = "1ayv3148drynqnxdfwpjxal8vwzgsjqanjg7yxp6lhdcbkxgd3vd"; - version = "8.2.3"; - }; + "elm-community/list-extra" = { + sha256 = "1ayv3148drynqnxdfwpjxal8vwzgsjqanjg7yxp6lhdcbkxgd3vd"; + version = "8.2.3"; + }; - "elm/random" = { - sha256 = "138n2455wdjwa657w6sjq18wx2r0k60ibpc4frhbqr50sncxrfdl"; - version = "1.0.0"; - }; + "elm/random" = { + sha256 = "138n2455wdjwa657w6sjq18wx2r0k60ibpc4frhbqr50sncxrfdl"; + version = "1.0.0"; + }; - "elm/time" = { - sha256 = "0vch7i86vn0x8b850w1p69vplll1bnbkp8s383z7pinyg94cm2z1"; - version = "1.0.0"; - }; + "elm/time" = { + sha256 = "0vch7i86vn0x8b850w1p69vplll1bnbkp8s383z7pinyg94cm2z1"; + version = "1.0.0"; + }; - "elm/json" = { - sha256 = "0kjwrz195z84kwywaxhhlnpl3p251qlbm5iz6byd6jky2crmyqyh"; - version = "1.1.3"; - }; + "elm/json" = { + sha256 = "0kjwrz195z84kwywaxhhlnpl3p251qlbm5iz6byd6jky2crmyqyh"; + version = "1.1.3"; + }; - "elm/parser" = { - sha256 = "0a3cxrvbm7mwg9ykynhp7vjid58zsw03r63qxipxp3z09qks7512"; - version = "1.1.0"; - }; + "elm/parser" = { + sha256 = "0a3cxrvbm7mwg9ykynhp7vjid58zsw03r63qxipxp3z09qks7512"; + version = "1.1.0"; + }; - "owanturist/elm-union-find" = { - sha256 = "13gm7msnp0gr1lqia5m7m4lhy3m6kvjg37d304whb3psn88wqhj5"; - version = "1.0.0"; - }; + "owanturist/elm-union-find" = { + sha256 = "13gm7msnp0gr1lqia5m7m4lhy3m6kvjg37d304whb3psn88wqhj5"; + version = "1.0.0"; + }; - "elm/url" = { - sha256 = "0av8x5syid40sgpl5vd7pry2rq0q4pga28b4yykn9gd9v12rs3l4"; - version = "1.0.0"; - }; + "elm/url" = { + sha256 = "0av8x5syid40sgpl5vd7pry2rq0q4pga28b4yykn9gd9v12rs3l4"; + version = "1.0.0"; + }; - "elm/virtual-dom" = { - sha256 = "0q1v5gi4g336bzz1lgwpn5b1639lrn63d8y6k6pimcyismp2i1yg"; - version = "1.0.2"; - }; + "elm/virtual-dom" = { + sha256 = "0q1v5gi4g336bzz1lgwpn5b1639lrn63d8y6k6pimcyismp2i1yg"; + version = "1.0.2"; + }; } diff --git a/users/wpcarro/website/sandbox/learnpianochords/default.nix b/users/wpcarro/website/sandbox/learnpianochords/default.nix index 934fbd70ac17..7cfdf7c45137 100644 --- a/users/wpcarro/website/sandbox/learnpianochords/default.nix +++ b/users/wpcarro/website/sandbox/learnpianochords/default.nix @@ -8,7 +8,7 @@ let , src , name , srcdir ? "./src" - , targets ? [] + , targets ? [ ] , registryDat ? ./registry.dat , outputJavaScript ? false }: @@ -24,33 +24,36 @@ let inherit registryDat; }; - installPhase = let - elmfile = module: "${srcdir}/${builtins.replaceStrings ["."] ["/"] module}.elm"; - extension = if outputJavaScript then "js" else "html"; - in '' - mkdir -p $out/share/doc - ${lib.concatStrings (map (module: '' - echo "compiling ${elmfile module}" - elm make ${elmfile module} --output $out/${module}.${extension} --docs $out/share/doc/${module}.json - ${lib.optionalString outputJavaScript '' - echo "minifying ${elmfile module}" - uglifyjs $out/${module}.${extension} --compress 'pure_funcs="F2,F3,F4,F5,F6,F7,F8,F9,A2,A3,A4,A5,A6,A7,A8,A9",pure_getters,keep_fargs=false,unsafe_comps,unsafe' \ - | uglifyjs --mangle --output $out/${module}.min.${extension} - ''} - '') targets)} - ''; + installPhase = + let + elmfile = module: "${srcdir}/${builtins.replaceStrings ["."] ["/"] module}.elm"; + extension = if outputJavaScript then "js" else "html"; + in + '' + mkdir -p $out/share/doc + ${lib.concatStrings (map (module: '' + echo "compiling ${elmfile module}" + elm make ${elmfile module} --output $out/${module}.${extension} --docs $out/share/doc/${module}.json + ${lib.optionalString outputJavaScript '' + echo "minifying ${elmfile module}" + uglifyjs $out/${module}.${extension} --compress 'pure_funcs="F2,F3,F4,F5,F6,F7,F8,F9,A2,A3,A4,A5,A6,A7,A8,A9",pure_getters,keep_fargs=false,unsafe_comps,unsafe' \ + | uglifyjs --mangle --output $out/${module}.min.${extension} + ''} + '') targets)} + ''; }; mainDotElm = mkDerivation { name = "elm-app-0.1.0"; srcs = ./elm-srcs.nix; src = builtins.path { path = ./.; name = "learnpianochords"; }; - targets = ["Main"]; + targets = [ "Main" ]; srcdir = "./src"; outputJavaScript = true; }; -in stdenv.mkDerivation { +in +stdenv.mkDerivation { name = "learn-piano-chords"; - buildInputs = []; + buildInputs = [ ]; src = builtins.path { path = ./.; name = "learnpianochords"; }; buildPhase = '' mkdir -p $out diff --git a/users/wpcarro/website/sandbox/learnpianochords/elm-srcs.nix b/users/wpcarro/website/sandbox/learnpianochords/elm-srcs.nix index 2823b430f887..c62262e6835a 100644 --- a/users/wpcarro/website/sandbox/learnpianochords/elm-srcs.nix +++ b/users/wpcarro/website/sandbox/learnpianochords/elm-srcs.nix @@ -1,67 +1,67 @@ { - "elm-community/maybe-extra" = { - sha256 = "0qslmgswa625d218djd3p62pnqcrz38f5p558mbjl6kc1ss0kzv3"; - version = "5.2.0"; - }; + "elm-community/maybe-extra" = { + sha256 = "0qslmgswa625d218djd3p62pnqcrz38f5p558mbjl6kc1ss0kzv3"; + version = "5.2.0"; + }; - "elm/html" = { - sha256 = "1n3gpzmpqqdsldys4ipgyl1zacn0kbpc3g4v3hdpiyfjlgh8bf3k"; - version = "1.0.0"; - }; + "elm/html" = { + sha256 = "1n3gpzmpqqdsldys4ipgyl1zacn0kbpc3g4v3hdpiyfjlgh8bf3k"; + version = "1.0.0"; + }; - "elm-community/random-extra" = { - sha256 = "1dg2nz77w2cvp16xazbdsxkkw0xc9ycqpkd032faqdyky6gmz9g6"; - version = "3.1.0"; - }; + "elm-community/random-extra" = { + sha256 = "1dg2nz77w2cvp16xazbdsxkkw0xc9ycqpkd032faqdyky6gmz9g6"; + version = "3.1.0"; + }; - "elm/svg" = { - sha256 = "1cwcj73p61q45wqwgqvrvz3aypjyy3fw732xyxdyj6s256hwkn0k"; - version = "1.0.1"; - }; + "elm/svg" = { + sha256 = "1cwcj73p61q45wqwgqvrvz3aypjyy3fw732xyxdyj6s256hwkn0k"; + version = "1.0.1"; + }; - "elm/browser" = { - sha256 = "0nagb9ajacxbbg985r4k9h0jadqpp0gp84nm94kcgbr5sf8i9x13"; - version = "1.0.2"; - }; + "elm/browser" = { + sha256 = "0nagb9ajacxbbg985r4k9h0jadqpp0gp84nm94kcgbr5sf8i9x13"; + version = "1.0.2"; + }; - "elm/core" = { - sha256 = "19w0iisdd66ywjayyga4kv2p1v9rxzqjaxhckp8ni6n8i0fb2dvf"; - version = "1.0.5"; - }; + "elm/core" = { + sha256 = "19w0iisdd66ywjayyga4kv2p1v9rxzqjaxhckp8ni6n8i0fb2dvf"; + version = "1.0.5"; + }; - "elm-community/list-extra" = { - sha256 = "1ayv3148drynqnxdfwpjxal8vwzgsjqanjg7yxp6lhdcbkxgd3vd"; - version = "8.2.3"; - }; + "elm-community/list-extra" = { + sha256 = "1ayv3148drynqnxdfwpjxal8vwzgsjqanjg7yxp6lhdcbkxgd3vd"; + version = "8.2.3"; + }; - "elm/random" = { - sha256 = "138n2455wdjwa657w6sjq18wx2r0k60ibpc4frhbqr50sncxrfdl"; - version = "1.0.0"; - }; + "elm/random" = { + sha256 = "138n2455wdjwa657w6sjq18wx2r0k60ibpc4frhbqr50sncxrfdl"; + version = "1.0.0"; + }; - "elm/time" = { - sha256 = "0vch7i86vn0x8b850w1p69vplll1bnbkp8s383z7pinyg94cm2z1"; - version = "1.0.0"; - }; + "elm/time" = { + sha256 = "0vch7i86vn0x8b850w1p69vplll1bnbkp8s383z7pinyg94cm2z1"; + version = "1.0.0"; + }; - "elm/json" = { - sha256 = "0kjwrz195z84kwywaxhhlnpl3p251qlbm5iz6byd6jky2crmyqyh"; - version = "1.1.3"; - }; + "elm/json" = { + sha256 = "0kjwrz195z84kwywaxhhlnpl3p251qlbm5iz6byd6jky2crmyqyh"; + version = "1.1.3"; + }; - "owanturist/elm-union-find" = { - sha256 = "13gm7msnp0gr1lqia5m7m4lhy3m6kvjg37d304whb3psn88wqhj5"; - version = "1.0.0"; - }; + "owanturist/elm-union-find" = { + sha256 = "13gm7msnp0gr1lqia5m7m4lhy3m6kvjg37d304whb3psn88wqhj5"; + version = "1.0.0"; + }; - "elm/url" = { - sha256 = "0av8x5syid40sgpl5vd7pry2rq0q4pga28b4yykn9gd9v12rs3l4"; - version = "1.0.0"; - }; + "elm/url" = { + sha256 = "0av8x5syid40sgpl5vd7pry2rq0q4pga28b4yykn9gd9v12rs3l4"; + version = "1.0.0"; + }; - "elm/virtual-dom" = { - sha256 = "0q1v5gi4g336bzz1lgwpn5b1639lrn63d8y6k6pimcyismp2i1yg"; - version = "1.0.2"; - }; + "elm/virtual-dom" = { + sha256 = "0q1v5gi4g336bzz1lgwpn5b1639lrn63d8y6k6pimcyismp2i1yg"; + version = "1.0.2"; + }; } -- cgit 1.4.1