Skip to content

Commit

Permalink
Initial set of files
Browse files Browse the repository at this point in the history
  • Loading branch information
drupol committed Apr 16, 2024
0 parents commit 6f8dfb8
Show file tree
Hide file tree
Showing 27 changed files with 660 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @drupol
75 changes: 75 additions & 0 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of
experience, nationality, personal appearance, race, religion, or sexual identity
and orientation.

## Our Standards

Examples of behaviour that contributes to creating a positive environment
include:

- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members

Examples of unacceptable behaviour by participants include:

- The use of sexualized language or imagery and unwelcome sexual attention or
advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic
address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behaviour and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behaviour.

Project maintainers have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, or to ban temporarily or permanently any
contributor for other behaviours that they deem inappropriate, threatening,
offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behaviour may be
reported by contacting the project team at [email protected]. The
project team will review and investigate all complaints, and will respond in a
way that it deems appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an
incident. Further details of specific enforcement policies may be posted
separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 1.4, available at [http://contributor-covenant.org/version/1/4][version]

[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
6 changes: 6 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# CONTRIBUTING

We're using [GitHub Actions](https://docs.github.com/en/actions) as a continuous
integration system.

For details, see the workflows in [.github/workflows](../.github/workflows).
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: drupol
13 changes: 13 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## Steps required to reproduce the problem

1.
2.
3.

## Expected Result

-

## Actual Result

-
10 changes: 10 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
This PR:

- [ ] Fix ...
- [ ] Provide ...
- [ ] It breaks backward compatibility
- [ ] Is covered by tests
- [ ] Has documentation
- [ ] Is an experimental thing

Follows #. Related to #. Fixes #.
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: monthly
open-pull-requests-limit: 10
55 changes: 55 additions & 0 deletions .github/settings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# https://github.com/probot/settings

branches:
- name: main
protection:
enforce_admins: false
required_pull_request_reviews:
dismiss_stale_reviews: true
require_code_owner_reviews: true
required_approving_review_count: 1
restrictions: null
required_linear_history: true

labels:
- name: backward breaking change
color: ff0000

- name: bug
color: ee0701

- name: dependencies
color: 0366d6

- name: enhancement
color: 0e8a16

- name: experimentation
color: eeeeee

- name: question
color: cc317c

- name: new feature
color: 0e8a16

- name: security
color: ee0701

- name: stale
color: eeeeee

repository:
allow_merge_commit: true
allow_rebase_merge: true
allow_squash_merge: true
default_branch: master
description: "A template for maintaining your own Nix expressions in your own repository"
topics: nix
has_downloads: false
has_issues: true
has_pages: false
has_projects: false
has_wiki: false
name: my-own-nixpkgs
private: false
9 changes: 9 additions & 0 deletions .github/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
daysUntilStale: 60

daysUntilClose: 7

staleLabel: stale

markComment: >
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no
further activity occurs. Thank you for your contributions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
./result
./direnv
20 changes: 20 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
The MIT License (MIT)

Copyright (c) 2024 Pol Dellaiera

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.
99 changes: 99 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
[![Donate!][donate github]][github sponsors link]

# My Custom Nixpkgs Overlay

This project provides templates for creating your own collection of custom
Nix expressions, similar to what is done in [`nixpkgs`]. It includes a `default`
[overlay](https://wiki.nixos.org/wiki/Overlays) that exposes all custom
packages, facilitating their integration into other projects.

While this custom repository provides a platform for developing, integrating and
sharing your own packages, we encourage contributors to also consider submitting
their packages directly to the official [`nixpkgs`] repository. Contributing to
`nixpkgs` helps to enrich the broader Nix community by making your work
available to a wider audience and benefiting from the collective expertise of
Nix developers. However, maintaining your own repository can be advantageous for
experimental, personal, or organization-specific packages that require specific
configurations or are not yet ready for broader adoption.

## Usage

### Setting Up Your Own Repository

1. Use the `my-own-nixpkgs` template `nix flake new --template git+https://github.com/drupol/my-own-nixpkgs#my-own-nixpkgs ./my-repo` as a starting point
2. Begin adding packages to the `pkgs/by-name` directory. Follow the
same approach as adding packages in `nixpkgs` (similar to [RFC140]). Packages
added in this directory will be automatically discovered.
- Create a new directory for each package.
- Inside each directory, create a `package.nix` file.
3. Optionally, you can add packages directly to the `pkgs/` directory and
manually update the bindings in the `imports/pkgs-all.nix` file.

### Using Your Own Repository

Use the `client` template `nix flake new --template git+https://github.com/drupol/my-own-nixpkgs#client ./my-nix-project` as a starting point or follow the manual steps hereunder.

To use this repository as an overlay in another project, follow these steps:

1. **Add the Repository as an Input**:

Add the following to your `nix` file to include this repository as an input:

```nix
inputs = {
my-custom-nixpkgs.url = "repo-url"; # Replace "repo-url" with the actual URL to your repository
};
```

2. **Include the Overlay in `pkgs`**:

When constructing `pkgs`, include the overlay as follows:

```nix
pkgs = import inputs.nixpkgs {
overlays = [
inputs.my-custom-nixpkgs.overlays.default
];
};
```

3. **Use Your Packages**:

Access the packages in your project like this:

```nix
buildInputs = [ pkgs.example1 pkgs.example2 ];
```

[RFC140]: https://github.com/NixOS/rfcs/pull/140

### Examples

Refer to the dummy projects `example1` and `example2` for practical examples of
how packages can be structured.

## Going further

- Use the continuous integration service of your choice to build and test your
packages
- Add a binary cache to your repository to speed up builds and avoid
recompilation using [Cachix](https://cachix.org/)
- This project uses a flake framework, we recommend to use [flake-parts](https://flake.parts)

## Contributing

Feel free to contribute by sending pull requests. We are a usually very
responsive team and we will help you going through your pull request from the
beginning to the end.

For some reasons, if you can't contribute to the code and willing to help,
sponsoring is a good, sound and safe way to show us some gratitude for the hours
we invested in this package.

Sponsor me on [Github][github sponsors link] and/or any of [the
contributors][6].

[donate github]: https://img.shields.io/badge/Sponsor-Github-brightgreen.svg?style=flat-square
[github sponsors link]: https://github.com/sponsors/drupol
[6]: https://github.com/drupol/my-own-nixpkgs/graphs/contributors
[`nixpkgs`]: https://github.com/NixOS/nixpkgs
20 changes: 20 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
description = "Nix templates for building your own nixpkgs repository and use it";

inputs = {
flake-parts.url = "github:hercules-ci/flake-parts";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
systems.url = "github:nix-systems/default";
};

outputs =
inputs@{ flake-parts, systems, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = import systems;

imports = [
./imports/formatter.nix
./imports/templates.nix
];
};
}
17 changes: 17 additions & 0 deletions imports/formatter.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{ inputs, ... }:

{
perSystem =
{
config,
self',
inputs',
pkgs,
system,
lib,
...
}:
{
formatter = pkgs.nixfmt-rfc-style;
};
}
17 changes: 17 additions & 0 deletions imports/templates.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{ ... }:
{
flake = {
templates = {
client = {
path = ../templates/client;
description = "A basic 'client' template for getting started using your own nixpkgs repository.";
welcomeText = builtins.readFile ../templates/client/README.md;
};
my-own-nixpkgs = {
path = ../templates/my-own-nixpkgs;
description = "A basic custom nixpkgs repository for maintaining and promoting your own Nix expressions and packages.";
welcomeText = builtins.readFile ../templates/my-own-nixpkgs/README.md;
};
};
};
}
21 changes: 21 additions & 0 deletions templates/client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# My Custom Nixpkgs Overlay

This project uses [flake-parts](https://flake.parts), a flake framework to
manage Nix expressions and to some extent, packages.

## Contributing

Feel free to contribute by sending pull requests. We are a usually very
responsive team and we will help you going through your pull request from the
beginning to the end.

For some reasons, if you can't contribute to the code and willing to help,
sponsoring is a good, sound and safe way to show us some gratitude for the hours
we invested in this package.

Sponsor me on [Github][github sponsors link] and/or any of [the
contributors][6].

[donate github]: https://img.shields.io/badge/Sponsor-Github-brightgreen.svg?style=flat-square
[github sponsors link]: https://github.com/sponsors/drupol
[6]: https://github.com/drupol/my-own-nixpkgs/graphs/contributors
Loading

0 comments on commit 6f8dfb8

Please sign in to comment.