added hydra jobs and flakes cleanup

This commit is contained in:
Sebastian Wendel 2024-05-07 17:20:50 +02:00
parent dea33e48f9
commit e94bc36a01
5 changed files with 83 additions and 53 deletions

View file

@ -90,18 +90,17 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1713805509,
"narHash": "sha256-YgSEan4CcrjivCNO5ZNzhg7/8ViLkZ4CB/GrGBVSudo=",
"owner": "nixos",
"lastModified": 1714906307,
"narHash": "sha256-UlRZtrCnhPFSJlDQE7M0eyhgvuuHBTe1eJ9N9AQlJQ0=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "1e1dc66fe68972a76679644a5577828b6a7e8be4",
"rev": "25865a40d14b3f9cf19f19b924e2ab4069b09588",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
"id": "nixpkgs",
"ref": "nixos-unstable",
"type": "indirect"
}
},
"nixpkgs-lib": {
@ -154,6 +153,22 @@
"type": "github"
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 1708475490,
"narHash": "sha256-g1v0TsWBQPX97ziznfJdWhgMyMGtoBFs102xSYO4syU=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "0e74ca98a74bc7270d28838369593635a5db3260",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"pre-commit": {
"inputs": {
"flake-compat": "flake-compat",
@ -181,7 +196,8 @@
"flake-parts": "flake-parts",
"nix-filter": "nix-filter",
"nixpkgs": "nixpkgs",
"pre-commit": "pre-commit"
"pre-commit": "pre-commit",
"treefmt-nix": "treefmt-nix"
}
},
"systems": {
@ -198,6 +214,24 @@
"repo": "default",
"type": "github"
}
},
"treefmt-nix": {
"inputs": {
"nixpkgs": "nixpkgs_3"
},
"locked": {
"lastModified": 1714058656,
"narHash": "sha256-Qv4RBm4LKuO4fNOfx9wl40W2rBbv5u5m+whxRYUMiaA=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "c6aaf729f34a36c445618580a9f95a48f5e4e03f",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "treefmt-nix",
"type": "github"
}
}
},
"root": "root",

View file

@ -2,48 +2,43 @@
description = "srx.digital - Website";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixpkgs-unstable";
nixpkgs.url = "nixpkgs/nixos-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
treefmt-nix.url = "github:numtide/treefmt-nix";
nix-filter.url = "github:numtide/nix-filter";
pre-commit.url = "github:cachix/pre-commit-hooks.nix";
};
outputs = {
flake-parts,
nix-filter,
pre-commit,
...
} @ inputs: let
systems = ["x86_64-linux" "aarch64-linux"];
in
flake-parts.lib.mkFlake {inherit inputs;} {
outputs = { self, flake-parts, treefmt-nix, pre-commit, ... }@inputs:
let systems = [ "x86_64-linux" "aarch64-linux" ];
in flake-parts.lib.mkFlake { inherit inputs; } {
inherit systems;
imports = [
pre-commit.flakeModule
treefmt-nix.flakeModule
./nix/hooks.nix
./nix/devshell.nix
./nix/package.nix
];
perSystem = {
config,
pkgs,
self',
inputs',
system,
...
}: {
perSystem = { config, pkgs, self', ... }: {
apps = {
serve.program = "${pkgs.writeShellScript "serve" ''
${pkgs.miniserve}/bin/miniserve -p 3001 --index index.html ${self'.packages.default}
''}";
};
packages = {
default = self'.packages.srx-digital;
packages.default = self'.packages.srx-digital;
treefmt.config = {
projectRootFile = "flake.nix";
programs.nixpkgs-fmt.enable = true;
};
formatter = config.treefmt.build.wrapper;
};
flake.hydraJobs = { inherit (self) packages; };
};
}

View file

@ -1,6 +1,8 @@
{
perSystem = { pkgs, config, ... }: {
devShells.default = pkgs.mkShell {
inputsFrom = [ config.treefmt.build.devShell ];
nativeBuildInputs = with pkgs; [
# ide
(vscode-with-extensions.override {
@ -17,7 +19,7 @@
})
# formater
nixfmt
nixpkgs-fmt
nodePackages_latest.prettier
# lsp
@ -27,6 +29,10 @@
nodePackages_latest.vscode-html-languageserver-bin
tailwindcss-language-server
# nix
deadnix
statix
# node
nodePackages_latest.nodejs
nodePackages_latest.typescript
@ -36,7 +42,9 @@
# html
html5validator
];
shellHook = config.pre-commit.installationScript;
shellHook = ''
${config.pre-commit.installationScript}
'';
};
};
}

View file

@ -1,10 +1,13 @@
{
perSystem = {pkgs, ...}: {
pre-commit = {
check.enable = true;
settings = {
hooks = {};
};
perSystem.pre-commit = {
check.enable = true;
settings.hooks = {
markdownlint.enable = true;
shellcheck.enable = true;
nixpkgs-fmt.enable = true;
deadnix.enable = true;
statix.enable = true;
eslint.enable = true;
};
};
}

View file

@ -1,12 +1,7 @@
{inputs, ...}: let
inherit (inputs.nix-filter.lib) filter inDirectory matchExt;
{ inputs, ... }:
let inherit (inputs.nix-filter.lib) filter inDirectory matchExt;
in {
perSystem = {
config,
pkgs,
inputs',
...
}: {
perSystem = { pkgs, ... }: {
packages.srx-digital = pkgs.mkYarnPackage rec {
name = "srx-digital";
@ -30,10 +25,7 @@ in {
packageJSON = ../package.json;
yarnLock = ../yarn.lock;
yarnFlags = [
"--offline"
"--production=true"
];
yarnFlags = [ "--offline" "--production=true" ];
pkgConfig.sharp = {
nativeBuildInputs = with pkgs; [
@ -42,9 +34,7 @@ in {
nodePackages.node-gyp
];
buildInputs = with pkgs; [
vips.dev
];
buildInputs = with pkgs; [ vips.dev ];
postInstall = ''
${pkgs.nodePackages.node-gyp}/bin/node-gyp --node-dir=${pkgs.nodePackages.nodejs}/include/node rebuild