nixpkgs-fmt update

This commit is contained in:
Charlotte Van Petegem 2020-04-27 14:46:52 +02:00
parent 5843e44ed6
commit d151c29b80
22 changed files with 277 additions and 282 deletions

View file

@ -6,7 +6,7 @@
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ]; boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ];
boot.initrd.kernelModules = [ "i915" ]; boot.initrd.kernelModules = [ "i915" ];
boot.kernelModules = [ "kvm-intel" ]; boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = []; boot.extraModulePackages = [ ];
fileSystems."/" = { fileSystems."/" = {
device = "/dev/disk/by-uuid/e4b7eae2-546d-412b-9258-389315f4b835"; device = "/dev/disk/by-uuid/e4b7eae2-546d-412b-9258-389315f4b835";

View file

@ -7,7 +7,7 @@
# Early KMS start # Early KMS start
boot.initrd.kernelModules = [ "i915" ]; boot.initrd.kernelModules = [ "i915" ];
boot.kernelModules = [ "kvm-intel" ]; boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = []; boot.extraModulePackages = [ ];
fileSystems."/" = { fileSystems."/" = {
device = "/dev/disk/by-uuid/0eb8b94a-5fc2-4b24-962a-94b3675b6f5b"; device = "/dev/disk/by-uuid/0eb8b94a-5fc2-4b24-962a-94b3675b6f5b";

View file

@ -1,8 +1,8 @@
{ pkgs ? import <nixpkgs> {} }: { pkgs ? import <nixpkgs> { } }:
with pkgs; with pkgs;
let let
buildGradle = callPackage ./gradle-env.nix {}; buildGradle = callPackage ./gradle-env.nix { };
in in
buildGradle { buildGradle {
envSpec = ./gradle-env.json; envSpec = ./gradle-env.json;

View file

@ -40,7 +40,6 @@ let
versionOlder unique mapAttrs last concatMapStringsSep removeSuffix versionOlder unique mapAttrs last concatMapStringsSep removeSuffix
optionalString groupBy' readFile hasSuffix optionalString groupBy' readFile hasSuffix
; ;
mkDep = depSpec: stdenv.mkDerivation { mkDep = depSpec: stdenv.mkDerivation {
inherit (depSpec) name; inherit (depSpec) name;
@ -55,13 +54,11 @@ let
ln -s $src $out/${depSpec.path}/${depSpec.name} ln -s $src $out/${depSpec.path}/${depSpec.name}
''; '';
}; };
mkModuleMetadata = deps: mkModuleMetadata = deps:
let let
ids = filter ids = filter
(id: id.type == "pom") (id: id.type == "pom")
(map (dep: dep.id) deps); (map (dep: dep.id) deps);
modules = groupBy' modules = groupBy'
( (
meta: id: meta: id:
@ -70,7 +67,8 @@ let
isNewerRelease = isNewerRelease =
!(hasSuffix "-SNAPSHOT" id.version) !(hasSuffix "-SNAPSHOT" id.version)
&& versionOlder meta.release id.version; && versionOlder meta.release id.version;
in { in
{
groupId = id.group; groupId = id.group;
artifactId = id.name; artifactId = id.name;
latest = if isNewer then id.version else meta.latest; latest = if isNewer then id.version else meta.latest;
@ -81,17 +79,19 @@ let
{ {
latest = ""; latest = "";
release = ""; release = "";
versions = []; versions = [ ];
} }
(id: "${replaceStrings [ "." ] [ "/" ] id.group}/${id.name}/maven-metadata.xml") (id: "${replaceStrings [ "." ] [ "/" ] id.group}/${id.name}/maven-metadata.xml")
ids; ids;
in in
attrValues ( attrValues
mapAttrs ( (
path: meta: mapAttrs
let (
versions' = sort versionOlder (unique meta.versions); path: meta:
in let
versions' = sort versionOlder (unique meta.versions);
in
with meta; writeTextDir path '' with meta; writeTextDir path ''
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<metadata modelVersion="1.1"> <metadata modelVersion="1.1">
@ -106,13 +106,11 @@ let
</versioning> </versioning>
</metadata> </metadata>
'' ''
) modules ) modules
); );
mkSnapshotMetadata = deps: mkSnapshotMetadata = deps:
let let
snapshotDeps = filter (dep: dep ? build && dep ? timestamp) deps; snapshotDeps = filter (dep: dep ? build && dep ? timestamp) deps;
modules = groupBy' modules = groupBy'
( (
meta: dep: meta: dep:
@ -120,17 +118,19 @@ let
id = dep.id; id = dep.id;
isNewer = dep.build > meta.buildNumber; isNewer = dep.build > meta.buildNumber;
# Timestamp values can be bogus, e.g. jitpack.io # Timestamp values can be bogus, e.g. jitpack.io
updated = if (match "[0-9]{8}\.[0-9]{6}" dep.timestamp) != null updated =
then replaceStrings [ "." ] [ "" ] dep.timestamp if (match "[0-9]{8}\.[0-9]{6}" dep.timestamp) != null
else ""; then replaceStrings [ "." ] [ "" ] dep.timestamp
in { else "";
in
{
groupId = id.group; groupId = id.group;
artifactId = id.name; artifactId = id.name;
version = id.version; version = id.version;
timestamp = if isNewer then dep.timestamp else meta.timestamp; timestamp = if isNewer then dep.timestamp else meta.timestamp;
buildNumber = if isNewer then dep.build else meta.buildNumber; buildNumber = if isNewer then dep.build else meta.buildNumber;
lastUpdated = if isNewer then updated else meta.lastUpdated; lastUpdated = if isNewer then updated else meta.lastUpdated;
versions = meta.versions or [] ++ [ versions = meta.versions or [ ] ++ [
{ {
classifier = id.classifier or ""; classifier = id.classifier or "";
extension = id.extension; extension = id.extension;
@ -147,7 +147,6 @@ let
} }
(dep: "${replaceStrings [ "." ] [ "/" ] dep.id.group}/${dep.id.name}/${dep.id.version}/maven-metadata.xml") (dep: "${replaceStrings [ "." ] [ "/" ] dep.id.group}/${dep.id.name}/${dep.id.version}/maven-metadata.xml")
snapshotDeps; snapshotDeps;
mkSnapshotVersion = version: '' mkSnapshotVersion = version: ''
<snapshotVersion> <snapshotVersion>
${optionalString (version.classifier != "") "<classifier>${version.classifier}</classifier>"} ${optionalString (version.classifier != "") "<classifier>${version.classifier}</classifier>"}
@ -157,77 +156,76 @@ let
</snapshotVersion> </snapshotVersion>
''; '';
in in
attrValues ( attrValues
mapAttrs ( (
path: meta: mapAttrs
with meta; writeTextDir path '' (
<?xml version="1.0" encoding="UTF-8"?> path: meta:
<metadata modelVersion="1.1"> with meta; writeTextDir path ''
<groupId>${groupId}</groupId> <?xml version="1.0" encoding="UTF-8"?>
<artifactId>${artifactId}</artifactId> <metadata modelVersion="1.1">
<version>${version}</version> <groupId>${groupId}</groupId>
<versioning> <artifactId>${artifactId}</artifactId>
<snapshot> <version>${version}</version>
${optionalString (timestamp != "") "<timestamp>${timestamp}</timestamp>"} <versioning>
${optionalString (buildNumber != -1) "<buildNumber>${toString buildNumber}</buildNumber>"} <snapshot>
</snapshot> ${optionalString (timestamp != "") "<timestamp>${timestamp}</timestamp>"}
${optionalString (lastUpdated != "") "<lastUpdated>${lastUpdated}</lastUpdated>"} ${optionalString (buildNumber != -1) "<buildNumber>${toString buildNumber}</buildNumber>"}
<snapshotVersions> </snapshot>
${concatMapStringsSep "\n " mkSnapshotVersion versions} ${optionalString (lastUpdated != "") "<lastUpdated>${lastUpdated}</lastUpdated>"}
</snapshotVersions> <snapshotVersions>
</versioning> ${concatMapStringsSep "\n " mkSnapshotVersion versions}
</metadata> </snapshotVersions>
'' </versioning>
) modules </metadata>
''
) modules
); );
mkRepo = project: type: deps: buildEnv { mkRepo = project: type: deps: buildEnv {
name = "${project}-gradle-${type}-env"; name = "${project}-gradle-${type}-env";
paths = map mkDep deps ++ mkModuleMetadata deps ++ mkSnapshotMetadata deps; paths = map mkDep deps ++ mkModuleMetadata deps ++ mkSnapshotMetadata deps;
}; };
mkInitScript = projectSpec: mkInitScript = projectSpec:
let let
repos = mapAttrs (mkRepo projectSpec.name) projectSpec.dependencies; repos = mapAttrs (mkRepo projectSpec.name) projectSpec.dependencies;
in in
writeText "init.gradle" '' writeText "init.gradle" ''
static def offlineRepo(RepositoryHandler repositories, String env, String path) { static def offlineRepo(RepositoryHandler repositories, String env, String path) {
repositories.clear() repositories.clear()
repositories.maven { repositories.maven {
name "Nix''${env.capitalize()}MavenOffline" name "Nix''${env.capitalize()}MavenOffline"
url path url path
metadataSources { metadataSources {
it.gradleMetadata() it.gradleMetadata()
it.mavenPom() it.mavenPom()
it.artifact() it.artifact()
} }
} }
repositories.ivy { repositories.ivy {
name "Nix''${env.capitalize()}IvyOffline" name "Nix''${env.capitalize()}IvyOffline"
url path url path
layout "maven" layout "maven"
metadataSources { metadataSources {
it.gradleMetadata() it.gradleMetadata()
it.ivyDescriptor() it.ivyDescriptor()
it.artifact() it.artifact()
} }
} }
} }
gradle.settingsEvaluated { gradle.settingsEvaluated {
offlineRepo(it.pluginManagement.repositories, "plugin", "${repos.plugin}") offlineRepo(it.pluginManagement.repositories, "plugin", "${repos.plugin}")
} }
gradle.projectsLoaded {
allprojects {
buildscript {
offlineRepo(repositories, "buildscript", "${repos.buildscript}")
}
offlineRepo(repositories, "project", "${repos.project}")
}
}
'';
gradle.projectsLoaded {
allprojects {
buildscript {
offlineRepo(repositories, "buildscript", "${repos.buildscript}")
}
offlineRepo(repositories, "project", "${repos.project}")
}
}
'';
mkGradle = gradleSpec: mkGradle = gradleSpec:
gradleGen.gradleGen { gradleGen.gradleGen {
inherit (gradleSpec) nativeVersion; inherit (gradleSpec) nativeVersion;
@ -238,46 +236,44 @@ let
inherit (gradleSpec) url sha256; inherit (gradleSpec) url sha256;
}; };
}; };
mkProjectEnv = projectSpec: { mkProjectEnv = projectSpec: {
inherit (projectSpec) name version; inherit (projectSpec) name version;
initScript = mkInitScript projectSpec; initScript = mkInitScript projectSpec;
gradle = args.gradlePackage or mkGradle projectSpec.gradle; gradle = args.gradlePackage or mkGradle projectSpec.gradle;
}; };
gradleEnv = mapAttrs gradleEnv = mapAttrs
(_: p: mkProjectEnv p) (_: p: mkProjectEnv p)
(fromJSON (readFile envSpec)); (fromJSON (readFile envSpec));
projectEnv = gradleEnv.""; projectEnv = gradleEnv."";
pname = args.pname or projectEnv.name; pname = args.pname or projectEnv.name;
version = args.version or projectEnv.version; version = args.version or projectEnv.version;
in in
stdenv.mkDerivation ( stdenv.mkDerivation
args // { (
args // {
inherit pname version; inherit pname version;
nativeBuildInputs = (args.nativeBuildInputs or []) ++ [ projectEnv.gradle ]; nativeBuildInputs = (args.nativeBuildInputs or [ ]) ++ [ projectEnv.gradle ];
buildPhase = args.buildPhase or '' buildPhase = args.buildPhase or ''
runHook preBuild runHook preBuild
( (
set -x set -x
env \ env \
"GRADLE_USER_HOME=$(mktemp -d)" \ "GRADLE_USER_HOME=$(mktemp -d)" \
gradle --offline --no-daemon --no-build-cache \ gradle --offline --no-daemon --no-build-cache \
--info --full-stacktrace --warning-mode=all \ --info --full-stacktrace --warning-mode=all \
${optionalString enableParallelBuilding "--parallel"} \ ${optionalString enableParallelBuilding "--parallel"} \
${optionalString enableDebug "-Dorg.gradle.debug=true"} \ ${optionalString enableDebug "-Dorg.gradle.debug=true"} \
--init-script ${projectEnv.initScript} \ --init-script ${projectEnv.initScript} \
${concatStringsSep " " gradleFlags} ${concatStringsSep " " gradleFlags}
) )
runHook postBuild runHook postBuild
''; '';
dontStrip = true; dontStrip = true;
} }
) )

View file

@ -5,7 +5,7 @@ let
python = if nodejs ? python then nodejs.python else python2; python = if nodejs ? python then nodejs.python else python2;
# Create a tar wrapper that filters all the 'Ignoring unknown extended header keyword' noise # Create a tar wrapper that filters all the 'Ignoring unknown extended header keyword' noise
tarWrapper = runCommand "tarWrapper" {} '' tarWrapper = runCommand "tarWrapper" { } ''
mkdir -p $out/bin mkdir -p $out/bin
cat > $out/bin/tar <<EOF cat > $out/bin/tar <<EOF
@ -20,27 +20,27 @@ let
buildNodeSourceDist = buildNodeSourceDist =
{ name, version, src, ... }: { name, version, src, ... }:
stdenv.mkDerivation { stdenv.mkDerivation {
name = "node-tarball-${name}-${version}"; name = "node-tarball-${name}-${version}";
inherit src; inherit src;
buildInputs = [ nodejs ]; buildInputs = [ nodejs ];
buildPhase = '' buildPhase = ''
export HOME=$TMPDIR export HOME=$TMPDIR
tgzFile=$(npm pack | tail -n 1) # Hooks to the pack command will add output (https://docs.npmjs.com/misc/scripts) tgzFile=$(npm pack | tail -n 1) # Hooks to the pack command will add output (https://docs.npmjs.com/misc/scripts)
''; '';
installPhase = '' installPhase = ''
mkdir -p $out/tarballs mkdir -p $out/tarballs
mv $tgzFile $out/tarballs mv $tgzFile $out/tarballs
mkdir -p $out/nix-support mkdir -p $out/nix-support
echo "file source-dist $out/tarballs/$tgzFile" >> $out/nix-support/hydra-build-products echo "file source-dist $out/tarballs/$tgzFile" >> $out/nix-support/hydra-build-products
''; '';
}; };
includeDependencies = { dependencies }: includeDependencies = { dependencies }:
stdenv.lib.optionalString (dependencies != []) stdenv.lib.optionalString (dependencies != [ ])
( (
stdenv.lib.concatMapStrings ( stdenv.lib.concatMapStrings
dependency: (
dependency:
'' ''
# Bundle the dependencies of the package # Bundle the dependencies of the package
mkdir -p node_modules mkdir -p node_modules
@ -54,11 +54,11 @@ let
cd .. cd ..
'' ''
) dependencies ) dependencies
); );
# Recursively composes the dependencies of a package # Recursively composes the dependencies of a package
composePackage = { name, packageName, src, dependencies ? [], ... }@args: composePackage = { name, packageName, src, dependencies ? [ ], ... }@args:
'' ''
DIR=$(pwd) DIR=$(pwd)
cd $TMPDIR cd $TMPDIR
@ -104,7 +104,6 @@ let
cd .. cd ..
${stdenv.lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."} ${stdenv.lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."}
''; '';
pinpointDependencies = { dependencies, production }: pinpointDependencies = { dependencies, production }:
let let
pinpointDependenciesFromPackageJSON = writeTextFile { pinpointDependenciesFromPackageJSON = writeTextFile {
@ -160,10 +159,10 @@ let
''; '';
}; };
in in
'' ''
node ${pinpointDependenciesFromPackageJSON} ${if production then "production" else "development"} node ${pinpointDependenciesFromPackageJSON} ${ if production then "production" else "development"}
${stdenv.lib.optionalString (dependencies != []) ${stdenv.lib.optionalString (dependencies != [ ])
'' ''
if [ -d node_modules ] if [ -d node_modules ]
then then
@ -172,13 +171,12 @@ let
cd .. cd ..
fi fi
''} ''}
''; '';
# Recursively traverses all dependencies of a package and pinpoints all # Recursively traverses all dependencies of a package and pinpoints all
# 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, ... }@args:
'' ''
if [ -d "${packageName}" ] if [ -d "${packageName}" ]
then then
@ -191,7 +189,7 @@ let
# Extract the Node.js source code which is used to compile packages with # Extract the Node.js source code which is used to compile packages with
# native bindings # native bindings
nodeSources = runCommand "node-sources" {} '' nodeSources = runCommand "node-sources" { } ''
tar --no-same-owner --no-same-permissions -xf ${nodejs.src} tar --no-same-owner --no-same-permissions -xf ${nodejs.src}
mv node-* $out mv node-* $out
''; '';
@ -318,69 +316,68 @@ let
fs.writeFileSync("package-lock.json", JSON.stringify(lockObj, null, 2)); fs.writeFileSync("package-lock.json", JSON.stringify(lockObj, null, 2));
''; '';
}; };
prepareAndInvokeNPM = { packageName, bypassCache, reconstructLock, npmFlags, production }: prepareAndInvokeNPM = { packageName, bypassCache, reconstructLock, npmFlags, production }:
let let
forceOfflineFlag = if bypassCache then "--offline" else "--registry http://www.example.com"; forceOfflineFlag = if bypassCache then "--offline" else "--registry http://www.example.com";
in in
'' ''
# Pinpoint the versions of all dependencies to the ones that are actually being used # Pinpoint the versions of all dependencies to the ones that are actually being used
echo "pinpointing versions of dependencies..." echo "pinpointing versions of dependencies..."
source $pinpointDependenciesScriptPath source $pinpointDependenciesScriptPath
# Patch the shebangs of the bundled modules to prevent them from # Patch the shebangs of the bundled modules to prevent them from
# calling executables outside the Nix store as much as possible # calling executables outside the Nix store as much as possible
patchShebangs . patchShebangs .
# Deploy the Node.js package by running npm install. Since the # Deploy the Node.js package by running npm install. Since the
# dependencies have been provided already by ourselves, it should not # dependencies have been provided already by ourselves, it should not
# attempt to install them again, which is good, because we want to make # attempt to install them again, which is good, because we want to make
# it Nix's responsibility. If it needs to install any dependencies # it Nix's responsibility. If it needs to install any dependencies
# anyway (e.g. because the dependency parameters are # anyway (e.g. because the dependency parameters are
# incomplete/incorrect), it fails. # incomplete/incorrect), it fails.
# #
# The other responsibilities of NPM are kept -- version checks, build # The other responsibilities of NPM are kept -- version checks, build
# steps, postprocessing etc. # steps, postprocessing etc.
export HOME=$TMPDIR export HOME=$TMPDIR
cd "${packageName}" cd "${packageName}"
runHook preRebuild runHook preRebuild
${stdenv.lib.optionalString bypassCache '' ${stdenv.lib.optionalString bypassCache ''
${stdenv.lib.optionalString reconstructLock '' ${stdenv.lib.optionalString reconstructLock ''
if [ -f package-lock.json ] if [ -f package-lock.json ]
then then
echo "WARNING: Reconstruct lock option enabled, but a lock file already exists!" echo "WARNING: Reconstruct lock option enabled, but a lock file already exists!"
echo "This will most likely result in version mismatches! We will remove the lock file and regenerate it!" echo "This will most likely result in version mismatches! We will remove the lock file and regenerate it!"
rm package-lock.json rm package-lock.json
else else
echo "No package-lock.json file found, reconstructing..." echo "No package-lock.json file found, reconstructing..."
fi fi
node ${reconstructPackageLock} node ${reconstructPackageLock}
''} ''}
node ${addIntegrityFieldsScript} node ${addIntegrityFieldsScript}
''} ''}
npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${stdenv.lib.optionalString production "--production"} rebuild npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${stdenv.lib.optionalString production "--production"} rebuild
if [ "$dontNpmInstall" != "1" ] if [ "$dontNpmInstall" != "1" ]
then then
# NPM tries to download packages even when they already exist if npm-shrinkwrap is used. # NPM tries to download packages even when they already exist if npm-shrinkwrap is used.
rm -f npm-shrinkwrap.json rm -f npm-shrinkwrap.json
npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${stdenv.lib.optionalString production "--production"} install npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${stdenv.lib.optionalString production "--production"} install
fi fi
''; '';
# Builds and composes an NPM package including all its dependencies # Builds and composes an NPM package including all its dependencies
buildNodePackage = buildNodePackage =
{ name { name
, packageName , packageName
, version , version
, dependencies ? [] , dependencies ? [ ]
, buildInputs ? [] , buildInputs ? [ ]
, production ? true , production ? true
, npmFlags ? "" , npmFlags ? ""
, dontNpmInstall ? false , dontNpmInstall ? false
@ -392,60 +389,61 @@ let
, buildPhase ? "true" , buildPhase ? "true"
, ... , ...
}@args: }@args:
let let
extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" "dontStrip" "dontNpmInstall" "preRebuild" "unpackPhase" "buildPhase" ]; extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" "dontStrip" "dontNpmInstall" "preRebuild" "unpackPhase" "buildPhase" ];
in in
stdenv.mkDerivation ( stdenv.mkDerivation
{ (
name = "node_${name}-${version}"; {
buildInputs = [ tarWrapper python nodejs ] name = "node_${name}-${version}";
++ stdenv.lib.optional (stdenv.isLinux) utillinux buildInputs = [ tarWrapper python nodejs ]
++ stdenv.lib.optional (stdenv.isDarwin) libtool ++ stdenv.lib.optional (stdenv.isLinux) utillinux
++ buildInputs; ++ stdenv.lib.optional (stdenv.isDarwin) libtool
++ buildInputs;
inherit dontStrip; # Stripping may fail a build for some package deployments inherit dontStrip; # Stripping may fail a build for some package deployments
inherit dontNpmInstall preRebuild unpackPhase buildPhase; inherit dontNpmInstall preRebuild unpackPhase buildPhase;
compositionScript = composePackage args; compositionScript = composePackage args;
pinpointDependenciesScript = pinpointDependenciesOfPackage args; pinpointDependenciesScript = pinpointDependenciesOfPackage args;
passAsFile = [ "compositionScript" "pinpointDependenciesScript" ]; passAsFile = [ "compositionScript" "pinpointDependenciesScript" ];
installPhase = '' installPhase = ''
# Create and enter a root node_modules/ folder # Create and enter a root node_modules/ folder
mkdir -p $out/lib/node_modules mkdir -p $out/lib/node_modules
cd $out/lib/node_modules cd $out/lib/node_modules
# Compose the package and all its dependencies # Compose the package and all its dependencies
source $compositionScriptPath source $compositionScriptPath
${prepareAndInvokeNPM { inherit packageName bypassCache reconstructLock npmFlags production; }} ${prepareAndInvokeNPM { inherit packageName bypassCache reconstructLock npmFlags production; }}
# Create symlink to the deployed executable folder, if applicable # Create symlink to the deployed executable folder, if applicable
if [ -d "$out/lib/node_modules/.bin" ] if [ -d "$out/lib/node_modules/.bin" ]
then then
ln -s $out/lib/node_modules/.bin $out/bin ln -s $out/lib/node_modules/.bin $out/bin
fi fi
# Create symlinks to the deployed manual page folders, if applicable # Create symlinks to the deployed manual page folders, if applicable
if [ -d "$out/lib/node_modules/${packageName}/man" ] if [ -d "$out/lib/node_modules/${packageName}/man" ]
then then
mkdir -p $out/share mkdir -p $out/share
for dir in "$out/lib/node_modules/${packageName}/man/"* for dir in "$out/lib/node_modules/${packageName}/man/"*
do do
mkdir -p $out/share/man/$(basename "$dir") mkdir -p $out/share/man/$(basename "$dir")
for page in "$dir"/* for page in "$dir"/*
do do
ln -s $page $out/share/man/$(basename "$dir") ln -s $page $out/share/man/$(basename "$dir")
done done
done done
fi fi
# Run post install hook, if provided # Run post install hook, if provided
runHook postInstall runHook postInstall
''; '';
} // extraArgs } // extraArgs
); );
# Builds a development shell # Builds a development shell
buildNodeShell = buildNodeShell =
@ -453,8 +451,8 @@ let
, packageName , packageName
, version , version
, src , src
, dependencies ? [] , dependencies ? [ ]
, buildInputs ? [] , buildInputs ? [ ]
, production ? true , production ? true
, npmFlags ? "" , npmFlags ? ""
, dontNpmInstall ? false , dontNpmInstall ? false
@ -465,10 +463,10 @@ let
, buildPhase ? "true" , buildPhase ? "true"
, ... , ...
}@args: }@args:
let let
extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" ]; extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" ];
nodeDependencies = stdenv.mkDerivation
nodeDependencies = stdenv.mkDerivation ( (
{ {
name = "node-dependencies-${name}-${version}"; name = "node-dependencies-${name}-${version}";
@ -495,11 +493,11 @@ let
cp ${src}/package.json . cp ${src}/package.json .
chmod 644 package.json chmod 644 package.json
${stdenv.lib.optionalString bypassCache '' ${stdenv.lib.optionalString bypassCache ''
if [ -f ${src}/package-lock.json ] if [ -f ${src}/package-lock.json ]
then then
cp ${src}/package-lock.json . cp ${src}/package-lock.json .
fi fi
''} ''}
# Go to the parent folder to make sure that all packages are pinpointed # Go to the parent folder to make sure that all packages are pinpointed
cd .. cd ..
@ -516,28 +514,28 @@ let
''; '';
} // extraArgs } // extraArgs
); );
in in
stdenv.mkDerivation { stdenv.mkDerivation {
name = "node-shell-${name}-${version}"; name = "node-shell-${name}-${version}";
buildInputs = [ python nodejs ] ++ stdenv.lib.optional (stdenv.isLinux) utillinux ++ buildInputs; buildInputs = [ python nodejs ] ++ stdenv.lib.optional (stdenv.isLinux) utillinux ++ buildInputs;
buildCommand = '' buildCommand = ''
mkdir -p $out/bin mkdir -p $out/bin
cat > $out/bin/shell <<EOF cat > $out/bin/shell <<EOF
#! ${stdenv.shell} -e #! ${stdenv.shell} -e
$shellHook $shellHook
exec ${stdenv.shell} exec ${stdenv.shell}
EOF EOF
chmod +x $out/bin/shell chmod +x $out/bin/shell
''; '';
# Provide the dependencies in a development shell through the NODE_PATH environment variable # Provide the dependencies in a development shell through the NODE_PATH environment variable
inherit nodeDependencies; inherit nodeDependencies;
shellHook = stdenv.lib.optionalString (dependencies != []) '' shellHook = stdenv.lib.optionalString (dependencies != [ ]) ''
export NODE_PATH=$nodeDependencies/lib/node_modules export NODE_PATH=$nodeDependencies/lib/node_modules
export PATH="$nodeDependencies/bin:$PATH" export PATH="$nodeDependencies/bin:$PATH"
''; '';
}; };
in in
{ {
buildNodeSourceDist = stdenv.lib.makeOverridable buildNodeSourceDist; buildNodeSourceDist = stdenv.lib.makeOverridable buildNodeSourceDist;

View file

@ -1,6 +1,6 @@
# This file has been generated by node2nix 1.7.0. Do not edit! # This file has been generated by node2nix 1.7.0. Do not edit!
{ nodeEnv, fetchurl, fetchgit, globalBuildInputs ? [] }: { nodeEnv, fetchurl, fetchgit, globalBuildInputs ? [ ] }:
let let
sources = { sources = {
"@babel/code-frame-7.8.3" = { "@babel/code-frame-7.8.3" = {

View file

@ -59,7 +59,7 @@
]; ];
} }
) )
(pass.withExtensions (ext: [ext.pass-otp ext.pass-genphrase])) (pass.withExtensions (ext: [ ext.pass-otp ext.pass-genphrase ]))
ripgrep ripgrep
unzip unzip
]; ];

View file

@ -70,7 +70,13 @@
chromium chromium
citrix_workspace citrix_workspace
deluge deluge
firefox (
firefox.override {
extraNativeMessagingHosts = [
(passff-host.override { pass = (pass.withExtensions (ext: [ ext.pass-otp ext.pass-genphrase ])); })
];
}
)
google-chrome google-chrome
(gnupg.override { guiSupport = true; }) (gnupg.override { guiSupport = true; })
hledger hledger

Binary file not shown.

View file

@ -1,4 +1,4 @@
with import <nixpkgs> {}; with import <nixpkgs> { };
{ ... }: { ... }:
let let
launcher = import ../sway/launcher.nix { inherit pkgs stdenv; }; launcher = import ../sway/launcher.nix { inherit pkgs stdenv; };
@ -26,7 +26,7 @@ in
statusCommand = "${pkgs.i3status-rust}/bin/i3status-rs ${status-configuration}"; statusCommand = "${pkgs.i3status-rust}/bin/i3status-rs ${status-configuration}";
} }
]; ];
floating.criteria = [ { class = "launcher"; } { class = "accentor.Main"; } ]; floating.criteria = [{ class = "launcher"; } { class = "accentor.Main"; }];
fonts = [ "Fira Code Normal 9" ]; fonts = [ "Fira Code Normal 9" ];
menu = "${pkgs.kitty}/bin/kitty --class launcher -e ${launcher}/bin/launcher"; menu = "${pkgs.kitty}/bin/kitty --class launcher -e ${launcher}/bin/launcher";
modifier = "Mod4"; modifier = "Mod4";

View file

@ -1,4 +1,4 @@
with import <nixpkgs> {}; with import <nixpkgs> { };
{ {
home-manager.users.charlotte = { pkgs, ... }: { home-manager.users.charlotte = { pkgs, ... }: {

View file

@ -1,4 +1,4 @@
with import <nixpkgs> {}; with import <nixpkgs> { };
{ pkgs, ... }: { pkgs, ... }:
let let
launcher = import ./launcher.nix { inherit pkgs stdenv; }; launcher = import ./launcher.nix { inherit pkgs stdenv; };

View file

@ -7,7 +7,6 @@ let
type = "gem"; type = "gem";
version = "4.0.0.rc2"; version = "4.0.0.rc2";
}; };
emoji_list = stdenv.mkDerivation { emoji_list = stdenv.mkDerivation {
name = "emoji_list"; name = "emoji_list";
buildInputs = [ pkgs.ruby gemoji ]; buildInputs = [ pkgs.ruby gemoji ];

View file

@ -48,7 +48,7 @@ pkgs.writeText "configuration.toml" ''
block = "net" block = "net"
device = "wlp0s20f3" device = "wlp0s20f3"
ssid = true ssid = true
signal_strength = true signal_strength = false
speed_up = false speed_up = false
speed_down = false speed_down = false
hide_missing = true hide_missing = true

View file

@ -43,6 +43,7 @@
sessionVariables = { sessionVariables = {
DEFAULT_USER = "charlotte"; DEFAULT_USER = "charlotte";
EDITOR = "nvim"; EDITOR = "nvim";
PASSWORD_STORE_DIR = "$HOME/repos/passwords";
}; };
shellAliases = { shellAliases = {
upgrade = "sudo nix-channel --update && sudo nixos-rebuild switch"; upgrade = "sudo nix-channel --update && sudo nixos-rebuild switch";

View file

@ -23,7 +23,6 @@ let
# useGoogleTVAddOns = false; # useGoogleTVAddOns = false;
# includeExtras = [ "extras;google;gcm" ]; # includeExtras = [ "extras;google;gcm" ];
}; };
customPlugins.kotlin-vim = pkgs.vimUtils.buildVimPlugin { customPlugins.kotlin-vim = pkgs.vimUtils.buildVimPlugin {
name = "kotlin-vim"; name = "kotlin-vim";
src = pkgs.fetchFromGitHub { src = pkgs.fetchFromGitHub {
@ -33,7 +32,6 @@ let
sha256 = "1yqzxabhpc4jbdlzhsysp0vi1ayqg0vnpysvx4ynd9961q2fk3sz"; sha256 = "1yqzxabhpc4jbdlzhsysp0vi1ayqg0vnpysvx4ynd9961q2fk3sz";
}; };
}; };
gradle-fhs-nix = pkgs.writeText "gradle-fhs.nix" '' gradle-fhs-nix = pkgs.writeText "gradle-fhs.nix" ''
{ run }: { run }:
let let
@ -48,14 +46,12 @@ let
runScript = "bash -c '''''${run}'''"; runScript = "bash -c '''''${run}'''";
}).env }).env
''; '';
gradle-run-script = pkgs.writeScriptBin "gradle" '' gradle-run-script = pkgs.writeScriptBin "gradle" ''
#!${pkgs.bash}/bin/bash #!${pkgs.bash}/bin/bash
REPO_ROOT="$(git rev-parse --show-toplevel)" REPO_ROOT="$(git rev-parse --show-toplevel)"
nix-shell --argstr run "\"$REPO_ROOT/gradlew $@\"" "${gradle-fhs-nix}" nix-shell --argstr run "\"$REPO_ROOT/gradlew $@\"" "${gradle-fhs-nix}"
''; '';
sign-release = pkgs.writeScriptBin "sign-release" '' sign-release = pkgs.writeScriptBin "sign-release" ''
#!${pkgs.bash}/bin/bash #!${pkgs.bash}/bin/bash
@ -90,7 +86,7 @@ pkgs.mkShell {
\ } \ }
''; '';
vam.knownPlugins = baseVimConfig.vam.knownPlugins // customPlugins; vam.knownPlugins = baseVimConfig.vam.knownPlugins // customPlugins;
vam.pluginDictionaries = (baseVimConfig.vam.pluginDictionaries or []) ++ [ vam.pluginDictionaries = (baseVimConfig.vam.pluginDictionaries or [ ]) ++ [
{ {
names = [ names = [
"kotlin-vim" "kotlin-vim"

View file

@ -1,5 +1,5 @@
let let
pkgs = import <nixpkgs> {}; pkgs = import <nixpkgs> { };
baseVimConfig = import ../programs/neovim/base.nix { inherit pkgs; }; baseVimConfig = import ../programs/neovim/base.nix { inherit pkgs; };
in in
pkgs.mkShell { pkgs.mkShell {
@ -21,7 +21,7 @@ pkgs.mkShell {
\ } \ }
''; '';
vam.knownPlugins = baseVimConfig.vam.knownPlugins; vam.knownPlugins = baseVimConfig.vam.knownPlugins;
vam.pluginDictionaries = (baseVimConfig.vam.pluginDictionaries or []) ++ [ vam.pluginDictionaries = (baseVimConfig.vam.pluginDictionaries or [ ]) ++ [
{ {
names = [ names = [
"LanguageClient-neovim" "LanguageClient-neovim"

View file

@ -1,5 +1,5 @@
let let
pkgs = import <nixpkgs> {}; pkgs = import <nixpkgs> { };
baseVimConfig = import ../programs/neovim/base.nix { inherit pkgs; }; baseVimConfig = import ../programs/neovim/base.nix { inherit pkgs; };
nodePackages = import ../packages/node/default.nix { inherit pkgs; }; nodePackages = import ../packages/node/default.nix { inherit pkgs; };
in in
@ -19,7 +19,7 @@ pkgs.mkShell {
\ } \ }
''; '';
vam.knownPlugins = baseVimConfig.vam.knownPlugins; vam.knownPlugins = baseVimConfig.vam.knownPlugins;
vam.pluginDictionaries = (baseVimConfig.vam.pluginDictionaries or []) ++ [ vam.pluginDictionaries = (baseVimConfig.vam.pluginDictionaries or [ ]) ++ [
{ {
names = [ names = [
"LanguageClient-neovim" "LanguageClient-neovim"

View file

@ -1,5 +1,5 @@
let let
pkgs = import <nixpkgs> {}; pkgs = import <nixpkgs> { };
baseVimConfig = import ../programs/neovim/base.nix { inherit pkgs; }; baseVimConfig = import ../programs/neovim/base.nix { inherit pkgs; };
nodePackages = import ../packages/node/default.nix { inherit pkgs; }; nodePackages = import ../packages/node/default.nix { inherit pkgs; };
in in
@ -36,7 +36,7 @@ pkgs.mkShell {
\ } \ }
''; '';
vam.knownPlugins = baseVimConfig.vam.knownPlugins; vam.knownPlugins = baseVimConfig.vam.knownPlugins;
vam.pluginDictionaries = (baseVimConfig.vam.pluginDictionaries or []) ++ [ vam.pluginDictionaries = (baseVimConfig.vam.pluginDictionaries or [ ]) ++ [
{ {
names = [ names = [
"LanguageClient-neovim" "LanguageClient-neovim"

View file

@ -1,8 +1,7 @@
let let
pkgs = import <nixpkgs> {}; pkgs = import <nixpkgs> { };
baseVimConfig = import ../programs/neovim/base.nix { inherit pkgs; }; baseVimConfig = import ../programs/neovim/base.nix { inherit pkgs; };
jdtls = import ../packages/jdtls/default.nix { inherit pkgs; stdenv = pkgs.stdenv; }; jdtls = import ../packages/jdtls/default.nix { inherit pkgs; stdenv = pkgs.stdenv; };
extraRpath = pkgs.stdenv.lib.strings.makeLibraryPath (with pkgs; [ ffmpeg ]); extraRpath = pkgs.stdenv.lib.strings.makeLibraryPath (with pkgs; [ ffmpeg ]);
in in
pkgs.mkShell { pkgs.mkShell {
@ -41,7 +40,7 @@ pkgs.mkShell {
\} \}
''; '';
vam.knownPlugins = baseVimConfig.vam.knownPlugins; vam.knownPlugins = baseVimConfig.vam.knownPlugins;
vam.pluginDictionaries = (baseVimConfig.vam.pluginDictionaries or []) ++ [ vam.pluginDictionaries = (baseVimConfig.vam.pluginDictionaries or [ ]) ++ [
{ {
names = [ names = [
"LanguageClient-neovim" "LanguageClient-neovim"

View file

@ -1,5 +1,5 @@
let let
pkgs = import <nixpkgs> {}; pkgs = import <nixpkgs> { };
baseVimConfig = import ../programs/neovim/base.nix { inherit pkgs; }; baseVimConfig = import ../programs/neovim/base.nix { inherit pkgs; };
in in
pkgs.mkShell { pkgs.mkShell {
@ -9,7 +9,7 @@ pkgs.mkShell {
configure = { configure = {
customRC = baseVimConfig.customRC; customRC = baseVimConfig.customRC;
vam.knownPlugins = baseVimConfig.vam.knownPlugins; vam.knownPlugins = baseVimConfig.vam.knownPlugins;
vam.pluginDictionaries = (baseVimConfig.vam.pluginDictionaries or []) ++ [ { name = "vim-ledger"; } ]; vam.pluginDictionaries = (baseVimConfig.vam.pluginDictionaries or [ ]) ++ [{ name = "vim-ledger"; }];
}; };
} }
) )

View file

@ -1,5 +1,5 @@
let let
pkgs = import <nixpkgs> {}; pkgs = import <nixpkgs> { };
in in
pkgs.mkShell { pkgs.mkShell {
buildInputs = with pkgs; [ buildInputs = with pkgs; [