flake: pull in changes from digga upstream

See:
54ede8e591...0595ae70cd?diff=unified
b12f
teutat3s 2023-03-27 13:35:59 +02:00
parent fd7f326376
commit d0470d5aaf
Signed by untrusted user: teutat3s
GPG Key ID: 4FA1D3FA524F22C1
10 changed files with 60 additions and 66 deletions

View File

@ -5,7 +5,6 @@ let
ciSystems = [ ciSystems = [
"aarch64-linux" "aarch64-linux"
"i686-linux"
"x86_64-linux" "x86_64-linux"
]; ];

View File

@ -59,5 +59,5 @@ list of strings
_*Default*_ _*Default*_
``` ```
["aarch64-linux","aarch64-darwin","i686-linux","x86_64-darwin","x86_64-linux"] ["aarch64-linux","aarch64-darwin","x86_64-darwin","x86_64-linux"]
``` ```

View File

@ -1,5 +1,9 @@
[book] [book]
authors = ["Timothy DeHerrera"] authors = [
"Timothy DeHerrera",
"Parthiv Seetharaman",
"David Arnold",
]
language = "en" language = "en"
multilingual = false multilingual = false
src = "." src = "."

View File

@ -9,8 +9,7 @@
Users are a special case of [profiles](profiles.md) that define system Users are a special case of [profiles](profiles.md) that define system
users and [home-manager][home-manager] configurations. For your convenience, users and [home-manager][home-manager] configurations. For your convenience,
home manager is wired in by default so all you have to worry about is declaring home manager is wired in by default so all you have to worry about is declaring
your users. For a fully fleshed out example, check out the developers personal your users.
[branch](https://github.com/divnix/devos/tree/nrd/users/nrd/default.nix).
## Basic Usage ## Basic Usage
@ -60,18 +59,6 @@ using the `homeConfigurations` flake output.
This is great for keeping your environment consistent across Unix-like systems, This is great for keeping your environment consistent across Unix-like systems,
including macOS. including macOS.
### From within the projects devshell:
```sh
# builds the pub-solar user defined in the PubSolarOS host
nix build '.#homeConfigurations."pub-solar@PubSolarOS".activationPackage'
# build and activate
nix build '.#homeConfigurations."pub-solar@PubSolarOS".activationPackage' && ./result/activate && unlink result
```
### Manually from outside the project:
```sh ```sh
# build # build
nix build "github:divnix/devos#homeConfigurations.nixos@NixOS.home.activationPackage" nix build "github:divnix/devos#homeConfigurations.nixos@NixOS.home.activationPackage"
@ -81,5 +68,5 @@ nix build "github:divnix/devos#homeConfigurations.nixos@NixOS.home.activationPac
``` ```
[home-manager]: https://nix-community.github.io/home-manager [home-manager]: https://nix-community.github.io/home-manager
[modules-list]: https://github.com/divnix/devos/tree/main/users/modules/module-list.nix [modules-list]: https://github.com/divnix/digga/tree/main/users/modules/module-list.nix
[portableuser]: https://digga.divnix.com/api-reference-home.html#homeusers [portableuser]: https://digga.divnix.com/api-reference-home.html#homeusers

View File

@ -4,7 +4,8 @@ The only dependency is nix, so make sure you have it [installed][install-nix].
## Get the Template ## Get the Template
If you currently don't have flakes setup, you can utilize the digga shell to pull the template: If you currently don't have flakes setup, you can utilize the digga shell to
pull the template:
```sh ```sh
nix-shell "https://github.com/divnix/digga/archive/main.tar.gz" \ nix-shell "https://github.com/divnix/digga/archive/main.tar.gz" \
@ -22,37 +23,26 @@ Then make sure to create the git repository:
```sh ```sh
git init git init
git add . git add .
git commit -m init git commit
``` ```
To drop into a nix-shell, if you don't have flakes setup, use the digga shell to create a `flake.lock`: Finally, run `nix-shell` to get to an interactive shell with all the
dependencies, including the unstable nix version required. You can run `menu` to
```sh confirm that you are using digga (expected output includes [docs], [general
nix-shell "https://github.com/divnix/digga/archive/main.tar.gz" \ commands], [linter], etc.).
--run "nix flake lock"
```
Or if you do have flakes support, just run:
```sh
nix flake lock
```
Finally, run `nix-shell` to get to an interactive shell with all the dependencies, including the unstable nix
version required. You can run `menu` to confirm that you are using digga (expected output includes [docs], [general commands], [linter], etc.).
In addition, the [binary cache](../integrations/cachix.md) is added for faster deployment. In addition, the [binary cache](../integrations/cachix.md) is added for faster deployment.
> ##### _Notes:_ > # _Notes:_
> >
> - Flakes ignore files that have not been added to git, so be sure to stage new > - Flakes ignore files that have not been added to git, so be sure to stage new
> files before building the system. > files before building the system.
> - You can choose to simply clone the repo with git if you want to follow > - You can choose to simply clone the repo with git if you want to follow
> upstream changes. > upstream changes.
> - If the `nix-shell -p cachix --run "cachix use nrdxp"` line doesn't work > - If the `nix-shell -p cachix --run "cachix use nrdxp"` line doesn't work you
> you can try with sudo: `sudo nix-shell -p cachix --run "cachix use nrdxp"` > can try with sudo: `sudo nix-shell -p cachix --run "cachix use nrdxp"`
## Next Steps: ## Next Steps
- [Make installable ISO](./iso.md) - [Make installable ISO](./iso.md)

View File

@ -14,12 +14,21 @@ be built during CI.
## Integration Tests ## Integration Tests
All your profiles defined in suites will be tested in a NixOS VM. All your profiles defined in suites can be tested against an individual host.
Simply use digga's pre-baked `digga.lib.allProfilesTest` like so:
```nix
{
hosts = {
Morty.tests = [ allProfilesTest ];
};
}
```
You can write integration tests for one or more NixOS VMs that can, You can write integration tests for one or more NixOS VMs that can,
optionally, be networked together, and yes, it's as awesome as it sounds! optionally, be networked together, and yes, it's as awesome as it sounds!
Be sure to use the `mkTest` function from digga, `digga.lib.pkgs-lib.mkTest` Be sure to use the `mkTest` function from Digga, `digga.lib.mkTest`
which wraps the official [testing-python][testing-python] function to ensure which wraps the official [testing-python][testing-python] function to ensure
that the system is setup exactly as it is for a bare DevOS system. There are that the system is setup exactly as it is for a bare DevOS system. There are
already great resources for learning how to use these tests effectively, already great resources for learning how to use these tests effectively,
@ -28,7 +37,7 @@ and the examples in [nixpkgs][nixos-tests].
[test-doc]: https://nixos.org/manual/nixos/stable/index.html#sec-nixos-tests [test-doc]: https://nixos.org/manual/nixos/stable/index.html#sec-nixos-tests
[test-blog]: https://www.haskellforall.com/2020/11/how-to-use-nixos-for-lightweight.html [test-blog]: https://www.haskellforall.com/2020/11/how-to-use-nixos-for-lightweight.html
[default]: https://github.com/divnix/devos/tree/main/tests/default.nix [default]: https://github.com/divnix/devos/tree/core/tests/default.nix
[run-test]: https://github.com/NixOS/nixpkgs/blob/6571462647d7316aff8b8597ecdf5922547bf365/lib/debug.nix#L154-L166 [run-test]: https://github.com/NixOS/nixpkgs/blob/6571462647d7316aff8b8597ecdf5922547bf365/lib/debug.nix#L154-L166
[nixos-tests]: https://github.com/NixOS/nixpkgs/tree/master/nixos/tests [nixos-tests]: https://github.com/NixOS/nixpkgs/tree/master/nixos/tests
[testing-python]: https://github.com/NixOS/nixpkgs/tree/master/nixos/lib/testing-python.nix [testing-python]: https://github.com/NixOS/nixpkgs/tree/master/nixos/lib/testing-python.nix

View File

@ -1,2 +1,10 @@
{lib}: {lib}:
lib.makeExtensible (self: {}) lib.makeExtensible (self: let
callLibs = file: import file {lib = self;};
in rec {
## Define your own library functions here!
#id = x: x;
## Or in files, containing functions that take {lib}
#foo = callLibs ./foo.nix;
## In configs, they can be used under "lib.our"
})

View File

@ -15,10 +15,10 @@
auto-optimise-store = true; auto-optimise-store = true;
# Prevents impurities in builds # Prevents impurities in builds
sandbox = true; sandbox = true;
# give root and @wheel special privileges with nix # Give root and @wheel special privileges with nix
trusted-users = ["root" "@wheel"]; trusted-users = ["root" "@wheel"];
# This is just a representation of the nix default # Allow only group wheel to connect to the nix daemon
system-features = ["nixos-test" "benchmark" "big-parallel" "kvm"]; allowed-users = ["@wheel"];
}; };
# Generally useful nix option defaults # Generally useful nix option defaults
extraOptions = '' extraOptions = ''

View File

@ -8,11 +8,11 @@
inherit inherit
(pkgs) (pkgs)
agenix agenix
alejandra
cachix cachix
editorconfig-checker editorconfig-checker
mdbook
nix nix
alejandra nodePackages
nvfetcher nvfetcher
shellcheck shellcheck
shfmt shfmt
@ -25,21 +25,23 @@
prettier prettier
; ;
hooks = import ./hooks;
pkgWithCategory = category: package: {inherit package category;}; pkgWithCategory = category: package: {inherit package category;};
devos = pkgWithCategory "devos"; devos = pkgWithCategory "devos";
linter = pkgWithCategory "linter"; formatter = pkgWithCategory "linter";
docs = pkgWithCategory "docs";
in { in {
_file = toString ./.; imports = ["${extraModulesPath}/git/hooks.nix" ./hooks];
imports = ["${extraModulesPath}/git/hooks.nix"];
git = {inherit hooks;};
# override for our own welcome # override for our own welcome
devshell.name = pkgs.lib.mkForce "PubSolarOS"; devshell.name = pkgs.lib.mkForce "PubSolarOS";
packages = [
alejandra
editorconfig-checker
nodePackages.prettier
shellcheck
shfmt
];
commands = with pkgs; commands = with pkgs;
[ [
(devos nix) (devos nix)
@ -50,14 +52,7 @@ in {
help = pkgs.nvfetcher.meta.description; help = pkgs.nvfetcher.meta.description;
command = "cd $PRJ_ROOT/pkgs; ${pkgs.nvfetcher}/bin/nvfetcher -c ./sources.toml $@"; command = "cd $PRJ_ROOT/pkgs; ${pkgs.nvfetcher}/bin/nvfetcher -c ./sources.toml $@";
} }
(linter alejandra) (formatter treefmt)
(linter editorconfig-checker)
(linter nodePackages.prettier)
(linter shfmt)
(linter shellcheck)
(linter treefmt)
(docs mdbook)
] ]
++ lib.optionals (!pkgs.stdenv.buildPlatform.isi686) [ ++ lib.optionals (!pkgs.stdenv.buildPlatform.isi686) [
(devos cachix) (devos cachix)

View File

@ -1,4 +1,6 @@
{ {
enable = true; git.hooks = {
pre-commit.text = builtins.readFile ./pre-commit.sh; enable = true;
pre-commit.text = builtins.readFile ./pre-commit.sh;
};
} }