Skip to content
This repository has been archived by the owner on Feb 15, 2023. It is now read-only.

feat: nixify the template #269

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# This file has been generated by node2nix 1.9.0. Do not edit!

{pkgs ? import <nixpkgs> {
inherit system;
}, system ? builtins.currentSystem, nodejs ? pkgs."nodejs-12_x"}:

let
nodeEnv = import ./node-env.nix {
inherit (pkgs) stdenv lib python2 runCommand writeTextFile;
inherit pkgs nodejs;
libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null;
};
in
import ./node-packages.nix {
inherit (pkgs) fetchurl nix-gitignore stdenv lib fetchgit;
inherit nodeEnv;
}
43 changes: 43 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

59 changes: 59 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
description = "A very basic flake";

inputs = {
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:nixos/nixpkgs/nixos-21.05";
};

outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
nodeDependencies = (import ./overrides.nix { inherit pkgs; }).shell.nodeDependencies;
in
rec {
packages = flake-utils.lib.flattenTree {
svelte-template = pkgs.stdenv.mkDerivation {
name = "svelte-template";
src = ./.;

buildInputs = let
p = pkgs;
in
[
p.nodePackages.npm
];

configurePhase = ''
ln -s ${nodeDependencies}/lib/node_modules ./node_modules;
export PATH="${nodeDependencies}/.bin:$PATH";
'';

buildPhase = ''
npm run build;
'';

installPhase = ''
cp -r public $out/
'';
};
};

devShell = pkgs.mkShell {
buildInputs = let
p = pkgs;
in
[
p.nodePackages.npm
];

shellHook = ''
export NODE_PATH="${nodeDependencies}/lib/node_modules";
export PATH="${nodeDependencies}/bin:$PATH";
'';
};

defaultPackage = packages.svelte-template;
});
}
Loading