mirror of
https://github.com/quantum9Innovation/suntheme.git
synced 2024-11-28 19:13:50 -08:00
Compare commits
1 commit
759266f9fd
...
ab58c137c9
Author | SHA1 | Date | |
---|---|---|---|
|
ab58c137c9 |
6 changed files with 14 additions and 37 deletions
1
.envrc
1
.envrc
|
@ -1 +0,0 @@
|
||||||
use flake
|
|
18
.github/workflows/main.yml
vendored
18
.github/workflows/main.yml
vendored
|
@ -1,18 +0,0 @@
|
||||||
name: "Cache binaries"
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
push:
|
|
||||||
jobs:
|
|
||||||
tests:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- uses: cachix/install-nix-action@v25
|
|
||||||
with:
|
|
||||||
nix_path: nixpkgs=channel:nixos-unstable
|
|
||||||
- uses: cachix/cachix-action@v14
|
|
||||||
with:
|
|
||||||
name: suntheme
|
|
||||||
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
|
|
||||||
- run: nix build --accept-flake-config
|
|
||||||
- run: nix develop --accept-flake-config
|
|
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -21,5 +21,4 @@ cabal.project.local
|
||||||
cabal.project.local~
|
cabal.project.local~
|
||||||
.HTF/
|
.HTF/
|
||||||
.ghc.environment.*
|
.ghc.environment.*
|
||||||
result
|
result/
|
||||||
.direnv/
|
|
||||||
|
|
16
README.md
16
README.md
|
@ -1,14 +1,12 @@
|
||||||
# Suntheme
|
# Suntheme
|
||||||
|
|
||||||
Runs a script on sunrise and sunset, written in pure Haskell
|
runs a script on sunrise and sunset, written in pure haskell.
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
You may be wondering how a program written in Haskell, the purely functional
|
You may be wondering how a program written in Haskell, the purely functional
|
||||||
programming language, could possibly act on the real world by running a so-called "script."
|
programming language, could possibly act on the real world by running a so-called "script".
|
||||||
|
|
||||||
It's simple. We take in the entire World as an input to a pure function, the IO Monad.
|
It's simple. We take in the entire World as an input to a pure function, the IO Monad.
|
||||||
It then maps the original World to a new (generated) World, with our desired IO actions carefully applied with mathematical precision.
|
It then maps the original World to the changed World, with our desired IO actions carefully applied.
|
||||||
|
|
||||||
> From the second perspective, an IO action transforms the whole world. IO actions are actually pure, because they receive a unique world as an argument and then return the changed world.
|
> From the second perspective, an IO action transforms the whole world. IO actions are actually pure, because they receive a unique world as an argument and then return the changed world.
|
||||||
|
|
||||||
|
@ -16,13 +14,13 @@ See [this](https://lean-lang.org/functional_programming_in_lean/monads/io.html)
|
||||||
|
|
||||||
## Hacking on suntheme
|
## Hacking on suntheme
|
||||||
|
|
||||||
It's trivial to get started with suntheme development thanks to [Nix](https://nixos.org/), the purely functional package manager.
|
It's trivially easy to get started with suntheme development thanks to [Nix](https://nixos.org/), the purely functional package manager.
|
||||||
Naturally, we leverage it as our primary package manager, both for Hackage and development tools like language servers and the like.
|
Naturally, we leverage it as our primary package manager, for both Hackage packages and development tools like language servers and the like.
|
||||||
|
|
||||||
First, install Nix through your preferred avenue or local system administrator. If unsure, we recommend [the Determinate Nix Installer](https://github.com/DeterminateSystems/nix-installer).
|
First, install Nix through your preferred avenue. If unsure, we recommend [the Determinate Nix Installer](https://github.com/DeterminateSystems/nix-installer).
|
||||||
Make sure flakes and nix-command are enabled (the Determinate Installer will enable them by default).
|
Make sure flakes and nix-command are enabled (the Determinate Installer will enable them by default).
|
||||||
|
|
||||||
Once you have `nix`, simply type:
|
Once you have `nix`, simply type
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
nix develop
|
nix develop
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
|
-- requires 'at' for running a command at a certain time
|
||||||
|
-- requires 'date' for converting unix time to human readable time
|
||||||
-- run on boot and at noon and midnight
|
-- run on boot and at noon and midnight
|
||||||
-- don't add commands to `at` while this script is running (monadic purity must be preserved)
|
-- don't add commands to at while this script is running (monadic purity must be preserved)
|
||||||
|
|
||||||
module Main where
|
module Main where
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
description = "Suntheme's development and build environment";
|
description = "Flake for suntheme's development environment and builds";
|
||||||
|
|
||||||
inputs.haskellNix.url = "github:input-output-hk/haskell.nix";
|
inputs.haskellNix.url = "github:input-output-hk/haskell.nix";
|
||||||
inputs.nixpkgs.follows = "haskellNix/nixpkgs-unstable";
|
inputs.nixpkgs.follows = "haskellNix/nixpkgs-unstable";
|
||||||
|
@ -29,9 +29,6 @@
|
||||||
hlint = {};
|
hlint = {};
|
||||||
haskell-language-server = {};
|
haskell-language-server = {};
|
||||||
};
|
};
|
||||||
shell.buildInputs = with pkgs; [
|
|
||||||
at
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
@ -49,8 +46,8 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
nixConfig = {
|
nixConfig = {
|
||||||
extra-substituters = ["https://cache.iog.io" "https://suntheme.cachix.org"];
|
extra-substituters = ["https://cache.iog.io"];
|
||||||
extra-trusted-public-keys = ["hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=" "suntheme.cachix.org-1:fHjlz7YAmMUcLp3tsZis8g9wIsDS6HvECGR3uZETGRo="];
|
extra-trusted-public-keys = ["hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ="];
|
||||||
allow-import-from-derivation = "true";
|
allow-import-from-derivation = "true";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue