diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index e4fc197e..c8a8f64c 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -2,7 +2,7 @@ name: "Check & Cachix" on: push: branches: - - core + - main - trying - staging jobs: diff --git a/.github/workflows/mdbook_docs.yml b/.github/workflows/mdbook_docs.yml index 842171c4..5faf9c28 100644 --- a/.github/workflows/mdbook_docs.yml +++ b/.github/workflows/mdbook_docs.yml @@ -3,7 +3,7 @@ name: Deploy Docs to GitHub Pages on: push: branches: - - core + - main jobs: deploy: diff --git a/.gitignore b/.gitignore index c319c3b0..08a8736b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,4 @@ result -up -hosts/up-* .direnv doc/index.html @@ -12,3 +10,4 @@ doi # PubSolarOS tags /owners +pkgs/_sources/.shake* diff --git a/README.md b/README.md index b7cd8871..15211ebc 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Make an awesome template for NixOS users, with consideration for common tools li [devshell][devshell], and [more](./doc/integrations). ### No. Why _flakes_? -Flakes are a part of an explicit push to improve [Nix's UI](https://github.com/NixOS/nix/blob/master/doc/manual/src/contributing/cli-guideline.md), and have become an intergral 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. @@ -43,6 +43,7 @@ following giants][giants]: ### :family: — like family - [`numtide/devshell`][devshell] - [`serokell/deploy-rs`][deploy] +- [`berberman/nvfetcher`][nvfetcher] - [`NixOS/nixpkgs`][nixpkgs] :heart: @@ -68,23 +69,22 @@ 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 -[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 -[digga]: https://github.com/divnix/digga -[fup]: https://github.com/gytis-ivaskevicius/flake-utils-plus -[fu]: https://github.com/numtide/flake-utils -[devshell]: https://github.com/numtide/devshell -[nix]: https://nixos.org/manual/nix/stable -[mit]: https://mit-license.org -[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 +[core]: https://github.com/divnix/devos +[deploy]: https://github.com/serokell/deploy-rs +[devshell]: https://github.com/numtide/devshell +[digga]: https://github.com/divnix/digga [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 +[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 +[nixpkgs]: https://github.com/NixOS/nixpkgs +[nvfetcher]: https://github.com/berberman/nvfetcher [please]: https://github.com/nrdxp/devos/tree/nrd -[matrix]: https://matrix.to/#/#devos:nixos.org diff --git a/bud/default.nix b/bud/default.nix new file mode 100644 index 00000000..c486636b --- /dev/null +++ b/bud/default.nix @@ -0,0 +1,10 @@ +{ pkgs, lib, budUtils, ... }: { + bud.cmds = with pkgs; { + get = { + writer = budUtils.writeBashWithPaths [ nixUnstable git coreutils ]; + synopsis = "get [DEST]"; + help = "Copy the desired template to DEST"; + script = ./get.bash; + }; + }; +} diff --git a/bud/get.bash b/bud/get.bash new file mode 100644 index 00000000..3b4d9a74 --- /dev/null +++ b/bud/get.bash @@ -0,0 +1 @@ +nix flake new -t "github:divnix/devos/core" "${2:-devos}" diff --git a/doc/CONTRIBUTING.md b/doc/CONTRIBUTING.md index 4766cdf7..8574daea 100644 --- a/doc/CONTRIBUTING.md +++ b/doc/CONTRIBUTING.md @@ -1,25 +1,18 @@ # Pull Requests -All development is done in the `develop` branch. Only minor bug-fixes and release -PRs should target `master`. -If making a change to the template, or adding a feature, please be sure to update the -relevant docs. Each directory contains its own README.md, which will -automatically be pulled into the [mdbook](https://devos.divnix.com). The book is -rendered on every change, so the docs should always be up to date. +## TL;DR; +- **Target Branch**: `main` +- **Merge Policy**: [`bors`][bors] is alwyas right (→ `bors try`) +- **Docs**: every changeset is expected to contain doc updates +- **Commit Msg**: be a poet! Comprehensive and explanatory commit messages + should cover the motivation and use case in an easily understandable manner + even when read after a few months. +- **Test Driven Development**: please default to test driven development where possible. -We also use [BORS](https://bors.tech) to ensure that all pull requests pass the -test suite once at least one review is completed. +### Within the Devshell (`nix develop`) +- **Hooks**: please `git commit` within the devshell +- **Fail Early**: please run from within the devshell on your local machine: + - `nix flake check` -# Style -If you wish to contribute please follow these guidelines: +[bors]: https://bors.tech -* format your code with [`nixpkgs-fmt`][nixpkgs-fmt]. The default devshell - includes a pre-commit hook that does this for you. - -* The commit message follows the same semantics as [nixpkgs][nixpkgs]. - * You can use a `#` symbol to specify ambiguities. For example, - `develop#zsh: ` would tell me that you're updating the - `zsh` subprofile living under the `develop` profile. - -[nixpkgs-fmt]: https://github.com/nix-community/nixpkgs-fmt -[nixpkgs]: https://github.com/NixOS/nixpkgs diff --git a/doc/SUMMARY.md b/doc/SUMMARY.md index e2b6e9a4..1d7bafe9 100644 --- a/doc/SUMMARY.md +++ b/doc/SUMMARY.md @@ -6,7 +6,6 @@ - [Bootstrapping](./start/bootstrapping.md) - [From NixOS](./start/from-nixos.md) - [Key Concepts](./concepts/index.md) - - [Extern](./concepts/extern.md) - [Hosts](./concepts/hosts.md) - [Overrides](./concepts/overrides.md) - [Profiles](./concepts/profiles.md) @@ -17,19 +16,13 @@ - [Overlays](./outputs/overlays.md) - [Packages](./outputs/pkgs.md) - [Concerns]() - - [Lib](./lib.md) - [Secrets](./secrets.md) - [Tests](./tests.md) -- [Helper Script – `flk`](./flk/index.md) - - [up](./flk/up.md) - - [update](./flk/update.md) - - [get](./flk/get.md) - - [doi](./flk/doi.md) - - [iso](./flk/iso.md) - - [install](./flk/install.md) - - [home](./flk/home.md) +- [Helper Script – `bud`](./bud/index.md) + - [get](./bud/get.md) - [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) diff --git a/doc/flk/get.md b/doc/bud/get.md similarity index 90% rename from doc/flk/get.md rename to doc/bud/get.md index 8761f004..12263df0 100644 --- a/doc/flk/get.md +++ b/doc/bud/get.md @@ -4,7 +4,7 @@ git history. ## Usage ```sh -flk get DEST-DIR +bud get DEST-DIR ``` If DEST-DIR is ommitted, it defaults to _./devos_. diff --git a/doc/bud/index.md b/doc/bud/index.md new file mode 100644 index 00000000..7b985792 --- /dev/null +++ b/doc/bud/index.md @@ -0,0 +1,24 @@ +# [`bud`][bud] command +The template incudes a convenient script for managing your system called [`bud`][bud]. + +It is a portable and highly composable system control tool that work anywhere on your host +or in the flake's devshell. + +Although it comes with some predefined standard helpers, +it is very extensible and you are encouraged to write your own script snippets +to ease your workflows. An example is the bud module for a `get` command that +comes included with `devos`. + +While writing scripts you can convenientely access smart environment variables +that can tell the current architecture, user or host name, among others, regardless +wether you invoke `bud` within the devshell or as the system-wide installed `bud`. + +For details, please review the [bud repo][bud]. + +## Usage +```sh +bud help +``` + + +[bud]: https://github.com/divnix/bud diff --git a/doc/concepts/extern.md b/doc/concepts/extern.md deleted file mode 100644 index 45d8dcb5..00000000 --- a/doc/concepts/extern.md +++ /dev/null @@ -1,42 +0,0 @@ -# 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, 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. - -## Overlays -External overlays can directly be added to a channel's `overlays` list. - -flake.nix: -```nix -{ - channels.nixos.overlays = [ inputs.agenix.overlay ]; -} -``` -Upon exporting overlays, these overlays will be automatically filtered out by inspecting the `inputs` argument. - -## Modules -There is a dedicated `nixos.hostDefaults.externalModules` argument for external -modules. - -flake.nix: -```nix -{ - nixos.hostDefaults.externalModules = [ inputs.agenix.nixosModules.age ]; -} -``` - -## 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 -{ - home.externalModules = [ doom-emacs = doom-emacs.hmModule ]; -} -``` - -> ##### 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. diff --git a/doc/concepts/index.md b/doc/concepts/index.md index 8aca6e5c..618292cb 100644 --- a/doc/concepts/index.md +++ b/doc/concepts/index.md @@ -1,4 +1,10 @@ # Key Concepts -There are few idioms unique to DevOS. This section is dedicated to helping you -understand them. +Key concepts are derived from [digga][digga]. Please refer to its +[docs][digga-docs] for more details. + +This section is dedicated to helping you develop a more hands on +understanding of them them. + +[digga-docs]: https://digga.divnix.com +[digga]: https://github.com/divnix/digga diff --git a/doc/concepts/users.md b/doc/concepts/users.md index 20f371de..12bf5622 100644 --- a/doc/concepts/users.md +++ b/doc/concepts/users.md @@ -1,3 +1,8 @@ +> ##### _Note:_ +> This section and its semantics need a conceptiual rework. +> Since recently [portable home configurations][portableuser] +> that are not bound to any specific host are a thing. + # Users Users are a special case of [profiles](profiles.md) that define system @@ -69,3 +74,4 @@ nix build "github:divnix/devos#homeConfigurations.nixos@NixOS.home.activationPac [home-manager]: https://nix-community.github.io/home-manager [modules-list]: https://github.com/divnix/devos/tree/core/users/modules/module-list.nix +[portableuser]: https://digga.divnix.com/api-reference-home.html#homeusers diff --git a/doc/flk/doi.md b/doc/flk/doi.md deleted file mode 100644 index fc522cdd..00000000 --- a/doc/flk/doi.md +++ /dev/null @@ -1,10 +0,0 @@ -# DigitalOcean - -Now you can [create a droplet](https://cloud.digitalocean.com/droplets/new) using your custom image. - -Making a DigitalOcean compatible image for `hosts/NixOS.nix` is as simple as: -```sh -flk doi NixOS -``` - -This works for any file matching `hosts/*.nix` excluding `default.nix`. diff --git a/doc/flk/home.md b/doc/flk/home.md deleted file mode 100644 index f0bae767..00000000 --- a/doc/flk/home.md +++ /dev/null @@ -1,8 +0,0 @@ -# home -The `home` subcommand is for using your home-manager configurations outside of -NixOS, providing an awesome mechanism for keeping your environments -synchronized, even when using other systems. - -## Usage -The [users](../concepts/users.md#external-usage) page contains a good usage -example. diff --git a/doc/flk/index.md b/doc/flk/index.md deleted file mode 100644 index 04fc1c48..00000000 --- a/doc/flk/index.md +++ /dev/null @@ -1,20 +0,0 @@ -# flk command -The devshell for the project incudes a convenient script for managing your -system called `flk`. Each of the following chapters is a reference for one of -its subcommands. - -## Rebuild -Without any of the subcommands, `flk` acts as a convenient shortcut for -`nixos-rebuild`: -```sh -flk NixOS build -``` - -Will build _hosts/NixOS.nix_. You can change out `build` for `switch`, `test`, -etc. Any additional arguments are passed through to the call to -`nixos-rebuild`. - -## Usage -```sh -flk help -``` diff --git a/doc/flk/install.md b/doc/flk/install.md deleted file mode 100644 index 3ae52504..00000000 --- a/doc/flk/install.md +++ /dev/null @@ -1,12 +0,0 @@ -# install -The `install` subcommand is a simple convenience for `nixos-install`, similar -to the shortcut for `nixos-rebuild`, all additional arguments are passed -through. - -## Example -```sh -flk install NixOS -``` - -This will install _hosts/NixOS.nix_ to /mnt. You can override this directory -using standard `nixos-install` args. diff --git a/doc/flk/iso.md b/doc/flk/iso.md deleted file mode 120000 index fa658ef4..00000000 --- a/doc/flk/iso.md +++ /dev/null @@ -1 +0,0 @@ -../start/iso.md \ No newline at end of file diff --git a/doc/flk/up.md b/doc/flk/up.md deleted file mode 100644 index 265e03a0..00000000 --- a/doc/flk/up.md +++ /dev/null @@ -1,4 +0,0 @@ -# up -The `up` subcommand is a simple shortcut for `nixos-generate-config` that is -compatible with devos. There is a short explanation in the the getting started -[guide](../start/from-nixos.md#generate-configuration). diff --git a/doc/flk/update.md b/doc/flk/update.md deleted file mode 100644 index 869db72f..00000000 --- a/doc/flk/update.md +++ /dev/null @@ -1,22 +0,0 @@ -# update -The `update` subcommand is a simple alias for: -```sh -nix flake update -``` -As it sounds, this will update your lock file. - -## Updating Package Sources -If you pass directory name then it will update that input if the directory -contains a flake.nix, with an optional arguement to update only a specific -input in the subflake. - -For example, you can update any -[package sources](../outputs/pkgs.md#automatic-source-updates) you may have -declared in _pkgs/flake.nix_: -```sh -flk update pkgs -``` -or just its _nixpkgs_: -```sh -flk update pkgs nixpkgs -``` diff --git a/doc/integrations/nvfetcher.md b/doc/integrations/nvfetcher.md new file mode 100644 index 00000000..4670657e --- /dev/null +++ b/doc/integrations/nvfetcher.md @@ -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 diff --git a/doc/mkFlakeOptions.md b/doc/mkFlakeOptions.md deleted file mode 100644 index dbc7abc1..00000000 --- a/doc/mkFlakeOptions.md +++ /dev/null @@ -1,541 +0,0 @@ -## channels -nixpkgs channels to create - - -*_Type_*: -attribute set of submodules - - -*_Default_* -``` -{} -``` - - - - -## channels.\.config -nixpkgs config for this channel - - -*_Type_*: -attribute set or path convertible to it - - -*_Default_* -``` -{} -``` - - - - -## channels.\.input -nixpkgs flake input to use for this channel - - -*_Type_*: -nix flake - - -*_Default_* -``` -"self.inputs." -``` - - - - -## channels.\.overlays -overlays to apply to this channel -these will get exported under the 'overlays' flake output -as \/\ and any overlay pulled from ${inputs} -will be filtered out - - -*_Type_*: -list of valid Nixpkgs overlay or path convertible to its or anything convertible to it - - -*_Default_* -``` -[] -``` - - - - -## channelsConfig -nixpkgs config for all channels - - -*_Type_*: -attribute set or path convertible to it - - -*_Default_* -``` -{} -``` - - - - -## devshell -Modules to include in your devos shell. the `modules` argument -will be exported under the `devshellModules` output - - -*_Type_*: -submodule - - -*_Default_* -``` -{} -``` - - - - -## devshell.externalModules -modules to include that won't be exported -meant importing modules from external flakes - - -*_Type_*: -list of valid module or path convertible to its or anything convertible to it - - -*_Default_* -``` -[] -``` - - - - -## devshell.modules -modules to include in all hosts and export to devshellModules output - - -*_Type_*: -list of path to a modules or anything convertible to it or path convertible to it - - -*_Default_* -``` -[] -``` - - - - -## home -hosts, modules, suites, and profiles for home-manager - - -*_Type_*: -submodule - - -*_Default_* -``` -{} -``` - - - - -## home.externalModules -modules to include that won't be exported -meant importing modules from external flakes - - -*_Type_*: -list of valid module or path convertible to its or anything convertible to it - - -*_Default_* -``` -[] -``` - - - - -## home.importables -Packages of paths to be passed to modules as `specialArgs`. - - -*_Type_*: -attribute set - - -*_Default_* -``` -{} -``` - - - - -## home.importables.suites -collections of profiles - - -*_Type_*: -attribute set of list of paths or anything convertible to its - - - - - - -## home.modules -modules to include in all hosts and export to homeModules output - - -*_Type_*: -list of path to a modules or anything convertible to it or path convertible to it - - -*_Default_* -``` -[] -``` - - - - -## home.profiles -WARNING: The 'suites' and `profiles` options have been deprecated, you can now create -both with the importables option. `rakeLeaves` can be used to create profiles and -by passing a module or `rec` set to `importables`, suites can access profiles. -Example: -``` -importables = rec { - profiles = digga.lib.importers.rakeLeaves ./profiles; - suites = with profiles; { }; -} -``` -See https://github.com/divnix/digga/pull/30 for more details - - -*_Type_*: -list of paths - - -*_Default_* -``` -[] -``` - - - - -## home.suites -WARNING: The 'suites' and `profiles` options have been deprecated, you can now create -both with the importables option. `rakeLeaves` can be used to create profiles and -by passing a module or `rec` set to `importables`, suites can access profiles. -Example: -``` -importables = rec { - profiles = digga.lib.importers.rakeLeaves ./profiles; - suites = with profiles; { }; -} -``` -See https://github.com/divnix/digga/pull/30 for more details - - -*_Type_*: -function that evaluates to a(n) attrs or path convertible to it - - - - - - -## nixos -hosts, modules, suites, and profiles for nixos - - -*_Type_*: -submodule - - -*_Default_* -``` -{} -``` - - - - -## nixos.hostDefaults -Defaults for all hosts. -the modules passed under hostDefaults will be exported -to the 'nixosModules' flake output. -They will also be added to all hosts. - - -*_Type_*: -submodule - - -*_Default_* -``` -{} -``` - - - - -## nixos.hostDefaults.channelName -Channel this host should follow - - -*_Type_*: -a channel defined in `channels` - - -*_Default_* -``` -null -``` - - - - -## nixos.hostDefaults.externalModules -modules to include that won't be exported -meant importing modules from external flakes - - -*_Type_*: -list of valid module or path convertible to its or anything convertible to it - - -*_Default_* -``` -[] -``` - - - - -## nixos.hostDefaults.modules -modules to include in all hosts and export to nixosModules output - - -*_Type_*: -list of path to a modules or anything convertible to it or path convertible to it - - -*_Default_* -``` -[] -``` - - - - -## nixos.hostDefaults.system -system for this host - - -*_Type_*: -system defined in `supportedSystems` - - -*_Default_* -``` -null -``` - - - - -## nixos.hosts -configurations to include in the nixosConfigurations output - - -*_Type_*: -attribute set of submodules - - -*_Default_* -``` -{} -``` - - - - -## nixos.hosts.\.channelName -Channel this host should follow - - -*_Type_*: -a channel defined in `channels` - - -*_Default_* -``` -null -``` - - - - -## nixos.hosts.\.modules -modules to include - - -*_Type_*: -list of valid module or path convertible to its or anything convertible to it - - -*_Default_* -``` -[] -``` - - - - -## nixos.hosts.\.system -system for this host - - -*_Type_*: -system defined in `supportedSystems` - - -*_Default_* -``` -null -``` - - - - -## nixos.importables -Packages of paths to be passed to modules as `specialArgs`. - - -*_Type_*: -attribute set - - -*_Default_* -``` -{} -``` - - - - -## nixos.importables.suites -collections of profiles - - -*_Type_*: -attribute set of list of paths or anything convertible to its - - - - - - -## nixos.profiles -WARNING: The 'suites' and `profiles` options have been deprecated, you can now create -both with the importables option. `rakeLeaves` can be used to create profiles and -by passing a module or `rec` set to `importables`, suites can access profiles. -Example: -``` -importables = rec { - profiles = digga.lib.importers.rakeLeaves ./profiles; - suites = with profiles; { }; -} -``` -See https://github.com/divnix/digga/pull/30 for more details - - -*_Type_*: -list of paths - - -*_Default_* -``` -[] -``` - - - - -## nixos.suites -WARNING: The 'suites' and `profiles` options have been deprecated, you can now create -both with the importables option. `rakeLeaves` can be used to create profiles and -by passing a module or `rec` set to `importables`, suites can access profiles. -Example: -``` -importables = rec { - profiles = digga.lib.importers.rakeLeaves ./profiles; - suites = with profiles; { }; -} -``` -See https://github.com/divnix/digga/pull/30 for more details - - -*_Type_*: -function that evaluates to a(n) attrs or path convertible to it - - - - - - -## outputsBuilder -builder for flake system-spaced outputs -The builder gets passed an attrset of all channels - - -*_Type_*: -function that evaluates to a(n) attrs - - -*_Default_* -``` -"channels: { }" -``` - - - - -## self -The flake to create the devos outputs for - -*_Type_*: -nix flake - - - - - - -## supportedSystems -The systems supported by this flake - - -*_Type_*: -list of strings - - -*_Default_* -``` -["aarch64-linux","i686-linux","x86_64-darwin","x86_64-linux"] -``` - - - diff --git a/doc/outputs/pkgs.md b/doc/outputs/pkgs.md index 58ce52bd..548667ff 100644 --- a/doc/outputs/pkgs.md +++ b/doc/outputs/pkgs.md @@ -13,16 +13,6 @@ the supported systems listed in the package's `meta.platforms` attribute. And, as usual, every package in the overlay is also available to any NixOS [host](../concepts/hosts.md). -## Automatic Source Updates -There is the added, but optional, convenience of declaring your sources in -_pkgs/flake.nix_ as an input. You can then access them from the `srcs` package. -This allows updates to be managed automatically by simply -[updating](../flk/update.md#updating-package-sources) the lock file. No -more manually entering sha256 hashes! - -As an added bonus, version strings are also generated automatically from either -the flake ref, or the date and git revision of the source. - ## Example pkgs/development/libraries/libinih/default.nix: ```nix diff --git a/doc/start/bootstrapping.md b/doc/start/bootstrapping.md index 873af32e..f4c5190e 100644 --- a/doc/start/bootstrapping.md +++ b/doc/start/bootstrapping.md @@ -20,29 +20,32 @@ partition to `/mnt/boot`: ```console $ mount /dev/disk/by-label/nixos /mnt $ mkdir -p /mnt/boot && mount /dev/disk/by-label/boot /mnt/boot # UEFI only -$ swapon /dev/$your_swap_partition +$ swapon /dev/disk/by-label/swap +``` + +Add some extra space to the store. In the iso, it's running on a tmpfs +off your RAM: +```console +$ mkdir -p /mnt/tmpstore/{work,store} +$ mount -t overlay overlay -olowerdir=/nix/store,upperdir=/mnt/tmpstore/store,workdir=/mnt/tmpstore/work /nix/store ``` ## Install -Install using the `flk` wrapper baked into the iso off of a copy of devos -from the time the iso was built: +Install off of a copy of devos from the time the iso was built: ```console $ cd /iso/devos -$ nix develop -$ flk install NixOS --impure # use same host as above +$ nixos-install --flake .#NixOS ``` - - ## Notes of interest ### Remote access to the live installer The iso live installer comes preconfigured with a network configuration which announces it's hostname via [MulticastDNS][mDNS] as `hostname.local`, -that is `NixOS.local` in the [iso example](./iso). +that is `bootstrap.local` in the [iso example](./iso). In the rare case that [MulticastDNS][mDNS] is not availabe or turned off in your network, there is a static link-local IPv6 address configured to @@ -66,7 +69,7 @@ You can then ssh into the live installer through one of the following options: ```console -ssh root@NixOS.local +ssh root@bootstrap.local ssh root@fe80::47%eno1 # where eno1 is your network interface on which you are linked to the target ``` diff --git a/doc/start/iso.md b/doc/start/iso.md index efa515a0..76af1c6e 100644 --- a/doc/start/iso.md +++ b/doc/start/iso.md @@ -1,14 +1,12 @@ # ISO -Making and writing an installable iso for `hosts/NixOS.nix` is as simple as: +Making and writing an installable iso for `hosts/bootstrap.nix` is as simple as: ```sh -flk iso NixOS - -dd bs=4M if=result/iso/*.iso of=/dev/$your_installation_device \ - status=progress oflag=sync +bud build bootstrap bootstrapIso +sudo -E $(which bud) burn ``` -This works for any file matching `hosts/*.nix` excluding `default.nix`. +This works for any host. ## ISO image nix store & cache diff --git a/flake.lock b/flake.lock index 287e42ca..602213b3 100644 --- a/flake.lock +++ b/flake.lock @@ -22,7 +22,9 @@ }, "b12f-nix-fonts": { "inputs": { - "nixpkgs": "nixpkgs" + "nixpkgs": [ + "latest" + ] }, "locked": { "lastModified": 1622501268, @@ -39,31 +41,42 @@ "url": "https://git.b12f.io/b12f/nix-fonts" } }, - "ci-agent": { - "inputs": { - "flake-compat": "flake-compat", - "nix-darwin": [ - "darwin" - ], - "nixos-20_09": [ - "nixos" - ], - "nixos-unstable": [ - "latest" - ], - "pre-commit-hooks-nix": "pre-commit-hooks-nix" - }, + "blank": { "locked": { - "lastModified": 1626066948, - "narHash": "sha256-rBo4nCPyAHb1e/9ysYGH7tW1FV0N2XNvRcJR+g8gugA=", - "owner": "hercules-ci", - "repo": "hercules-ci-agent", - "rev": "7f3265cc42d5f364066c145939ee2812938b991c", + "lastModified": 1625557891, + "narHash": "sha256-O8/MWsPBGhhyPoPLHZAuoZiiHo9q6FLlEeIDEXuj6T4=", + "owner": "divnix", + "repo": "blank", + "rev": "5a5d2684073d9f563072ed07c871d577a6c614a8", "type": "github" }, "original": { - "owner": "hercules-ci", - "repo": "hercules-ci-agent", + "owner": "divnix", + "repo": "blank", + "type": "github" + } + }, + "bud": { + "inputs": { + "devshell": [ + "digga", + "devshell" + ], + "nixpkgs": [ + "nixos" + ] + }, + "locked": { + "lastModified": 1627855680, + "narHash": "sha256-snDOrUp8nth2Vs3GeEXr7Xji+HaHy25htZLNvid/U3I=", + "owner": "divnix", + "repo": "bud", + "rev": "612228a68d404d559405225427a5d8b3cef9d27c", + "type": "github" + }, + "original": { + "owner": "divnix", + "repo": "bud", "type": "github" } }, @@ -89,17 +102,23 @@ }, "deploy": { "inputs": { - "flake-compat": "flake-compat_2", + "flake-compat": "flake-compat", "naersk": "naersk", - "nixpkgs": "nixpkgs_2", - "utils": "utils" + "nixpkgs": [ + "digga", + "nixpkgs" + ], + "utils": [ + "digga", + "flake-utils" + ] }, "locked": { - "lastModified": 1616406726, - "narHash": "sha256-n9zmgxR03QNrvs9/fHewqE0j3SjL7Y+cglBCFu3U3rg=", + "lastModified": 1628752686, + "narHash": "sha256-Lzh9MYUJDsjgif+YEyOErXtj1IH+ci8J1C30g1ms69s=", "owner": "serokell", "repo": "deploy-rs", - "rev": "9e405fbc5ab5bacbd271fd78c6b6b6877c4d9f8d", + "rev": "e5546f9c2503c26d175f08a81fc0a0f330be4cbe", "type": "github" }, "original": { @@ -110,11 +129,11 @@ }, "devshell": { "locked": { - "lastModified": 1622013274, - "narHash": "sha256-mK/Lv0lCbl07dI5s7tR/7nb79HunKnJik3KyR6yeI2k=", + "lastModified": 1629275356, + "narHash": "sha256-R17M69EKXP6q8/mNHaK53ECwjFo1pdF+XaJC9Qq8zjg=", "owner": "numtide", "repo": "devshell", - "rev": "e7faf69e6bf8546517cc936c7f6d31c7eb3abcb2", + "rev": "26f25a12265f030917358a9632cd600b51af1d97", "type": "github" }, "original": { @@ -125,23 +144,33 @@ }, "digga": { "inputs": { + "blank": "blank", "deploy": "deploy", "devshell": "devshell", - "nixlib": "nixlib", - "nixpkgs": "nixpkgs_3", - "utils": "utils_2" + "flake-utils": "flake-utils", + "flake-utils-plus": "flake-utils-plus", + "home-manager": [ + "home" + ], + "nix": "nix", + "nixlib": [ + "nixos" + ], + "nixos-generators": "nixos-generators", + "nixpkgs": [ + "nixos" + ] }, "locked": { - "lastModified": 1623197477, - "narHash": "sha256-2Qk/uIHb1nXre2rRlGonAJmpuamBs7RRfgXhMmS5JkU=", + "lastModified": 1629419320, + "narHash": "sha256-ktoQQnRi/27juWC9YRNBj2RBG7lJU5h/kG8/KYFQt6M=", "owner": "divnix", "repo": "digga", - "rev": "f69703abc33f221b676966a8435c4f09ef70ff49", + "rev": "50f10e12156a08f71a189cca98498161fae9c952", "type": "github" }, "original": { "owner": "divnix", - "ref": "master", "repo": "digga", "type": "github" } @@ -162,44 +191,50 @@ "type": "github" } }, - "flake-compat_2": { - "flake": false, + "flake-utils": { "locked": { - "lastModified": 1606424373, - "narHash": "sha256-oq8d4//CJOrVj+EcOaSXvMebvuTkmBJuT5tzlfewUnQ=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "99f1c2157fba4bfe6211a321fd0ee43199025dbf", + "lastModified": 1623875721, + "narHash": "sha256-A8BU7bjS5GirpAUv4QA+QnJ4CceLHkcXdRp4xITDB0s=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "f7e004a55b120c02ecb6219596820fcd32ca8772", "type": "github" }, "original": { - "owner": "edolstra", - "repo": "flake-compat", + "owner": "numtide", + "repo": "flake-utils", "type": "github" } }, - "flake-utils": { + "flake-utils-plus": { + "inputs": { + "flake-utils": [ + "digga", + "flake-utils" + ] + }, "locked": { - "lastModified": 1620759905, - "narHash": "sha256-WiyWawrgmyN0EdmiHyG2V+fqReiVi8bM9cRdMaKQOFg=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "b543720b25df6ffdfcf9227afafc5b8c1fabfae8", + "lastModified": 1628855985, + "narHash": "sha256-OqhVFoCCA6GfGuMhZXQ5CrmZUYsumCJTwI72FOMf82I=", + "owner": "gytis-ivaskevicius", + "repo": "flake-utils-plus", + "rev": "a79a0b86e59dc087df6704f9b13b1ed951ef5c5f", "type": "github" }, "original": { - "owner": "numtide", - "repo": "flake-utils", + "owner": "gytis-ivaskevicius", + "ref": "staging", + "repo": "flake-utils-plus", "type": "github" } }, "flake-utils_2": { "locked": { - "lastModified": 1619345332, - "narHash": "sha256-qHnQkEp1uklKTpx3MvKtY6xzgcqXDsz5nLilbbuL+3A=", + "lastModified": 1623875721, + "narHash": "sha256-A8BU7bjS5GirpAUv4QA+QnJ4CceLHkcXdRp4xITDB0s=", "owner": "numtide", "repo": "flake-utils", - "rev": "2ebf2558e5bf978c7fb8ea927dfaed8fefab2e28", + "rev": "f7e004a55b120c02ecb6219596820fcd32ca8772", "type": "github" }, "original": { @@ -215,44 +250,67 @@ ] }, "locked": { - "lastModified": 1626073055, - "narHash": "sha256-vocByfpVu6m9zvtJugDvmd6/9iT2HJuG4tmDICKd0lI=", + "lastModified": 1630076227, + "narHash": "sha256-p3YdtqSPLnMudWsLMgd6XMEhQKB2oz1hvDkHtOlz5/Q=", "owner": "nix-community", "repo": "home-manager", - "rev": "775cb20bd4af7781fbf336fb201df02ee3d544bb", + "rev": "f5adb9be829f487f99bcc0f1884f74ddb85f70c8", "type": "github" }, "original": { "owner": "nix-community", + "ref": "release-21.05", "repo": "home-manager", "type": "github" } }, "latest": { "locked": { - "lastModified": 1626195678, - "narHash": "sha256-fPjSHiZ0JqkmhWiPDPEqbs/fEjZukFCU80YMocg/MRg=", - "path": "/nix/store/nnzn6zsmdi6ass7yd6krvc2rdkxxp8nh-source", - "rev": "e223f84cd8c279b892c53f5d779d6e63eb4277eb", - "type": "path" + "lastModified": 1627942574, + "narHash": "sha256-guUcGRWvY2mfiVSet2x/zeHIyflm2wgglj0ldg0mMio=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "c464dc811babfe316ed4ab7bbc12351122e69dd7", + "type": "github" }, "original": { - "id": "nixpkgs", - "type": "indirect" + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "lowdown-src": { + "flake": false, + "locked": { + "lastModified": 1617481909, + "narHash": "sha256-SqnfOFuLuVRRNeVJr1yeEPJue/qWoCp5N6o5Kr///p4=", + "owner": "kristapsdz", + "repo": "lowdown", + "rev": "148f9b2f586c41b7e36e73009db43ea68c7a1a4d", + "type": "github" + }, + "original": { + "owner": "kristapsdz", + "ref": "VERSION_0_8_4", + "repo": "lowdown", + "type": "github" } }, "naersk": { "inputs": { "nixpkgs": [ - "latest" + "digga", + "deploy", + "nixpkgs" ] }, "locked": { - "lastModified": 1610392286, - "narHash": "sha256-3wFl5y+4YZO4SgRYK8WE7JIS3p0sxbgrGaQ6RMw+d98=", + "lastModified": 1622810282, + "narHash": "sha256-4wmvM3/xfD0hCdNDIXVzRMfL4yB1J+DjH6Zte2xbAxk=", "owner": "nmattia", "repo": "naersk", - "rev": "d7bfbad3304fd768c0f93a4c3b50976275e6d4be", + "rev": "e8061169e1495871b56be97c5c51d310fae01374", "type": "github" }, "original": { @@ -269,11 +327,11 @@ ] }, "locked": { - "lastModified": 1623927034, + "lastModified": 1629707199, "narHash": "sha256-sGxlmfp5eXL5sAMNqHSb04Zq6gPl+JeltIZ226OYN0w=", "owner": "nmattia", "repo": "naersk", - "rev": "e09c320446c5c2516d430803f7b19f5833781337", + "rev": "df71f5e4babda41cd919a8684b72218e2e809fa9", "type": "github" }, "original": { @@ -282,17 +340,39 @@ "type": "github" } }, + "nix": { + "inputs": { + "lowdown-src": "lowdown-src", + "nixpkgs": [ + "digga", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1629360796, + "narHash": "sha256-KAcvr8eEhEqOQweDAsHurO9ECmfdptbU1UT7smcpyBs=", + "owner": "nixos", + "repo": "nix", + "rev": "ffa629b2c0ea6368deca700afdac53a6e14557aa", + "type": "github" + }, + "original": { + "owner": "nixos", + "repo": "nix", + "type": "github" + } + }, "nix-dram": { "inputs": { "flake-utils": "flake-utils_2", - "nixpkgs": "nixpkgs_4" + "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1620663773, - "narHash": "sha256-Nfc2g9xUCPYBFKE5O7OdrDpCVspwk64S8EbsDYoY38c=", + "lastModified": 1628492639, + "narHash": "sha256-ffF/oEhLs/stAsXXobruKHyH9jnMC2rt/SM3ASrs2U8=", "owner": "dramforever", "repo": "nix-dram", - "rev": "86485e22621b17bcc4472889eedbd562498bb5a2", + "rev": "fba426108ea6bdeb1e362bac9da06cbd33726f41", "type": "github" }, "original": { @@ -301,34 +381,45 @@ "type": "github" } }, - "nixlib": { - "locked": { - "lastModified": 1620519687, - "narHash": "sha256-+6Dd72b2CASuXm2W7KRxZIE7AOy/dj4mU28vaF+zxcs=", - "owner": "divnix", - "repo": "nixpkgs.lib", - "rev": "c7b6169809c5f74dd0c34f3d69e9d12ba4d448de", - "type": "github" - }, - "original": { - "owner": "divnix", - "repo": "nixpkgs.lib", - "type": "github" - } - }, "nixos": { "locked": { - "lastModified": 1626046891, - "narHash": "sha256-Zt8saH+hAehXskW0iFAzk+iMillYoFBxvLReYNqGT9E=", - "owner": "NixOS", + "lastModified": 1630598110, + "narHash": "sha256-FD1xIDoKMOjBE8tHHp95aa5HfxKDCa+3kf5T7AA47tY=", + "owner": "nixos", "repo": "nixpkgs", - "rev": "d8f8f31af9d77a48220e4e8a301d1e79774cb7d2", + "rev": "6bfe71f2a4e2e425dee26b25d2309f341ff1600d", "type": "github" }, "original": { - "id": "nixpkgs", - "ref": "nixos-unstable", - "type": "indirect" + "owner": "nixos", + "ref": "release-21.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixos-generators": { + "inputs": { + "nixlib": [ + "digga", + "nixlib" + ], + "nixpkgs": [ + "digga", + "blank" + ] + }, + "locked": { + "lastModified": 1624973746, + "narHash": "sha256-11JbJRduNwyf556gndGErR5/12ceyHOHBfEuha5Vws4=", + "owner": "nix-community", + "repo": "nixos-generators", + "rev": "022ef440af8dc237ab1f59fa363cb1e25783ec3e", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixos-generators", + "type": "github" } }, "nixos-hardware": { @@ -348,57 +439,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1622059058, - "narHash": "sha256-t1/ZMtyxClVSfcV4Pt5C1YpkeJ/UwFF3oitLD7Ch/UA=", + "lastModified": 1626556499, + "narHash": "sha256-c2ueMT7fi/yvCNq3nGLEC2v5GklS7eHpB1240LRSW9Y=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "84aa23742f6c72501f9cc209f29c438766f5352d", - "type": "github" - }, - "original": { - "id": "nixpkgs", - "ref": "nixpkgs-unstable", - "type": "indirect" - } - }, - "nixpkgs_2": { - "locked": { - "lastModified": 1610942247, - "narHash": "sha256-PKo1ATAlC6BmfYSRmX0TVmNoFbrec+A5OKcabGEu2yU=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "7d71001b796340b219d1bfa8552c81995017544a", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_3": { - "locked": { - "lastModified": 1620962350, - "narHash": "sha256-9ASW4d4/Z8HmRvuJI8rxbEOTbXTBpQ8y+CmFYBwtXzE=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "5d4a430472cafada97888cc80672fab255231f57", - "type": "github" - }, - "original": { - "owner": "nixos", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_4": { - "locked": { - "lastModified": 1620340338, - "narHash": "sha256-Op/4K0+Z9Sp5jtFH0s/zMM4H7VFZxrekcAmjQ6JpQ4w=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "63586475587d7e0e078291ad4b49b6f6a6885100", + "rev": "b59c06dc92f8d03660eb4155754d93a6c34cda83", "type": "github" }, "original": { @@ -408,35 +453,47 @@ "type": "github" } }, - "pkgs": { - "inputs": { - "nixpkgs": [ - "nixos" - ] - }, + "nur": { "locked": { - "narHash": "sha256-G+qmA0vMRMgEd0Wp+jMjbOe5Yz+5/Imh+wn6mTWit1o=", - "path": "./pkgs", - "type": "path" - }, - "original": { - "path": "./pkgs", - "type": "path" - } - }, - "pre-commit-hooks-nix": { - "flake": false, - "locked": { - "lastModified": 1622650193, - "narHash": "sha256-qSzUpJDv04ajS9FXoCq6NjVF3qOt9IiGIiGh0P8amyw=", - "owner": "cachix", - "repo": "pre-commit-hooks.nix", - "rev": "0398f0649e0a741660ac5e8216760bae5cc78579", + "lastModified": 1626378135, + "narHash": "sha256-koC6DBYmLCrgXA+AMHVaODf1uHYPmvcFygHfy3eg6vI=", + "owner": "nix-community", + "repo": "NUR", + "rev": "00c2ec8f0bbdf0cfb2135bde55fbae5d6b64aa6d", "type": "github" }, "original": { - "owner": "cachix", - "repo": "pre-commit-hooks.nix", + "id": "nur", + "type": "indirect" + } + }, + "nvfetcher": { + "inputs": { + "flake-compat": [ + "digga", + "deploy", + "flake-compat" + ], + "flake-utils": [ + "digga", + "flake-utils-plus", + "flake-utils" + ], + "nixpkgs": [ + "latest" + ] + }, + "locked": { + "lastModified": 1627523399, + "narHash": "sha256-j9CgnUQpWcb8OB4LRzPW8BdxvmoROJptgptDlPA8Heo=", + "owner": "berberman", + "repo": "nvfetcher", + "rev": "fb8f2cc770ad3dd3e29d7ba3004692d4d53fba9b", + "type": "github" + }, + "original": { + "owner": "berberman", + "repo": "nvfetcher", "type": "github" } }, @@ -444,50 +501,40 @@ "inputs": { "agenix": "agenix", "b12f-nix-fonts": "b12f-nix-fonts", - "ci-agent": "ci-agent", + "blank": [ + "digga", + "blank" + ], + "bud": "bud", "darwin": "darwin", + "deploy": [ + "digga", + "deploy" + ], "digga": "digga", + "flake-utils": [ + "digga", + "flake-utils" + ], + "flake-utils-plus": [ + "digga", + "flake-utils-plus" + ], "home": "home", "latest": "latest", "naersk": "naersk_2", "nix-dram": "nix-dram", + "nixlib": [ + "digga", + "nixlib" + ], "nixos": "nixos", "nixos-hardware": "nixos-hardware", - "pkgs": "pkgs" - } - }, - "utils": { - "locked": { - "lastModified": 1610051610, - "narHash": "sha256-U9rPz/usA1/Aohhk7Cmc2gBrEEKRzcW4nwPWMPwja4Y=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "3982c9903e93927c2164caa727cd3f6a0e6d14cc", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "utils_2": { - "inputs": { - "flake-utils": "flake-utils" - }, - "locked": { - "lastModified": 1622583383, - "narHash": "sha256-2DFx619SNfjzYwqx1ryae8zHnTh+N7VsZkbtAbrYIIA=", - "owner": "gytis-ivaskevicius", - "repo": "flake-utils-plus", - "rev": "6b2ea4b02cad77fac581c6a9ec4f822ba87dce5c", - "type": "github" - }, - "original": { - "owner": "gytis-ivaskevicius", - "ref": "staging", - "repo": "flake-utils-plus", - "type": "github" + "nixpkgs": [ + "nixos" + ], + "nur": "nur", + "nvfetcher": "nvfetcher" } } }, diff --git a/flake.nix b/flake.nix index dfc20700..c298cc4b 100644 --- a/flake.nix +++ b/flake.nix @@ -1,133 +1,174 @@ { description = "A highly structured configuration database."; + nixConfig.extra-experimental-features = "nix-command flakes ca-references"; + nixConfig.extra-substituters = "https://nrdxp.cachix.org https://nix-community.cachix.org"; + nixConfig.extra-trusted-public-keys = "nrdxp.cachix.org-1:Fc5PSqY2Jm1TrWfm88l6cvGWwz3s93c6IOifQWnhNW4= nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="; + inputs = { - nixos.url = "nixpkgs/nixos-unstable"; - latest.url = "nixpkgs"; - digga.url = "github:divnix/digga/master"; + nixos.url = "github:nixos/nixpkgs/release-21.05"; + latest.url = "github:nixos/nixpkgs/nixos-unstable"; + + digga.url = "github:divnix/digga"; + digga.inputs.nixpkgs.follows = "nixos"; + digga.inputs.nixlib.follows = "nixos"; + digga.inputs.home-manager.follows = "home"; + + bud.url = "github:divnix/bud"; + bud.inputs.nixpkgs.follows = "nixos"; + bud.inputs.devshell.follows = "digga/devshell"; + + home.url = "github:nix-community/home-manager/release-21.05"; + home.inputs.nixpkgs.follows = "nixos"; - ci-agent = { - url = "github:hercules-ci/hercules-ci-agent"; - inputs = { nix-darwin.follows = "darwin"; nixos-20_09.follows = "nixos"; nixos-unstable.follows = "latest"; }; - }; darwin.url = "github:LnL7/nix-darwin"; darwin.inputs.nixpkgs.follows = "latest"; - home.url = "github:nix-community/home-manager"; - home.inputs.nixpkgs.follows = "nixos"; - naersk.url = "github:nmattia/naersk"; - naersk.inputs.nixpkgs.follows = "latest"; + + deploy.follows = "digga/deploy"; + agenix.url = "github:ryantm/agenix"; agenix.inputs.nixpkgs.follows = "latest"; + + nvfetcher.url = "github:berberman/nvfetcher"; + nvfetcher.inputs.nixpkgs.follows = "latest"; + nvfetcher.inputs.flake-compat.follows = "digga/deploy/flake-compat"; + nvfetcher.inputs.flake-utils.follows = "digga/flake-utils-plus/flake-utils"; + + naersk.url = "github:nmattia/naersk"; + naersk.inputs.nixpkgs.follows = "latest"; + nixos-hardware.url = "github:nixos/nixos-hardware"; - pkgs.url = "path:./pkgs"; - pkgs.inputs.nixpkgs.follows = "nixos"; + # start ANTI CORRUPTION LAYER + # remove after https://github.com/NixOS/nix/pull/4641 + nixpkgs.follows = "nixos"; + nixlib.follows = "digga/nixlib"; + blank.follows = "digga/blank"; + flake-utils-plus.follows = "digga/flake-utils-plus"; + flake-utils.follows = "digga/flake-utils"; + # end ANTI CORRUPTION LAYER # PubSolarOS additions nix-dram.url = "github:dramforever/nix-dram"; # b12f additions b12f-nix-fonts.url = "git+https://git.b12f.io/b12f/nix-fonts?ref=main"; + b12f-nix-fonts.inputs.nixpkgs.follows = "latest"; }; outputs = - inputs@{ self - , pkgs + { self , digga + , bud , nixos - , ci-agent , home , nixos-hardware + , nur , agenix + , nvfetcher + , deploy , nix-dram , b12f-nix-fonts , ... - }: digga.lib.mkFlake { - inherit self inputs; + } @ inputs: + digga.lib.mkFlake + { + inherit self inputs; - channelsConfig = { allowUnfree = true; }; + channelsConfig = { allowUnfree = true; }; + + channels = { + nixos = { + imports = [ (digga.lib.importOverlays ./overlays) ]; + overlays = [ + digga.overlays.patchedNix + nur.overlay + agenix.overlay + nvfetcher.overlay + deploy.overlay + nix-dram.overlay + b12f-nix-fonts.overlay + ./pkgs/default.nix + ]; + }; + latest = { }; + }; + + lib = import ./lib { lib = digga.lib // nixos.lib; }; + + sharedOverlays = [ + (final: prev: { + __dontExport = true; + lib = prev.lib.extend (lfinal: lprev: { + our = self.lib; + }); + }) + ]; - channels = { nixos = { - imports = [ (digga.lib.importers.overlays ./overlays) ]; - overlays = [ - ./pkgs/default.nix - pkgs.overlay # for `srcs` - agenix.overlay - nix-dram.overlay - b12f-nix-fonts.overlay - ]; - }; - latest = { }; - }; - - lib = import ./lib { lib = digga.lib // nixos.lib; }; - - sharedOverlays = [ - (final: prev: { - lib = prev.lib.extend (lfinal: lprev: { - our = self.lib; - }); - }) - ]; - - nixos = { - hostDefaults = { - system = "x86_64-linux"; - channelName = "nixos"; - modules = ./modules/module-list.nix; - externalModules = [ - { _module.args.ourLib = self.lib; } - ci-agent.nixosModules.agent-profile - home.nixosModules.home-manager - agenix.nixosModules.age - ./modules/customBuilds.nix - ]; - }; - - imports = [ (digga.lib.importers.hosts ./hosts) ]; - hosts = { - /* set host specific properties here */ - NixOS = { }; - }; - importables = rec { - profiles = digga.lib.importers.rakeLeaves ./profiles // { - users = digga.lib.importers.rakeLeaves ./users; + hostDefaults = { + system = "x86_64-linux"; + channelName = "nixos"; + imports = [ (digga.lib.importModules ./modules) ]; + externalModules = [ + { lib.our = self.lib; } + digga.nixosModules.bootstrapIso + digga.nixosModules.nixConfig + home.nixosModules.home-manager + agenix.nixosModules.age + bud.nixosModules.bud + ]; }; - suites = with profiles; rec { - base = [ core users.nixos users.root ]; - pubsolaros = [ core base-user users.root ]; - anonymous = pubsolaros ++ [ users.nixos ]; - b12f = pubsolaros ++ [ users.ben ]; - biolimo = b12f ++ [ graphical ]; - chocolatebar = b12f ++ [ graphical virtualisation ]; + + imports = [ (digga.lib.importHosts ./hosts) ]; + hosts = { + /* set host specific properties here */ + NixOS = { }; + }; + importables = rec { + profiles = digga.lib.rakeLeaves ./profiles // { + users = digga.lib.rakeLeaves ./users; + }; + suites = with profiles; rec { + base = [ core users.nixos users.root ]; + pubsolaros = [ core base-user users.root ]; + anonymous = pubsolaros ++ [ users.nixos ]; + b12f = pubsolaros ++ [ users.ben ]; + biolimo = b12f ++ [ graphical ]; + chocolatebar = b12f ++ [ graphical ]; + }; }; }; - }; - home = { - modules = ./users/modules/module-list.nix; - externalModules = [ ]; - importables = rec { - profiles = digga.lib.importers.rakeLeaves ./users/profiles; - suites = with profiles; rec { - base = [ direnv git ]; + home = { + imports = [ (digga.lib.importModules ./users/modules) ]; + externalModules = [ ]; + importables = rec { + profiles = digga.lib.rakeLeaves ./users/profiles; + suites = with profiles; rec { + base = [ direnv git ]; + }; }; + users = { + nixos = { suites, ... }: { imports = suites.base; }; + }; # digga.lib.importers.rakeLeaves ./users/hm; }; - }; - devshell.externalModules = { pkgs, ... }: { - packages = [ pkgs.agenix ]; - }; + devshell = ./shell; - homeConfigurations = digga.lib.mkHomeConfigurations self.nixosConfigurations; + homeConfigurations = digga.lib.mkHomeConfigurations self.nixosConfigurations; - deploy.nodes = digga.lib.mkDeployNodes self.nixosConfigurations { }; + deploy.nodes = digga.lib.mkDeployNodes self.nixosConfigurations { }; - defaultTemplate = self.templates.flk; - templates.flk.path = ./.; - templates.flk.description = "flk template"; + defaultTemplate = self.templates.bud; + templates.bud.path = ./.; + templates.bud.description = "bud template"; + + } + // + { + budModules = { devos = import ./bud; }; } ; } diff --git a/hosts/biolimo/biolimo.nix b/hosts/biolimo/biolimo.nix new file mode 100644 index 00000000..25e247c4 --- /dev/null +++ b/hosts/biolimo/biolimo.nix @@ -0,0 +1,26 @@ +{ config, pkgs, lib, ... }: +with lib; +let + psCfg = config.pub-solar; + xdg = config.home-manager.users."${psCfg.user.name}".xdg; +in +{ + imports = [ + ./configuration.nix + ]; + + config = { + pub-solar.x-os.keyfile = "/etc/nixos/hosts/biolimo/secrets/keyfile.bin"; + + hardware.cpu.intel.updateMicrocode = true; + + networking.firewall.allowedTCPPorts = [ 5000 ]; + + home-manager.users."${psCfg.user.name}".xdg.configFile = mkIf psCfg.sway.enable { + "sway/config.d/10-screens.conf".source = ./.config/sway/config.d/screens.conf; + "sway/config.d/10-autostart.conf".source = ./.config/sway/config.d/autostart.conf; + "sway/config.d/10-input-defaults.conf".source = ./.config/sway/config.d/input-defaults.conf; + "sway/config.d/10-custom-keybindings.conf".source = ./.config/sway/config.d/custom-keybindings.conf; + }; + }; +} diff --git a/hosts/biolimo/configuration.nix b/hosts/biolimo/configuration.nix index 76207fd3..9f4a341a 100644 --- a/hosts/biolimo/configuration.nix +++ b/hosts/biolimo/configuration.nix @@ -15,82 +15,12 @@ boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; - # networking.hostName = "nixos"; # Define your hostname. - # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. - - # Set your time zone. - # time.timeZone = "Europe/Amsterdam"; - - # Configure network proxy if necessary - # networking.proxy.default = "http://user:password@proxy:port/"; - # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; - - # Select internationalisation properties. - # i18n.defaultLocale = "en_US.UTF-8"; - # console = { - # font = "Lat2-Terminus16"; - # keyMap = "us"; - # }; - - # Enable the X11 windowing system. - # services.xserver.enable = true; - - - - - # Configure keymap in X11 - # services.xserver.layout = "us"; - # services.xserver.xkbOptions = "eurosign:e"; - - # Enable CUPS to print documents. - # services.printing.enable = true; - - # Enable sound. - # sound.enable = true; - # hardware.pulseaudio.enable = true; - - # Enable touchpad support (enabled default in most desktopManager). - # services.xserver.libinput.enable = true; - - # Define a user account. Don't forget to set a password with ‘passwd’. - # users.users.jane = { - # isNormalUser = true; - # extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user. - # }; - - # List packages installed in system profile. To search, run: - # $ nix search wget - # environment.systemPackages = with pkgs; [ - # wget vim - # firefox - # ]; - - # Some programs need SUID wrappers, can be configured further or are - # started in user sessions. - # programs.mtr.enable = true; - # programs.gnupg.agent = { - # enable = true; - # enableSSHSupport = true; - # }; - - # List services that you want to enable: - - # Enable the OpenSSH daemon. - # services.openssh.enable = true; - - # Open ports in the firewall. - # networking.firewall.allowedTCPPorts = [ ... ]; - # networking.firewall.allowedUDPPorts = [ ... ]; - # Or disable the firewall altogether. - # networking.firewall.enable = false; - # This value determines the NixOS release from which the default # settings for stateful data, like file locations and database versions # on your system were taken. It‘s perfectly fine and recommended to leave # this value at the release version of the first install of this system. # Before changing this value read the documentation for this option # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). - system.stateVersion = "21.05"; # Did you read the comment? - + system.stateVersion = "20.09"; # Did you read the comment? } diff --git a/hosts/biolimo/default.nix b/hosts/biolimo/default.nix index 4f014a22..26d7e453 100644 --- a/hosts/biolimo/default.nix +++ b/hosts/biolimo/default.nix @@ -1,6 +1,6 @@ { suites, ... }: { imports = [ - ./base.nix + ./biolimo.nix ] ++ suites.biolimo; } diff --git a/hosts/bootstrap.nix b/hosts/bootstrap.nix new file mode 100644 index 00000000..d491855d --- /dev/null +++ b/hosts/bootstrap.nix @@ -0,0 +1,18 @@ +{ profiles, ... }: +{ + # build with: `bud build bootstrap bootstrapIso` + # reachable on the local link via ssh root@fe80::47%eno1 + # where 'eno1' is replaced by your own machine's network + # interface that has the local link to the target machine + imports = [ + # profiles.networking + profiles.core + profiles.users.root # make sure to configure ssh keys + profiles.users.nixos + ]; + + boot.loader.systemd-boot.enable = true; + + # will be overridden by the bootstrapIso instrumentation + fileSystems."/" = { device = "/dev/disk/by-label/nixos"; }; +} diff --git a/hosts/chocolatebar/chocolatebar.nix b/hosts/chocolatebar/chocolatebar.nix new file mode 100644 index 00000000..76175878 --- /dev/null +++ b/hosts/chocolatebar/chocolatebar.nix @@ -0,0 +1,31 @@ +{ config, pkgs, lib, ... }: +with lib; +let + psCfg = config.pub-solar; + xdg = config.home-manager.users."${psCfg.user.name}".xdg; +in +{ + imports = [ + ./configuration.nix + ./virtualisation + ]; + + config = { + pub-solar.x-os.keyfile = "/etc/nixos/hosts/chocolatebar/secrets/keyfile.bin"; + + pub-solar.virtualisation.isolateGPU = "rx550x"; + + hardware.cpu.amd.updateMicrocode = true; + + hardware.opengl.extraPackages = with pkgs; [ + rocm-opencl-icd + rocm-opencl-runtime + ]; + + home-manager.users."${psCfg.user.name}".xdg.configFile = mkIf psCfg.sway.enable { + "sway/config.d/10-autostart.conf".source = ./.config/sway/config.d/autostart.conf; + "sway/config.d/10-input-defaults.conf".source = ./.config/sway/config.d/input-defaults.conf; + "sway/config.d/10-screens.conf".source = ./.config/sway/config.d/screens.conf; + }; + }; +} diff --git a/hosts/chocolatebar/configuration.nix b/hosts/chocolatebar/configuration.nix index 55457be8..4cdd96fd 100644 --- a/hosts/chocolatebar/configuration.nix +++ b/hosts/chocolatebar/configuration.nix @@ -15,81 +15,11 @@ boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; - # networking.hostName = "nixos"; # Define your hostname. - # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. - - # Set your time zone. - # time.timeZone = "Europe/Amsterdam"; - - # Configure network proxy if necessary - # networking.proxy.default = "http://user:password@proxy:port/"; - # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; - - # Select internationalisation properties. - # i18n.defaultLocale = "en_US.UTF-8"; - # console = { - # font = "Lat2-Terminus16"; - # keyMap = "us"; - # }; - - # Enable the X11 windowing system. - # services.xserver.enable = true; - - - - - # Configure keymap in X11 - # services.xserver.layout = "us"; - # services.xserver.xkbOptions = "eurosign:e"; - - # Enable CUPS to print documents. - # services.printing.enable = true; - - # Enable sound. - # sound.enable = true; - # hardware.pulseaudio.enable = true; - - # Enable touchpad support (enabled default in most desktopManager). - # services.xserver.libinput.enable = true; - - # Define a user account. Don't forget to set a password with ‘passwd’. - # users.users.jane = { - # isNormalUser = true; - # extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user. - # }; - - # List packages installed in system profile. To search, run: - # $ nix search wget - # environment.systemPackages = with pkgs; [ - # wget vim - # firefox - # ]; - - # Some programs need SUID wrappers, can be configured further or are - # started in user sessions. - # programs.mtr.enable = true; - # programs.gnupg.agent = { - # enable = true; - # enableSSHSupport = true; - # }; - - # List services that you want to enable: - - # Enable the OpenSSH daemon. - # services.openssh.enable = true; - - # Open ports in the firewall. - # networking.firewall.allowedTCPPorts = [ ... ]; - # networking.firewall.allowedUDPPorts = [ ... ]; - # Or disable the firewall altogether. - # networking.firewall.enable = false; - # This value determines the NixOS release from which the default # settings for stateful data, like file locations and database versions # on your system were taken. It‘s perfectly fine and recommended to leave # this value at the release version of the first install of this system. # Before changing this value read the documentation for this option # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). - system.stateVersion = "21.05"; # Did you read the comment? - + system.stateVersion = "20.09"; # Did you read the comment? } diff --git a/hosts/chocolatebar/default.nix b/hosts/chocolatebar/default.nix index fcb71c52..d7548796 100644 --- a/hosts/chocolatebar/default.nix +++ b/hosts/chocolatebar/default.nix @@ -1,6 +1,6 @@ { suites, ... }: { imports = [ - ./base.nix + ./chocolatebar.nix ] ++ suites.chocolatebar; } diff --git a/modules/customBuilds.nix b/modules/customBuilds.nix deleted file mode 100644 index 7181f65e..00000000 --- a/modules/customBuilds.nix +++ /dev/null @@ -1,33 +0,0 @@ -{ lib, self, diggaLib, config, modules, channel, ... }: -let - mkBuild = buildModule: - # TODO: get specialArgs as a module argument and drop builderArgs usage - channel.input.lib.nixosSystem (diggaLib.mergeAny config.lib.builderArgs { - modules = [ buildModule ]; - }); -in -{ - system.build = { - iso = (mkBuild (diggaLib.modules.isoConfig { - inherit self; - fullHostConfig = config; - })).config.system.build.isoImage; - - homes = (mkBuild ({ config, ... }: { - home-manager.useUserPackages = lib.mkForce false; - home-manager.sharedModules = [ - { - home.sessionVariables = { - inherit (config.environment.sessionVariables) NIX_PATH; - }; - xdg.configFile."nix/registry.json".text = - config.environment.etc."nix/registry.json".text; - } - ]; - })).config.home-manager.users; - - digitalOcean = (mkBuild ({ modulesPath, ... }: { - imports = [ "${modulesPath}/virtualisation/digital-ocean-image.nix" ]; - })).config.system.build.digitalOceanImage; - }; -} diff --git a/modules/hm-system-defaults.nix b/modules/hm-system-defaults.nix new file mode 100644 index 00000000..7b442a61 --- /dev/null +++ b/modules/hm-system-defaults.nix @@ -0,0 +1,11 @@ +{ config, ... }: { + home-manager.sharedModules = [ + { + home.sessionVariables = { + inherit (config.environment.sessionVariables) NIX_PATH; + }; + xdg.configFile."nix/registry.json".text = + config.environment.etc."nix/registry.json".text; + } + ]; +} diff --git a/modules/module-list.nix b/modules/module-list.nix deleted file mode 100644 index d17797a6..00000000 --- a/modules/module-list.nix +++ /dev/null @@ -1,21 +0,0 @@ -[ - # ./compat - ./user - ./x-os - ./sway - ./graphical - ./docker - ./audio - ./email - ./crypto - ./nextcloud - ./gaming - ./virtualisation - ./social - ./devops - ./terminal-life - ./server - ./printing - ./office - ./uhk -] diff --git a/modules/nix-path.nix b/modules/nix-path.nix new file mode 100644 index 00000000..273f67a6 --- /dev/null +++ b/modules/nix-path.nix @@ -0,0 +1,7 @@ +{ channel, inputs, ... }: { + nix.nixPath = [ + "nixpkgs=${channel.input}" + "nixos-config=${../lib/compat/nixos}" + "home-manager=${inputs.home}" + ]; +} diff --git a/modules/sway/config/config b/modules/sway/config/config index 2360c062..752a96c5 100644 --- a/modules/sway/config/config +++ b/modules/sway/config/config @@ -125,7 +125,7 @@ output * bg ~/.config/wallpaper.jpg fill bindsym $mod+Shift+9 move container to workspace 9; workspace $ws9 # Note: workspaces can have any name you want, not just numbers. # We just use 1-10 as the default. - + #navigate workspaces next / previous bindsym $mod+Ctrl+Right workspace next bindsym $mod+Ctrl+Left workspace prev @@ -141,13 +141,13 @@ output * bg ~/.config/wallpaper.jpg fill # Configure border style default_border pixel 1 default_floating_border normal - + # Hide borders hide_edge_borders none # Font for window titles. Will also be used by the bar unless a different font # is used in the bar {} block below. - font xft:Hack 16 + font xft:Hack 16 # You can "split" the current object of your focus with # $mod+b or $mod+v, for horizontal and vertical splits diff --git a/modules/sway/config/config.d/gaps.conf b/modules/sway/config/config.d/gaps.conf index f0a17661..0dcc5087 100644 --- a/modules/sway/config/config.d/gaps.conf +++ b/modules/sway/config/config.d/gaps.conf @@ -10,7 +10,7 @@ gaps outer -5 # Smart gaps (gaps used if only more than one container on the workspace) smart_gaps on -# Smart borders (draw borders around container only if it is not the only container on this workspace) +# Smart borders (draw borders around container only if it is not the only container on this workspace) # on|no_gaps (on=always activate and no_gaps=only activate if the gap size to the edge of the screen is 0) smart_borders on diff --git a/modules/sway/config/config.d/systemd.conf b/modules/sway/config/config.d/systemd.conf index ceb273f8..3fecd355 100644 --- a/modules/sway/config/config.d/systemd.conf +++ b/modules/sway/config/config.d/systemd.conf @@ -1,5 +1,5 @@ # Note that the systemctl commands must be run synchronously and can't be split into -# three exec statements, since otherwise the session target may be started before +# three exec statements, since otherwise the session target may be started before # systemctl import-environment is complete, and services that require certain variables # will fail to run. # https://github.com/swaywm/sway/wiki/Systemd-integration diff --git a/modules/terminal-life/zsh/p10k.zsh b/modules/terminal-life/zsh/p10k.zsh index 64503895..be207b58 100644 --- a/modules/terminal-life/zsh/p10k.zsh +++ b/modules/terminal-life/zsh/p10k.zsh @@ -596,7 +596,7 @@ typeset -g POWERLEVEL9K_ASDF_HASKELL_FOREGROUND=172 # typeset -g POWERLEVEL9K_ASDF_HASKELL_VISUAL_IDENTIFIER_EXPANSION='⭐' # typeset -g POWERLEVEL9K_ASDF_HASKELL_SHOW_ON_UPGLOB='*.foo|*.bar' - + ###########[ nix_shell ]########### # # Nix shell color. typeset -g POWERLEVEL9K_NIX_SHELL_FOREGROUND=74 diff --git a/overlays/manix.nix b/overlays/manix.nix new file mode 100644 index 00000000..d39baa74 --- /dev/null +++ b/overlays/manix.nix @@ -0,0 +1,5 @@ +final: prev: { + manix = prev.manix.overrideAttrs (o: rec{ + inherit (prev.sources.manix) pname version src; + }); +} diff --git a/overlays/overrides.nix b/overlays/overrides.nix index 502a0754..06aa5247 100644 --- a/overlays/overrides.nix +++ b/overlays/overrides.nix @@ -7,8 +7,8 @@ channels: final: prev: { dhall discord element-desktop - manix rage + docker-compose neovim-unwrapped nixpkgs-fmt qutebrowser @@ -16,15 +16,15 @@ channels: final: prev: { starship; - haskellPackages = prev.haskellPackages.override { - overrides = hfinal: hprev: - let version = prev.lib.replaceChars [ "." ] [ "" ] prev.ghc.version; - in - { - # same for haskell packages, matching ghc versions - inherit (channels.latest.haskell.packages."ghc${version}") - haskell-language-server; - }; - }; - + haskellPackages = prev.haskellPackages.override + (old: { + overrides = prev.lib.composeExtensions (old.overrides or (_: _: { })) (hfinal: hprev: + let version = prev.lib.replaceChars [ "." ] [ "" ] prev.ghc.version; + in + { + # same for haskell packages, matching ghc versions + inherit (channels.latest.haskell.packages."ghc${version}") + haskell-language-server; + }); + }); } diff --git a/overlays/various-flake-fixes.nix b/overlays/various-flake-fixes.nix new file mode 100644 index 00000000..7dbfc18b --- /dev/null +++ b/overlays/various-flake-fixes.nix @@ -0,0 +1,11 @@ +final: prev: { + # Since: https://github.com/NixOS/nixpkgs/pull/126137 + nix-direnv = + if builtins.hasAttr "enableFlakes" prev.nix-direnv.override.__functionArgs + then + prev.nix-direnv.override + { + enableFlakes = true; + } + else prev.nix-direnv; +} diff --git a/pkgs/_sources/generated.nix b/pkgs/_sources/generated.nix new file mode 100644 index 00000000..71be3965 --- /dev/null +++ b/pkgs/_sources/generated.nix @@ -0,0 +1,16 @@ +# This file was generated by nvfetcher, please do not modify it manually. +{ fetchgit, fetchurl }: +{ + manix = { + pname = "manix"; + version = "d08e7ca185445b929f097f8bfb1243a8ef3e10e4"; + src = fetchgit { + url = "https://github.com/mlvzk/manix"; + rev = "d08e7ca185445b929f097f8bfb1243a8ef3e10e4"; + fetchSubmodules = false; + deepClone = false; + leaveDotGit = false; + sha256 = "1b7xi8c2drbwzfz70czddc4j33s7g1alirv12dwl91hbqxifx8qs"; + }; + }; +} diff --git a/pkgs/default.nix b/pkgs/default.nix index 935206d9..a096f93e 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -1,15 +1,18 @@ final: prev: -with final; { - import-gtk-settings = writeShellScriptBin "import-gtk-settings" (import ./import-gtk-settings.nix final); - mailto-mutt = writeShellScriptBin "mailto-mutt" (import ./mailto-mutt.nix final); - mopidy-jellyfin = import ./mopidy-jellyfin.nix final; - mu = writeShellScriptBin "mu" (import ./mu.nix final); - psos = writeShellScriptBin "psos" (import ./psos.nix final); - s = writeShellScriptBin "s" (import ./s.nix final); - sway-launcher = writeScriptBin "sway-launcher" (import ./sway-launcher.nix final); - sway-service = writeShellScriptBin "sway-service" (import ./sway-service.nix final); - swaylock-bg = writeScriptBin "swaylock-bg" (import ./swaylock-bg.nix final); - toggle-kbd-layout = writeShellScriptBin "toggle-kbd-layout" (import ./toggle-kbd-layout.nix final); - uhk-agent = import ./uhk-agent.nix final; - wcwd = writeShellScriptBin "wcwd" (import ./wcwd.nix final); + with final; { + # keep sources this first + sources = prev.callPackage (import ./_sources/generated.nix) { }; + # then, call packages with `final.callPackage` + import-gtk-settings = writeShellScriptBin "import-gtk-settings" (import ./import-gtk-settings.nix final); + mailto-mutt = writeShellScriptBin "mailto-mutt" (import ./mailto-mutt.nix final); + mopidy-jellyfin = import ./mopidy-jellyfin.nix final; + mu = writeShellScriptBin "mu" (import ./mu.nix final); + psos = writeShellScriptBin "psos" (import ./psos.nix final); + s = writeShellScriptBin "s" (import ./s.nix final); + sway-launcher = writeScriptBin "sway-launcher" (import ./sway-launcher.nix final); + sway-service = writeShellScriptBin "sway-service" (import ./sway-service.nix final); + swaylock-bg = writeScriptBin "swaylock-bg" (import ./swaylock-bg.nix final); + toggle-kbd-layout = writeShellScriptBin "toggle-kbd-layout" (import ./toggle-kbd-layout.nix final); + uhk-agent = import ./uhk-agent.nix final; + wcwd = writeShellScriptBin "wcwd" (import ./wcwd.nix final); } diff --git a/pkgs/flake.lock b/pkgs/flake.lock deleted file mode 100644 index ef3f5a9a..00000000 --- a/pkgs/flake.lock +++ /dev/null @@ -1,25 +0,0 @@ -{ - "nodes": { - "nixpkgs": { - "locked": { - "lastModified": 1615926763, - "narHash": "sha256-yeq8A3EPNuQVlsxlEQrIRsklfJwJK0Us6jtcG/u8wNs=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "b702a56d417647de4090ac56c0f18bdc7e646610", - "type": "github" - }, - "original": { - "id": "nixpkgs", - "type": "indirect" - } - }, - "root": { - "inputs": { - "nixpkgs": "nixpkgs" - } - } - }, - "root": "root", - "version": 7 -} diff --git a/pkgs/flake.nix b/pkgs/flake.nix deleted file mode 100644 index 1b6cc0a2..00000000 --- a/pkgs/flake.nix +++ /dev/null @@ -1,52 +0,0 @@ -{ - description = "Package Sources"; - - inputs = { }; - - outputs = { self, nixpkgs, ... }: { - overlay = final: prev: { - inherit (self) srcs; - }; - - srcs = - let - inherit (nixpkgs) lib; - - mkVersion = name: input: - let - inputs = (builtins.fromJSON - (builtins.readFile ./flake.lock)).nodes; - - ref = - if lib.hasAttrByPath [ name "original" "ref" ] inputs - then inputs.${name}.original.ref - else ""; - - version = - let version' = builtins.match - "[[:alpha:]]*[-._]?([0-9]+(\.[0-9]+)*)+" - ref; - in - if lib.isList version' - then lib.head version' - else if input ? lastModifiedDate && input ? shortRev - then "${lib.substring 0 8 input.lastModifiedDate}_${input.shortRev}" - else null; - in - version; - in - lib.mapAttrs - (pname: input: - let - version = mkVersion pname input; - in - input // { inherit pname; } - // lib.optionalAttrs (! isNull version) - { - inherit version; - } - ) - (lib.filterAttrs (n: _: n != "nixpkgs") - self.inputs); - }; -} diff --git a/pkgs/sources.toml b/pkgs/sources.toml new file mode 100644 index 00000000..f7af168e --- /dev/null +++ b/pkgs/sources.toml @@ -0,0 +1,4 @@ +# nvfetcher.toml +[manix] +src.git = "https://github.com/mlvzk/manix" +fetch.github = "mlvzk/manix" diff --git a/profiles/base-user/.config/dircolors b/profiles/base-user/.config/dircolors index 89c085da..16b9bb1b 100644 --- a/profiles/base-user/.config/dircolors +++ b/profiles/base-user/.config/dircolors @@ -116,7 +116,7 @@ EXEC 01;32 #.sh 01;32 #.csh 01;32 - # archives or compressed (bright red) +# archives or compressed (bright red) .tar 01;31 .tgz 01;31 .arc 01;31 diff --git a/profiles/base-user/.config/mutt/mailcap b/profiles/base-user/.config/mutt/mailcap index f6cb96a1..86035375 100644 --- a/profiles/base-user/.config/mutt/mailcap +++ b/profiles/base-user/.config/mutt/mailcap @@ -1 +1 @@ -text/html; w3m -I %{charset} -T text/html; copiousoutput; +text/html; w3m -I %{charset} -T text/html; copiousoutput; diff --git a/profiles/base-user/.config/user-dirs.dirs b/profiles/base-user/.config/user-dirs.dirs index 5a833b8f..a1bf8b4d 100644 --- a/profiles/base-user/.config/user-dirs.dirs +++ b/profiles/base-user/.config/user-dirs.dirs @@ -4,7 +4,7 @@ # Format is XDG_xxx_DIR="$HOME/yyy", where yyy is a shell-escaped # homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an # absolute path. No other format is supported. -# + XDG_DESKTOP_DIR="$HOME/" XDG_DOWNLOAD_DIR="$HOME/Downloads" XDG_TEMPLATES_DIR="$HOME/Templates" diff --git a/profiles/base-user/.config/user-dirs.locale b/profiles/base-user/.config/user-dirs.locale index 3e0b4191..7741b83a 100644 --- a/profiles/base-user/.config/user-dirs.locale +++ b/profiles/base-user/.config/user-dirs.locale @@ -1 +1 @@ -en_US \ No newline at end of file +en_US diff --git a/profiles/base-user/.config/vifm/vifmrc b/profiles/base-user/.config/vifm/vifmrc index 3a10e173..400aea0d 100644 --- a/profiles/base-user/.config/vifm/vifmrc +++ b/profiles/base-user/.config/vifm/vifmrc @@ -195,26 +195,26 @@ filextype *.djvu " Audio filetype *.wav,*.mp3,*.flac,*.m4a,*.wma,*.ape,*.ac3,*.og[agx],*.spx,*.opus - \ {Play using vlc} - \ vlc %c, - \ {Play using ffplay} - \ ffplay -nodisp -autoexit %c, + \ {Play using vlc} + \ vlc %c, + \ {Play using ffplay} + \ ffplay -nodisp -autoexit %c, fileviewer *.mp3 mp3info fileviewer *.flac soxi " Video filextype *.avi,*.mp4,*.wmv,*.dat,*.3gp,*.ogv,*.mkv,*.mpg,*.mpeg,*.vob, - \*.fl[icv],*.m2v,*.mov,*.webm,*.ts,*.mts,*.m4v,*.r[am],*.qt,*.divx, - \*.as[fx] + \*.fl[icv],*.m2v,*.mov,*.webm,*.ts,*.mts,*.m4v,*.r[am],*.qt,*.divx, + \*.as[fx] \ {View using vlc} \ vlc %f, \ {View using ffplay} \ ffplay -fs -autoexit %f, fileviewer *.avi,*.mp4,*.wmv,*.dat,*.3gp,*.ogv,*.mkv,*.mpg,*.mpeg,*.vob, - \*.fl[icv],*.m2v,*.mov,*.webm,*.ts,*.mts,*.m4v,*.r[am],*.qt,*.divx, - \*.as[fx] - \ vifmimg videopreview %px %py %pw %ph %c - \ %pc + \*.fl[icv],*.m2v,*.mov,*.webm,*.ts,*.mts,*.m4v,*.r[am],*.qt,*.divx, + \*.as[fx] + \ vifmimg videopreview %px %py %pw %ph %c + \ %pc \ vifmimg clear " \ ffprobe -pretty %c 2>&1 @@ -242,7 +242,7 @@ fileviewer *.bmp,*.jpg,*.jpeg,*.png,*.xpm \ %pc \ vifmimg clear " Get w3m image previews inside vifm - " \ imgt %px %py %pw %ph %c + " \ imgt %px %py %pw %ph %c " \ %pc " \ imgc %px %py %pw %ph NOT NEEDED IN XTERM fileviewer *.gif @@ -262,28 +262,28 @@ filextype *.vym " MD5 filetype *.md5 - \ {Check MD5 hash sum} - \ md5sum -c %f %S, + \ {Check MD5 hash sum} + \ md5sum -c %f %S, " SHA1 filetype *.sha1 - \ {Check SHA1 hash sum} - \ sha1sum -c %f %S, + \ {Check SHA1 hash sum} + \ sha1sum -c %f %S, " SHA256 filetype *.sha256 - \ {Check SHA256 hash sum} - \ sha256sum -c %f %S, + \ {Check SHA256 hash sum} + \ sha256sum -c %f %S, " SHA512 filetype *.sha512 - \ {Check SHA512 hash sum} - \ sha512sum -c %f %S, + \ {Check SHA512 hash sum} + \ sha512sum -c %f %S, " GPG signature filetype *.asc - \ {Check signature} - \ !!gpg --verify %c, + \ {Check signature} + \ !!gpg --verify %c, " Torrent filetype *.torrent ktorrent %f & @@ -291,18 +291,18 @@ fileviewer *.torrent dumptorrent -v %c " FuseZipMount filetype *.zip,*.jar,*.war,*.ear,*.oxt,*.apkg - \ {Mount with fuse-zip} - \ FUSE_MOUNT|fuse-zip %SOURCE_FILE %DESTINATION_DIR, - \ {View contents} - \ zip -sf %c | less, - \ {Extract here} - \ tar -xf %c, + \ {Mount with fuse-zip} + \ FUSE_MOUNT|fuse-zip %SOURCE_FILE %DESTINATION_DIR, + \ {View contents} + \ zip -sf %c | less, + \ {Extract here} + \ tar -xf %c, fileviewer *.zip,*.jar,*.war,*.ear,*.oxt zip -sf %c " ArchiveMount filetype *.tar,*.tar.bz2,*.tbz2,*.tgz,*.tar.gz,*.tar.xz,*.txz - \ {Mount with archivemount} - \ FUSE_MOUNT|archivemount %SOURCE_FILE %DESTINATION_DIR, + \ {Mount with archivemount} + \ FUSE_MOUNT|archivemount %SOURCE_FILE %DESTINATION_DIR, fileviewer *.tgz,*.tar.gz tar -tzf %c fileviewer *.tar.bz2,*.tbz2 tar -tjf %c fileviewer *.tar.txz,*.txz xz --list %c @@ -310,29 +310,29 @@ fileviewer *.tar tar -tf %c " Rar2FsMount and rar archives filetype *.rar - \ {Mount with rar2fs} - \ FUSE_MOUNT|rar2fs %SOURCE_FILE %DESTINATION_DIR, + \ {Mount with rar2fs} + \ FUSE_MOUNT|rar2fs %SOURCE_FILE %DESTINATION_DIR, fileviewer *.rar unrar v %c " IsoMount filetype *.iso - \ {Mount with fuseiso} - \ FUSE_MOUNT|fuseiso %SOURCE_FILE %DESTINATION_DIR, + \ {Mount with fuseiso} + \ FUSE_MOUNT|fuseiso %SOURCE_FILE %DESTINATION_DIR, " SshMount filetype *.ssh - \ {Mount with sshfs} - \ FUSE_MOUNT2|sshfs %PARAM %DESTINATION_DIR %FOREGROUND, + \ {Mount with sshfs} + \ FUSE_MOUNT2|sshfs %PARAM %DESTINATION_DIR %FOREGROUND, " FtpMount filetype *.ftp - \ {Mount with curlftpfs} - \ FUSE_MOUNT2|curlftpfs -o ftp_port=-,,disable_eprt %PARAM %DESTINATION_DIR %FOREGROUND, + \ {Mount with curlftpfs} + \ FUSE_MOUNT2|curlftpfs -o ftp_port=-,,disable_eprt %PARAM %DESTINATION_DIR %FOREGROUND, " Fuse7z and 7z archives filetype *.7z - \ {Mount with fuse-7z} - \ FUSE_MOUNT|fuse-7z %SOURCE_FILE %DESTINATION_DIR, + \ {Mount with fuse-7z} + \ FUSE_MOUNT|fuse-7z %SOURCE_FILE %DESTINATION_DIR, fileviewer *.7z 7z l %c " Office files @@ -348,8 +348,8 @@ filextype *.pro qtcreator %f & " All others filetype *.ts,*.js,*.css,*.sass,*.scss,*.go,*.rs,*.py,*.html,*.xhtml,*.json,*.jsx,*.tsx,*.vue,*.svelte,*.sql - \ {Open in editor} - \ nvim %c, + \ {Open in editor} + \ nvim %c, fileviewer *.ts,*.js,*.css,*.sass,*.scss,*.go,*.rs,*.py,*.html,*.xhtml,*.json,*.jsx,*.tsx,*.vue,*.svelte,*.sql bat %c " Directories diff --git a/profiles/base-user/.config/waybar/config b/profiles/base-user/.config/waybar/config index b2231671..3ac2f37a 100644 --- a/profiles/base-user/.config/waybar/config +++ b/profiles/base-user/.config/waybar/config @@ -1,102 +1,102 @@ { - "layer": "top", // Waybar at top layer - // "position": "bottom", // Waybar position (top|bottom|left|right) + "layer": "top", // Waybar at top layer + // "position": "bottom", // Waybar position (top|bottom|left|right) - "height": 26, // Waybar height - "modules-left": ["sway/workspaces", "sway/mode"], - "modules-center": ["mpd"], - "modules-right": ["sway/language", "pulseaudio", "network", "idle_inhibitor", "battery", "clock", "tray"], - "sway/workspaces": { - "disable-scroll": true - }, - "sway/mode": { - "tooltip": false, - "format": "{}" - }, - "sway/window": { - "tooltip": false, - "max-length": 96 - }, - "sway/language": { + "height": 26, // Waybar height + "modules-left": ["sway/workspaces", "sway/mode"], + "modules-center": ["mpd"], + "modules-right": ["sway/language", "pulseaudio", "network", "idle_inhibitor", "battery", "clock", "tray"], + "sway/workspaces": { + "disable-scroll": true + }, + "sway/mode": { + "tooltip": false, + "format": "{}" + }, + "sway/window": { + "tooltip": false, + "max-length": 96 + }, + "sway/language": { "format": "{}", "max-length": 50 - }, - "tray": { - "icon-size": 21, - "spacing": 10 - }, - "clock": { - "tooltip-format": "{:%Y %B}\n{calendar}", - "format-alt": "{:%a %d. %h %H:%M}" - }, - "backlight": { - // "device": "acpi_video1", - "tooltip": true, - "tooltip-format": "Brightness: {percent}%", - "format": "{icon}", - "format-icons": ["", ""] + }, + "tray": { + "icon-size": 21, + "spacing": 10 + }, + "clock": { + "tooltip-format": "{:%Y %B}\n{calendar}", + "format-alt": "{:%a %d. %h %H:%M}" + }, + "backlight": { + // "device": "acpi_video1", + "tooltip": true, + "tooltip-format": "Brightness: {percent}%", + "format": "{icon}", + "format-icons": ["", ""] + }, + "cpu": { + "format": "{}% " + }, + "memory": { + "format": "{}% " + }, + "idle_inhibitor": { + "format": "{icon} ", + "format-icons": { + "activated": "", + "deactivated": "" + } + }, + "battery": { + "tooltip": false, + "states": { + "critical": 25 }, - "cpu": { - "format": "{}% " - }, - "memory": { - "format": "{}% " - }, - "idle_inhibitor": { - "format": "{icon} ", - "format-icons": { - "activated": "", - "deactivated": "" - } + "full-at": 84, + "format": "{icon} {capacity}%", + "format-full": "{icon}", + "format-icons": ["", "", "", "", ""], + }, + "network": { + "interval": 3, + "tooltip": true, + //"interface": "wlp4s0", // (Optional) To force the use of this interface   \uF2E7, + "format-wifi": " \uf062 {bandwidthUpBits} | \uf063 {bandwidthDownBits}", + "format-ethernet": " \uf062 {bandwidthUpBits} | \uf063 {bandwidthDownBits}", + "format-disconnected": "", + "tooltip-format-wifi": "{essid} ({signalStrength}%)  {ipaddr}", + "tooltip-format-ethernet": "{ifname}  {ipaddr}" + }, + //\ue04f{volume}% + "pulseaudio": { + "tooltip": false, + "format": "{volume}% {icon}", + "format-bluetooth": "{volume}% {icon}", + "format-muted": "", + "on-click": "pavucontrol", + "format-alt": "{volume}% {icon}", + "format-icons": { + "headphones": "", + "handsfree": "", + "headset": "", + "phone": "", + "portable": "", + "car": "", + "default": ["","", ""] + } + }, + "mpd": { + "format": "{artist} - {title} [{elapsedTime:%M:%S} / {totalTime:%M:%S}]", + "format-disconnected": "", + "format-stopped": "", + "interval": 1, + "state-icons": { + "paused": "", + "playing": "" }, - "battery": { - "tooltip": false, - "states": { - "critical": 25 - }, - "full-at": 84, - "format": "{icon} {capacity}%", - "format-full": "{icon}", - "format-icons": ["", "", "", "", ""], - }, - "network": { - "interval": 3, - "tooltip": true, - //"interface": "wlp4s0", // (Optional) To force the use of this interface   \uF2E7, - "format-wifi": " \uf062 {bandwidthUpBits} | \uf063 {bandwidthDownBits}", - "format-ethernet": " \uf062 {bandwidthUpBits} | \uf063 {bandwidthDownBits}", - "format-disconnected": "", - "tooltip-format-wifi": "{essid} ({signalStrength}%)  {ipaddr}", - "tooltip-format-ethernet": "{ifname}  {ipaddr}" - }, - //\ue04f{volume}% - "pulseaudio": { - "tooltip": false, - "format": "{volume}% {icon}", - "format-bluetooth": "{volume}% {icon}", - "format-muted": "", - "on-click": "pavucontrol", - "format-alt": "{volume}% {icon}", - "format-icons": { - "headphones": "", - "handsfree": "", - "headset": "", - "phone": "", - "portable": "", - "car": "", - "default": ["","", ""] - } - }, - "mpd": { - "format": "{artist} - {title} [{elapsedTime:%M:%S} / {totalTime:%M:%S}]", - "format-disconnected": "", - "format-stopped": "", - "interval": 1, - "state-icons": { - "paused": "", - "playing": "" - }, - "tooltip-format": "MPD (connected)", - "tooltip-format-disconnected": "MPD (disconnected)" - } + "tooltip-format": "MPD (connected)", + "tooltip-format-disconnected": "MPD (disconnected)" + } } diff --git a/profiles/base-user/.config/waybar/style.css b/profiles/base-user/.config/waybar/style.css index f4e07cce..ef85a95a 100644 --- a/profiles/base-user/.config/waybar/style.css +++ b/profiles/base-user/.config/waybar/style.css @@ -51,7 +51,7 @@ window#waybar { } #battery.critical { - color: @base07; + color: @base07; } #battery.charging { color: @base0B; diff --git a/profiles/base-user/.xinitrc b/profiles/base-user/.xinitrc index 3c317bfb..d961f66c 100644 --- a/profiles/base-user/.xinitrc +++ b/profiles/base-user/.xinitrc @@ -46,28 +46,28 @@ if [ -d /etc/X11/xinit/xinitrc.d ] ; then fi get_session(){ - local dbus_args=(--sh-syntax --exit-with-session) - case $1 in - awesome) dbus_args+=(awesome) ;; - bspwm) dbus_args+=(bspwm-session) ;; - budgie) dbus_args+=(budgie-desktop) ;; - cinnamon) dbus_args+=(cinnamon-session) ;; - deepin) dbus_args+=(startdde) ;; - enlightenment) dbus_args+=(enlightenment_start) ;; - fluxbox) dbus_args+=(startfluxbox) ;; - gnome) dbus_args+=(gnome-session) ;; - i3|i3wm) dbus_args+=(i3 --shmlog-size 0) ;; - jwm) dbus_args+=(jwm) ;; - kde) dbus_args+=(startkde) ;; - lxde) dbus_args+=(startlxde) ;; - lxqt) dbus_args+=(lxqt-session) ;; - mate) dbus_args+=(mate-session) ;; - xfce) dbus_args+=(xfce4-session) ;; - openbox) dbus_args+=(openbox-session) ;; - *) dbus_args+=($DEFAULT_SESSION) ;; - esac + local dbus_args=(--sh-syntax --exit-with-session) + case $1 in + awesome) dbus_args+=(awesome) ;; + bspwm) dbus_args+=(bspwm-session) ;; + budgie) dbus_args+=(budgie-desktop) ;; + cinnamon) dbus_args+=(cinnamon-session) ;; + deepin) dbus_args+=(startdde) ;; + enlightenment) dbus_args+=(enlightenment_start) ;; + fluxbox) dbus_args+=(startfluxbox) ;; + gnome) dbus_args+=(gnome-session) ;; + i3|i3wm) dbus_args+=(i3 --shmlog-size 0) ;; + jwm) dbus_args+=(jwm) ;; + kde) dbus_args+=(startkde) ;; + lxde) dbus_args+=(startlxde) ;; + lxqt) dbus_args+=(lxqt-session) ;; + mate) dbus_args+=(mate-session) ;; + xfce) dbus_args+=(xfce4-session) ;; + openbox) dbus_args+=(openbox-session) ;; + *) dbus_args+=($DEFAULT_SESSION) ;; + esac - echo "dbus-launch ${dbus_args[*]}" + echo "dbus-launch ${dbus_args[*]}" } exec $(get_session) diff --git a/shell/default.nix b/shell/default.nix new file mode 100644 index 00000000..aef90a55 --- /dev/null +++ b/shell/default.nix @@ -0,0 +1,10 @@ +{ self, inputs, ... }: +{ + externalModules = with inputs; [ + bud.devshellModules.bud + ]; + modules = [ + ./devos.nix + ]; +} + diff --git a/shell/devos.nix b/shell/devos.nix new file mode 100644 index 00000000..128b45c3 --- /dev/null +++ b/shell/devos.nix @@ -0,0 +1,61 @@ +{ pkgs, extraModulesPath, ... }: +let + + hooks = import ./hooks; + + pkgWithCategory = category: package: { inherit package category; }; + linter = pkgWithCategory "linter"; + docs = pkgWithCategory "docs"; + devos = pkgWithCategory "devos"; + +in +{ + _file = toString ./.; + + imports = [ "${extraModulesPath}/git/hooks.nix" ]; + git = { inherit hooks; }; + + # tempfix: remove when merged https://github.com/numtide/devshell/pull/123 + devshell.startup.load_profiles = pkgs.lib.mkForce (pkgs.lib.noDepEntry '' + # PATH is devshell's exorbitant privilige: + # fence against its pollution + _PATH=''${PATH} + # Load installed profiles + for file in "$DEVSHELL_DIR/etc/profile.d/"*.sh; do + # If that folder doesn't exist, bash loves to return the whole glob + [[ -f "$file" ]] && source "$file" + done + # Exert exorbitant privilige and leave no trace + export PATH=''${_PATH} + unset _PATH + ''); + + packages = with pkgs; [ + git-crypt + ]; + + commands = with pkgs; [ + (devos nixUnstable) + (devos agenix) + { + category = "devos"; + name = pkgs.nvfetcher-bin.pname; + help = pkgs.nvfetcher-bin.meta.description; + command = "cd $DEVSHELL_ROOT/pkgs; ${pkgs.nvfetcher-bin}/bin/nvfetcher -c ./sources.toml --no-output $@"; + } + (linter nixpkgs-fmt) + (linter editorconfig-checker) + # (docs python3Packages.grip) too many deps + (docs mdbook) + ] + + ++ lib.optional + (pkgs ? deploy-rs) + (devos deploy-rs.deploy-rs) + + ++ lib.optional + (system != "i686-linux") + (devos cachix) + + ; +} diff --git a/shell/hooks/default.nix b/shell/hooks/default.nix new file mode 100644 index 00000000..10f2c9d2 --- /dev/null +++ b/shell/hooks/default.nix @@ -0,0 +1,4 @@ +{ + enable = true; + pre-commit.text = builtins.readFile ./pre-commit.sh; +} diff --git a/shell/hooks/pre-commit.sh b/shell/hooks/pre-commit.sh new file mode 100755 index 00000000..985d3b40 --- /dev/null +++ b/shell/hooks/pre-commit.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +if git rev-parse --verify HEAD >/dev/null 2>&1 +then + against=HEAD +else + # Initial commit: diff against an empty tree object + against=$(${git}/bin/git hash-object -t tree /dev/null) +fi + +diff="git diff-index --name-only --cached $against --diff-filter d" + +nix_files=($($diff -- '*.nix')) +all_files=($($diff)) + +# Format staged nix files. +if [[ -n "${nix_files[@]}" ]]; then + nixpkgs-fmt "${nix_files[@]}" \ + && git add "${nix_files[@]}" +fi + +# check editorconfig +editorconfig-checker -- "${all_files[@]}" +if [[ $? != '0' ]]; then + printf "%b\n" \ + "\nCode is not aligned with .editorconfig" \ + "Review the output and commit your fixes" >&2 + exit 1 +fi diff --git a/users/modules/.flake-keep b/users/modules/.flake-keep new file mode 100644 index 00000000..e69de29b diff --git a/users/modules/module-list.nix b/users/modules/module-list.nix deleted file mode 100644 index 1e3ec721..00000000 --- a/users/modules/module-list.nix +++ /dev/null @@ -1 +0,0 @@ -[ ] diff --git a/users/nixos/default.nix b/users/nixos/default.nix index 700467b9..5c037fe8 100644 --- a/users/nixos/default.nix +++ b/users/nixos/default.nix @@ -1,8 +1,6 @@ -{ ... }: +{ hmUsers, ... }: { - home-manager.users.nixos = { suites, ... }: { - imports = suites.base; - }; + home-manager.users = { inherit (hmUsers) nixos; }; users.users.nixos = { uid = 1000; diff --git a/users/profiles/direnv/default.nix b/users/profiles/direnv/default.nix index 173a9c58..d345e2d3 100644 --- a/users/profiles/direnv/default.nix +++ b/users/profiles/direnv/default.nix @@ -1,6 +1,9 @@ { programs.direnv = { enable = true; - enableNixDirenvIntegration = true; + nix-direnv = { + enable = true; + enableFlakes = true; + }; }; }