mirror of
https://codeberg.org/demostf/frontend.git
synced 2026-06-03 10:14:13 +02:00
flake rework
This commit is contained in:
parent
cb7657116c
commit
8f9eeadb74
20 changed files with 256 additions and 382 deletions
62
.github/workflows/ci.yaml
vendored
62
.github/workflows/ci.yaml
vendored
|
|
@ -4,65 +4,29 @@ on:
|
|||
push:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
machine:
|
||||
- platform: x86_64-linux
|
||||
- platform: aarch64-linux
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
matrix: ${{ steps.set-matrix.outputs.matrix }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- if: matrix.machine.platform != 'x86_64-linux'
|
||||
uses: docker/setup-qemu-action@v3
|
||||
- uses: cachix/install-nix-action@v26
|
||||
with:
|
||||
extra_nix_config: |
|
||||
extra-platforms = aarch64-linux
|
||||
- uses: icewind1991/attic-action@v1
|
||||
with:
|
||||
name: ci
|
||||
instance: https://cache.icewind.me
|
||||
authToken: '${{ secrets.ATTIC_TOKEN }}'
|
||||
- run: nix build --option system ${{ matrix.machine.platform }} .#frontend
|
||||
- uses: cachix/install-nix-action@v27
|
||||
- id: set-matrix
|
||||
run: echo "matrix={\"check\":$(nix eval --json '.#checks.x86_64-linux' --apply 'builtins.attrNames')}" | tee -a $GITHUB_OUTPUT
|
||||
|
||||
build-docker:
|
||||
checks:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [build]
|
||||
needs: [matrix]
|
||||
strategy:
|
||||
matrix:
|
||||
machine:
|
||||
- platform: x86_64-linux
|
||||
- platform: aarch64-linux
|
||||
fail-fast: false
|
||||
matrix: ${{fromJson(needs.matrix.outputs.matrix)}}
|
||||
name: ${{ matrix.check }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- if: matrix.machine.platform != 'x86_64-linux'
|
||||
uses: docker/setup-qemu-action@v3
|
||||
- uses: cachix/install-nix-action@v26
|
||||
with:
|
||||
extra_nix_config: |
|
||||
extra-platforms = aarch64-linux
|
||||
- uses: icewind1991/attic-action@v1
|
||||
with:
|
||||
name: ci
|
||||
instance: https://cache.icewind.me
|
||||
authToken: '${{ secrets.ATTIC_TOKEN }}'
|
||||
- run: nix build --option system ${{ matrix.machine.platform }} .#docker
|
||||
|
||||
docker:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [build-docker]
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
- uses: cachix/install-nix-action@v26
|
||||
- uses: icewind1991/attic-action@v1
|
||||
with:
|
||||
name: ci
|
||||
instance: https://cache.icewind.me
|
||||
- run: nix run .#dockerManifest
|
||||
if: github.ref == 'refs/heads/main'
|
||||
env:
|
||||
VERSION: "1.0.0"
|
||||
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
authToken: "${{ secrets.ATTIC_TOKEN }}"
|
||||
- run: nix build .#checks.x86_64-linux.${{ matrix.check }}
|
||||
|
|
|
|||
|
|
@ -45,20 +45,9 @@
|
|||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Int4"
|
||||
]
|
||||
"Left": ["Int4"]
|
||||
},
|
||||
"nullable": [
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null
|
||||
]
|
||||
"nullable": [null, null, null, null, null, null, null, null]
|
||||
},
|
||||
"hash": "047f7ac22872178be671d3994baec9116658520f0ff83d09ae8321ac096b28de"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,17 +52,7 @@
|
|||
"parameters": {
|
||||
"Left": []
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
]
|
||||
"nullable": [false, false, false, false, false, false, false, false, false]
|
||||
},
|
||||
"hash": "05e9dfee9d5ee8ea3bd13d7433ba0ba39ed00ab0ffb0c3fc9021921382be00bd"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,14 +15,9 @@
|
|||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Text"
|
||||
]
|
||||
"Left": ["Text"]
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
false
|
||||
]
|
||||
"nullable": [false, false]
|
||||
},
|
||||
"hash": "44fdd79c15ce83bff64db5558711a40d097ff41c029e096f29138a1d5bbc8762"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,15 +20,9 @@
|
|||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Int4"
|
||||
]
|
||||
"Left": ["Int4"]
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
false
|
||||
]
|
||||
"nullable": [false, false, false]
|
||||
},
|
||||
"hash": "4c62efff159fa311007f71db061e4eeb040c79977f0c452065d5361fb134b0d3"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,12 +4,7 @@
|
|||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Varchar",
|
||||
"Varchar",
|
||||
"Varchar",
|
||||
"Varchar"
|
||||
]
|
||||
"Left": ["Varchar", "Varchar", "Varchar", "Varchar"]
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
|
|
|
|||
|
|
@ -15,14 +15,9 @@
|
|||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Text"
|
||||
]
|
||||
"Left": ["Text"]
|
||||
},
|
||||
"nullable": [
|
||||
true,
|
||||
true
|
||||
]
|
||||
"nullable": [true, true]
|
||||
},
|
||||
"hash": "5073fab60c719e464b592393d94372067be0ea36e4a1d138646f496b8cad56c7"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -90,9 +90,7 @@
|
|||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Int4"
|
||||
]
|
||||
"Left": ["Int4"]
|
||||
},
|
||||
"nullable": [
|
||||
false,
|
||||
|
|
|
|||
|
|
@ -12,9 +12,7 @@
|
|||
"parameters": {
|
||||
"Left": []
|
||||
},
|
||||
"nullable": [
|
||||
true
|
||||
]
|
||||
"nullable": [true]
|
||||
},
|
||||
"hash": "af217d7d86c606e4d76bd0c79a2551ed5d423b3900cb1d6d8b0fe3789414eb27"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,11 +11,7 @@ use std::path::Path;
|
|||
pub fn bundle_style(style: &str) -> Vec<u8> {
|
||||
// todo build time?
|
||||
let fs = FileProvider::new();
|
||||
let mut bundler = Bundler::new(
|
||||
&fs,
|
||||
None,
|
||||
ParserOptions::default(),
|
||||
);
|
||||
let mut bundler = Bundler::new(&fs, None, ParserOptions::default());
|
||||
let mut stylesheet = bundler
|
||||
.bundle(Path::new(style))
|
||||
.expect("failed to bundle css");
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
dockerTools,
|
||||
demostf-frontend,
|
||||
{ dockerTools
|
||||
, demostf-frontend
|
||||
,
|
||||
}:
|
||||
dockerTools.buildLayeredImage {
|
||||
name = "demostf/frontend";
|
||||
|
|
|
|||
205
flake.lock
generated
205
flake.lock
generated
|
|
@ -1,113 +1,77 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-parts": {
|
||||
"inputs": {
|
||||
"nixpkgs-lib": "nixpkgs-lib"
|
||||
},
|
||||
"crane": {
|
||||
"locked": {
|
||||
"lastModified": 1701473968,
|
||||
"narHash": "sha256-YcVE5emp1qQ8ieHUnxt1wCZCC3ZfAS+SRRWZ2TMda7E=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "34fed993f1674c8d06d58b37ce1e0fe5eebcb9f5",
|
||||
"lastModified": 1730060262,
|
||||
"narHash": "sha256-RMgSVkZ9H03sxC+Vh4jxtLTCzSjPq18UWpiM0gq6shQ=",
|
||||
"owner": "ipetkov",
|
||||
"repo": "crane",
|
||||
"rev": "498d9f122c413ee1154e8131ace5a35a80d8fa76",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"owner": "ipetkov",
|
||||
"repo": "crane",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils": {
|
||||
"flakelight": {
|
||||
"inputs": {
|
||||
"systems": "systems_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1705309234,
|
||||
"narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flocken": {
|
||||
"inputs": {
|
||||
"flake-parts": "flake-parts",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
],
|
||||
"systems": "systems"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1704105102,
|
||||
"narHash": "sha256-c4VWO9plhINjQzYPHSKURWgQ2D2q24aI3OIN0MTPjz0=",
|
||||
"owner": "mirkolenz",
|
||||
"repo": "flocken",
|
||||
"rev": "3a846dfca17f989805d9f4177de85c96dc0f8542",
|
||||
"lastModified": 1731933812,
|
||||
"narHash": "sha256-PeuRDDq1DcHxbOmXWb3nWMp5PqWUn5PSKimNbUzWEaQ=",
|
||||
"owner": "nix-community",
|
||||
"repo": "flakelight",
|
||||
"rev": "f4b26f683be5c9ac1ec05f968dbbcb35f4bb6346",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "mirkolenz",
|
||||
"ref": "v2",
|
||||
"repo": "flocken",
|
||||
"owner": "nix-community",
|
||||
"repo": "flakelight",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"mill-scale": {
|
||||
"inputs": {
|
||||
"crane": "crane",
|
||||
"flakelight": [
|
||||
"flakelight"
|
||||
],
|
||||
"rust-overlay": "rust-overlay"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1732197065,
|
||||
"narHash": "sha256-Lyosd/rJHFp1xnWPNhukQkW1hFtIiIiVDxQ+fcVypgI=",
|
||||
"owner": "icewind1991",
|
||||
"repo": "mill-scale",
|
||||
"rev": "8051d162308a80dde168b7efe012bfa1363be4ba",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "icewind1991",
|
||||
"repo": "mill-scale",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1717763955,
|
||||
"narHash": "sha256-KTFz7DM0eHpsvuXky0xOmDSp+dCSsB2ODH69UDaGdIs=",
|
||||
"lastModified": 1731797254,
|
||||
"narHash": "sha256-df3dJApLPhd11AlueuoN0Q4fHo/hagP75LlM5K1sz9g=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "4984dd33b2b489065500233eae7defc4659c3c59",
|
||||
"rev": "e8c38b73aeb218e27163376a2d617e61a2ad9b59",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"ref": "release-24.05",
|
||||
"ref": "nixos-24.05",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"nixpkgs-lib": {
|
||||
"locked": {
|
||||
"dir": "lib",
|
||||
"lastModified": 1701253981,
|
||||
"narHash": "sha256-ztaDIyZ7HrTAfEEUt9AtTDNoCYxUdSd6NrRHaYOIxtk=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "e92039b55bcd58469325ded85d4f58dd5a4eaf58",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"dir": "lib",
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1706487304,
|
||||
"narHash": "sha256-LE8lVX28MV2jWJsidW13D2qrHU/RUUONendL2Q/WlJg=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "90f456026d284c22b3e3497be980b2e47d0b28ac",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"npmlock2nix": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
|
|
@ -126,24 +90,26 @@
|
|||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flocken": "flocken",
|
||||
"flakelight": "flakelight",
|
||||
"mill-scale": "mill-scale",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"npmlock2nix": "npmlock2nix",
|
||||
"rust-overlay": "rust-overlay",
|
||||
"utils": "utils"
|
||||
"npmlock2nix": "npmlock2nix"
|
||||
}
|
||||
},
|
||||
"rust-overlay": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs_2"
|
||||
"nixpkgs": [
|
||||
"mill-scale",
|
||||
"flakelight",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1717726729,
|
||||
"narHash": "sha256-2WDKLjVRKWXbadnJHSOUb46PTq3D5nS89vhHTphRw1M=",
|
||||
"lastModified": 1731897198,
|
||||
"narHash": "sha256-Ou7vLETSKwmE/HRQz4cImXXJBr/k9gp4J4z/PF8LzTE=",
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"rev": "7f52ac9ae95bd60c0780d6e32baea22e542e11e1",
|
||||
"rev": "0be641045af6d8666c11c2c40e45ffc9667839b5",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -151,69 +117,6 @@
|
|||
"repo": "rust-overlay",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems_2": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems_3": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"utils": {
|
||||
"inputs": {
|
||||
"systems": "systems_3"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1710146030,
|
||||
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
|
|
|
|||
92
flake.nix
92
flake.nix
|
|
@ -1,82 +1,46 @@
|
|||
{
|
||||
inputs = {
|
||||
utils.url = "github:numtide/flake-utils";
|
||||
nixpkgs.url = "nixpkgs/release-24.05";
|
||||
rust-overlay.url = "github:oxalica/rust-overlay";
|
||||
npmlock2nix.url = "github:nix-community/npmlock2nix";
|
||||
npmlock2nix.flake = false;
|
||||
flocken = {
|
||||
url = "github:mirkolenz/flocken/v2";
|
||||
nixpkgs.url = "nixpkgs/nixos-24.05";
|
||||
flakelight = {
|
||||
url = "github:nix-community/flakelight";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
mill-scale = {
|
||||
url = "github:icewind1991/mill-scale";
|
||||
inputs.flakelight.follows = "flakelight";
|
||||
};
|
||||
|
||||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
utils,
|
||||
rust-overlay,
|
||||
npmlock2nix,
|
||||
flocken,
|
||||
}:
|
||||
utils.lib.eachDefaultSystem (system: let
|
||||
overlays = [
|
||||
(import rust-overlay)
|
||||
npmlock2nix = {
|
||||
url = "github:nix-community/npmlock2nix";
|
||||
flake = false;
|
||||
};
|
||||
};
|
||||
outputs = { mill-scale, npmlock2nix, ... }: mill-scale ./. {
|
||||
packageOpts = { demostf-frontend-node-modules, ... }: {
|
||||
preBuild = ''
|
||||
ln -s ${demostf-frontend-node-modules}/node_modules .
|
||||
'';
|
||||
};
|
||||
extraPaths = [
|
||||
./.sqlx
|
||||
./images
|
||||
./script
|
||||
./style
|
||||
];
|
||||
withOverlays = [
|
||||
(final: prev: {
|
||||
npmlock2nix = final.callPackage npmlock2nix { };
|
||||
})
|
||||
(import ./overlay.nix)
|
||||
(final: prev: {
|
||||
demostf-frontend-toolchain = final.rust-bin.nightly."2024-06-04".default;
|
||||
demostf-frontend-toolchain = final.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
|
||||
})
|
||||
(import ./overlay.nix)
|
||||
];
|
||||
pkgs = (import nixpkgs) {
|
||||
inherit system overlays;
|
||||
};
|
||||
inherit (flocken.legacyPackages.${system}) mkDockerManifest;
|
||||
inherit (builtins) fromTOML readFile;
|
||||
version = (fromTOML (readFile ./Cargo.toml)).package.version;
|
||||
in rec {
|
||||
packages = rec {
|
||||
node_modules = pkgs.demostf-frontend-node-modules;
|
||||
frontend = pkgs.demostf-frontend;
|
||||
docker = pkgs.demostf-frontend-docker;
|
||||
default = frontend;
|
||||
|
||||
dockerManifest = mkDockerManifest {
|
||||
tags = ["latest"];
|
||||
registries = {
|
||||
"docker.io" = {
|
||||
enable = true;
|
||||
repo = "demostf/frontend";
|
||||
username = "$DOCKERHUB_USERNAME";
|
||||
password = "$DOCKERHUB_TOKEN";
|
||||
};
|
||||
};
|
||||
inherit version;
|
||||
images = with self.packages; [x86_64-linux.docker aarch64-linux.docker];
|
||||
};
|
||||
};
|
||||
devShells.default = pkgs.mkShell {
|
||||
OPENSSL_NO_VENDOR = 1;
|
||||
|
||||
nativeBuildInputs = with pkgs; [
|
||||
demostf-frontend-toolchain
|
||||
bacon
|
||||
cargo-edit
|
||||
cargo-outdated
|
||||
clippy
|
||||
cargo-audit
|
||||
cargo-watch
|
||||
pkg-config
|
||||
openssl
|
||||
toolchain = pkgs: pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
|
||||
tools = pkgs: with pkgs; [
|
||||
nodejs
|
||||
nodePackages.svgo
|
||||
typescript
|
||||
sqlx-cli
|
||||
];
|
||||
};
|
||||
}) // {
|
||||
overlays.default = import ./overlay.nix;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
86
flake_.nix
Normal file
86
flake_.nix
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
{
|
||||
inputs = {
|
||||
utils.url = "github:numtide/flake-utils";
|
||||
nixpkgs.url = "nixpkgs/release-24.05";
|
||||
rust-overlay.url = "github:oxalica/rust-overlay";
|
||||
npmlock2nix.url = "github:nix-community/npmlock2nix";
|
||||
npmlock2nix.flake = false;
|
||||
flocken = {
|
||||
url = "github:mirkolenz/flocken/v2";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
|
||||
outputs =
|
||||
{ self
|
||||
, nixpkgs
|
||||
, utils
|
||||
, rust-overlay
|
||||
, npmlock2nix
|
||||
, flocken
|
||||
,
|
||||
}:
|
||||
utils.lib.eachDefaultSystem
|
||||
(system:
|
||||
let
|
||||
overlays = [
|
||||
(import rust-overlay)
|
||||
(final: prev: {
|
||||
npmlock2nix = final.callPackage npmlock2nix { };
|
||||
})
|
||||
(import ./overlay.nix)
|
||||
(final: prev: {
|
||||
demostf-frontend-toolchain = final.rust-bin.nightly."2024-06-04".default;
|
||||
})
|
||||
];
|
||||
pkgs = (import nixpkgs) {
|
||||
inherit system overlays;
|
||||
};
|
||||
inherit (flocken.legacyPackages.${system}) mkDockerManifest;
|
||||
inherit (builtins) fromTOML readFile;
|
||||
version = (fromTOML (readFile ./Cargo.toml)).package.version;
|
||||
in
|
||||
rec {
|
||||
packages = rec {
|
||||
node_modules = pkgs.demostf-frontend-node-modules;
|
||||
frontend = pkgs.demostf-frontend;
|
||||
docker = pkgs.demostf-frontend-docker;
|
||||
default = frontend;
|
||||
|
||||
dockerManifest = mkDockerManifest {
|
||||
tags = [ "latest" ];
|
||||
registries = {
|
||||
"docker.io" = {
|
||||
enable = true;
|
||||
repo = "demostf/frontend";
|
||||
username = "$DOCKERHUB_USERNAME";
|
||||
password = "$DOCKERHUB_TOKEN";
|
||||
};
|
||||
};
|
||||
inherit version;
|
||||
images = with self.packages; [ x86_64-linux.docker aarch64-linux.docker ];
|
||||
};
|
||||
};
|
||||
devShells.default = pkgs.mkShell {
|
||||
OPENSSL_NO_VENDOR = 1;
|
||||
|
||||
nativeBuildInputs = with pkgs; [
|
||||
demostf-frontend-toolchain
|
||||
bacon
|
||||
cargo-edit
|
||||
cargo-outdated
|
||||
clippy
|
||||
cargo-audit
|
||||
cargo-watch
|
||||
pkg-config
|
||||
openssl
|
||||
nodejs
|
||||
nodePackages.svgo
|
||||
typescript
|
||||
sqlx-cli
|
||||
];
|
||||
};
|
||||
}) // {
|
||||
overlays.default = import ./overlay.nix;
|
||||
};
|
||||
}
|
||||
12
module.nix
12
module.nix
|
|
@ -1,8 +1,7 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
{ config
|
||||
, lib
|
||||
, pkgs
|
||||
, ...
|
||||
}:
|
||||
with lib; let
|
||||
format = pkgs.formats.toml { };
|
||||
|
|
@ -15,7 +14,8 @@ with lib; let
|
|||
device."password-file" = "$CREDENTIALS_DIRECTORY/device_password";
|
||||
};
|
||||
cfg = config.services.demostf-frontend;
|
||||
in {
|
||||
in
|
||||
{
|
||||
options.services.demostf-frontend = {
|
||||
enable = mkEnableOption "Log archiver";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
{
|
||||
npmlock2nix,
|
||||
nodejs_20,
|
||||
lib,
|
||||
}: let
|
||||
{ npmlock2nix
|
||||
, nodejs_20
|
||||
, lib
|
||||
,
|
||||
}:
|
||||
let
|
||||
inherit (lib.sources) sourceByRegex;
|
||||
in npmlock2nix.v2.node_modules {
|
||||
in
|
||||
npmlock2nix.v2.node_modules {
|
||||
src = sourceByRegex ./. [ "package.*" ];
|
||||
nodejs = nodejs_20;
|
||||
}
|
||||
|
|
|
|||
19
package.nix
19
package.nix
|
|
@ -1,12 +1,13 @@
|
|||
{
|
||||
stdenv,
|
||||
makeRustPlatform,
|
||||
lib,
|
||||
demostf-frontend-toolchain,
|
||||
pkg-config,
|
||||
openssl,
|
||||
demostf-frontend-node-modules,
|
||||
}: let
|
||||
{ stdenv
|
||||
, makeRustPlatform
|
||||
, lib
|
||||
, demostf-frontend-toolchain
|
||||
, pkg-config
|
||||
, openssl
|
||||
, demostf-frontend-node-modules
|
||||
,
|
||||
}:
|
||||
let
|
||||
inherit (lib.sources) sourceByRegex;
|
||||
rustPlatform = makeRustPlatform {
|
||||
rustc = demostf-frontend-toolchain;
|
||||
|
|
|
|||
4
rust-toolchain.toml
Normal file
4
rust-toolchain.toml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
[toolchain]
|
||||
channel = "nightly-2024-11-18"
|
||||
components = [ "rustfmt", "rust-std", "clippy", "rust-src" ]
|
||||
targets = [ "riscv32imc-unknown-none-elf" ]
|
||||
Loading…
Add table
Add a link
Reference in a new issue