This commit is contained in:
GearKite 2025-04-14 01:57:08 +00:00 committed by GitHub
commit 18a2d33e2e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 68 additions and 6 deletions

2
.gitignore vendored
View file

@ -12,3 +12,5 @@ deb/usr
*.prof *.prof
*.db* *.db*
*.log *.log
.direnv
result

View file

@ -1,19 +1,78 @@
{ {
description = "Gomuks development environment"; description = "Gomuks development environment & packages";
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
}; };
outputs = { self, nixpkgs, flake-utils }: outputs =
(flake-utils.lib.eachDefaultSystem (system: {
self,
nixpkgs,
flake-utils,
...
}:
flake-utils.lib.eachDefaultSystem (
system:
let let
pkgs = import nixpkgs { pkgs = import nixpkgs {
inherit system; inherit system;
config.permittedInsecurePackages = [ "olm-3.2.16" ]; config = {
permittedInsecurePackages = [ "olm-3.2.16" ];
}; };
in { };
outPackages = self.outputs.packages.${system};
# Extract version from version.go
versionContent = builtins.readFile ./version/version.go;
versionMatch = builtins.match ''^.*const StaticVersion = "([0-9\.]+)".*$'' versionContent;
version = builtins.elemAt versionMatch 0;
in
{
packages = {
gomuks = pkgs.buildGoModule {
pname = "gomuks";
inherit version;
src = ./.;
# Go dependency hash (should be updated when dependencies are)
vendorHash = "sha256-hQ8/kPS+XAMPLreIS84DOcCxOw5CNFFFTrVbkpntsMY=";
buildInputs = with pkgs; [
outPackages.gomuks-web
olm
];
preBuild = ''
cp -r ${outPackages.gomuks-web}/dist web/dist
'';
# skip non-existant & broken pytest tests
pytestCheckPhase = '':'';
subPackages = [ "cmd/gomuks" ];
};
# Package for building web dist
gomuks-web = pkgs.buildNpmPackage rec {
pname = "gomuks-web";
inherit version;
src = ./web;
# Same as the Go dependency hash but for NPM packages
npmDepsHash = "sha256-anidtDhINPAX+o6M16ob7yu7tqyTlrB0l8gtkfFdIjw=";
installPhase = ''
mkdir -p $out/dist
cp -r dist/* $out/dist/
'';
};
default = outPackages.gomuks;
};
devShells = { devShells = {
default = pkgs.mkShell { default = pkgs.mkShell {
packages = with pkgs; [ packages = with pkgs; [
@ -36,5 +95,6 @@
]; ];
}; };
}; };
})); }
);
} }