flake: add flake-compat+default.nix+shell.nix

This commit is contained in:
surtur 2022-04-26 15:08:36 +02:00
parent f0462b777b
commit 88f38822a6
Signed by: wanderer
GPG Key ID: 19CE1EC1D9E0486D
5 changed files with 58 additions and 1 deletions

@ -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

14
default.nix Normal file

@ -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

@ -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"
}
}

@ -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

14
shell.nix Normal file

@ -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