From 6ded2b6f9887a3ed756f081b0d0481db2fe7bc29 Mon Sep 17 00:00:00 2001 From: Valentin Boettcher Date: Tue, 3 Jan 2023 10:47:43 -0500 Subject: [PATCH] Initial commit --- .envrc | 2 ++ .gitignore | 1 + LICENSE | 21 +++++++++++++++++++++ README.md | 24 ++++++++++++++++++++++++ UNLICENSE | 24 ++++++++++++++++++++++++ flake.lock | 44 ++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 16 ++++++++++++++++ shell.nix | 8 ++++++++ 8 files changed, 140 insertions(+) create mode 100644 .envrc create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 README.md create mode 100644 UNLICENSE create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 shell.nix diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..8d15fd6 --- /dev/null +++ b/.envrc @@ -0,0 +1,2 @@ +watch_file **/*.nix +use flake || use nix diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..92b2793 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.direnv diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..900df69 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2021 Eric S Bullington + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..8f3339d --- /dev/null +++ b/README.md @@ -0,0 +1,24 @@ +## Flake-based development shell for Nix + + +### Instructions + +- Make sure you have installed Nix and have [enabled Nix flakes](https://nixos.wiki/wiki/Flakes) in your local environment. + +- Fork project as template. + +- Then `git clone` on your project fork + +- After putting your dependencies in `shell.nix`, run `flake develop` to initialize project (if you have `direnv`, then run `direnv allow` and thereafter the project will be initialized automatically when you `cd` into that directory) + +### Nix package source + +I have this flake pinned to my fork of `nixpkgs`, but you are free to change the `nixpkgs` to the original `NixOS` `nixpkgs`, or any other fork or commit that you wish. The settingi to change is `inputs.nixpkgs.url` (same applies to my fork of `flake-utils`, which is this project's only dependency outside of Nix itself). + +### Dependencies + +The template only has `jq` as a project dependency, but you are free to use any project dependency that is available in recent `nixpkgs`. + +### License + +Dual-licensed under MIT or the UNLICENSE. diff --git a/UNLICENSE b/UNLICENSE new file mode 100644 index 0000000..68a49da --- /dev/null +++ b/UNLICENSE @@ -0,0 +1,24 @@ +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or +distribute this software, either in source code form or as a compiled +binary, for any purpose, commercial or non-commercial, and by any +means. + +In jurisdictions that recognize copyright laws, the author or authors +of this software dedicate any and all copyright interest in the +software to the public domain. We make this dedication for the benefit +of the public at large and to the detriment of our heirs and +successors. We intend this dedication to be an overt act of +relinquishment in perpetuity of all present and future rights to this +software under copyright law. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +For more information, please refer to diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..36a4990 --- /dev/null +++ b/flake.lock @@ -0,0 +1,44 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1610051610, + "narHash": "sha256-U9rPz/usA1/Aohhk7Cmc2gBrEEKRzcW4nwPWMPwja4Y=", + "owner": "nix-resources", + "repo": "flake-utils", + "rev": "3982c9903e93927c2164caa727cd3f6a0e6d14cc", + "type": "github" + }, + "original": { + "owner": "nix-resources", + "ref": "nix-resources-stable", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1613226215, + "narHash": "sha256-3rA5cGIrBHD6yeKhNhsF7/t461ww25oJY8KyBb0IhjU=", + "owner": "nix-resources", + "repo": "nixpkgs", + "rev": "ff96a0fa5635770390b184ae74debea75c3fd534", + "type": "github" + }, + "original": { + "owner": "nix-resources", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..0443327 --- /dev/null +++ b/flake.nix @@ -0,0 +1,16 @@ +# flake.nix +{ + description = "my project description"; + + inputs.flake-utils.url = "github:nix-resources/flake-utils/nix-resources-stable"; + inputs.nixpkgs.url = "github:nix-resources/nixpkgs/nixos-unstable"; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem + (system: + let pkgs = nixpkgs.legacyPackages.${system}; in + { + devShell = import ./shell.nix { inherit pkgs; }; + } + ); +} diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..567ceca --- /dev/null +++ b/shell.nix @@ -0,0 +1,8 @@ +{ pkgs, ... }: +pkgs.mkShell { + # buildInputs is for dependencies you'd need "at run time", + # were you to to use nix-build not nix-shell and build whatever you were working on + buildInputs = [ + pkgs.jq + ]; +}