GitHub

Original file line numberDiff line numberDiff line change

@@ -15,7 +15,16 @@ concurrency:

1515

cancel-in-progress: true

1616
1717

jobs:

18+

check:

19+

runs-on: [self-hosted, nixos]

20+

steps:

21+

- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

22+

with:

23+

persist-credentials: false

24+

- run: nix flake check --print-build-logs

25+
1826

deploy:

27+

needs: check

1928

runs-on: [self-hosted, nixos]

2029

environment:

2130

name: github-pages

@@ -24,17 +33,12 @@ jobs:

2433

- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

2534

with:

2635

persist-credentials: false

27-

- run: nix shell nixpkgs#nodejs --command npm ci

28-

- run: nix shell nixpkgs#nodejs --command npm run format:check

29-

- run: nix shell nixpkgs#nodejs --command npm run lint

30-

- run: nix shell nixpkgs#actionlint --command actionlint

3136

# The external orchestrator must enable Pages with build_type=workflow.

3237

- uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5.0.0

33-

- name: Prepare site

38+

- name: Build site

3439

run: |

35-

mkdir .public

36-

cp -r -- * .public

37-

mv .public public

40+

nix build --print-build-logs

41+

cp -rL result public

3842

- uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0

3943

with:

4044

path: public

Original file line numberDiff line numberDiff line change

@@ -1 +1,3 @@

11

node_modules/

2+

result

3+

result-*

Original file line numberDiff line numberDiff line change

@@ -0,0 +1,87 @@

1+

{

2+

description = "Paris public toilets static website";

3+
4+

inputs = {

5+

nixpkgs.url = "github:NixOS/nixpkgs/nixos-26.05";

6+

flake-utils.url = "github:numtide/flake-utils";

7+

};

8+
9+

outputs =

10+

{ nixpkgs, flake-utils, ... }:

11+

flake-utils.lib.eachSystem

12+

[

13+

"x86_64-linux"

14+

"aarch64-linux"

15+

]

16+

(

17+

system:

18+

let

19+

pkgs = import nixpkgs { inherit system; };

20+

pname = "dut-a2-pwebc-carte";

21+

version = "0.0.0";

22+

src = pkgs.lib.cleanSource ./.;

23+

npmDeps = pkgs.fetchNpmDeps {

24+

inherit src;

25+

hash = "sha256-MoDiYiH++CUUuGZYel47psMewHl8PpYlo0liuouibM4=";

26+

};

27+
28+

site = pkgs.buildNpmPackage {

29+

inherit

30+

pname

31+

version

32+

src

33+

npmDeps

34+

;

35+

nodejs = pkgs.nodejs_22;

36+

dontNpmBuild = true;

37+

installPhase = ''

38+

runHook preInstall

39+

mkdir -p $out

40+

cp -r css imgs scripts index.html $out/

41+

runHook postInstall

42+

'';

43+

};

44+
45+

mkCheck =

46+

name: command:

47+

pkgs.buildNpmPackage {

48+

inherit

49+

pname

50+

version

51+

src

52+

npmDeps

53+

;

54+

name = "${pname}-${name}";

55+

nodejs = pkgs.nodejs_22;

56+

dontNpmBuild = true;

57+

installPhase = ''

58+

runHook preInstall

59+

${command}

60+

touch $out

61+

runHook postInstall

62+

'';

63+

};

64+
65+

actionlint = pkgs.runCommand "${pname}-actionlint" { nativeBuildInputs = [ pkgs.actionlint ]; } ''

66+

actionlint -config-file ${src}/.github/actionlint.yaml ${src}/.github/workflows/*.yml

67+

touch $out

68+

'';

69+

in

70+

{

71+

packages.default = site;

72+
73+

checks = {

74+

inherit actionlint;

75+

format = mkCheck "format" "npm run format:check";

76+

lint = mkCheck "lint" "npm run lint";

77+

package = site;

78+

};

79+
80+

devShells.default = pkgs.mkShell {

81+

packages = [ pkgs.nodejs_22 ];

82+

};

83+
84+

formatter = pkgs.nixfmt-tree;

85+

}

86+

);

87+

}

Read the original on github.com ↗