mirror of
https://codeberg.org/puppe/financier-nix.git
synced 2025-12-20 00:12:17 +01:00
Use nix flake functionality for development
This commit is contained in:
parent
8c56307c55
commit
dd5f51d9cc
10 changed files with 61 additions and 25 deletions
1
.envrc
Normal file
1
.envrc
Normal file
|
|
@ -0,0 +1 @@
|
|||
use flake
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -1 +1,2 @@
|
|||
/.direnv/
|
||||
/result
|
||||
|
|
|
|||
|
|
@ -7,13 +7,13 @@ This repository contains files for building
|
|||
First, you should update the necessary Nix files:
|
||||
|
||||
``` bash
|
||||
nix-shell --run 'bash generate.sh'
|
||||
nix develop --command bash generate.sh
|
||||
```
|
||||
|
||||
Afterwards, the distribution for financier can be built:
|
||||
|
||||
``` bash
|
||||
nix-build dist.nix
|
||||
nix build
|
||||
```
|
||||
|
||||
There is also a module (module.nix) that you can use in your NixOS
|
||||
|
|
|
|||
5
dist.nix
5
dist.nix
|
|
@ -1,12 +1,11 @@
|
|||
{ pkgs ? import <nixpkgs> { inherit system; }, system ? builtins.currentSystem
|
||||
}:
|
||||
, financierVersion }:
|
||||
|
||||
let
|
||||
financier = (import ./default.nix { inherit pkgs system; }).package;
|
||||
meta = import ./meta.nix;
|
||||
|
||||
in pkgs.stdenv.mkDerivation {
|
||||
inherit (meta) version;
|
||||
version = financierVersion;
|
||||
pname = "financier-dist";
|
||||
src = "${financier}/lib/node_modules/financier";
|
||||
buildInputs = [ financier.nodejs ];
|
||||
|
|
|
|||
17
flake.lock
generated
17
flake.lock
generated
|
|
@ -1,5 +1,21 @@
|
|||
{
|
||||
"nodes": {
|
||||
"financier": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1643285999,
|
||||
"narHash": "sha256-t0fdmgXtL5oh1sORK/9Uv8lDFXW2GCkQg+LGWyo8mXw=",
|
||||
"owner": "mpuppe",
|
||||
"repo": "financier",
|
||||
"rev": "feb17f4bfba2121043be68d6ab74573c6be2a06d",
|
||||
"type": "gitlab"
|
||||
},
|
||||
"original": {
|
||||
"owner": "mpuppe",
|
||||
"repo": "financier",
|
||||
"type": "gitlab"
|
||||
}
|
||||
},
|
||||
"flake-utils": {
|
||||
"locked": {
|
||||
"lastModified": 1631561581,
|
||||
|
|
@ -31,6 +47,7 @@
|
|||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"financier": "financier",
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
|
|
|
|||
32
flake.nix
32
flake.nix
|
|
@ -1,8 +1,22 @@
|
|||
{
|
||||
inputs.flake-utils.url = "github:numtide/flake-utils";
|
||||
outputs = { self, nixpkgs, flake-utils }:
|
||||
let overlay = import ./overlay.nix;
|
||||
in flake-utils.lib.eachDefaultSystem (system:
|
||||
inputs.financier = {
|
||||
url = "gitlab:mpuppe/financier";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
outputs = inputs@{ self, nixpkgs, ... }:
|
||||
let
|
||||
financierVersion = "1.7.3";
|
||||
nodeVersion = "12";
|
||||
|
||||
overlay = final: prev: {
|
||||
financier-dist = import ./dist.nix {
|
||||
inherit financierVersion;
|
||||
inherit (prev) pkgs system;
|
||||
};
|
||||
};
|
||||
in inputs.flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
|
|
@ -11,8 +25,18 @@
|
|||
in {
|
||||
packages = { inherit (pkgs) financier-dist; };
|
||||
defaultPackage = self.packages.${system}.financier-dist;
|
||||
devShell = pkgs.mkShell {
|
||||
packages = with pkgs; [ nodePackages.node2nix ];
|
||||
shellHook = ''
|
||||
export FINANCIER_SRC="${inputs.financier}"
|
||||
export FINANCIER_NODE_VERSION="${nodeVersion}"
|
||||
'';
|
||||
};
|
||||
}) // {
|
||||
inherit overlay;
|
||||
nixosModule = import ./module.nix;
|
||||
nixosModule = {
|
||||
imports = [ ./module.nix ];
|
||||
nixpkgs.overlays = [ self.overlay ];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
12
helpers.nix
12
helpers.nix
|
|
@ -1,4 +1,12 @@
|
|||
{
|
||||
fetchFinancier = { fetchgit, meta ? import ./meta.nix }:
|
||||
fetchgit { inherit (meta) url rev sha256; };
|
||||
fetchFinancier = { fetchgit }:
|
||||
let
|
||||
financierLockData = (builtins.fromJSON
|
||||
(builtins.readFile ./flake.lock)).nodes.financier.locked;
|
||||
inherit (financierLockData) narHash owner repo rev;
|
||||
url = "https://gitlab.com/${owner}/${repo}.git";
|
||||
in fetchgit {
|
||||
inherit url rev;
|
||||
sha256 = narHash;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
9
meta.nix
9
meta.nix
|
|
@ -1,9 +0,0 @@
|
|||
rec {
|
||||
version = "1.7.3";
|
||||
nodeVersion = "12";
|
||||
|
||||
# Arguments for fetchgit
|
||||
url = "https://gitlab.com/mpuppe/financier.git";
|
||||
rev = "83367cae265af4a036a05766c6f80ea22d1cc1ec";
|
||||
sha256 = "0h7222j9fk4b3fkc7c6gbhl0xranpl5swapkwibb0aba0g6fykfg";
|
||||
}
|
||||
|
|
@ -29,8 +29,6 @@ in {
|
|||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
nixpkgs.overlays = [ (import ./overlay.nix) ];
|
||||
|
||||
networking.firewall.allowedTCPPorts = [ 80 443 ];
|
||||
|
||||
services.nginx = mkIf (cfg.server == "nginx") {
|
||||
|
|
|
|||
|
|
@ -1,3 +0,0 @@
|
|||
final: prev: {
|
||||
financier-dist = import ./dist.nix { inherit (prev) pkgs system; };
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue