summaryrefslogtreecommitdiff
path: root/README.md
blob: d84229172e86e8b42c67c9f9c85cb7760c6dc6fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# getchpkgs

[![Build status](https://img.shields.io/github/actions/workflow/status/getchoo/getchpkgs/ci.yaml?style=flat-square&logo=github&label=Build%20status&color=5277c3)](https://github.com/getchoo/getchpkgs/actions/workflows/ci.yaml)
[![FlakeHub](https://img.shields.io/endpoint?url=https://flakehub.com/f/getchoo/getchpkgs/badge)](https://flakehub.com/flake/getchoo/getchpkgs)

My nix expressions not quite ready for nixpkgs yet - if ever

## How to Use

### Enabling the Binary Cache

All packages are cached by [cachix](https://cachix.org). To enable it, you can run
`nix run nixpkgs#cachix use getchoo`. It may may also be used in the `nixConfig` attribute
of Flakes or in a system configuration.

<details>
<summary>Example</summary>

```nix
{
  nix.settings = {
    substituters = [ "https://getchoo.cachix.org" ];
    trusted-public-keys = [ "getchoo.cachix.org-1:ftdbAUJVNaFonM0obRGgR5+nUmdLMM+AOvDOSx0z5tE=" ];
  };
}
```

</details>

### Flake-based

Flakes are the primary method to use this repository

#### Installing Packages

You can add this repository as an input, and optionally override the nixpkgs input to build against
your own revision of nixpkgs

```nix
{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";

    darwin = {
      url = "github:LnL7/nix-darwin";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    getchpkgs = {
      url = "github:getchoo/getchpkgs";
      # this will break reproducibility, but lower the instances of nixpkgs
      # in flake.lock and possibly duplicated dependencies
      # inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs =
    { nixpkgs, getchpkgs, ... }:

    {
      nixosConfigurations.myMachine = nixpkgs.lib.nixosSystem {
        modules = [
          ./configuration.nix

          (
            { pkgs, ... }:

            let
              inherit (pkgs.stdenv.hostPlatform) system;
            in

            {
              environment.systemPackages = [
                getchpkgs.packages.${system}.treefetch
              ];
            }
          )
        ];
      };
    };
}
```

#### Ad-hoc Installation

This Flake can also be used in the base Nix package manager!

The best way to make these packages available for you is to
add it to your flake registry like so:

```console
$ nix registry add getchpkgs 'github:getchoo/getchpkgs'
$ nix profile install 'getchpkgs#treefetch'
$ nix shell 'getchpkgs#treefetch'
```

### Stable Nix

There are two main ways to use this repository with stable Nix: channels and [`npins`](https://github.com/andir/npins) (or similar)

To add the channel, run:

```console
$ nix-channel --add https://github.com/getchoo/getchpkgs/archive/main.tar.gz getcpkgs
$ nix-channel --update getchpkgs
```

To use `npins`, please view their [Getting Started guide](https://github.com/andir/npins?tab=readme-ov-file#getting-started) to initialize your project.
After, run:

```console
$ npins add github getchoo getchpkgs
```

#### Installing Packages

```nix
{ pkgs, ... }:

let
  # If you use channels
  getcpkgs = import <getchpkgs> {
    # Add this if you want to use your own nixpkgs
    inherit pkgs;
  };

  # Or if you use `npins`
  # sources = import ./npins;
  # getchoo = import sources.getchpkgs { };
in

{
  environment.systemPackages = [ getchpkgs.treefetch ];
}
```

#### Ad-hoc Installation

Channels are the recommended method of adhoc-installation and usage. After adding it with the command above, you can use it like so:

```console
$ nix-env -f '<getchpkgs>' -iA treefetch
$ nix-shell '<getchpkgs>' -p treefetch
```