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

Update core #276

Merged
merged 107 commits into from
May 15, 2021
Merged
Show file tree
Hide file tree
Changes from 103 commits
Commits
Show all changes
107 commits
Select commit Hold shift + click to select a range
b7bcaea
Update evalArgs to match the new planned api
Apr 12, 2021
8d0c036
Merge pull request #239 from Pacman99/evalargs-next
Pacman99 Apr 12, 2021
2b70cd3
fix some small bugs in mkFlake/evalArgs
Apr 12, 2021
0db2bb0
add old evalArgs as evalOldArgs, so flake works
Apr 13, 2021
863c176
libtests: outfactor in preparation of lib/flake.nix
Apr 18, 2021
5f89d27
ref: extract lib into subflake
Apr 2, 2021
21a03fa
fixup: nix flake check I / X
Apr 18, 2021
6116779
fixup: nix flake check II / II
Apr 18, 2021
19c900e
workarround for unkown problem
Apr 18, 2021
c241996
fixup: distinguish self and userSelf
Apr 18, 2021
fb6c6ba
fix: update devos in flake.lock
Apr 19, 2021
16b3fad
ref: merge dev into lib
Apr 18, 2021
cd7fb4f
ref: flatten out inputs
Apr 18, 2021
6cccb55
ref: userSelf -> userFlakeSelf
Apr 19, 2021
9dca402
ref: make onion with flake-utils
Apr 18, 2021
be924bc
ref: reduce exposure to callLibs
Apr 18, 2021
40acfd1
use: makeExtensible
Apr 19, 2021
6f0392b
ref: cave out instances of userFLake dependencies and intject them as
Apr 19, 2021
362cc31
fix: constructors of mkFlake function family
Apr 19, 2021
8134350
ref: simplify pkgs-lib deps injection
Apr 19, 2021
a714cf4
fix: various left-overs
Apr 19, 2021
239386b
Merge branch 'core' into api-next
Apr 19, 2021
24dbb2b
add mkFlakeDoc to pkgs-lib to build options doc
Apr 12, 2021
a44fcf6
Merge pull request #251 from divnix/api-next
Apr 22, 2021
f3defb4
used coercedTo for typing and improve options
Apr 12, 2021
8fdd668
Merge pull request #255 from Pacman99/type-improvements
Pacman99 Apr 22, 2021
eea4e40
ref: config -> hosts | nixos -> os
Apr 22, 2021
3322bf5
Merge pull request #256 from blaggacao/da/renamings
Pacman99 Apr 22, 2021
fe9ba26
evalArgs: cleanup module and type references
Apr 24, 2021
eab0bf0
lib: one line for arguments, drop userFlake*
Apr 24, 2021
f702ca1
Merge pull request #260 from Pacman99/format-fixes
Pacman99 Apr 24, 2021
1cd4ed1
mkFlakeDoc: move to packages output
Apr 24, 2021
a53aa8b
lib: drop jobs output, prefer checks and packages
Apr 24, 2021
e6f548e
Merge pull request #262 from Pacman99/simplify-mkflakedoc
Pacman99 Apr 24, 2021
2d9ea0d
lib: init modules and move mkHosts modules there
Apr 24, 2021
4e28ec2
devosSystem: fix iso build - can't remove core
Apr 24, 2021
58c7d04
extract iso/hm config modules to lib.modules
Apr 24, 2021
60bfb24
Merge pull request #263 from Pacman99/devos-modules
Pacman99 Apr 24, 2021
2cab5b5
add and use lib.collectProfiles
Apr 26, 2021
c0d6453
Merge pull request #265 from Pacman99/collect-profiles
Pacman99 Apr 26, 2021
abd133c
make devosSystem construct a proper nixos builder
Apr 25, 2021
59383e8
modules: drop any logic already done by fup
Apr 25, 2021
ba01aa7
mkSuites: generalize for one profile/suite pair
Apr 26, 2021
3986cc4
pkgs-lib: don't system space functions
Apr 25, 2021
ceef514
init unifyOverlays: to pass channels to overlays
Apr 25, 2021
377381d
export pathsIn in lib and update devos input
Apr 26, 2021
3bb2633
switch to flake-utils-plus staging for rebase
Apr 25, 2021
f8315a2
evalArgs: general api improvements
Apr 25, 2021
dceac02
implement mkFlake for new api and rebase on fup
Apr 25, 2021
c3d8805
update devos template to use new api
Apr 22, 2021
9f31d5d
mkFlake: use inputs argument not self.inputs
Apr 26, 2021
37820fc
explain overlay exporting inputs workaround
Apr 26, 2021
b766c69
add pkgs overlay, pkgs.overlay is just for srcs
Apr 26, 2021
2a7d9e7
fix suites test to match new mkSuites
Apr 26, 2021
ffe4836
update doc to match new template format and logic
Apr 27, 2021
a6344fa
update fup to fix infinite recursion error
Apr 27, 2021
b6c00e7
set add self and hosts module arguments
Apr 27, 2021
e967533
add cachix to base suite
Apr 27, 2021
278ae0e
set _module.check in evalArgs instead of mkFlake
Apr 27, 2021
c41d3ee
drop debugging related mkFlakeConfig output
Apr 27, 2021
064ba88
improve, build, and add mkFlake options doc
Apr 27, 2021
466304c
improve passing host and channel arguments to fup
Apr 27, 2021
7f3116c
safeReadDir: conver path to string for reliability
Apr 27, 2021
f57840d
mkFlake/default.nix: formatting
Apr 27, 2021
e67b49c
auto-flatten coercedListOf and type fixes
Apr 27, 2021
d527619
move overrides.nix to overlays
Apr 27, 2021
a7cd35e
update lib subflake lock
Apr 27, 2021
df39cb6
rebuild and update mkFlakeOptions.md
Apr 27, 2021
aa825b8
auto import hosts in flake.nix
Apr 27, 2021
bb9bc02
fix channels.*.input defaultText formatting
Apr 27, 2021
5bc88ad
don't use lockfile to get flake-compat
Apr 27, 2021
62c9b12
Merge pull request #264 from divnix/api-next
Pacman99 Apr 27, 2021
a5dcb5f
fix flake by removing flake-compat follows
Apr 28, 2021
23ee58d
use __dontExport property for lib and overrides
Apr 29, 2021
e1f1872
Merge pull request #268 from Pacman99/dontexport
Pacman99 Apr 29, 2021
e98e595
pass builderArgs to config and extract builds
Apr 28, 2021
378107f
Merge pull request #266 from Pacman99/extract-builds
Pacman99 May 2, 2021
e97e916
lib: init generators section
May 2, 2021
c93e9fd
lib: init importers section
May 2, 2021
e837aaa
lib: remove devos section
May 2, 2021
496348b
lib: update namespaces and cleanup exports
May 2, 2021
197d792
update to new lib format
May 2, 2021
30412b1
Merge pull request #271 from Pacman99/lib-rearrange
Pacman99 May 2, 2021
deb47db
move otherArguments to right side of merge
May 2, 2021
7bf605d
lib/modules: pull devlib module arg from pkgs
May 3, 2021
b8f7cdb
improve home-manager and deploy-rs integration
May 2, 2021
8dabd0f
switch to devlib repo and remove in-tree lib
May 5, 2021
f4cd791
add in-tree local lib, ourlib
May 5, 2021
226dd9b
Merge pull request #273 from Pacman99/devlib
Pacman99 May 5, 2021
4b4f9dc
Merge branch 'core' into develop
May 6, 2021
6e906e8
doc/extern: improve overlay filtering explanation
Pacman99 May 10, 2021
8f20bb0
doc/extern: elaborate external modules filtering
Pacman99 May 10, 2021
725e459
doc/start: fix grammar
Pacman99 May 10, 2021
8a590c9
core: use self for nixos-option compat path
May 11, 2021
0d7eb1c
doc/lib: explain ourlib usage
May 11, 2021
a081a92
flake: update devlib input
May 12, 2021
858e854
flake: update devlib input
May 12, 2021
2b73d3b
customBuilds: add TODO to drop builderArgs
May 12, 2021
3ee831f
flake.nix: explicitly append overlays from path
Pacman99 May 12, 2021
67f5451
flake: format and update to devlib api changes
May 12, 2021
c89dfed
don't import cachix in suites
May 13, 2021
7793ab4
flake: update devlib input
Pacman99 May 13, 2021
ccc0fc9
flake.nix: use `imports` for auto-import of hosts
Pacman99 May 14, 2021
923ce7f
tree: rename devlib -> digga
Pacman99 May 14, 2021
dd6c481
flake: format ourlib for consistency with digga
Pacman99 May 14, 2021
25388a0
Merge pull request #280 from Pacman99/digga
Pacman99 May 14, 2021
2f474e3
flake: update to latest digga api
Pacman99 May 14, 2021
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
47 changes: 22 additions & 25 deletions doc/concepts/extern.md
Original file line number Diff line number Diff line change
@@ -1,45 +1,42 @@
# External Art
When you need to use a module, overlay, or pass a value from one of your inputs
to the rest of your NixOS configuration, [extern][extern] is where you do it.
to the rest of your NixOS configuration, you can make use of a couple arguments.
It is encouraged to add external art directly in your `flake.nix` so the file
represents a complete dependency overview of your flake.

Modules and overlays are self explanatory, and the `specialArgs` attribute is
used to extend the arguments passed to all NixOS modules, allowing for
arbitrary values to be passed from flake inputs to the rest of your
configuration.
## Overlays
External overlays can directly be added to a channel's `overlays` list.

## Home Manager
There is also an `hmModules` attribute set for pulling home-manager modules in
from the outside world:

### Declare:
flake.nix:
```nix
{
inputs.doom-emacs.url = "github:vlaci/nix-doom-emacs";
channels.nixos.overlays = [ inputs.agenix.overlay ];
}
```
Upon exporting overlays, these overlays will be automatically filtered out by inspecting the `inputs` argument.

extern/default.nix:
## Modules
There is a dedicated `nixos.hostDefaults.externalModules` argument for external
modules.

flake.nix:
```nix
with inputs;
{
hmModules = {
doom-emacs = doom-emacs.hmModule;
};
nixos.hostDefaults.externalModules = [ inputs.agenix.nixosModules.age ];
}
```

### Use:
users/nixos/default.nix:
## Home Manager
Since there isn't a `hosts` concept for home-manager, externalModules is just a
top-level argument in the `home` namespace.

flake.nix:
```nix
{ hmModules, ... }:
{
home-manager.users.nixos = {
imports = [ hmModules.doom-emacs ] ;

programs.doom-emacs.enable = true;
};
home.externalModules = [ doom-emacs = doom-emacs.hmModule ];
}
```

[extern]: https://github.com/divnix/devos/tree/core/extern/default.nix
> ##### Note:
> To avoid declaring "external" modules separately, which is obvious since they come from `inputs`, the optimal solution would be to automatically export modules that were created in
> your flake. But this is not possible due to NixOS/nix#4740.
30 changes: 22 additions & 8 deletions doc/concepts/hosts.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,41 @@ attribute to the name of the file minus the _.nix_ extension. This is for
convenience, since `nixos-rebuild` automatically searches for a configuration
matching the current systems hostname if one is not specified explicitly.

You can set channels, systems, and add extra modules to each host by editing the
`nixos.hosts` argument in flake.nix. This is the perfect place to import
host specific modules from external sources, such as the
[nixos-hardware][nixos-hardware] repository.

It is recommended that the host modules only contain configuration information
specific to a particular piece of hardware. Anything reusable across machines
is best saved for [profile modules](./profiles.md).

This is a good place to import sets of profiles, called [suites](./suites.md),
that you intend to use on your machine.

Additionally, this is the perfect place to import anything you might need from
the [nixos-hardware][nixos-hardware] repository.

> ##### _Note:_
> Set `nixpkgs.system` to the architecture of this host, default is "x86_64-linux".
> Keep in mind that not all packages are available for all architectures.

## Example

flake.nix:
```nix
{
nixos.hosts = mkMerge [
(devos.lib.importHosts ./hosts)
{
librem = {
channelName = "latest";
modules = [ hardware.purism-librem-13v3 ];
};
}
];
}
```

hosts/librem.nix:
```nix
{ suites, hardware, ... }:
{ suites, ... }:
{
imports = suites.laptop ++ [ hardware.purism-librem-13v3 ];
imports = suites.laptop;

boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
Expand Down
54 changes: 24 additions & 30 deletions doc/concepts/overrides.md
Original file line number Diff line number Diff line change
@@ -1,47 +1,41 @@
# Overrides
By default, the NixOS systems are based on unstable. While it is trivial to
change this to a stable release, or any other branch of nixpkgs by
changing the flake url, sometimes all we want is a single package from another
branch.
Each NixOS host follows one channel. But many times it is useful to get packages
or modules from different channels.

This is what the overrides are for. By default, they are pulled directly from
nixpkgs/master, but you can change the `override` flake input url to
nixos-unstable, or even a specific sha revision.
## Packages
You can make use of `overlays/overrides.nix` to override specific packages in the
default channel to be pulled from other channels. That file is simply an example
of how any overlay can get `channels` as their first argument.

They are defined in the `extern/overrides.nix` file.
You can add overlays to any channel to override packages from other channels.

## Example

### Packages
The override packages are defined as a regular overlay with an extra arguement
`pkgs`. This refers to the packages built from the `override` flake.

Pulling the manix package from the override flake:
Pulling the manix package from the `latest` channel:
```nix
{
packages = pkgs: final: prev: {
inherit (pkgs) manix;
};
channels: final: prev: {
__dontExport = true;
inherit (pkgs.latest) manix;
}
```

### Modules
It is recommended to set the `__dontExport` property for override specific
overlays. `overlays/overrides.nix` is the best place to consolidate all package
overrides and the property is already set for you.

## Modules

You can also pull modules from override. Simply specify their path relative to
the nixpkgs [modules][nixpkgs-modules] directory. The old version will be added
to `disabledModules` and the new version imported into the configuration.
You can also pull modules from other channels. All modules have access to the
`modulesPath` for each channel as `<channelName>ModulesPath`. And you can use
`disabledModules` to remove modules from the current channel.

Pulling the zsh module from the override flake:
Pulling the zsh module from the `latest` channel:
```nix
{
modules = [ "programs/zsh/zsh.nix" ];
{ latestModulesPath }: {
modules = [ "${latestModulesPath}/programs/zsh/zsh.nix" ];
disabledModules = [ "programs/zsh/zsh.nix" ];
}
```

> ##### _Note:_
> Sometimes a modules name will change from one branch to another. This is what
> the `disabledModules` list is for. If the module name changes, the old
> version will not automatically be disabled, so simply put it's old name in
> this list to disable it.
> Sometimes a modules name will change from one branch to another.

[nixpkgs-modules]: https://github.com/NixOS/nixpkgs/tree/master/nixos/modules
8 changes: 7 additions & 1 deletion doc/concepts/suites.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@ profiles. For good examples, check out the suites defined in the community
In the future, we will use suites as a mechanism for deploying various machine
types which don't depend on hardware, such as vm's and containers.

They are defined in `profiles/suites.nix`.
They are defined with the `suites` argument in either `home` or `nixos` namespace.
Suites should be passed as a function that take profiles as an argument.

The profiles are passed based on the folder names and list passed to the relevant
`profiles` argument. In the template's flake.nix `profiles` is set as
`[ ./profiles ./users ]` and that corresponds to the `{ profiles, users }` argument
pattern.

## Definition
```nix
Expand Down
3 changes: 1 addition & 2 deletions doc/lib.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ The lib directory mirrors the upstream concepts of [`nixpkgs:./lib`][nixpkgs-lib
[`nixpkgs:./nixos/lib`][nixpkgs-nixos-lib] and [`nixpkgs:./pkgs/pkgs-lib`][nixpkgs-pkgs-lib],
but also occasionally [`nixpkgs:./pkgs/build-support`][nixpkgs-pkgs-build-support].

It comes with functions necesary to declutter `devos` itself, but you are
welcome to extend it to your needs.
All functions defined in lib can be accessed in modules and packages as `ourlib`.

For example:

Expand Down
Loading