Skip to content

Commit

Permalink
🧠 redesign Use newer flake-utils
Browse files Browse the repository at this point in the history
  • Loading branch information
Lord-Valen authored and blaggacao committed Jan 6, 2023
1 parent 7646c7d commit 482d571
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 32 deletions.
2 changes: 1 addition & 1 deletion doc/api-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,5 @@ list of strings
_*Default*_

```
["aarch64-linux","aarch64-darwin","i686-linux","x86_64-darwin","x86_64-linux"]
["aarch64-linux","aarch64-darwin","x86_64-darwin","x86_64-linux"]
```
1 change: 0 additions & 1 deletion examples/devos/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ let

ciSystems = [
"aarch64-linux"
"i686-linux"
"x86_64-linux"
];

Expand Down
11 changes: 7 additions & 4 deletions flake.lock

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

5 changes: 3 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
devshell.url = "github:numtide/devshell";
devshell.inputs.nixpkgs.follows = "nixpkgs";

flake-utils.url = "github:numtide/flake-utils";
flake-utils-plus.url = "github:gytis-ivaskevicius/flake-utils-plus/?ref=refs/pull/120/head";
flake-utils-plus.inputs.flake-utils.follows = "flake-utils";

flake-compat = {
url = "github:edolstra/flake-compat";
Expand Down Expand Up @@ -65,7 +67,6 @@
mkFlake = let
mkFlake' = import ./src/mkFlake {
inherit (nixlib) lib;
inherit (flake-utils-plus.inputs) flake-utils;
inherit
collectors
darwin
Expand All @@ -87,7 +88,7 @@
# .. see: https://demo.hedgedoc.org/s/_W6Ve03GK#

# Super Stupid Flakes (ssf) / System As an Input - Style:
supportedSystems = ["x86_64-linux" "aarch64-linux" "x86_64-darwin"];
supportedSystems = flake-utils-plus.lib.defaultSystems;

# Pass this flake(self) as "digga"
polyfillInputs = self.inputs // {digga = self;};
Expand Down
1 change: 0 additions & 1 deletion src/mkFlake/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
devshell,
home-manager,
flake-utils-plus,
flake-utils,
internal-modules,
tests,
} @ injectedDeps: {
Expand Down
38 changes: 15 additions & 23 deletions src/mkFlake/options.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
lib,
devshell,
flake-utils,
flake-utils-plus,
self,
inputs,
...
Expand All @@ -16,53 +16,45 @@ with lib;
# #############

/*
* Synopsis: maybeImport <path|string or obj>
*
Synopsis: maybeImport <path|string or obj>
Returns an imported path or string or the object otherwise.
Use when you want to allow specifying an object directly or a path to it.
It saves the end user the additional import statement.
* Returns an imported path or string or the object otherwise.
*
* Use when you want to allow specifying an object directly or a path to it.
* It saves the end user the additional import statement.
*/
maybeImport = obj:
if (builtins.isPath obj || builtins.isString obj)
then import obj
else obj;

/*
* Synopsis: maybeImportDevshellToml <path|string or obj>
*
Synopsis: maybeImportDevshellToml <path|string or obj>
Returns an imported path or string if the filename ends in `toml` or the object or path otherwise.
Use only for devshell modules, as an apply function.
* Returns an imported path or string if the filename ends in `toml` or the object or path otherwise.
*
* Use only for devshell modules, as an apply function.
*/
maybeImportDevshellToml = obj:
if ((builtins.isPath obj || builtins.isString obj) && lib.hasSuffix ".toml" obj)
then devshell.lib.importTOML obj
else obj;

/*
* Synopsis: pathToOr <type>
*
Synopsis: pathToOr <type>
Type resolver: types maybeImport's <obj>.
Use in type declarations.
* Type resolver: types maybeImport's <obj>.
*
* Use in type declarations.
*/
pathToOr = elemType: with types; coercedTo path maybeImport elemType;

/*
* Synopsis: coercedListOf <type>
*
Synopsis: coercedListOf <type>
Type resolver & list flattner: flattens a (evtl. arbitrarily nested) list of type <type>.
Use in type declarations.
* Type resolver & list flattner: flattens a (evtl. arbitrarily nested) list of type <type>.
*
* Use in type declarations.
*/
coercedListOf = elemType:
with types;
Expand Down Expand Up @@ -439,7 +431,7 @@ with lib;
};
supportedSystems = mkOption {
type = listOf str;
default = flake-utils.lib.defaultSystems;
default = flake-utils-plus.lib.defaultSystems;
description = ''
The systems supported by this flake
'';
Expand Down

0 comments on commit 482d571

Please sign in to comment.