Compare commits

..

3 Commits

Author SHA1 Message Date
bcd4c4a269
betanin: apply deadnix 2023-09-27 17:16:58 +10:00
5f261acb3b
modules/betanin: simplify configuration
Use secret settings configuration that a handful of other NixOS modules
do. Remove assertions. Remove beets config file setting.
2023-09-27 17:15:57 +10:00
55936a1641
betanin: format files 2023-09-27 16:32:01 +10:00
4 changed files with 125 additions and 129 deletions

View File

@ -18,13 +18,12 @@
packages = import ./pkgs/top-level { localSystem = system; inherit pkgs; }; packages = import ./pkgs/top-level { localSystem = system; inherit pkgs; };
checks = { checks = {
# FIXME: Disabled until I can work out what to do with generated code. nixpkgs-fmt = pkgs.writeShellScriptBin "nixpkgs-fmt-check" ''
# nixpkgs-fmt = pkgs.writeShellScriptBin "nixpkgs-fmt-check" '' ${pkgs.nixpkgs-fmt}/bin/nixpkgs-fmt --check .
# ${pkgs.nixpkgs-fmt}/bin/nixpkgs-fmt --check . '';
# ''; deadnix = pkgs.writeShellScriptBin "deadnix-check" ''
# deadnix = pkgs.writeShellScriptBin "deadnix-check" '' ${pkgs.deadnix}/bin/deadnix --fail .
# ${pkgs.deadnix}/bin/deadnix --fail . '';
# '';
# Ensures that the NUR bot can evaluate and find all our packages. # Ensures that the NUR bot can evaluate and find all our packages.
# Normally we'd also run with `--option restrict-eval true`, but # Normally we'd also run with `--option restrict-eval true`, but
# this is incompatible with flakes because reasons. # this is incompatible with flakes because reasons.

View File

@ -2,7 +2,10 @@
{ pkgs ? import <nixpkgs> { { pkgs ? import <nixpkgs> {
inherit system; inherit system;
}, system ? builtins.currentSystem, nodejs ? pkgs."nodejs_18"}: }
, system ? builtins.currentSystem
, nodejs ? pkgs."nodejs_18"
}:
let let
nodeEnv = import ./node-env.nix { nodeEnv = import ./node-env.nix {

View File

@ -96,20 +96,22 @@ let
mkdir -p node_modules mkdir -p node_modules
cd node_modules cd node_modules
'' ''
+ (lib.concatMapStrings (dependency: + (lib.concatMapStrings
(dependency:
'' ''
if [ ! -e "${dependency.packageName}" ]; then if [ ! -e "${dependency.packageName}" ]; then
${composePackage dependency} ${composePackage dependency}
fi fi
'' ''
) dependencies) )
dependencies)
+ '' + ''
cd .. cd ..
'' ''
); );
# Recursively composes the dependencies of a package # Recursively composes the dependencies of a package
composePackage = { name, packageName, src, dependencies ? [], ... }@args: composePackage = { packageName, src, dependencies ? [ ], ... }:
builtins.addErrorContext "while evaluating node package '${packageName}'" '' builtins.addErrorContext "while evaluating node package '${packageName}'" ''
installPackage "${packageName}" "${src}" installPackage "${packageName}" "${src}"
${includeDependencies { inherit dependencies; }} ${includeDependencies { inherit dependencies; }}
@ -194,7 +196,7 @@ let
# dependencies in the package.json file to the versions that are actually # dependencies in the package.json file to the versions that are actually
# being used. # being used.
pinpointDependenciesOfPackage = { packageName, dependencies ? [], production ? true, ... }@args: pinpointDependenciesOfPackage = { packageName, dependencies ? [ ], production ? true, ... }:
'' ''
if [ -d "${packageName}" ] if [ -d "${packageName}" ]
then then
@ -479,7 +481,6 @@ let
{ name { name
, packageName , packageName
, version ? null , version ? null
, dependencies ? []
, buildInputs ? [ ] , buildInputs ? [ ]
, production ? true , production ? true
, npmFlags ? "" , npmFlags ? ""
@ -491,7 +492,8 @@ let
, unpackPhase ? "true" , unpackPhase ? "true"
, buildPhase ? "true" , buildPhase ? "true"
, meta ? { } , meta ? { }
, ... }@args: , ...
}@args:
let let
extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" "dontStrip" "dontNpmInstall" "preRebuild" "unpackPhase" "buildPhase" "meta" ]; extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" "dontStrip" "dontNpmInstall" "preRebuild" "unpackPhase" "buildPhase" "meta" ];
@ -582,7 +584,8 @@ let
, dontStrip ? true , dontStrip ? true
, unpackPhase ? "true" , unpackPhase ? "true"
, buildPhase ? "true" , buildPhase ? "true"
, ... }@args: , ...
}@args:
let let
extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" ]; extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" ];
@ -640,20 +643,11 @@ let
# Builds a development shell # Builds a development shell
buildNodeShell = buildNodeShell =
{ name { name
, packageName
, version ? null , version ? null
, src
, dependencies ? [ ] , dependencies ? [ ]
, buildInputs ? [ ] , buildInputs ? [ ]
, production ? true , ...
, npmFlags ? "" }@args:
, dontNpmInstall ? false
, bypassCache ? false
, reconstructLock ? false
, dontStrip ? true
, unpackPhase ? "true"
, buildPhase ? "true"
, ... }@args:
let let
nodeDependencies = buildNodeDependencies args; nodeDependencies = buildNodeDependencies args;

View File

@ -1,6 +1,6 @@
# This file has been generated by node2nix 1.11.1. Do not edit! # This file has been generated by node2nix 1.11.1. Do not edit!
{nodeEnv, fetchurl, fetchgit, nix-gitignore, stdenv, lib, globalBuildInputs ? []}: { nodeEnv, fetchurl, nix-gitignore, stdenv, lib, globalBuildInputs ? [ ] }:
let let
sources = { sources = {
@ -9196,8 +9196,7 @@ let
}) })
]; ];
buildInputs = globalBuildInputs; buildInputs = globalBuildInputs;
meta = { meta = { };
};
production = false; production = false;
bypassCache = true; bypassCache = true;
reconstructLock = false; reconstructLock = false;
@ -9216,7 +9215,8 @@ in
"*" "*"
"!package.json" "!package.json"
"!package-lock.json" "!package-lock.json"
] args.src; ]
args.src;
dontBuild = true; dontBuild = true;
installPhase = "mkdir -p $out; cp -r ./* $out;"; installPhase = "mkdir -p $out; cp -r ./* $out;";
}; };