mirror of
https://codeberg.org/angestoepselt/homepage.git
synced 2025-05-24 14:46:16 +00:00
Reformat flake file
This commit is contained in:
parent
aa5c0000d6
commit
00a0318709
1 changed files with 54 additions and 67 deletions
121
flake.nix
121
flake.nix
|
|
@ -3,80 +3,67 @@
|
|||
|
||||
inputs.nixpkgs.url = "nixpkgs/nixos-unstable";
|
||||
|
||||
outputs = { self, nixpkgs }: let
|
||||
system = "x86_64-linux";
|
||||
outputs = { self, nixpkgs }:
|
||||
let
|
||||
system = "x86_64-linux";
|
||||
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
|
||||
nodejs = pkgs.nodejs-16_x;
|
||||
nodejs = pkgs.nodejs-16_x;
|
||||
|
||||
nodePackages = import ./nix/default.nix { inherit pkgs system nodejs; };
|
||||
nodeDependencies = nodePackages.nodeDependencies.override {
|
||||
nativeBuildInputs = with pkgs; [ pkg-config ];
|
||||
buildInputs = with pkgs; [ vips ];
|
||||
dontNpmInstall = true;
|
||||
};
|
||||
in {
|
||||
packages.${system} = {
|
||||
angestoepselt-site = pkgs.stdenv.mkDerivation {
|
||||
name = "angestoepselt-site";
|
||||
src = self;
|
||||
nodePackages = import ./nix/default.nix { inherit pkgs system nodejs; };
|
||||
nodeDependencies = nodePackages.nodeDependencies.override {
|
||||
nativeBuildInputs = with pkgs; [ pkg-config ];
|
||||
buildInputs = with pkgs; [ vips ];
|
||||
dontNpmInstall = true;
|
||||
};
|
||||
in
|
||||
{
|
||||
packages.${system} = {
|
||||
angestoepselt-site = pkgs.stdenv.mkDerivation {
|
||||
name = "angestoepselt-site";
|
||||
src = self;
|
||||
|
||||
buildInputs = [ nodejs nodeDependencies ];
|
||||
buildInputs = [ nodejs nodeDependencies ];
|
||||
|
||||
buildPhase = ''
|
||||
npm run build
|
||||
'';
|
||||
buildPhase = ''
|
||||
npm run build
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p "$out"
|
||||
cp -r _site "$out/www"
|
||||
'';
|
||||
installPhase = ''
|
||||
mkdir -p "$out"
|
||||
cp -r _site "$out/www"
|
||||
'';
|
||||
};
|
||||
|
||||
# This package isn't actually the fully-built site, but rather a
|
||||
# derivation that contains the relevant programs (with correctly set up
|
||||
# environment) to develop and build the site. It can either be used with
|
||||
# `nix develop` – see the repository's readme for details – or compiled
|
||||
# with `nix build`. The latter will output a folder which contains node
|
||||
# and npm binaries that can be used in an IDE.
|
||||
angestoepselt-site-dev = pkgs.symlinkJoin {
|
||||
name = "angestoepselt-site-dev";
|
||||
paths = [ nodejs nodeDependencies ];
|
||||
|
||||
shellHook = ''
|
||||
export NODE_PATH=${nodeDependencies}/lib/node_modules
|
||||
export PATH="${nodeDependencies}/bin:$PATH"
|
||||
|
||||
echo ""
|
||||
echo " To start editing content, run:"
|
||||
echo ""
|
||||
echo "npm run build:styles"
|
||||
echo "npm run dev:site"
|
||||
echo ""
|
||||
echo " The site will be available under http://localhost:8080/ for"
|
||||
echo " local development and rebuilds automatically when content"
|
||||
echo " changes."
|
||||
echo ""
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
# This package isn't actually the fully-built site, but rather a
|
||||
# derivation that contains the relevant programs (with correctly set up
|
||||
# environment) to develop and build the site. It can either be used with
|
||||
# `nix develop` – see the repository's readme for details – or compiled
|
||||
# with `nix build`. The latter will output a folder which contains node
|
||||
# and npm binaries that can be used in an IDE.
|
||||
angestoepselt-site-dev = pkgs.runCommand "angestoepselt-site-dev" {
|
||||
buildInputs = [ nodejs pkgs.makeWrapper ];
|
||||
|
||||
shellHook = ''
|
||||
export NODE_PATH=${nodeDependencies}/lib/node_modules
|
||||
export PATH="${nodeDependencies}/bin:$PATH"
|
||||
|
||||
echo ""
|
||||
echo " To start editing content, run:"
|
||||
echo ""
|
||||
echo "npm run build:styles"
|
||||
echo "npm run dev:site"
|
||||
echo ""
|
||||
echo " The site will be available under http://localhost:8080/ for"
|
||||
echo " local development and rebuilds automatically when content"
|
||||
echo " changes."
|
||||
echo ""
|
||||
'';
|
||||
} ''
|
||||
mkdir -p "$out"
|
||||
ln -s "${nodejs}/lib" "$out/lib"
|
||||
|
||||
wrap() {
|
||||
makeWrapper "${nodejs}/bin/$1" "$out/bin/$1" \
|
||||
--prefix PATH : "${nodejs}/bin" \
|
||||
--prefix PATH : "${nodeDependencies}/bin" \
|
||||
--set-default NODE_PATH "${nodeDependencies}/lib/node_modules"
|
||||
}
|
||||
|
||||
wrap node
|
||||
wrap npm
|
||||
wrap npx
|
||||
|
||||
unset -f wrap
|
||||
'';
|
||||
defaultPackage.${system} = self.packages.${system}.angestoepselt-site-dev;
|
||||
};
|
||||
|
||||
defaultPackage.${system} = self.packages.${system}.angestoepselt-site-dev;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue