diff --git a/README.md b/README.md index e39a82d..aab9d3d 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,13 @@ that means you can get started: run `nix develop` in the project folder *first*, then `go {run,build,fmt,...}` about your day. +### developing using nix (without flakes) +> for compatibility with non-flake-enabled systems, this project uses +> [`github:edolstra/flake-compat`](https://github.com/edolstra/flake-compat). + +run `nix-shell` in the project folder *first*, then `go {run,build,fmt,...}` +about your day. + ### developing without nix > *note*: you only need to have the Go toolchain and [Fyne > dependencies](https://developer.fyne.io/started/#prerequisites) installed for diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..cb27f93 --- /dev/null +++ b/default.nix @@ -0,0 +1,14 @@ +(import + ( + let + lock = builtins.fromJSON (builtins.readFile ./flake.lock); + in + fetchTarball { + url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz"; + sha256 = lock.nodes.flake-compat.locked.narHash; + } + ) + { + src = ./.; + } +).defaultNix diff --git a/flake.lock b/flake.lock index 2362728..f73ac1a 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,21 @@ { "nodes": { + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1650374568, + "narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "b4a34015c698c7793d592d66adbab377907a2be8", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1650161686, @@ -17,6 +33,7 @@ }, "root": { "inputs": { + "flake-compat": "flake-compat", "nixpkgs": "nixpkgs" } } diff --git a/flake.nix b/flake.nix index 5f78e7c..dbfbfea 100644 --- a/flake.nix +++ b/flake.nix @@ -1,10 +1,15 @@ { description = "an offline-capable xkcd webcomic reader written in Go"; + inputs.flake-compat = { + url = "github:edolstra/flake-compat"; + flake = false; + inputs.nixpkgs.follows = "nixpkgs"; + }; # Nixpkgs / NixOS version to use. inputs.nixpkgs.url = "nixpkgs/nixos-unstable"; - outputs = { self, nixpkgs }: + outputs = { self, nixpkgs, ... }: let # to work with older version of flakes diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..ed7286c --- /dev/null +++ b/shell.nix @@ -0,0 +1,14 @@ +(import + ( + let + lock = builtins.fromJSON (builtins.readFile ./flake.lock); + in + fetchTarball { + url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz"; + sha256 = lock.nodes.flake-compat.locked.narHash; + } + ) + { + src = ./.; + } +).shellNix