summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorseth <[email protected]>2024-05-22 19:40:55 -0400
committerseth <[email protected]>2024-05-22 17:50:16 -0600
commit2709dd24a25fe667728544b79390ca7bda48c8b8 (patch)
treeb6fba8f0b7acc37831065c235c80a8b43db0338d
parentd49db6e7118ac34b18d32b59bba6785eb716a004 (diff)
remove overlay
https://zimbatm.com/notes/1000-instances-of-nixpkgs and i don't really use them :shrug:
-rw-r--r--README.md124
-rw-r--r--default.nix33
-rw-r--r--flake.nix7
-rw-r--r--overlay.nix18
4 files changed, 41 insertions, 141 deletions
diff --git a/README.md b/README.md
index e44cdf8..3cbaf67 100644
--- a/README.md
+++ b/README.md
@@ -27,8 +27,7 @@ of flakes or in a system configuration.
### flake-based
-flakes are the primary supported method to use this repository - and in my opinion, can offer a much
-nicer user experience :)
+flakes are the primary method to use this repository
#### installing packages
@@ -48,6 +47,8 @@ your own revision of nixpkgs
# this will break reproducibility, but lower the instances of nixpkgs
# in flake.lock and possibly duplicated dependencies
# inputs.nixpkgs.follows = "nixpkgs";
+ # if you want to save some space
+ # inputs.flake-checks.follows = "";
};
};
@@ -72,53 +73,6 @@ your own revision of nixpkgs
}
```
-<details>
-<summary>using the overlay</summary>
-
-the overlay (though not preferred for the sake of reproducibility) is also an
-option for those who want to avoid the verbosity of installing packages directly,
-a "plug-n-play" solution to using the packages, and/or a reduction in duplicated dependencies.
-
-```nix
-{
- inputs = {
- nixpkgs.url = "nixpkgs/nixos-unstable";
- darwin = {
- url = "github:LnL7/nix-darwin";
- inputs.nixpkgs.follows = "nixpkgs";
- };
- getchoo = {
- url = "github:getchoo/nix-exprs";
- # this should probably be used in this scenario as reproducibility is
- # already broken by using an overlay
- inputs.nixpkgs.follows = "nixpkgs";
- };
- };
-
- outputs = {
- nixpkgs,
- getchoo,
- ...
- }: {
- nixosConfigurations.hostname = nixpkgs.lib.nixosSystem {
- system = "x86_64-linux";
- modules = [
- ./configuration.nix
-
- ({pkgs, ...}: {
- nixpkgs.overlays = [getchoo.overlays.default];
- environment.systemPackages = with pkgs; [
- treefetch
- ];
- })
- ];
- };
- };
-}
-```
-
-</details>
-
#### ad-hoc installation
this flake can also be used in the base nix package manager!
@@ -132,13 +86,9 @@ nix profile install getchoo#treefetch
nix shell getchoo#cfspeedtest
```
-### standard nix
-
-this repository uses [flake-compat](https://github.com/edolstra/flake-compat) to allow for non-flake environments to use the packages provided.
+### stable nix
-there are two ways to do this: through channels or `fetchTarball` (or similar functions). i personally recommend
-channels as they are the easiest to update - though if you want to pin a specific revision of this repository,
-`fetchTarball` would probably be a better alternative.
+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:
@@ -148,75 +98,33 @@ nix-channel --update getchoo
```
-to use `fetchTarball`, please view the [documentation](https://nixos.org/manual/nix/stable/language/builtins.html?highlight=fetchtarball#builtins-fetchTarball) as there are a fair number of ways to use it.
-at it's most basic, you could use this:
+to use `npins`, please view the [getting started guide](https://github.com/andir/npins?tab=readme-ov-file#getting-started) to initialize your project.
+after, run:
-```nix
-{
- getchoo = import (builtins.fetchTarball "https://github.com/getchoo/nix-exprs/archive/main.tar.gz");
-}
+```sh
+npins add --name getchoo github getchoo nix-exprs
```
#### installing packages
```nix
-{pkgs, ...}: let
- # if you use channels
- getchoo = import <getchoo>;
-
- # or if you use `fetchTarball`
- # getchoo = import (builtins.fetchTarball "https://github.com/getchoo/nix-exprs/archive/main.tar.gz");
-in {
- environment.systemPackages = [getchoo.packages.${pkgs.system}.treefetch];
-}
-```
-
-<details>
-<summary>with the overlay</summary>
-
-```nix
-{pkgs, ...}: let
+{ pkgs, ... }: let
# if you use channels
getchoo = import <getchoo>;
- # or if you use `fetchTarball`
- # getchoo = import (builtins.fetchTarball "https://github.com/getchoo/nix-exprs/archive/main.tar.gz");
+ # or if you use `npins`
+ # sources = import ./npins;
+ # getchoo = import sources.getchoo;
in {
- nixpkgs.overlays = [getchoo.overlays.default];
- environment.systemPackages = [pkgs.treefetch];
+ environment.systemPackages = [ getchoo.treefetch ];
}
```
-</details>
-
#### ad-hoc installation
-there are two ways to use ad-hoc commands: through channels or `overlays.nix`.
-
-channels are again then the preferred method here, where once it's added it can be used
-like so:
+channels are the recommended method of adhoc-installation and usage. after adding it with the command above, you can use it like so:
```sh
-nix-env -f '<getchoo>' -iA getchoo.packages.x86_64-linux.treefetch # replace x86_64-linux with your system
+nix-env -f '<getchoo>' -iA treefetch
nix-shell '<getchoo>' -p treefetch
```
-
-<details>
-<summary>overlays.nix</summary>
-
-for those who don't want to use this flake's revision of nixpkgs - or have the verbosity
-of the `flake-compat` provided commands - `overlays.nix` is a good option.
-
-in `~/.config/nixpkgs/overlays.nix`:
-
-```nix
-let
- # if you use channels
- getchoo = import <getchoo>;
-
- # or if you use `fetchTarball`
- # getchoo = import (builtins.fetchTarball "https://github.com/getchoo/nix-exprs/archive/main.tar.gz");
-in [getchoo.overlays.default]
-```
-
-</details>
diff --git a/default.nix b/default.nix
index 8e74c61..4338ecf 100644
--- a/default.nix
+++ b/default.nix
@@ -1,20 +1,35 @@
let
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
- nixpkgs' = fetchTarball {
- url = lock.nodes.nixpkgs.locked.url or "https://github.com/NixOS/nixpkgs/archive/${lock.nodes.nixpkgs.locked.rev}.tar.gz";
- sha256 = lock.nodes.nixpkgs.locked.narHash;
- };
in
{
- nixpkgs ?
- import nixpkgs' {
+ pkgs ?
+ import nixpkgs {
config = {};
overlays = [];
inherit system;
},
+ lib ? pkgs.lib,
+ nixpkgs ? (fetchTarball {
+ url = "https://github.com/NixOS/nixpkgs/archive/${lock.nodes.nixpkgs.locked.rev}.tar.gz";
+ sha256 = lock.nodes.nixpkgs.locked.narHash;
+ }),
system ? builtins.currentSystem,
}: let
- # fixed point wizardry
- pkgs' = import ./overlay.nix (nixpkgs // pkgs') nixpkgs;
+ inherit (pkgs) callPackage;
in
- pkgs'
+ lib.fix (final:
+ lib.packagesFromDirectoryRecursive {
+ inherit callPackage;
+ directory = ./pkgs;
+ }
+ // {
+ clang-tidy-sarif = callPackage ./pkgs/clang-tidy-sarif/package.nix {inherit (final) clang-tidy-sarif;};
+ clippy-sarif = callPackage ./pkgs/clippy-sarif/package.nix {inherit (final) clippy-sarif;};
+ hadolint-sarif = callPackage ./pkgs/hadolint-sarif/package.nix {inherit (final) hadolint-sarif;};
+ sarif-fmt = callPackage ./pkgs/sarif-fmt/package.nix {inherit (final) sarif-fmt;};
+
+ flat-manager = callPackage ./pkgs/flat-manager/package.nix {inherit (final) flat-manager;};
+ flat-manager-client = callPackage ./pkgs/flat-manager-client/package.nix {inherit (final) flat-manager;};
+
+ papa = callPackage ./pkgs/papa/package.nix {inherit (final) papa;};
+ })
diff --git a/flake.nix b/flake.nix
index 486dd4f..5775907 100644
--- a/flake.nix
+++ b/flake.nix
@@ -56,18 +56,13 @@
isValid = _: v:
lib.elem pkgs.system (v.meta.platforms or [pkgs.system]) && !(v.meta.broken or false);
- pkgs' = lib.filterAttrs isValid (import ./. {
- nixpkgs = pkgs;
- inherit system;
- });
+ pkgs' = lib.filterAttrs isValid (import ./. {inherit pkgs;});
in
pkgs' // {default = pkgs'.treefetch;}
);
formatter = forAllSystems (pkgs: pkgs.alejandra);
- overlays.default = final: prev: import ./overlay.nix final prev;
-
templates = import ./templates;
};
}
diff --git a/overlay.nix b/overlay.nix
deleted file mode 100644
index 2d2c2b2..0000000
--- a/overlay.nix
+++ /dev/null
@@ -1,18 +0,0 @@
-final: prev: let
- inherit (prev) callPackage;
-in
- prev.lib.packagesFromDirectoryRecursive {
- inherit callPackage;
- directory = ./pkgs;
- }
- // {
- clang-tidy-sarif = callPackage ./pkgs/clang-tidy-sarif/package.nix {inherit (final) clang-tidy-sarif;};
- clippy-sarif = callPackage ./pkgs/clippy-sarif/package.nix {inherit (final) clippy-sarif;};
- hadolint-sarif = callPackage ./pkgs/hadolint-sarif/package.nix {inherit (final) hadolint-sarif;};
- sarif-fmt = callPackage ./pkgs/sarif-fmt/package.nix {inherit (final) sarif-fmt;};
-
- flat-manager = callPackage ./pkgs/flat-manager/package.nix {inherit (final) flat-manager;};
- flat-manager-client = callPackage ./pkgs/flat-manager-client/package.nix {inherit (final) flat-manager;};
-
- papa = callPackage ./pkgs/papa/package.nix {inherit (final) papa;};
- }