From 6ca203faa2702f0f6c759adb8aa23692f29ccaba Mon Sep 17 00:00:00 2001 From: seth Date: Thu, 2 Mar 2023 21:55:16 -0500 Subject: initial commit --- .github/workflows/checkandformat.yml | 37 ++++++++++++++++++ .gitignore | 1 + LICENSE | 21 +++++++++++ PACKAGES.md | 8 ++++ README.md | 73 ++++++++++++++++++++++++++++++++++++ default.nix | 9 +++++ flake.lock | 62 ++++++++++++++++++++++++++++++ flake.nix | 42 +++++++++++++++++++++ pkgs/discord-canary.nix | 1 + pkgs/treefetch.nix | 30 +++++++++++++++ 10 files changed, 284 insertions(+) create mode 100644 .github/workflows/checkandformat.yml create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 PACKAGES.md create mode 100644 README.md create mode 100644 default.nix create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 pkgs/discord-canary.nix create mode 100644 pkgs/treefetch.nix diff --git a/.github/workflows/checkandformat.yml b/.github/workflows/checkandformat.yml new file mode 100644 index 0000000..2856163 --- /dev/null +++ b/.github/workflows/checkandformat.yml @@ -0,0 +1,37 @@ +name: check and format flake + +on: + pull_request: + push: + workflow_dispatch: + +jobs: + check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - uses: cachix/install-nix-action@v19 + with: + github_access_token: ${{ secrets.GITHUB_TOKEN }} + + - run: nix flake check + format: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + if: ${{ github.event_name == 'pull_request' }} + with: + repository: ${{ github.event.pull_request.head.repo.full_name }} + ref: ${{ github.event.pull_request.head.ref }} + + - uses: cachix/install-nix-action@v19 + with: + github_access_token: ${{ secrets.GITHUB_TOKEN }} + + - run: nix fmt + + - uses: EndBug/add-and-commit@v9 + with: + default_autor: github_actions + message: "chore: format flake" diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b2be92b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +result diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..cdf9e16 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 seth + +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/PACKAGES.md b/PACKAGES.md new file mode 100644 index 0000000..5a0d5c8 --- /dev/null +++ b/PACKAGES.md @@ -0,0 +1,8 @@ +## original packages + +- [treefetch](https://github.com/angelofallars/treefetch) + +## package overrides + +- discord-canary + - `{withOpenASAR = true;}` diff --git a/README.md b/README.md new file mode 100644 index 0000000..53acc6b --- /dev/null +++ b/README.md @@ -0,0 +1,73 @@ +# overlay + +my personal nix overlay :) + +## current packages + +see [PACKAGES.md](https://github.com/getchoo/overlay/blob/main/PACKAGES.md) + +## how to use + +### on nixos + +#### flake configuration: + +```nix +{ + inputs = { + getchoo = { + url = "github:getchoo/overlay"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = { + nixpkgs, + getchoo, + ... + }: { + nixosConfigurations.hostname = nixpkgs.lib.nixosSystem { + modules = [ + { + nixpkgs.overlays = [getchoo.overlays.default]; + environment.systemPackages = with pkgs; [ + treefetch + ]; + } + ]; + }; + }; +} +``` + +#### configuration.nix + +```nix +_: let + getchoo = builtins.fetchTarball "https://github.com/getchoo/overlay/archive/refs/heads/main.tar.gz"; +in { + nixpkgs.overlays = [getchoo.overlay.default]; +} +``` + +### cli support + +`nixpkgs.overlays` does not configure overlays for tools such as `nix(-)run`, `nix(-)shell`, etc. +the best way to make this overlay available for them is to add it to your flake registry or `~/.config/nixpkgs/overlays.nix`. + +#### flake registry + +```shell +nix registry add getchoo github:getchoo/overlay +nix run getchoo#treefetch +``` + +### overlays.nix + +in `~/.config/nixpkgs/overlays.nix` (or a nix file in `~/.config/nixpkgs/overlays/`): + +```nix +let + getchoo = import (builtins.fetchTarball "https://github.com/getchoo/overlay/archive/refs/heads/main.tar.gz"); +in [getchoo.overlays.default] +``` diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..a26e67c --- /dev/null +++ b/default.nix @@ -0,0 +1,9 @@ +(import ( + fetchTarball { + url = "https://github.com/edolstra/flake-compat/archive/99f1c2157fba4bfe6211a321fd0ee43199025dbf.tar.gz"; + sha256 = "0x2jn3vrawwv9xp15674wjz9pixwjyj3j771izayl962zziivbx2"; + } + ) { + src = ./.; + }) +.defaultNix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..e997044 --- /dev/null +++ b/flake.lock @@ -0,0 +1,62 @@ +{ + "nodes": { + "naersk": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1671096816, + "narHash": "sha256-ezQCsNgmpUHdZANDCILm3RvtO1xH8uujk/+EqNvzIOg=", + "owner": "nix-community", + "repo": "naersk", + "rev": "d998160d6a076cfe8f9741e56aeec7e267e3e114", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "naersk", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1677655566, + "narHash": "sha256-I8G8Lmpp3YduYl4+pkiIJFGT1WKw+8ZMH2QwANkTu2U=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "ae8bdd2de4c23b239b5a771501641d2ef5e027d0", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "root": { + "inputs": { + "naersk": "naersk", + "nixpkgs": "nixpkgs", + "utils": "utils" + } + }, + "utils": { + "locked": { + "lastModified": 1676283394, + "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..ed4b5f0 --- /dev/null +++ b/flake.nix @@ -0,0 +1,42 @@ +{ + inputs = { + utils.url = "github:numtide/flake-utils"; + naersk = { + url = "github:nix-community/naersk"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = { + nixpkgs, + utils, + naersk, + ... + }: let + supportedSystsems = with utils.lib.system; [ + x86_64-linux + # x86_64-darwin + # aarch64-linux + # aarch64-darwin + ]; + packageSet = pkgs: + with pkgs; { + treefetch = callPackage ./pkgs/treefetch.nix {inherit naersk;}; + }; + overrides = prev: { + discord-canary = import ./pkgs/discord-canary.nix prev; + }; + in + utils.lib.eachSystem supportedSystsems (system: let + pkgs = import nixpkgs {inherit system;}; + in { + formatter = pkgs.alejandra; + packages = let + p = packageSet pkgs; + in + p // {default = p.treefetch;}; + }) + // { + overlays.default = final: prev: packageSet final // overrides prev; + }; +} diff --git a/pkgs/discord-canary.nix b/pkgs/discord-canary.nix new file mode 100644 index 0000000..6cb9d27 --- /dev/null +++ b/pkgs/discord-canary.nix @@ -0,0 +1 @@ +prev: prev.discord-canary.override {withOpenASAR = true;} diff --git a/pkgs/treefetch.nix b/pkgs/treefetch.nix new file mode 100644 index 0000000..247354d --- /dev/null +++ b/pkgs/treefetch.nix @@ -0,0 +1,30 @@ +{ + lib, + callPackage, + fetchFromGitHub, + naersk, +}: let + commit = "02f65e11e1f23d5fa9e66335eb5ff4f2f6b01400"; + package = (callPackage naersk {}).buildPackage { + src = fetchFromGitHub { + owner = "angelofallars"; + repo = "treefetch"; + rev = commit; + sha256 = "sha256-FDiulTit492KwV46A3qwjHQwzpjVJvIXTfTrMufXd5k="; + }; + }; +in + with lib; + package + // { + meta = + package.meta + // { + description = "A plant-based system fetch tool made with Rust."; + longDescription = "A comfy and fast system fetch tool made in Rust. Tested to be much faster than neofetch and pfetch."; + homepage = "https://github.com/angelofallars/treefetch"; + license = licenses.gpl3; + maintainers = with maintainers; [getchoo]; + platforms = platforms.all; + }; + } -- cgit v1.2.3