nix flake based shell

This commit is contained in:
Anantha Kumaran 2022-09-15 22:54:42 +05:30
parent 30bd48288a
commit 452e4d695f
6 changed files with 61 additions and 18 deletions

View File

@ -16,9 +16,9 @@ jobs:
with:
nix_path: nixpkgs=channel:nixos-unstable
- run: |
nix-shell --run 'npm install'
nix-shell --run './node_modules/.bin/esbuild web/src/index.ts --bundle --outfile=web/static/dist.js'
nix-shell --run 'go build'
nix develop --command npm install
nix develop --command ./node_modules/.bin/esbuild web/src/index.ts --bundle --outfile=web/static/dist.js
nix develop --command go build
cp paisa paisa-linux-amd64
- name: Release
uses: softprops/action-gh-release@v1

View File

@ -13,5 +13,5 @@ jobs:
with:
nix_path: nixpkgs=channel:nixos-unstable
- run: |
nix-shell --run 'npm install'
nix-shell --run 'make lint'
nix develop --command npm install
nix develop --command make lint

View File

@ -11,7 +11,7 @@ sample:
go build && ./paisa init && ./paisa update && ./paisa serve
publish:
nix-shell --run 'cd docs && mdbook build'
nix develop --command bash -c 'cd docs && mdbook build'
lint:
./node_modules/.bin/prettier --check web/src

41
flake.lock Normal file
View File

@ -0,0 +1,41 @@
{
"nodes": {
"flake-utils": {
"locked": {
"lastModified": 1659877975,
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1663235518,
"narHash": "sha256-q8zLK6rK/CLXEguaPgm9yQJcY0VQtOBhAT9EV2UFK/A=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "2277e4c9010b0f27585eb0bed0a86d7cbc079354",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

8
flake.nix Normal file
View File

@ -0,0 +1,8 @@
{
description = "paisa";
inputs.flake-utils.url = "github:numtide/flake-utils";
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let pkgs = nixpkgs.legacyPackages.${system};
in { devShells.default = import ./shell.nix { inherit pkgs; }; });
}

View File

@ -1,20 +1,14 @@
{ pkgs ? import <nixpkgs> { } }:
let
pinned = import (builtins.fetchTarball {
url =
"https://github.com/NixOS/nixpkgs/archive/1ffba9f2f683063c2b14c9f4d12c55ad5f4ed887.tar.gz";
}) { };
in pkgs.mkShell {
pkgs.mkShell {
nativeBuildInputs = [
pinned.go_1_18
pinned.gotools
pinned.gopls
pkgs.go_1_19
pkgs.gotools
pkgs.gopls
pkgs.sqlite
pinned.nodejs-17_x
pkgs.nodejs-18_x
pkgs.mdbook
pkgs.pkgsCross.mingwW64.buildPackages.gcc
# pkgs.pkgsCross.mingwW64.buildPackages.gcc
];
shellHook = ''