Compare commits
3 commits
Author | SHA1 | Date | |
---|---|---|---|
4852951a6d | |||
a7cb13f15a | |||
45bfe5a4f3 |
19 changed files with 1237 additions and 827 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,8 +1,8 @@
|
|||
/.direnv
|
||||
/result
|
||||
/resources
|
||||
/public
|
||||
/node_modules
|
||||
/result
|
||||
|
||||
/.netlify
|
||||
|
||||
|
|
|
@ -10,16 +10,16 @@ I live in Kansas City where I help run <a target="_blank"
|
|||
href="https://kcrising.church">a small Christian church</a>, raise three boys
|
||||
with my <a target="_blank"
|
||||
href="https://www.instagram.com/valerielauren93">awesome wife</a>, and write
|
||||
software for <a target="_blank" href="https://getdivvy.com">Divvy (acquired by
|
||||
software for <a target="_blank" href="https://getdivvy.com">Divvy (bought by
|
||||
Bill.com)</a>.
|
||||
|
||||
I run a lot of self-hosted software here at home on some machines that sit on
|
||||
[an unnecessarily large server rack in my basement][rack]. I love building
|
||||
[keyboards][kb], too. [I heavily customize my workflow][wf] and you can
|
||||
see how I set everything up with [Nix][nix] if you like (or even my old
|
||||
[dotfiles][df]).
|
||||
[dotfiles](df)).
|
||||
|
||||
Occasionally, I post articles here.
|
||||
Occasionally, I post technical articles (of varying length and complexity) here.
|
||||
|
||||
[rack]: //files.lyte.dev/images/server-rack-angle-2023-07.jpg
|
||||
[kb]: //files.lyte.dev/keyboards
|
||||
|
|
|
@ -34,30 +34,3 @@ You can use something like `go env -w GOPROXY=http://localhost:9981,direct` to
|
|||
avoid prefixing all your `go` commands with the environment variable. Obviously,
|
||||
this can cause things to break weirdly if/when the `goproxy server` dies or the
|
||||
tunnel is disconnected. Tread lightly!
|
||||
|
||||
One last possible step is that when the proxy machine clones the repo it may try
|
||||
to do so over HTTPS when you almost certainly want it to use SSH. To avoid this,
|
||||
you can do something like this in `~/.gitconfig` or `~/.config/git/config` to
|
||||
force git to use SSH instead of HTTPS:
|
||||
|
||||
```ini
|
||||
[url "git@git.example.com:"]
|
||||
insteadOf = "https://git.example.com"
|
||||
```
|
||||
|
||||
My full invocation looks something like this:
|
||||
|
||||
```shell_session
|
||||
go install github.com/goproxy/goproxy/cmd/goproxy@latest
|
||||
# put this cute background job somewhere or `disown`
|
||||
GOPRIVATE=git.example.com GOMODCACHE=~/go goproxy server --address localhost:58320 &
|
||||
```
|
||||
|
||||
And then on the client:
|
||||
|
||||
```shell_session
|
||||
# put this cute background job somewhere or `disown`
|
||||
ssh -L 58320:localhost:58320 $PROXYHOST &
|
||||
go env -w GOPROXY=http://localhost:58320,direct
|
||||
go mod tidy
|
||||
```
|
||||
|
|
|
@ -1,382 +0,0 @@
|
|||
---
|
||||
date: "2024-07-08T16:34:00-05:00"
|
||||
title: "Learn Flakes the Fun Way"
|
||||
draft: false
|
||||
toc: false
|
||||
---
|
||||
|
||||
This post is a Flake-based rewrite of [Learn Nix the Fun Way on fzakaria.com][0].
|
||||
I really enjoyed the content of the post and wanted to write it as a Nix
|
||||
user who is just using and prefers Flakes. It does add a few extra steps and
|
||||
complexity, but I think it's still valuable and perhaps reveals a bit more about
|
||||
Nix and why it's pretty fantastic. I also include a few neat things that are
|
||||
more Flake-specific at the end.
|
||||
|
||||
But yes, it's basically plagiarism.
|
||||
|
||||
<!--more-->
|
||||
|
||||
## what-is-my-ip
|
||||
|
||||
Let's walk through a single example of a shell script one may write, `what-is-my-ip`:
|
||||
|
||||
```bash
|
||||
#!/usr/bin/env bash
|
||||
curl -s http://httpbin.org/get | jq --raw-output .origin
|
||||
```
|
||||
|
||||
Sure, it's _sort of portable_, if you tell the person running it to have _curl_ and _jq_. What if you relied on a specific version of either, though?
|
||||
|
||||
Nix **guarantees** portability.
|
||||
|
||||
We might leverage _[Nixpkgs' trivial builders](https://ryantm.github.io/nixpkgs/builders/trivial-builders/)_ (specifically, `writeShellScriptBin`) in a basic Nix Flake to turn this into a Nix derivation (i.e. build recipe):
|
||||
|
||||
```nix
|
||||
# flake.nix
|
||||
{
|
||||
inputs.nixpkgs.url = "nixpkgs/nixos-24.05";
|
||||
outputs = {nixpkgs, ...}: let
|
||||
systems = ["aarch64-linux" "aarch64-darwin" "x86_64-darwin" "x86_64-linux"];
|
||||
pkgsFor = func: (nixpkgs.lib.genAttrs systems (system: (func (import nixpkgs {inherit system;}))));
|
||||
in {
|
||||
packages = pkgsFor (pkgs: {
|
||||
default = pkgs.callPackage ./what-is-my-ip.nix {};
|
||||
});
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
```nix
|
||||
# what-is-my-ip.nix
|
||||
{pkgs}:
|
||||
pkgs.writeShellScriptBin "what-is-my-ip" ''
|
||||
${pkgs.curl}/bin/curl -s http://httpbin.org/get | ${pkgs.jq}/bin/jq --raw-output .origin
|
||||
''
|
||||
```
|
||||
|
||||
> 😬 Avoid over-focusing on the fact I just introduced a new language and a good chunk of boilerplate. Just come along for the ride.
|
||||
|
||||
Here we are pinning our package to dependencies which come from NixOS/Nixpkgs release branch 24.05.
|
||||
|
||||
We can build our package and find out the Nix store path (which contains the
|
||||
hash) like so:
|
||||
|
||||
```console
|
||||
$ nix build --print-out-paths
|
||||
/nix/store/lr6wlz2652r35rwzc79samg77l6iqmii-what-is-my-ip
|
||||
```
|
||||
|
||||
And, of course, we can run our built result:
|
||||
|
||||
```console
|
||||
$ ./result/bin/what-is-my-ip
|
||||
24.5.113.148
|
||||
```
|
||||
|
||||
Or run it from the Flake directly:
|
||||
|
||||
```console
|
||||
$ nix run
|
||||
24.5.113.148
|
||||
```
|
||||
|
||||
### Graph Dependencies
|
||||
|
||||
Now that this is in our Nix store, we've naturally modeled our dependencies
|
||||
and can do _fun_ things like generate graph diagrams:
|
||||
|
||||
```console
|
||||
$ nix-store --query --graph $(readlink result) | nix shell nixpkgs#graphviz -c dot -Tpng -o what-is-my-ip-deps.png
|
||||
```
|
||||
|
||||
[![Image of what-is-my-ip dependencies as a graph](/img/what-is-my-ip-deps.png)](/img/what-is-my-ip-deps.png)
|
||||
|
||||
### Developer Environments
|
||||
|
||||
Let's add a _developer environment_ which contains our new tool.
|
||||
This is a great way to create developer environments with reproducible tools.
|
||||
Generally, though, `devShells` are for working _on_ the product of the Flake and
|
||||
do not _usually_ include the product itself.
|
||||
|
||||
```diff
|
||||
diff --git a/flake.nix b/flake.nix
|
||||
index 2a99357..ab32421 100644
|
||||
--- a/flake.nix
|
||||
+++ b/flake.nix
|
||||
@@ -1,11 +1,24 @@
|
||||
{
|
||||
inputs.nixpkgs.url = "nixpkgs/nixos-24.05";
|
||||
- outputs = {nixpkgs, ...}: let
|
||||
+ outputs = {
|
||||
+ self, # we will need to reference our own outputs to pull in the package we've declared
|
||||
+ nixpkgs,
|
||||
+ ...
|
||||
+ }: let
|
||||
systems = ["aarch64-linux" "aarch64-darwin" "x86_64-darwin" "x86_64-linux"];
|
||||
pkgsFor = func: (nixpkgs.lib.genAttrs systems (system: (func (import nixpkgs {inherit system;}))));
|
||||
in {
|
||||
packages = pkgsFor (pkgs: {
|
||||
default = pkgs.callPackage ./what-is-my-ip.nix {};
|
||||
});
|
||||
+
|
||||
+ devShells = pkgsFor (pkgs: {
|
||||
+ default = pkgs.mkShell {
|
||||
+ packages = [self.outputs.packages.${pkgs.system}.default];
|
||||
+ shellHook = ''
|
||||
+ echo "Hello, Nix!"
|
||||
+ '';
|
||||
+ };
|
||||
+ });
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
```console
|
||||
$ nix develop -c $SHELL
|
||||
Hello, Nix!
|
||||
|
||||
$ which what-is-my-ip
|
||||
/nix/store/lr6wlz2652r35rwzc79samg77l6iqmii-what-is-my-ip/bin/what-is-my-ip
|
||||
```
|
||||
|
||||
🕵️ Notice that the hash `lr6wlz2652r35rwzc79samg77l6iqmii` is _exactly_ the same which we built earlier.
|
||||
|
||||
### Deployment
|
||||
|
||||
We can now do binary or source deployments 🚀🛠️📦 since we know the full dependency closure of our tool. We simply copy the necessary `/nix/store` paths to another machine with Nix installed.
|
||||
|
||||
```console
|
||||
$ nix copy --to ssh://beefcake $(nix build --print-out-paths)
|
||||
$ ssh beefcake /nix/store/lr6wlz2652r35rwzc79samg77l6iqmii-what-is-my-ip/bin/what-is-my-ip
|
||||
98.147.178.19
|
||||
```
|
||||
|
||||
#### With Containers
|
||||
|
||||
Maybe though you are stuck with Kubernetes or Docker. Let's use Nix to create an OCI-compatible image with our tool:
|
||||
|
||||
```diff
|
||||
diff --git a/flake.nix b/flake.nix
|
||||
index 99d6d52..81e98c9 100644
|
||||
--- a/flake.nix
|
||||
+++ b/flake.nix
|
||||
@@ -10,6 +10,12 @@
|
||||
in {
|
||||
packages = pkgsFor (pkgs: {
|
||||
default = pkgs.callPackage ./what-is-my-ip.nix {};
|
||||
+ container = pkgs.dockerTools.buildImage {
|
||||
+ name = "what-is-my-ip-container";
|
||||
+ config = {
|
||||
+ Cmd = ["${self.outputs.packages.${pkgs.system}.default}/bin/what-is-my-ip"];
|
||||
+ };
|
||||
+ };
|
||||
});
|
||||
|
||||
devShells = pkgsFor (pkgs: {
|
||||
```
|
||||
|
||||
```console
|
||||
$ docker load < $(nix build .#container --print-out-paths)
|
||||
Loaded image: what-is-my-ip-docker:c9g6x30invdq1bjfah3w1aw5w52vkdfn
|
||||
$ docker run -it what-is-my-ip-container:c9g6x30invdq1bjfah3w1aw5w52vkdfn
|
||||
24.5.113.148
|
||||
```
|
||||
|
||||
Cool! Nix + Docker integration perfectly. The image produced has only the files exactly necessary to run the tool provided, effectively **distroless**. You may also note that if you are following along, your image digest is exactly the same. **Reproducibility!**
|
||||
|
||||
#### In Virtual Machines
|
||||
|
||||
Finally, let's take the last step and create a reproducible operating system using NixOS to contain only the programs we want:
|
||||
|
||||
```diff
|
||||
diff --git a/flake.nix b/flake.nix
|
||||
index 99d6d52..81e98c9 100644
|
||||
--- a/flake.nix
|
||||
+++ b/flake.nix
|
||||
@@ -20,5 +26,27 @@
|
||||
'';
|
||||
};
|
||||
});
|
||||
+
|
||||
+ nixosConfigurations = let
|
||||
+ system = "x86_64-linux";
|
||||
+ in {
|
||||
+ default = nixpkgs.lib.nixosSystem {
|
||||
+ inherit system;
|
||||
+ modules = [
|
||||
+ {
|
||||
+ users.users.alice = {
|
||||
+ isNormalUser = true;
|
||||
+ # enable sudo
|
||||
+ extraGroups = ["wheel"];
|
||||
+ packages = [
|
||||
+ self.outputs.packages.${system}.default
|
||||
+ ];
|
||||
+ initialPassword = "swordfish";
|
||||
+ };
|
||||
+ system.stateVersion = "24.05";
|
||||
+ }
|
||||
+ ];
|
||||
+ };
|
||||
+ };
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
Now we can run this NixOS configuration as a reproducible virtual machine:
|
||||
|
||||
```console
|
||||
$ nixos-rebuild build-vm --flake .#default
|
||||
$ ./result/bin/run-nixos-vm
|
||||
|
||||
# I/O snippet from QEMU
|
||||
nixos login: alice
|
||||
Password:
|
||||
|
||||
$ readlink $(which what-is-my-ip)
|
||||
/nix/store/lr6wlz2652r35rwzc79samg77l6iqmii-what-is-my-ip/bin/what-is-my-ip
|
||||
|
||||
$ what-is-my-ip
|
||||
24.5.113.148
|
||||
```
|
||||
|
||||
💥 Hash `lr6wlz2652r35rwzc79samg77l6iqmii` present again!
|
||||
|
||||
We took a relatively simple script through a variety of applications in the Nix ecosystem: build recipe, shell, docker image, and finally NixOS VM.
|
||||
|
||||
## Flakes as All Kinds of Package Management
|
||||
|
||||
One of the super neat part about Flakes is that anywhere you find a Flake, you
|
||||
can make use of it. Try it out now!
|
||||
|
||||
> **NOTE**: The following obviously runs code from the internet. Be wary of doing this in general.
|
||||
|
||||
Run a Flake's package:
|
||||
|
||||
```console
|
||||
$ nix run git+https://git.lyte.dev/lytedev/learn-flakes-the-fun-way
|
||||
24.5.113.148
|
||||
```
|
||||
|
||||
Enter a Flake's development environment:
|
||||
|
||||
```console
|
||||
$ nix develop git+https://git.lyte.dev/lytedev/learn-flakes-the-fun-way -c $SHELL
|
||||
Hello, Nix!
|
||||
$ what-is-my-ip
|
||||
24.5.113.148
|
||||
|
||||
# want to hack on the Helix text editor?
|
||||
$ nix develop github:helix-editor/helix
|
||||
# yeah, seriously! that's it!
|
||||
```
|
||||
|
||||
Load a Flake's docker image and run it:
|
||||
|
||||
```console
|
||||
$ docker load < $(nix build git+https://git.lyte.dev/lytedev/learn-flakes-the-fun-way#container --print-out-paths)
|
||||
Loaded image: what-is-my-ip-container:wg0z43v4sc1qhq7rsqg02w80vsfk9dl0
|
||||
$ docker run -it what-is-my-ip-container:c9g6x30invdq1bjfah3w1aw5w52vkdfn
|
||||
```
|
||||
|
||||
Run a Flake's NixOS configuration as a virtual machine:
|
||||
|
||||
```console
|
||||
$ nixos-rebuild build-vm --flake git+https://git.lyte.dev/lytedev/learn-flakes-the-fun-way#default
|
||||
Done. The virtual machine can be started by running /nix/store/xswwdly9m5bwhcz9ajd6km5hx9vdmfzw-nixos-vm/bin/run-nixos-vm
|
||||
$ /nix/store/xswwdly9m5bwhcz9ajd6km5hx9vdmfzw-nixos-vm/bin/run-nixos-vm
|
||||
```
|
||||
|
||||
Run an exact replica my workstation in a virtual machine (as configured via Nix
|
||||
-- meaning it will not have my passwords on it 😉):
|
||||
|
||||
```console
|
||||
# NOTE: this will probably take a good, long time to build and lots of bandwidth
|
||||
# NOTE: you probably won't even be able to login
|
||||
$ nixos-rebuild build-vm --flake git+https://git.lyte.dev/lytedev/nix#dragon
|
||||
Done. The virtual machine can be started by running /nix/store/abc-nixos-vm/bin/run-dragon-vm
|
||||
$ /nix/store/abc-nixos-vm/bin/run-dragon-vm
|
||||
```
|
||||
|
||||
## Flakes as Inputs
|
||||
|
||||
Finally, Flakes can take any other Flake as input and use them for their own outputs. This means that they compose wonderfully. Any Flake can use anything from any other Flake. They're basically big ol' distributed functions (if you squint just right). `nixpkgs` itself is "simply" a huge Flake.
|
||||
|
||||
You can generate your own Flake however you like; Flakes provide templating
|
||||
facilities. Here, you can use my very own template:
|
||||
|
||||
```console
|
||||
$ mkdir -p ~/my-fun-flake
|
||||
$ cd ~/my-fun-flake
|
||||
$ nix flake init --template git+https://git.lyte.dev/lytedev/nix#nix-flake
|
||||
$ git init
|
||||
$ git add -A
|
||||
$ git commit -am 'initial commit'
|
||||
$ nix develop -c $SHELL
|
||||
```
|
||||
|
||||
And now you have everything you need to work on a Nix flake as if you were me!
|
||||
|
||||
To add the package from this tutorial, we can simply do this:
|
||||
|
||||
```diff
|
||||
diff --git a/flake.nix b/flake.nix
|
||||
index 408d4f2..c5d6883 100644
|
||||
--- a/flake.nix
|
||||
+++ b/flake.nix
|
||||
@@ -2,16 +2,20 @@
|
||||
inputs.pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
|
||||
inputs.pre-commit-hooks.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
||||
+ inputs.learn-flakes-the-fun-way.url = "git+https://git.lyte.dev/lytedev/learn-flakes-the-fun-way";
|
||||
+ inputs.learn-flakes-the-fun-way.inputs.nixpkgs.follows = "nixpkgs";
|
||||
+
|
||||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
pre-commit-hooks,
|
||||
+ learn-flakes-the-fun-way,
|
||||
...
|
||||
}: let
|
||||
systems = ["aarch64-linux" "aarch64-darwin" "x86_64-darwin" "x86_64-linux"];
|
||||
forSystems = nixpkgs.lib.genAttrs systems;
|
||||
in {
|
||||
formatter = genPkgs (pkgs: pkgs.alejandra);
|
||||
|
||||
@@ -26,7 +30,7 @@
|
||||
|
||||
devShells = genPkgs (pkgs: {
|
||||
nix = pkgs.mkShell {
|
||||
- packages = with pkgs; [nil alejandra];
|
||||
+ packages = with pkgs; [nil alejandra learn-flakes-the-fun-way.packages.${pkgs.system}.default];
|
||||
inherit (self.outputs.checks.${pkgs.system}.pre-commit-check) shellHook;
|
||||
};
|
||||
|
||||
```
|
||||
|
||||
Afterwards you can re-enter your development shell and run our script:
|
||||
|
||||
```console
|
||||
$ nix develop -c $SHELL
|
||||
$ what-is-my-ip
|
||||
24.5.113.148
|
||||
```
|
||||
|
||||
## Other Flakey (but in a good way) Tools
|
||||
|
||||
On top of all this, many very awesome tools can exist. You can leverage a `direnv`-style setup such that whenever you enter a directory you enter its development shell and are completely ready to work within that project with all the necessary tools with all the correct versions _reproducibly_.
|
||||
|
||||
Flakes have `checks` which are run when you run `nix flake check`. You can use this for CI to ensure that your Flake is always able to build whatever packages it needs or even check that code is formatted correctly.
|
||||
|
||||
All of this in one place makes for a pretty incredible developer experience.
|
||||
|
||||
## Conclusion
|
||||
|
||||
Hopefully, seeing the _fun things_ you can do with Nix might inspire you to push through the hard parts.
|
||||
|
||||
There is a golden pot 💰 at the end of this rainbow 🌈 awaiting you.
|
||||
|
||||
**Learn Flakes the fun way.**
|
||||
|
||||
[0]: https://fzakaria.com/2024/07/05/learn-nix-the-fun-way.html
|
||||
|
|
@ -32,26 +32,26 @@ simplicity and personal policy. Dates are rough estimates in many cases.
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Bill</td>
|
||||
<td>Sr. Staff <abbr title="Software Engineer">SWE</abbr></td>
|
||||
<td>2024-08-30</td>
|
||||
<td>Still here!</td>
|
||||
<td>$217,350</td>
|
||||
<td>$22,000</td>
|
||||
<td>$130,000</td>
|
||||
<td>N/A</td>
|
||||
<tr/>
|
||||
<tr>
|
||||
<td>Bill</td>
|
||||
<td>Sr. Staff <abbr title="Software Engineer">SWE</abbr></td>
|
||||
<td>2023-08-20</td>
|
||||
<td>2024-08-30</td>
|
||||
<td>$210,000</td>
|
||||
<td>$21,000</td>
|
||||
<td>$120,000</td>
|
||||
<td>Raise</td>
|
||||
<tr/>
|
||||
<tr>
|
||||
<td>Bill</td>
|
||||
<td>Sr. Staff <abbr title="Software Engineer">SWE</abbr></td>
|
||||
<td>2024-08-30</td>
|
||||
<td>Still here!</td>
|
||||
<td>$217,350</td>
|
||||
<td>$22,000</td>
|
||||
<td>$130,000</td>
|
||||
<td>N/A</td>
|
||||
<tr/>
|
||||
<tr>
|
||||
<td>Bill</td>
|
||||
<td>Sr. Staff <abbr title="Software Engineer">SWE</abbr></td>
|
||||
<td>2023-08-20</td>
|
||||
<td>2024-08-30</td>
|
||||
<td>$210,000</td>
|
||||
<td>$21,000</td>
|
||||
<td>$120,000</td>
|
||||
<td>Raise</td>
|
||||
<tr/>
|
||||
<tr>
|
||||
<td>Bill</td>
|
||||
<td>Staff <abbr title="Software Engineer">SWE</abbr></td>
|
||||
|
|
40
flake.lock
40
flake.lock
|
@ -1,30 +1,12 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1731533236,
|
||||
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1733581040,
|
||||
"narHash": "sha256-Qn3nPMSopRQJgmvHzVqPcE3I03zJyl8cSbgnnltfFDY=",
|
||||
"lastModified": 1696375444,
|
||||
"narHash": "sha256-Sv0ICt/pXfpnFhTGYTsX6lUr1SljnuXWejYTI2ZqHa4=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "22c3f2cf41a0e70184334a958e6b124fb0ce3e01",
|
||||
"rev": "81e8f48ebdecf07aab321182011b067aafc78896",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -36,24 +18,8 @@
|
|||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
|
|
42
flake.nix
42
flake.nix
|
@ -1,30 +1,26 @@
|
|||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
};
|
||||
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
|
||||
outputs = {
|
||||
nixpkgs,
|
||||
flake-utils,
|
||||
...
|
||||
}:
|
||||
flake-utils.lib.eachDefaultSystem (system: let
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
};
|
||||
in {
|
||||
devShells.default = pkgs.mkShell {
|
||||
buildInputs = with pkgs; [
|
||||
hugo
|
||||
gnumake
|
||||
netlify-cli
|
||||
nodejs
|
||||
];
|
||||
shellHook = ''
|
||||
npm install
|
||||
PATH="$(realpath node_modules/.bin):''${PATH}"
|
||||
'';
|
||||
self,
|
||||
}: let
|
||||
systems = ["aarch64-linux" "aarch64-darwin" "x86_64-darwin" "x86_64-linux"];
|
||||
genSystemAttrs = nixpkgs.lib.genAttrs systems;
|
||||
pkgsFor = system: import nixpkgs {inherit system;};
|
||||
pkgsGen = f: (genSystemAttrs (system: (f (pkgsFor system))));
|
||||
|
||||
buildDeps = pkgs: with pkgs; [hugo tailwindcss];
|
||||
infraDeps = pkgs: with pkgs; [netlify-cli];
|
||||
in {
|
||||
packages = pkgsGen (pkgs: {
|
||||
stylesheet = pkgs.callPackage ./nix/packages/stylesheet.nix {};
|
||||
});
|
||||
|
||||
devShells = pkgsGen (pkgs: {
|
||||
default = pkgs.mkShell {
|
||||
buildInputs = (buildDeps pkgs) ++ (infraDeps pkgs);
|
||||
};
|
||||
});
|
||||
};
|
||||
}
|
||||
|
|
12
nix/packages/stylesheet.nix
Normal file
12
nix/packages/stylesheet.nix
Normal file
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
stdenvNoCC,
|
||||
tailwindcss,
|
||||
}:
|
||||
stdenvNoCC.mkDerivation {
|
||||
pname = "stylesheet";
|
||||
version = "1.0.0";
|
||||
src = ../..;
|
||||
buildPhase = ''
|
||||
${tailwindcss}/bin/tailwindcss --input ./src/style.css --output $out/style.css
|
||||
'';
|
||||
}
|
165
package-lock.json
generated
165
package-lock.json
generated
|
@ -1,165 +0,0 @@
|
|||
{
|
||||
"name": "site.lyte.dev",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "site.lyte.dev",
|
||||
"version": "1.0.0",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"stylus": "^0.60.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@adobe/css-tools": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@adobe/css-tools/-/css-tools-4.2.0.tgz",
|
||||
"integrity": "sha512-E09FiIft46CmH5Qnjb0wsW54/YQd69LsxeKUOWawmws1XWvyFGURnAChH0mlr7YPFR1ofwvUQfcL0J3lMxXqPA=="
|
||||
},
|
||||
"node_modules/balanced-match": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
|
||||
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="
|
||||
},
|
||||
"node_modules/brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
||||
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
|
||||
"dependencies": {
|
||||
"balanced-match": "^1.0.0",
|
||||
"concat-map": "0.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/concat-map": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
||||
"integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg=="
|
||||
},
|
||||
"node_modules/debug": {
|
||||
"version": "4.3.4",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
|
||||
"integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
|
||||
"dependencies": {
|
||||
"ms": "2.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"supports-color": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/fs.realpath": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
|
||||
"integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw=="
|
||||
},
|
||||
"node_modules/glob": {
|
||||
"version": "7.2.3",
|
||||
"resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
|
||||
"integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==",
|
||||
"dependencies": {
|
||||
"fs.realpath": "^1.0.0",
|
||||
"inflight": "^1.0.4",
|
||||
"inherits": "2",
|
||||
"minimatch": "^3.1.1",
|
||||
"once": "^1.3.0",
|
||||
"path-is-absolute": "^1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "*"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/isaacs"
|
||||
}
|
||||
},
|
||||
"node_modules/inflight": {
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
|
||||
"integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==",
|
||||
"dependencies": {
|
||||
"once": "^1.3.0",
|
||||
"wrappy": "1"
|
||||
}
|
||||
},
|
||||
"node_modules/inherits": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
||||
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
||||
},
|
||||
"node_modules/minimatch": {
|
||||
"version": "3.1.2",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
|
||||
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
|
||||
"dependencies": {
|
||||
"brace-expansion": "^1.1.7"
|
||||
},
|
||||
"engines": {
|
||||
"node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/ms": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
||||
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
|
||||
},
|
||||
"node_modules/once": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
|
||||
"integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",
|
||||
"dependencies": {
|
||||
"wrappy": "1"
|
||||
}
|
||||
},
|
||||
"node_modules/path-is-absolute": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
|
||||
"integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/sax": {
|
||||
"version": "1.2.4",
|
||||
"resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz",
|
||||
"integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw=="
|
||||
},
|
||||
"node_modules/source-map": {
|
||||
"version": "0.7.4",
|
||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz",
|
||||
"integrity": "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==",
|
||||
"engines": {
|
||||
"node": ">= 8"
|
||||
}
|
||||
},
|
||||
"node_modules/stylus": {
|
||||
"version": "0.60.0",
|
||||
"resolved": "https://registry.npmjs.org/stylus/-/stylus-0.60.0.tgz",
|
||||
"integrity": "sha512-j2pBgEwzCu05yCuY4cmyp0FtPQQFBBAGB7TY7QaNl7eztiHwkxzwvIp5vjZJND/a1JNOka+ZW9ewVPFZpI3pcA==",
|
||||
"dependencies": {
|
||||
"@adobe/css-tools": "~4.2.0",
|
||||
"debug": "^4.3.2",
|
||||
"glob": "^7.1.6",
|
||||
"sax": "~1.2.4",
|
||||
"source-map": "^0.7.3"
|
||||
},
|
||||
"bin": {
|
||||
"stylus": "bin/stylus"
|
||||
},
|
||||
"engines": {
|
||||
"node": "*"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://opencollective.com/stylus"
|
||||
}
|
||||
},
|
||||
"node_modules/wrappy": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
||||
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
{
|
||||
"name": "site.lyte.dev",
|
||||
"version": "1.0.0",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"stylus": "^0.60.0"
|
||||
}
|
||||
}
|
10
readme.md
10
readme.md
|
@ -1,17 +1,9 @@
|
|||
<div align="center">
|
||||
|
||||
<h1>
|
||||
<img width="100" src="static/img/logo.svg" /> <br>
|
||||
<a href="https://lyte.dev">lyte.dev</a>
|
||||
</h1>
|
||||
|
||||
</div>
|
||||
# [lyte.dev][/]
|
||||
|
||||
## Dependencies
|
||||
|
||||
+ Hugo
|
||||
+ `netlify-cli` (for deployments)
|
||||
+ Stylus
|
||||
|
||||
## Build
|
||||
|
||||
|
|
1167
src/style.css
Normal file
1167
src/style.css
Normal file
File diff suppressed because it is too large
Load diff
|
@ -35,7 +35,7 @@ button.copy-code-button
|
|||
pre.chroma:hover > button.copy-code-button
|
||||
opacity 0.9
|
||||
|
||||
img, embed, frame, iframe { max-width: 100% }
|
||||
img, embed, frame, iframe { max-width: 100vw }
|
||||
|
||||
details
|
||||
position relative
|
||||
|
@ -271,11 +271,6 @@ form
|
|||
max-width 100vw
|
||||
overflow-x auto
|
||||
|
||||
blockquote > p
|
||||
padding 1em
|
||||
background-color var(--Mantle)
|
||||
border-left solid var(--syntax-bpx) var(--Surface1)
|
||||
|
||||
@media (min-width 600px)
|
||||
body.align-left
|
||||
.hide-in-align-left { display: none }
|
||||
|
|
|
@ -19,38 +19,10 @@ mocha = {
|
|||
/* TODO: everything should be a catppuccin color or based on one */
|
||||
|
||||
light-theme = {
|
||||
--Rosewater: #dc8a78,
|
||||
--Flamingo: #dd7878,
|
||||
--Pink: #ea76cb,
|
||||
--Mauve: #8839ef,
|
||||
--Red: #d20f39,
|
||||
--Maroon: #e64553,
|
||||
--Peach: #fe640b,
|
||||
--Yellow: #df8e1d,
|
||||
--Green: #40a02b,
|
||||
--Teal: #179299,
|
||||
--Sky: #04a5e5,
|
||||
--Sapphire: #209fb5,
|
||||
--Blue: #1e66f5,
|
||||
--Lavender: #7287fd,
|
||||
--Text: #4c4f69,
|
||||
--Subtext1: #5c5f77,
|
||||
--Subtext0: #6c6f85,
|
||||
--Overlay2: #7c7f93,
|
||||
--Overlay1: #8c8fa1,
|
||||
--Overlay0: #9ca0b0,
|
||||
--Surface2: #acb0be,
|
||||
--Surface1: #bcc0cc,
|
||||
--Surface0: #ccd0da,
|
||||
--Base: #eff1f5,
|
||||
--Mantle: #e6e9ef,
|
||||
--Crust: #dce0e8,
|
||||
|
||||
--syntax-brd: rgba(255, 255, 255, 0.2),
|
||||
--syntax-bg: #e6e9ef,
|
||||
--syntax-ledg: rgba(0, 0, 0, 0.1),
|
||||
--syntax-ledg: rgba(0, 0, 0, 0.3),
|
||||
--syntax-ledgbq: rgba(0, 0, 0, 0.3),
|
||||
--syntax-sh: #6c6f85,
|
||||
--syntax-name: latte['green'],
|
||||
--syntax-mag: latte['red'],
|
||||
|
@ -77,38 +49,10 @@ light-theme = {
|
|||
}
|
||||
|
||||
dark-theme = {
|
||||
--Rosewater: #f5e0dc,
|
||||
--Flamingo: #f2cdcd,
|
||||
--Pink: #f5c2e7,
|
||||
--Mauve: #cba6f7,
|
||||
--Red: #f38ba8,
|
||||
--Maroon: #eba0ac,
|
||||
--Peach: #fab387,
|
||||
--Yellow: #f9e2af,
|
||||
--Green: #a6e3a1,
|
||||
--Teal: #94e2d5,
|
||||
--Sky: #89dceb,
|
||||
--Sapphire: #74c7ec,
|
||||
--Blue: #89b4fa,
|
||||
--Lavender: #b4befe,
|
||||
--Text: #cdd6f4,
|
||||
--Subtext1: #bac2de,
|
||||
--Subtext0: #a6adc8,
|
||||
--Overlay2: #9399b2,
|
||||
--Overlay1: #7f849c,
|
||||
--Overlay0: #6c7086,
|
||||
--Surface2: #585b70,
|
||||
--Surface1: #45475a,
|
||||
--Surface0: #313244,
|
||||
--Base: #1e1e2e,
|
||||
--Mantle: #181825,
|
||||
--Crust: #11111b,
|
||||
|
||||
--syntax-brd: rgba(255, 255, 255, 0.2),
|
||||
--syntax-bg: #181825,
|
||||
--syntax-ledg: alpha(mocha['sapphire'], 0.5),
|
||||
--syntax-ledgh: mocha['sapphire'],
|
||||
--syntax-ledgbq: mocha['surface1'],
|
||||
--syntax-sh: #6c7086,
|
||||
--icon-shadow: #000,
|
||||
--syntax-name: mocha['green'],
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
did:plc:syp5oev6zvxsrlnoxbsucz3t
|
|
@ -82,7 +82,7 @@ function initCodeCopyButtons() {
|
|||
}
|
||||
|
||||
window.addEventListener("load", initAlign);
|
||||
// window.addEventListener("load", initCodeCopyButtons);
|
||||
window.addEventListener("load", initCodeCopyButtons);
|
||||
window.addEventListener("DOMContentLoaded", () => {
|
||||
document.querySelectorAll(".nojs").forEach(e => {
|
||||
e.classList.remove("nojs")
|
||||
|
|
|
@ -1,88 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
version="1.1"
|
||||
viewBox="0 0 70 60"
|
||||
width="48"
|
||||
height="48"
|
||||
alt="lyte.dev LED icon"
|
||||
id="svg3"
|
||||
sodipodi:docname="logo.svg"
|
||||
inkscape:version="1.3.2 (091e20ef0f, 2023-11-25)"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<defs
|
||||
id="defs3" />
|
||||
<sodipodi:namedview
|
||||
id="namedview3"
|
||||
pagecolor="#505050"
|
||||
bordercolor="#eeeeee"
|
||||
borderopacity="1"
|
||||
inkscape:showpageshadow="0"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:deskcolor="#505050"
|
||||
inkscape:zoom="16.25"
|
||||
inkscape:cx="23.969231"
|
||||
inkscape:cy="24"
|
||||
inkscape:window-width="1790"
|
||||
inkscape:window-height="1178"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="0"
|
||||
inkscape:current-layer="svg3" />
|
||||
<linearGradient
|
||||
id="logo-gradient"
|
||||
x1="0"
|
||||
x2="0"
|
||||
y1="0"
|
||||
y2="1">
|
||||
<stop
|
||||
offset="50%"
|
||||
style="stop-color:#df3c59"
|
||||
id="stop1" />
|
||||
<stop
|
||||
offset="100%"
|
||||
style="stop-color:#8e293b"
|
||||
id="stop2" />
|
||||
</linearGradient>
|
||||
<filter
|
||||
id="logo-shadow"
|
||||
x="-0.04137931"
|
||||
y="-0.050420168"
|
||||
width="1.0827586"
|
||||
height="1.1323529">
|
||||
<feGaussianBlur
|
||||
stdDeviation="1"
|
||||
id="feGaussianBlur2" />
|
||||
<feOffset
|
||||
dx="0"
|
||||
dy="1.5"
|
||||
result="offsetblur"
|
||||
id="feOffset2" />
|
||||
<feMerge
|
||||
id="feMerge3">
|
||||
<feMergeNode
|
||||
id="feMergeNode2" />
|
||||
<feMergeNode
|
||||
in="SourceGraphic"
|
||||
id="feMergeNode3" />
|
||||
</feMerge>
|
||||
</filter>
|
||||
<path
|
||||
id="logo-path"
|
||||
stroke-width="3.5"
|
||||
fill-opacity="0"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
d="M 19.5 44.6 h 30 v -12.3 a 15.0 14.057142857142859 0 0 0 -30 0 v 12.3 M 19.5 44.6 m 8 0 v 7 m 14 -7 v 7 M 19.5 44.6 m -9 -13.3 h -5 M 19.5 44.6 m -2.6999999999999997 -28.3 l -3.55 -3.55 M 19.5 44.6 m 15.0 -35.6 v -5 M 19.5 44.6 m 32.7 -28.3 l 3.55 -3.55 M 19.5 44.6 m 39 -13.3 h 5 M 19.5 44.6 m 8.0 -12.3 a 7.5 6.15 0 0 1 7.0 -6.5" />
|
||||
<use
|
||||
href="#logo-path"
|
||||
style="filter: url(#logo-shadow);"
|
||||
id="icon-shadow" />
|
||||
<use
|
||||
href="#logo-path"
|
||||
stroke="url(#logo-gradient)"
|
||||
id="use3" />
|
||||
</svg>
|
Before Width: | Height: | Size: 2.4 KiB |
Binary file not shown.
Before Width: | Height: | Size: 163 KiB |
9
tailwind.config.js
Normal file
9
tailwind.config.js
Normal file
|
@ -0,0 +1,9 @@
|
|||
/** @type {import('tailwindcss').Config} */
|
||||
module.exports = {
|
||||
content: [],
|
||||
theme: {
|
||||
extend: {},
|
||||
},
|
||||
plugins: [],
|
||||
}
|
||||
|
Loading…
Reference in a new issue