mirror of
https://codeberg.org/angestoepselt/homepage.git
synced 2025-05-24 14:46:16 +00:00
Add complete environment package
This commit is contained in:
parent
87dccd0408
commit
53242ef352
3 changed files with 57 additions and 7 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -7,3 +7,6 @@ node_modules/
|
||||||
# Editor settings
|
# Editor settings
|
||||||
.vscode/
|
.vscode/
|
||||||
.idea/
|
.idea/
|
||||||
|
|
||||||
|
# Environment
|
||||||
|
.env
|
||||||
|
|
|
||||||
29
README.md
29
README.md
|
|
@ -1 +1,30 @@
|
||||||
# Angestöpselt Homepage
|
# Angestöpselt Homepage
|
||||||
|
|
||||||
|
This repository contains the next version of Angestöpselt's homepage, intended
|
||||||
|
to be hosted at <angestoepselt.de>. It is built with the
|
||||||
|
[Eleventy](https://www.11ty.dev/) static site generator, using SCSS for
|
||||||
|
stylesheets.
|
||||||
|
|
||||||
|
## Local development environment
|
||||||
|
|
||||||
|
To build the site locally, make sure you have Node installed (currently tested
|
||||||
|
with version 14). Then run:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
npm install
|
||||||
|
npm run build:styles
|
||||||
|
npm run dev:site
|
||||||
|
```
|
||||||
|
|
||||||
|
Go to <https://localhost:8080/>, which will update live when content changes.
|
||||||
|
If you make style changes, make sure to recompile the CSS files with the second
|
||||||
|
command. Alternatively, run `npm run dev:styles` in a second terminal to watch
|
||||||
|
for changes.
|
||||||
|
|
||||||
|
### Nix environment
|
||||||
|
|
||||||
|
This repository also contains a [Nix flake](https://nixos.wiki/wiki/Flakes)
|
||||||
|
which contains the full development environment. `nix develop` will open a
|
||||||
|
shell with all required tools – you don't need to run `npm install` anymore.
|
||||||
|
When node dependencies get updated (which changes `package.json`), make sure to
|
||||||
|
run `./_nix/update.sh` to update the npm lockfile and the Nix environment.
|
||||||
|
|
|
||||||
32
flake.nix
32
flake.nix
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
outputs = { self, nixpkgs }: let
|
outputs = { self, nixpkgs }: let
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
|
|
||||||
pkgs = import nixpkgs { inherit system; };
|
pkgs = import nixpkgs { inherit system; };
|
||||||
|
|
||||||
nodejs = pkgs.nodejs-16_x;
|
nodejs = pkgs.nodejs-16_x;
|
||||||
|
|
@ -17,12 +17,15 @@
|
||||||
dontNpmInstall = true;
|
dontNpmInstall = true;
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
packages.${system}.angestoepselt-site = pkgs.stdenv.mkDerivation {
|
# This package isn't actually the fully-built site, but rather a derivation
|
||||||
name = "angestoepselt-site";
|
# that contains the relevant programs (with correctly set up environment)
|
||||||
src = self;
|
# 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.
|
||||||
|
packages.${system}.angestoepselt-site-dev = pkgs.runCommand "angestoepselt-site-dev" {
|
||||||
|
buildInputs = [ nodejs pkgs.makeWrapper ];
|
||||||
|
|
||||||
buildInputs = [ nodejs ];
|
|
||||||
|
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
export NODE_PATH=${nodeDependencies}/lib/node_modules
|
export NODE_PATH=${nodeDependencies}/lib/node_modules
|
||||||
export PATH="${nodeDependencies}/bin:$PATH"
|
export PATH="${nodeDependencies}/bin:$PATH"
|
||||||
|
|
@ -38,7 +41,22 @@
|
||||||
echo " changes."
|
echo " changes."
|
||||||
echo ""
|
echo ""
|
||||||
'';
|
'';
|
||||||
};
|
} ''
|
||||||
|
mkdir -p "$out"
|
||||||
|
|
||||||
|
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;
|
defaultPackage.${system} = self.packages.${system}.angestoepselt-site;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue