ATproto Nix User Repo

Initial commit

authored by Jack Valinsky and committed by GitHub 78f89f47

+6
.github/dependabot.yml
···
··· 1 + version: 2 2 + updates: 3 + - package-ecosystem: "github-actions" 4 + directory: "/" 5 + schedule: 6 + interval: "weekly"
+76
.github/workflows/build.yml
···
··· 1 + name: "Build and populate cache" 2 + on: 3 + pull_request: 4 + push: 5 + branches: 6 + - main 7 + - master 8 + schedule: 9 + # rebuild everyday at 2:51 10 + # TIP: Choose a random time here so not all repositories are build at once: 11 + # https://www.random.org/clock-times/?num=1&earliest=01%3A00&latest=08%3A00&interval=5&format=html&rnd=new 12 + - cron: '51 2 * * *' 13 + workflow_dispatch: 14 + jobs: 15 + tests: 16 + strategy: 17 + matrix: 18 + # Set this to notify the global nur package registry that changes are 19 + # available. 20 + # 21 + # The repo name as used in 22 + # https://github.com/nix-community/NUR/blob/master/repos.json 23 + nurRepo: 24 + - <YOUR_REPO_NAME> 25 + # Set this to cache your build results in cachix for faster builds 26 + # in CI and for everyone who uses your cache. 27 + # 28 + # Format: Your cachix cache host name without the ".cachix.org" suffix. 29 + # Example: mycache (for mycache.cachix.org) 30 + # 31 + # For this to work, you also need to set the CACHIX_SIGNING_KEY or 32 + # CACHIX_AUTH_TOKEN secret in your repository secrets settings in 33 + # Github found at 34 + # https://github.com/<your_githubname>/nur-packages/settings/secrets 35 + cachixName: 36 + - <YOUR_CACHIX_NAME> 37 + nixPath: 38 + - nixpkgs=https://github.com/NixOS/nixpkgs/archive/refs/heads/nixpkgs-unstable.tar.gz 39 + - nixpkgs=https://github.com/NixOS/nixpkgs/archive/refs/heads/nixos-unstable.tar.gz 40 + - nixpkgs=https://github.com/NixOS/nixpkgs/archive/refs/heads/nixos-25.05.tar.gz 41 + runs-on: ubuntu-latest 42 + steps: 43 + - name: Checkout repository 44 + uses: actions/checkout@v5 45 + - name: Install nix 46 + uses: cachix/install-nix-action@v31 47 + with: 48 + nix_path: "${{ matrix.nixPath }}" 49 + extra_nix_config: | 50 + experimental-features = nix-command flakes 51 + access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} 52 + - name: Show nixpkgs version 53 + run: nix-instantiate --eval -E '(import <nixpkgs> {}).lib.version' 54 + - name: Setup cachix 55 + uses: cachix/cachix-action@v16 56 + # Don't replace <YOUR_CACHIX_NAME> here! 57 + if: ${{ matrix.cachixName != '<YOUR_CACHIX_NAME>' }} 58 + with: 59 + name: ${{ matrix.cachixName }} 60 + signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}' 61 + authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' 62 + - name: Check evaluation 63 + run: | 64 + nix-env -f . -qa \* --meta --xml \ 65 + --allowed-uris https://static.rust-lang.org \ 66 + --option restrict-eval true \ 67 + --option allow-import-from-derivation true \ 68 + --drv-path --show-trace \ 69 + -I nixpkgs=$(nix-instantiate --find-file nixpkgs) \ 70 + -I $PWD 71 + - name: Build nix packages 72 + run: nix shell -f '<nixpkgs>' nix-build-uncached -c nix-build-uncached ci.nix -A cacheOutputs 73 + - name: Trigger NUR update 74 + # Don't replace <YOUR_REPO_NAME> here! 75 + if: ${{ matrix.nurRepo != '<YOUR_REPO_NAME>' }} 76 + run: curl -XPOST "https://nur-update.nix-community.org/update?repo=${{ matrix.nurRepo }}"
+3
.gitignore
···
··· 1 + result 2 + result-* 3 +
+22
LICENSE
···
··· 1 + MIT License 2 + 3 + Copyright (c) 2018 Francesco Gazzetta 4 + 5 + Permission is hereby granted, free of charge, to any person obtaining a copy 6 + of this software and associated documentation files (the "Software"), to deal 7 + in the Software without restriction, including without limitation the rights 8 + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 + copies of the Software, and to permit persons to whom the Software is 10 + furnished to do so, subject to the following conditions: 11 + 12 + The above copyright notice and this permission notice shall be included in all 13 + copies or substantial portions of the Software. 14 + 15 + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 + SOFTWARE. 22 +
+37
README.md
···
··· 1 + # nur-packages-template 2 + 3 + **A template for [NUR](https://github.com/nix-community/NUR) repositories** 4 + 5 + ## Setup 6 + 7 + 1. Click on [Use this template](https://github.com/nix-community/nur-packages-template/generate) to start a repo based on this template. (Do _not_ fork it.) 8 + 2. Add your packages to the [pkgs](./pkgs) directory and to 9 + [default.nix](./default.nix) 10 + * Remember to mark the broken packages as `broken = true;` in the `meta` 11 + attribute, or travis (and consequently caching) will fail! 12 + * Library functions, modules and overlays go in the respective directories 13 + 3. Choose your CI: Depending on your preference you can use github actions (recommended) or [Travis ci](https://travis-ci.com). 14 + - Github actions: Change your NUR repo name and optionally add a cachix name in [.github/workflows/build.yml](./.github/workflows/build.yml) and change the cron timer 15 + to a random value as described in the file 16 + - Travis ci: Change your NUR repo name and optionally your cachix repo name in 17 + [.travis.yml](./.travis.yml). Than enable travis in your repo. You can add a cron job in the repository settings on travis to keep your cachix cache fresh 18 + 5. Change your travis and cachix names on the README template section and delete 19 + the rest 20 + 6. [Add yourself to NUR](https://github.com/nix-community/NUR#how-to-add-your-own-repository) 21 + 22 + ## README template 23 + 24 + # nur-packages 25 + 26 + **My personal [NUR](https://github.com/nix-community/NUR) repository** 27 + 28 + <!-- Remove this if you don't use github actions --> 29 + ![Build and populate cache](https://github.com/<YOUR-GITHUB-USER>/nur-packages/workflows/Build%20and%20populate%20cache/badge.svg) 30 + 31 + <!-- 32 + Uncomment this if you use travis: 33 + 34 + [![Build Status](https://travis-ci.com/<YOUR_TRAVIS_USERNAME>/nur-packages.svg?branch=master)](https://travis-ci.com/<YOUR_TRAVIS_USERNAME>/nur-packages) 35 + --> 36 + [![Cachix Cache](https://img.shields.io/badge/cachix-<YOUR_CACHIX_CACHE_NAME>-blue.svg)](https://<YOUR_CACHIX_CACHE_NAME>.cachix.org) 37 +
+56
ci.nix
···
··· 1 + # This file provides all the buildable and cacheable packages and 2 + # package outputs in your package set. These are what gets built by CI, 3 + # so if you correctly mark packages as 4 + # 5 + # - broken (using `meta.broken`), 6 + # - unfree (using `meta.license.free`), and 7 + # - locally built (using `preferLocalBuild`) 8 + # 9 + # then your CI will be able to build and cache only those packages for 10 + # which this is possible. 11 + 12 + { pkgs ? import <nixpkgs> { } }: 13 + 14 + with builtins; 15 + let 16 + isReserved = n: n == "lib" || n == "overlays" || n == "modules"; 17 + isDerivation = p: isAttrs p && p ? type && p.type == "derivation"; 18 + isBuildable = p: let 19 + licenseFromMeta = p.meta.license or []; 20 + licenseList = if builtins.isList licenseFromMeta then licenseFromMeta else [licenseFromMeta]; 21 + in !(p.meta.broken or false) && builtins.all (license: license.free or true) licenseList; 22 + isCacheable = p: !(p.preferLocalBuild or false); 23 + shouldRecurseForDerivations = p: isAttrs p && p.recurseForDerivations or false; 24 + 25 + nameValuePair = n: v: { name = n; value = v; }; 26 + 27 + concatMap = builtins.concatMap or (f: xs: concatLists (map f xs)); 28 + 29 + flattenPkgs = s: 30 + let 31 + f = p: 32 + if shouldRecurseForDerivations p then flattenPkgs p 33 + else if isDerivation p then [ p ] 34 + else [ ]; 35 + in 36 + concatMap f (attrValues s); 37 + 38 + outputsOf = p: map (o: p.${o}) p.outputs; 39 + 40 + nurAttrs = import ./default.nix { inherit pkgs; }; 41 + 42 + nurPkgs = 43 + flattenPkgs 44 + (listToAttrs 45 + (map (n: nameValuePair n nurAttrs.${n}) 46 + (filter (n: !isReserved n) 47 + (attrNames nurAttrs)))); 48 + 49 + in 50 + rec { 51 + buildPkgs = filter isBuildable nurPkgs; 52 + cachePkgs = filter isCacheable buildPkgs; 53 + 54 + buildOutputs = concatMap outputsOf buildPkgs; 55 + cacheOutputs = concatMap outputsOf cachePkgs; 56 + }
+20
default.nix
···
··· 1 + # This file describes your repository contents. 2 + # It should return a set of nix derivations 3 + # and optionally the special attributes `lib`, `modules` and `overlays`. 4 + # It should NOT import <nixpkgs>. Instead, you should take pkgs as an argument. 5 + # Having pkgs default to <nixpkgs> is fine though, and it lets you use short 6 + # commands such as: 7 + # nix-build -A mypackage 8 + 9 + { pkgs ? import <nixpkgs> { } }: 10 + 11 + { 12 + # The `lib`, `modules`, and `overlays` names are special 13 + lib = import ./lib { inherit pkgs; }; # functions 14 + modules = import ./modules; # NixOS modules 15 + overlays = import ./overlays; # nixpkgs overlays 16 + 17 + example-package = pkgs.callPackage ./pkgs/example-package { }; 18 + # some-qt5-package = pkgs.libsForQt5.callPackage ./pkgs/some-qt5-package { }; 19 + # ... 20 + }
+27
flake.lock
···
··· 1 + { 2 + "nodes": { 3 + "nixpkgs": { 4 + "locked": { 5 + "lastModified": 1712449641, 6 + "narHash": "sha256-U9DDWMexN6o5Td2DznEgguh8TRIUnIl9levmit43GcI=", 7 + "owner": "NixOS", 8 + "repo": "nixpkgs", 9 + "rev": "600b15aea1b36eeb43833a50b0e96579147099ff", 10 + "type": "github" 11 + }, 12 + "original": { 13 + "owner": "NixOS", 14 + "ref": "nixpkgs-unstable", 15 + "repo": "nixpkgs", 16 + "type": "github" 17 + } 18 + }, 19 + "root": { 20 + "inputs": { 21 + "nixpkgs": "nixpkgs" 22 + } 23 + } 24 + }, 25 + "root": "root", 26 + "version": 7 27 + }
+14
flake.nix
···
··· 1 + { 2 + description = "My personal NUR repository"; 3 + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; 4 + outputs = { self, nixpkgs }: 5 + let 6 + forAllSystems = nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed; 7 + in 8 + { 9 + legacyPackages = forAllSystems (system: import ./default.nix { 10 + pkgs = import nixpkgs { inherit system; }; 11 + }); 12 + packages = forAllSystems (system: nixpkgs.lib.filterAttrs (_: v: nixpkgs.lib.isDerivation v) self.legacyPackages.${system}); 13 + }; 14 + }
+7
lib/default.nix
···
··· 1 + { pkgs }: 2 + 3 + with pkgs.lib; { 4 + # Add your library functions here 5 + # 6 + # hexint = x: hexvals.${toLower x}; 7 + }
+5
modules/default.nix
···
··· 1 + { 2 + # Add your NixOS modules here 3 + # 4 + # my-module = ./my-module; 5 + }
+15
overlay.nix
···
··· 1 + # You can use this file as a nixpkgs overlay. This is useful in the 2 + # case where you don't want to add the whole NUR namespace to your 3 + # configuration. 4 + 5 + self: super: 6 + let 7 + isReserved = n: n == "lib" || n == "overlays" || n == "modules"; 8 + nameValuePair = n: v: { name = n; value = v; }; 9 + nurAttrs = import ./default.nix { pkgs = super; }; 10 + 11 + in 12 + builtins.listToAttrs 13 + (map (n: nameValuePair n nurAttrs.${n}) 14 + (builtins.filter (n: !isReserved n) 15 + (builtins.attrNames nurAttrs)))
+5
overlays/default.nix
···
··· 1 + { 2 + # Add your overlays here 3 + # 4 + # my-overlay = import ./my-overlay; 5 + }
+9
pkgs/example-package/default.nix
···
··· 1 + { stdenv }: 2 + 3 + stdenv.mkDerivation rec { 4 + name = "example-package-${version}"; 5 + version = "1.0"; 6 + src = ./.; 7 + buildPhase = "echo echo Hello World > example"; 8 + installPhase = "install -Dm755 example $out"; 9 + }