Skip to content

Commit

Permalink
💎 style Format files
Browse files Browse the repository at this point in the history
  • Loading branch information
Lord-Valen authored and blaggacao committed Nov 12, 2022
1 parent 57c2796 commit 5d15941
Show file tree
Hide file tree
Showing 85 changed files with 2,026 additions and 1,928 deletions.
8 changes: 3 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

- A quick question. [\#428](https://github.com/divnix/digga/issues/428)
- infinite recursion error related to whether a git repo exists \#408 [\#413](https://github.com/divnix/digga/issues/413)
- Support aarch64-darwin [\#335](https://github.com/divnix/digga/issues/335)
- Support aarch64-darwin [\#335](https://github.com/divnix/digga/issues/335)
- pkgs in home-manager profiles [\#309](https://github.com/divnix/digga/issues/309)
- Allow the same user profile to behave differently based on hostname [\#308](https://github.com/divnix/digga/issues/308)
- Home-manager inside ./modules or ./profiles to set user settings in a user agnostic way [\#303](https://github.com/divnix/digga/issues/303)
Expand Down Expand Up @@ -126,7 +126,7 @@

**Fixed bugs:**

- My emacsGcc overlay is not working [\#146](https://github.com/divnix/digga/issues/146)
- My emacsGcc overlay is not working [\#146](https://github.com/divnix/digga/issues/146)
- local flake registry freezes branches [\#142](https://github.com/divnix/digga/issues/142)
- nixos-option no longer works after collect garbage [\#138](https://github.com/divnix/digga/issues/138)
- Profiles imports are brittle, causing failure if imported twice [\#136](https://github.com/divnix/digga/issues/136)
Expand Down Expand Up @@ -158,6 +158,4 @@

## [07092020](https://github.com/divnix/digga/tree/07092020) (2020-07-09)



\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
\* _This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)_
30 changes: 21 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
[![NixOS](https://img.shields.io/badge/NixOS-unstable-blue.svg?style=flat&logo=NixOS&logoColor=white)](https://nixos.org)
[![Chat](https://img.shields.io/badge/chat-join%20us-brightgreen.svg?style=flat&logo=matrix&logoColor=white)](https://matrix.to/#/#devos:nixos.org)


Digga — slangy German for "good friend" — is a flake utility library
that helps you declaratively craft and manage all three layers of your system
environment within a single [nix flakes][flakes] repository:
Expand All @@ -14,28 +13,32 @@ environment within a single [nix flakes][flakes] repository:
This library is based on [flake-utils-plus][].

# Status: Beta

Although this project has already matured quite a bit, a fair amount of api polishing is still
expected. There are unstable versions (0._x_._x_) to help users keep track
of changes and progress.

# Usage

The best way to make use of library is with the [Official template][template].
Check out the [guide](./doc/start/index.md) to get up and running.
Also have a look at devos's [_flake.nix_](./examples/devos/flake.nix).
If anything is not immediately discoverable via our [`mkFlake`][mk-flake], please file a bug report.

# Examples

Make sure to check out all the [examples](./examples) to see the different ways
to make use of the digga api.

## In the Wild

You can also see digga being actually used:
* @Pacman99: [Personal](https://gitlab.com/coffeetables/lower), [Server](https://gitlab.com/coffeetables/myrdd)
* [@danielphan2003](https://github.com/danielphan2003/flk) and make sure to also check out [devos-ext-lib](https://github.com/divnix/devos-ext-lib)
* [PubSolarOS](https://git.sr.ht/~b12f/pub-solar-os)
* @montchr: [Dotfield](https://github.com/montchr/dotfield) – including darwin configurations
* [@sweenu](https://github.com/sweenu/nixfiles): pc, server and RaspberryPi deployment in one repo

- @Pacman99: [Personal](https://gitlab.com/coffeetables/lower), [Server](https://gitlab.com/coffeetables/myrdd)
- [@danielphan2003](https://github.com/danielphan2003/flk) and make sure to also check out [devos-ext-lib](https://github.com/divnix/devos-ext-lib)
- [PubSolarOS](https://git.sr.ht/~b12f/pub-solar-os)
- @montchr: [Dotfield](https://github.com/montchr/dotfield) – including darwin configurations
- [@sweenu](https://github.com/sweenu/nixfiles): pc, server and RaspberryPi deployment in one repo

# Philosophy

Expand All @@ -54,17 +57,19 @@ interface comprising four API containers that allow you to:
your projects.

## Modules, Profiles & Suites

For NixOS- & home-manager-modules, _Digga_ allows you to distinguish between
_modules_, _profiles_ and _suites_.

- **Modules** are abstract configurations that, while holding the implementation, do not
set any system state.
set any system state.

- **Profiles** are concrete configurations that set system state within the profile domain.

- **Suites** are a composable, clean and discoverable mechanism for profile aggregation.

## Internal Art vs External Art

Overlays and modules can be defined internally coming from your repo or externally
coming from an upstream flake. This distinction serves the library to only export
your own work as the public flake output.
Expand All @@ -73,6 +78,7 @@ Downstream consumers of your flake can now more easily tell your art apart from
other upstream art.

# Contributing

We encourage contributions of any kind. The simplest way to get involved is to
join the [chat][] or report problems and ideas on the [issue thread][issues].

Expand All @@ -81,19 +87,23 @@ To craft well thought out APIs we need all the thoughts regarding new ideas.
Pull Requests are just as amazing.

# Why _flakes_?
Flakes are a part of an explicit push to improve [Nix's UX](https://github.com/NixOS/nix/blob/master/doc/manual/src/contributing/cli-guideline.md), and have become an integral part of that effort.

Flakes are a part of an explicit push to improve [Nix's UX](https://github.com/NixOS/nix/blob/master/doc/manual/src/contributing/cli-guideline.md), and have become an integral part of that effort.

They also make [Nix expressions](https://nixos.org/manual/nix/unstable/expressions/expression-syntax.html) easier to distribute and reuse with convient [flake references](https://github.com/NixOS/nix/blob/master/src/nix/flake.md#flake-references) for building or using packages, modules, and whole systems.

# Shoulders

This work does not reinvent the wheel. It stands on the [shoulders of the
following giants][giants]:

## :onion: — like the layers of an onion

- [`gytis-ivaskevicius/flake-utils-plus`](https://github.com/gytis-ivaskevicius/flake-utils-plus)
- [`numtide/flake-utils`](https://github.com/numtide/flake-utils/)

## :family: — like family

- [`numtide/devshell`](https://github.com/numtide/devshell)
- [`serokell/deploy-rs`](https://github.com/serokell/deploy-rs)
- [`berberman/nvfetcher`](https://github.com/berberman/nvfetcher)
Expand All @@ -102,13 +112,15 @@ following giants][giants]:
:heart:

### Inspiration & Art

- [hlissner/dotfiles](https://github.com/hlissner/dotfiles)
- [nix-user-chroot](https://github.com/nix-community/nix-user-chroot)
- [Nickel](https://github.com/tweag/nickel)
- [Awesome Nix](https://github.com/nix-community/awesome-nix)
- [devshell](https://github.com/numtide/devshell)

# Divnix

The divnix org is an open space that spontaneously formed out of "the Nix".
It is really just a place where otherwise unrelated people work
together and get stuff done.
Expand All @@ -121,6 +133,7 @@ It might eventually become a non-profit if that's not too complicated or, if tho
goals are sufficiently upstreamed into "the Nix", dissolved.

# License

Digga is licensed under the [MIT License][mit].

[mk-flake]: ./src/mkFlake
Expand All @@ -136,4 +149,3 @@ Digga is licensed under the [MIT License][mit].
[nix]: https://nixos.org/manual/nix/stable
[nixpkgs]: https://github.com/nixos/nixpkgs
[template]: ./examples/devos

53 changes: 26 additions & 27 deletions checks/default.nix
Original file line number Diff line number Diff line change
@@ -1,39 +1,38 @@
{ system ? builtins.currentSystem
, inputs ? (import ../.).inputs
}:
let

{
system ? builtins.currentSystem,
inputs ? (import ../.).inputs,
}: let
inherit (inputs) digga nixpkgs;
lib = nixpkgs.lib // digga.lib;
pkgs = nixpkgs.legacyPackages.${system};

in
{

libTests = pkgs.runCommandNoCC "devos-lib-tests"
in {
libTests =
pkgs.runCommandNoCC "devos-lib-tests"
{
buildInputs = [
pkgs.nix
(
let tests = import ./lib { inherit pkgs lib; }; in
if tests == [ ] then null
else throw (builtins.toJSON tests)
let
tests = import ./lib {inherit pkgs lib;};
in
if tests == []
then null
else throw (builtins.toJSON tests)
)
];
} ''
datadir="${pkgs.nix}/share"
export TEST_ROOT=$(pwd)/test-tmp
export NIX_BUILD_HOOK=
export NIX_CONF_DIR=$TEST_ROOT/etc
export NIX_LOCALSTATE_DIR=$TEST_ROOT/var
export NIX_LOG_DIR=$TEST_ROOT/var/log/nix
export NIX_STATE_DIR=$TEST_ROOT/var/nix
export NIX_STORE_DIR=$TEST_ROOT/store
export PAGER=cat
cacheDir=$TEST_ROOT/binary-cache
nix-store --init
touch $out
'';
datadir="${pkgs.nix}/share"
export TEST_ROOT=$(pwd)/test-tmp
export NIX_BUILD_HOOK=
export NIX_CONF_DIR=$TEST_ROOT/etc
export NIX_LOCALSTATE_DIR=$TEST_ROOT/var
export NIX_LOG_DIR=$TEST_ROOT/var/log/nix
export NIX_STATE_DIR=$TEST_ROOT/var/nix
export NIX_STORE_DIR=$TEST_ROOT/store
export PAGER=cat
cacheDir=$TEST_ROOT/binary-cache
nix-store --init
touch $out
'';
}
39 changes: 21 additions & 18 deletions checks/lib/default.nix
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
{ pkgs, lib }:
{
pkgs,
lib,
}:
with lib;
lib.runTests {
testRakeLeaves = {
expr = rakeLeaves ./profiles;
expected = {
f = ./profiles/f.nix;
foo = ./profiles/foo;
t = {
bar = ./profiles/t/bar.nix;
lib.runTests {
testRakeLeaves = {
expr = rakeLeaves ./profiles;
expected = {
f = ./profiles/f.nix;
foo = ./profiles/foo;
t = {
bar = ./profiles/t/bar.nix;
};
};
};
};

testFlattenTree = {
expr = flattenTree (rakeLeaves ./profiles);
expected = {
f = ./profiles/f.nix;
foo = ./profiles/foo;
"t.bar" = ./profiles/t/bar.nix;
testFlattenTree = {
expr = flattenTree (rakeLeaves ./profiles);
expected = {
f = ./profiles/f.nix;
foo = ./profiles/foo;
"t.bar" = ./profiles/t/bar.nix;
};
};
};
}
}
2 changes: 1 addition & 1 deletion checks/lib/profiles/f.nix
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ }
{}
2 changes: 1 addition & 1 deletion checks/lib/profiles/t/bar.nix
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ }
{}
35 changes: 20 additions & 15 deletions default.nix
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
let
inherit (import
(
let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in
fetchTarball {
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
sha256 = lock.nodes.flake-compat.locked.narHash;
}
)
{ src = ./.; }) defaultNix;
inherit
(import
(
let
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
in
fetchTarball {
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
sha256 = lock.nodes.flake-compat.locked.narHash;
}
)
{src = ./.;})
defaultNix
;
in
# Pass this flake as inputs.digga
defaultNix // {
inputs = defaultNix.inputs // { digga = defaultNix; };
shell = import ./devShell.nix { };
}

# Pass this flake as inputs.digga
defaultNix
// {
inputs = defaultNix.inputs // {digga = defaultNix;};
shell = import ./devShell.nix {};
}
9 changes: 5 additions & 4 deletions deprecated.nix
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
{ lib, importers }:
{
lib,
importers,
}:
lib.warn ''
You are accessing a deprecated item of the digga lib.
Please update timely, it will be remove soon.
''
rec {

importModules =
lib.warn ''
Deprecated Function: lib.importModules.
Use lib.importExportableModules instead to set `exportedModules` option
''
importers.importExportableModules;

importers.importExportableModules;
}
Loading

0 comments on commit 5d15941

Please sign in to comment.