mirror of
https://codeberg.org/angestoepselt/homepage.git
synced 2025-05-24 14:46:16 +00:00
Update nix flake
This commit is contained in:
parent
ed95bc6967
commit
a0eb7d3443
3 changed files with 79 additions and 46 deletions
|
|
@ -27,6 +27,8 @@ terminal to watch for changes.
|
|||
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.
|
||||
Run `nix build ".#angestoepseltSiteEnv" -o .dev` to get a running Node
|
||||
environment in the *.dev* folder (for example to configure an IDE).
|
||||
|
||||
When Node dependencies are updated (this will change `package.json`), make sure
|
||||
to run `./_nix/update.sh` to update the npm lockfile and the Nix environment.
|
||||
|
|
@ -34,7 +36,7 @@ to run `./_nix/update.sh` to update the npm lockfile and the Nix environment.
|
|||
The flake also contains a second package for building the production output:
|
||||
|
||||
```shell
|
||||
nix build .#angestoepselt-site
|
||||
nix build # Will create an output derivation in 'result'
|
||||
```
|
||||
|
||||
The final derivation contains a `www` folder that can be served.
|
||||
|
|
|
|||
22
flake.lock
generated
22
flake.lock
generated
|
|
@ -1,12 +1,27 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"locked": {
|
||||
"lastModified": 1631561581,
|
||||
"narHash": "sha256-3VQMV5zvxaVLvqqUrNz3iJelLw30mIVSfZmAaauM3dA=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "7e5bf3925f6fbdfaf50a2a7ca0be2879c4261d19",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1632660378,
|
||||
"narHash": "sha256-sjA8eQlnyDjDLyAyq3XlJmN0nqW0ftl/pb7VnMg86L0=",
|
||||
"lastModified": 1633528625,
|
||||
"narHash": "sha256-AGj5q58eHACAe0RQGxObrGwMUsjMozTsiznhsLCYisQ=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "31ffc50c571e6683e9ecc9dbcbd4a8e9914b4497",
|
||||
"rev": "5e2018f7b383aeca6824a30c0cd1978c9532a46a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -17,6 +32,7 @@
|
|||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
41
flake.nix
41
flake.nix
|
|
@ -2,11 +2,11 @@
|
|||
description = "Angestöpselt Homepage";
|
||||
|
||||
inputs.nixpkgs.url = "nixpkgs/nixos-unstable";
|
||||
inputs.flake-utils.url = "github:numtide/flake-utils";
|
||||
|
||||
outputs = { self, nixpkgs }:
|
||||
outputs = {self, nixpkgs, flake-utils }:
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
system = "x86_64-linux";
|
||||
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
|
||||
nodejs = pkgs.nodejs-16_x;
|
||||
|
|
@ -17,11 +17,9 @@
|
|||
buildInputs = with pkgs; [ vips ];
|
||||
dontNpmInstall = true;
|
||||
};
|
||||
in
|
||||
{
|
||||
packages.${system} = {
|
||||
angestoepselt-site = pkgs.stdenv.mkDerivation {
|
||||
name = "angestoepselt-site";
|
||||
|
||||
angestoepseltSite = pkgs.stdenv.mkDerivation {
|
||||
name = "angestoepseltSite";
|
||||
src = self;
|
||||
|
||||
buildInputs = [ nodejs nodeDependencies ];
|
||||
|
|
@ -35,6 +33,13 @@
|
|||
cp -r _site "$out/www"
|
||||
'';
|
||||
};
|
||||
in
|
||||
rec {
|
||||
apps = { inherit angestoepseltSite; };
|
||||
defaultApp = apps.angestoepseltSite;
|
||||
|
||||
packages = {
|
||||
inherit angestoepseltSite;
|
||||
|
||||
# This package isn't actually the fully-built site, but rather a
|
||||
# derivation that contains the relevant programs (with correctly set up
|
||||
|
|
@ -42,13 +47,21 @@
|
|||
# `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";
|
||||
angestoepseltSiteEnv = pkgs.symlinkJoin {
|
||||
name = "angestoepseltSiteEnv";
|
||||
|
||||
buildInputs = [ pkgs.makeWrapper ];
|
||||
paths = [ nodejs nodeDependencies ];
|
||||
|
||||
postBuild = ''
|
||||
wrapProgram "$out/bin/node" \
|
||||
--prefix PATH : "$out/lib/node_modules/.bin" \
|
||||
--prefix NODE_PATH : "$out/lib/node_modules"
|
||||
'';
|
||||
|
||||
shellHook = ''
|
||||
export NODE_PATH=${nodeDependencies}/lib/node_modules
|
||||
export PATH="${nodeDependencies}/bin:$PATH"
|
||||
export PATH="${nodeDependencies}/bin:${nodejs}/bin:$PATH"
|
||||
|
||||
echo ""
|
||||
echo " To start editing content, run:"
|
||||
|
|
@ -63,7 +76,9 @@
|
|||
'';
|
||||
};
|
||||
};
|
||||
defaultPackage = packages.angestoepseltSite;
|
||||
|
||||
defaultPackage.${system} = self.packages.${system}.angestoepselt-site-dev;
|
||||
};
|
||||
devShell = packages.angestoepseltSiteEnv;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue