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 <sternenseemann@systemli.org>
Reviewed-by: lukegb <lukegb@tvl.fyi>
Reviewed-by: wpcarro <wpcarro@gmail.com>
Reviewed-by: Profpatsch <mail@profpatsch.de>
Reviewed-by: kanepyork <rikingcoding@gmail.com>
Reviewed-by: tazjin <tazjin@tvl.su>
Reviewed-by: cynthia <cynthia@tvl.fyi>
Reviewed-by: edef <edef@edef.eu>
Reviewed-by: eta <tvl@eta.st>
Reviewed-by: grfn <grfn@gws.fyi>
This commit is contained in:
Vincent Ambo 2022-01-30 19:06:58 +03:00 committed by tazjin
parent 2d10d60fac
commit aa122cbae7
310 changed files with 7278 additions and 5490 deletions

View file

@ -12,5 +12,5 @@ depot.users.wpcarro.buildHaskell.program {
split
rio
];
ghcExtensions = [];
ghcExtensions = [ ];
}

View file

@ -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}
'';
};
}

View file

@ -10,4 +10,5 @@ let
label = ":broom: lint secrets";
}
];
in pkgs.writeText "pipeline.yaml" (toJSON pipeline)
in
pkgs.writeText "pipeline.yaml" (toJSON pipeline)

View file

@ -1,6 +1,6 @@
{ depot, pkgs, ... }:
pkgs.runCommandNoCC "monsterpoker.app" {} ''
pkgs.runCommandNoCC "monsterpoker.app" { } ''
mkdir -p $out
cp ${./index.html} $out/index.html
''

View file

@ -2,7 +2,8 @@
let
inherit (depot.users) wpcarro;
in {
in
{
programs = {
fish.enable = true;

View file

@ -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" .
'';

View file

@ -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

View file

@ -1,5 +1,5 @@
{ depot, ... }:
depot.users.wpcarro.buildHaskell.shell {
deps = hpkgs: [];
deps = hpkgs: [ ];
}

View file

@ -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 = [

View file

@ -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"

View file

@ -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";

View file

@ -4,7 +4,7 @@ pkgs.dockerTools.buildLayeredImage {
name = "gemma";
tag = "latest";
config.ExposedPorts = {
"4242" = {};
"4242" = { };
};
config.Env = [
"GEMMA_CONFIG=${./config.lisp}"

View file

@ -2,7 +2,8 @@
let
pypkgs = pkgs.python3Packages;
in pkgs.python3Packages.buildPythonApplication {
in
pkgs.python3Packages.buildPythonApplication {
pname = "main";
src = ./.;
version = "0.0.1";

View file

@ -1,5 +1,5 @@
{ depot, ... }:
depot.users.wpcarro.buildHaskell.shell {
deps = hpkgs: [];
deps = hpkgs: [ ];
}

View file

@ -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

View file

@ -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;
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;
# 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);
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
];
os = depot.ops.nixos.nixosFor (_: {
imports = [
"${pkgs.path}/nixos/modules/virtualisation/google-compute-image.nix"
configuration
];
networking.hostName = name;
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;
};
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}";
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;
};
attached_disk = {
source = "\${google_compute_disk.${name}.id}";
device_name = "${name}-disk";
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" ];
};
network_interface = {
resource.tls_private_key."${name}" = {
algorithm = "ECDSA";
ecdsa_curve = "P384";
};
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"
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}";
};
scratch="$(mktemp -d)"
function cleanup() {
rm -rf $scratch
}
trap cleanup EXIT
connection = {
host = "\${google_compute_instance.${name}.network_interface[0].access_config[0].nat_ip}";
};
# write out ssh key
echo -n "''${tls_private_key.${name}.private_key_pem}" > $scratch/id_rsa.pem
chmod 0600 $scratch/id_rsa.pem
provisioner = [
{ remote-exec.inline = [ "true" ]; }
{
local-exec.command = ''
export PATH="${pkgs.openssh}/bin:$PATH"
export NIX_SSHOPTS="\
-o StrictHostKeyChecking=no\
-o UserKnownHostsFile=/dev/null\
-o GlobalKnownHostsFile=/dev/null\
-o IdentityFile=$scratch/id_rsa.pem
"
scratch="$(mktemp -d)"
function cleanup() {
rm -rf $scratch
}
trap cleanup EXIT
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"
];
}
];
};
}));
# 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"
];
}
];
};
}));
}

View file

@ -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

View file

@ -12,7 +12,8 @@ let
utils
];
};
in depot.nix.buildGo.program {
in
depot.nix.buildGo.program {
name = "token-server";
srcs = [
./tokens.go

View file

@ -7,5 +7,5 @@ depot.nix.buildGo.program {
srcs = [
./main.go
];
deps = [];
deps = [ ];
}

View file

@ -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

View file

@ -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

View file

@ -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 ''

View file

@ -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;
}

View file

@ -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);
};
};
}

View file

@ -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

View file

@ -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
# /

View file

@ -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

View file

@ -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";
};
}

View file

@ -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

View file

@ -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";
};
}