on master help sign in
Merge pull request #98 from SupercedeTech/add-flake
18d5b76Jappie Klooster
.github/workflows/nix.yamlnew file+34
@@ -0,0 +1,34 @@
1+name: "Nix"
2+on:
3+ pull_request:
4+ push:
5+jobs:
6+ tests:
7+ runs-on: ubuntu-latest
8+ steps:
9+ - uses: actions/checkout@v3
10+ - name: Local cache
11+ uses: actions/cache@v3
12+ with:
13+ path: /nix/store
14+ key: "${{ runner.os }}-nix-cache"
15+ - uses: cachix/install-nix-action@v20
16+ with:
17+ nix_path: nixpkgs=channel:nixos-unstable
18+ extra_nix_config: |
19+ access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
20+
21+ # follow guide: https://nix.dev/tutorials/continuous-integration-github-actions
22+ # this uses the tokens which are revokable
23+ - uses: cachix/cachix-action@v12
24+ with:
25+ name: jappie
26+ # If you chose API tokens for write access OR if you have a private cache
27+ # authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
28+ signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
29+ - run: nix build
30+ - run: nix flake check
31+ - run: nix develop -c echo OK
32+ # legacy actions
33+ - run: nix-build
34+ - run: nix-shell --run "echo OK"
default.nixnew file+10
@@ -0,0 +1,10 @@
1+(import
2+ (
3+ let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in
4+ fetchTarball {
5+ url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
6+ sha256 = lock.nodes.flake-compat.locked.narHash;
7+ }
8+ )
9+ { src = ./.; }
10+).defaultNix
flake.locknew file+44
@@ -0,0 +1,44 @@
1+{
2+ "nodes": {
3+ "flake-compat": {
4+ "flake": false,
5+ "locked": {
6+ "lastModified": 1673956053,
7+ "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
8+ "owner": "edolstra",
9+ "repo": "flake-compat",
10+ "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
11+ "type": "github"
12+ },
13+ "original": {
14+ "owner": "edolstra",
15+ "repo": "flake-compat",
16+ "type": "github"
17+ }
18+ },
19+ "nixpkgs": {
20+ "locked": {
21+ "lastModified": 1688556768,
22+ "narHash": "sha256-mhd6g0iJGjEfOr3+6mZZOclUveeNr64OwxdbNtLc8mY=",
23+ "owner": "nixos",
24+ "repo": "nixpkgs",
25+ "rev": "27bd67e55fe09f9d68c77ff151c3e44c4f81f7de",
26+ "type": "github"
27+ },
28+ "original": {
29+ "owner": "nixos",
30+ "ref": "nixpkgs-unstable",
31+ "repo": "nixpkgs",
32+ "type": "github"
33+ }
34+ },
35+ "root": {
36+ "inputs": {
37+ "flake-compat": "flake-compat",
38+ "nixpkgs": "nixpkgs"
39+ }
40+ }
41+ },
42+ "root": "root",
43+ "version": 7
44+}
flake.nixnew file+44
@@ -0,0 +1,44 @@
1+# I used chatgpt to generate this template and then just
2+# modified to how I normally use these things.
3+{
4+ description = "odd jobs";
5+
6+ inputs = {
7+ nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
8+ flake-compat = {
9+ url = "github:edolstra/flake-compat";
10+ flake = false;
11+ };
12+ };
13+
14+ outputs = { self, nixpkgs, flake-compat }:
15+ let
16+ pkgs = nixpkgs.legacyPackages.x86_64-linux;
17+ hpkgs = pkgs.haskellPackages.override {
18+ overrides = hnew: hold: {
19+ odd-jobs = pkgs.haskell.lib.dontCheck # TOOD need to figure out how to make it call nixosTest end setup a postgres
20+ (hnew.callCabal2nix "odd-jobs" ./. { });
21+ servant-static-th = pkgs.haskell.lib.dontCheck (pkgs.haskell.lib.markUnbroken hold.servant-static-th);
22+ resource-pool = hnew.callHackageDirect {
23+ pkg = "resource-pool";
24+ ver = "0.4.0.0";
25+ sha256 = "sha256-X3VI1LnkyB28ZumRzOFUNG1UIJiW1UH63ZW/CPqPln4=";
26+ } {};
27+ };
28+ };
29+ in
30+ {
31+ defaultPackage.x86_64-linux = hpkgs.odd-jobs;
32+ inherit pkgs;
33+ devShell.x86_64-linux = hpkgs.shellFor {
34+ packages = ps : [ ps."odd-jobs" ];
35+ withHoogle = true;
36+
37+ buildInputs = [
38+ hpkgs.haskell-language-server
39+ pkgs.ghcid
40+ pkgs.cabal-install
41+ ];
42+ };
43+ };
44+}
shell.nixnew file+10
@@ -0,0 +1,10 @@
1+(import
2+ (
3+ let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in
4+ fetchTarball {
5+ url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
6+ sha256 = lock.nodes.flake-compat.locked.narHash;
7+ }
8+ )
9+ { src = ./.; }
10+).shellNix