fix: unocss in nixos derivation
This commit is contained in:
58
derivation.nix
Normal file
58
derivation.nix
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
{
|
||||||
|
pkgs ? import <nixpkgs>,
|
||||||
|
lib,
|
||||||
|
templ ? pkgs.templ,
|
||||||
|
gitignore,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
v = "2024-12-15";
|
||||||
|
|
||||||
|
npm = pkgs.buildNpmPackage {
|
||||||
|
name = "Keiko's Work NPM Build";
|
||||||
|
version = v;
|
||||||
|
|
||||||
|
src = gitignore.lib.gitignoreSource ./.;
|
||||||
|
|
||||||
|
npmDepsHash = "sha256-8J4oIl4B9gOQcfq4KPUMPnrlgB1vde3x0YVOUBdWCU8=";
|
||||||
|
npmPackFlags = ["--ignore-scripts"];
|
||||||
|
|
||||||
|
buildPhase = ''
|
||||||
|
runHook preBuild
|
||||||
|
|
||||||
|
npm run unocss
|
||||||
|
|
||||||
|
runHook postBuild
|
||||||
|
'';
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
|
|
||||||
|
mkdir -p $out
|
||||||
|
cp -r ./* $out
|
||||||
|
|
||||||
|
runHook postInstall
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
in
|
||||||
|
pkgs.buildGoModule {
|
||||||
|
name = "Keiko's Work";
|
||||||
|
pname = "keikos.work";
|
||||||
|
|
||||||
|
version = v;
|
||||||
|
|
||||||
|
src = npm;
|
||||||
|
|
||||||
|
nativeBuildInputs = [
|
||||||
|
pkgs.nodejs_20
|
||||||
|
];
|
||||||
|
|
||||||
|
vendorHash = "sha256-Hhvyh4M64LyuWbcKWSVWR20idIDIH/ZqLSDT2gGFqj4=";
|
||||||
|
|
||||||
|
preBuild = ''
|
||||||
|
${lib.escapeShellArg (lib.getExe' templ "templ")} generate .
|
||||||
|
'';
|
||||||
|
|
||||||
|
meta = {
|
||||||
|
mainProgram = "keikos.work";
|
||||||
|
};
|
||||||
|
}
|
||||||
29
flake.lock
generated
29
flake.lock
generated
@@ -34,6 +34,26 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"gitignore": {
|
"gitignore": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1709087332,
|
||||||
|
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
|
||||||
|
"owner": "hercules-ci",
|
||||||
|
"repo": "gitignore.nix",
|
||||||
|
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "hercules-ci",
|
||||||
|
"repo": "gitignore.nix",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"gitignore_2": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"templ",
|
"templ",
|
||||||
@@ -78,11 +98,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1733759999,
|
"lastModified": 1734119587,
|
||||||
"narHash": "sha256-463SNPWmz46iLzJKRzO3Q2b0Aurff3U1n0nYItxq7jU=",
|
"narHash": "sha256-AKU6qqskl0yf2+JdRdD0cfxX4b9x3KKV5RqA6wijmPM=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "a73246e2eef4c6ed172979932bc80e1404ba2d56",
|
"rev": "3566ab7246670a43abd2ffa913cc62dad9cdf7d5",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -110,6 +130,7 @@
|
|||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
|
"gitignore": "gitignore",
|
||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": "nixpkgs",
|
||||||
"templ": "templ"
|
"templ": "templ"
|
||||||
}
|
}
|
||||||
@@ -131,7 +152,7 @@
|
|||||||
},
|
},
|
||||||
"templ": {
|
"templ": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"gitignore": "gitignore",
|
"gitignore": "gitignore_2",
|
||||||
"gomod2nix": "gomod2nix",
|
"gomod2nix": "gomod2nix",
|
||||||
"nixpkgs": "nixpkgs_2",
|
"nixpkgs": "nixpkgs_2",
|
||||||
"xc": "xc"
|
"xc": "xc"
|
||||||
|
|||||||
17
flake.nix
17
flake.nix
@@ -3,6 +3,10 @@
|
|||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||||
templ.url = "github:a-h/templ?ref=v0.2.793";
|
templ.url = "github:a-h/templ?ref=v0.2.793";
|
||||||
|
gitignore = {
|
||||||
|
url = "github:hercules-ci/gitignore.nix";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
outputs = {
|
outputs = {
|
||||||
self,
|
self,
|
||||||
@@ -22,13 +26,12 @@
|
|||||||
f system pkgs);
|
f system pkgs);
|
||||||
templ = system: inputs.templ.packages.${system}.templ;
|
templ = system: inputs.templ.packages.${system}.templ;
|
||||||
in {
|
in {
|
||||||
packages = forAllSystems (system: pkgs: let
|
packages = forAllSystems (system: pkgs: {
|
||||||
musl = pkgs.musl;
|
keikos = pkgs.callPackage ./derivation.nix {
|
||||||
derivation =
|
templ = templ system;
|
||||||
pkgs.buildGoModule {
|
gitignore = inputs.gitignore;
|
||||||
};
|
};
|
||||||
in {
|
default = self.packages.${system}.keikos;
|
||||||
default = derivation;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
devShells = forAllSystems (system: pkgs: {
|
devShells = forAllSystems (system: pkgs: {
|
||||||
|
|||||||
Reference in New Issue
Block a user