Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sources per nvfetcher (family) #328

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ doc/index.html
vm
iso
doi

pkgs/_sources/.shake*
28 changes: 15 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ following giants][giants]:
### :family: — like family
- [`numtide/devshell`][devshell]
- [`serokell/deploy-rs`][deploy]
- [`berberman/nvfetcher`][nvfetcher]
- [`NixOS/nixpkgs`][nixpkgs]

:heart:
Expand All @@ -94,22 +95,23 @@ goals are sufficiently upstreamed into "the Nix", dissolved.
# License
DevOS is licensed under the [MIT License][mit].

[mk-flake]: https://github.com/divnix/digga/tree/master/src/mkFlake
[nixpkgs]: https://github.com/NixOS/nixpkgs
[community]: https://github.com/divnix/devos/tree/community
[core]: https://github.com/divnix/devos
[deploy]: https://github.com/serokell/deploy-rs
[toc]: https://github.com/divnix/devos/blob/core/flake.nix
[giants]: https://en.wikipedia.org/wiki/Standing_on_the_shoulders_of_giants
[devshell]: https://github.com/numtide/devshell
[digga]: https://github.com/divnix/digga
[fup]: https://github.com/gytis-ivaskevicius/flake-utils-plus
[dotfiles]: https://github.com/hlissner/dotfiles
[flake-doc]: https://github.com/NixOS/nix/blob/master/src/nix/flake.md
[flakes]: https://nixos.wiki/wiki/Flakes
[fu]: https://github.com/numtide/flake-utils
[devshell]: https://github.com/numtide/devshell
[nix]: https://nixos.org/manual/nix/stable
[fup]: https://github.com/gytis-ivaskevicius/flake-utils-plus
[giants]: https://en.wikipedia.org/wiki/Standing_on_the_shoulders_of_giants
[home-manager]: https://nix-community.github.io/home-manager
[mit]: https://mit-license.org
[mk-flake]: https://github.com/divnix/digga/tree/master/src/mkFlake
[nix]: https://nixos.org/manual/nix/stable
[nixos]: https://nixos.org/manual/nixos/stable
[home-manager]: https://nix-community.github.io/home-manager
[flakes]: https://nixos.wiki/wiki/Flakes
[flake-doc]: https://github.com/NixOS/nix/blob/master/src/nix/flake.md
[core]: https://github.com/divnix/devos
[community]: https://github.com/divnix/devos/tree/community
[dotfiles]: https://github.com/hlissner/dotfiles
[nixpkgs]: https://github.com/NixOS/nixpkgs
[nvfetcher]: https://github.com/berberman/nvfetcher
[please]: https://github.com/nrdxp/devos/tree/nrd
[toc]: https://github.com/divnix/devos/blob/core/flake.nix
1 change: 1 addition & 0 deletions doc/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,6 @@
- [Integrations](./integrations/index.md)
- [Cachix](./integrations/cachix.md)
- [Deploy RS](./integrations/deploy.md)
- [NvFetcher](./integrations/nvfetcher.md)
- [Hercules CI](./integrations/hercules.md)
- [Contributing](./CONTRIBUTING.md)
43 changes: 43 additions & 0 deletions doc/integrations/nvfetcher.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# nvfetcher
[NvFetcher][nvf] is a workflow companion for updating nix sources.

You can specify an origin source and an update configuration, and
nvfetcher can for example track updates to a specific branch and
automatically update your nix sources configuration on each run
to the tip of that branch.

All package source declaration is done in [sources.toml][sources.toml].

From within the devshell of this repo, run `nvfetcher`, a wrapped
version of `nvfetcher` that knows where to find and place its files
and commit the results.

## Usage

Statically fetching (not tracking) a particular tag from a github repo:
```toml
[manix]
src.manual = "v0.6.3"
fetch.github = "mlvzk/manix"
```

Tracking the latest github _release_ from a github repo:
```toml
[manix]
src.github = "mlvzk/manix" # responsible for tracking
fetch.github = "mlvzk/manix" # responsible for fetching
```

Tracking the latest commit of a git repository and fetch from a git repo:
```toml
[manix]
src.git = "https://github.com/mlvzk/manix.git" # responsible for tracking
fetch.git = "https://github.com/mlvzk/manix.git" # responsible for fetching
```

> ##### _Note:_
> Please refer to the [NvFetcher Readme][nvf-readme] for more options.

[nvf: https://github.com/berberman/nvfetcher
[nvf-readme]: https://github.com/berberman/nvfetcher#readme
[sources.toml]: https://github.com/divnix/devos/tree/core/pkgs/sources.toml
53 changes: 45 additions & 8 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 12 additions & 6 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,20 @@
agenix.inputs.nixpkgs.follows = "latest";
nixos-hardware.url = "github:nixos/nixos-hardware";

pkgs.url = "path:./pkgs";
pkgs.inputs.nixpkgs.follows = "nixos";
nvfetcher-flake.url = "github:berberman/nvfetcher";
nvfetcher-flake.inputs.nixpkgs.follows = "latest";
};

outputs =
{ self
, pkgs
, digga
, nixos
, ci-agent
, home
, nixos-hardware
, nur
, agenix
, nvfetcher-flake
, ...
} @ inputs:
digga.lib.mkFlake {
Expand All @@ -46,10 +46,10 @@
nixos = {
imports = [ (digga.lib.importers.overlays ./overlays) ];
overlays = [
./pkgs/default.nix
pkgs.overlay # for `srcs`
nur.overlay
agenix.overlay
nvfetcher-flake.overlay
./pkgs/default.nix
];
};
latest = { };
Expand Down Expand Up @@ -106,7 +106,13 @@
};

devshell.externalModules = { pkgs, ... }: {
packages = [ pkgs.agenix ];
commands = [
{ package = pkgs.agenix; category = "secrets"; }
{
name = pkgs.nvfetcher-bin.pname;
help = pkgs.nvfetcher-bin.meta.description;
command = "cd $DEVSHELL_ROOT/pkgs; ${pkgs.nvfetcher-bin}/bin/nvfetcher -c ./sources.toml $@"; }
];
};

homeConfigurations = digga.lib.mkHomeConfigurations self.nixosConfigurations;
Expand Down
5 changes: 5 additions & 0 deletions overlays/manix.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
final: prev: {
manix = prev.manix.overrideAttrs (o: rec{
inherit (prev.sources.manix) pname version src;
});
}
1 change: 0 additions & 1 deletion overlays/overrides.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ channels: final: prev: {
dhall
discord
element-desktop
manix
rage
nixpkgs-fmt
qutebrowser
Expand Down
17 changes: 17 additions & 0 deletions pkgs/_sources/generated.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# This file was generated by nvfetcher, please do not modify it manually.
{ fetchgit, fetchurl }:
{
manix = {
pname = "manix";
version = "v0.6.3";
src = fetchgit {
url = "https://github.com/mlvzk/manix";
rev = "v0.6.3";
fetchSubmodules = false;
deepClone = false;
leaveDotGit = false;
sha256 = "1b7xi8c2drbwzfz70czddc4j33s7g1alirv12dwl91hbqxifx8qs";
};

};
}
6 changes: 5 additions & 1 deletion pkgs/default.nix
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
final: prev: { }
final: prev: {
# keep sources this first
sources = prev.callPackage (import ./sources.nix) { };
# then, call packages with `final.callPackage`
}
25 changes: 0 additions & 25 deletions pkgs/flake.lock

This file was deleted.

52 changes: 0 additions & 52 deletions pkgs/flake.nix

This file was deleted.

1 change: 1 addition & 0 deletions pkgs/sources.nix
4 changes: 4 additions & 0 deletions pkgs/sources.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# nvfetcher.toml
[manix]
src.git = "https://github.com/mlvzk/manix"
fetch.github = "mlvzk/manix"