This repository has been archived by the owner on Dec 18, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
/
flake.nix
67 lines (51 loc) · 2.38 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
{
description = "Bud - a highly composable system ctl command";
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 = {
nixpkgs.url = "github:nixos/nixpkgs/release-21.11";
devshell.url = "github:numtide/devshell";
beautysh.url = "github:lovesegfault/beautysh";
};
outputs = { self, nixpkgs, devshell, beautysh, ... }:
let
# Unofficial Flakes Roadmap - Polyfills
# .. see: https://demo.hedgedoc.org/s/_W6Ve03GK#
# .. also: <repo-root>/ufr-polyfills
# Super Stupid Flakes / System As an Input - Style:
supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" ];
ufrContract = import ./ufr-polyfills/ufrContract.nix;
# Dependency Groups - Style
budInputs = { inherit self nixpkgs; };
# repind this flake's functor to new self as part of the inputs
# this helps to completely avoid invoking flake.lock.nix.
# In a flake-only scenario, flake.lock.nix would disregard
# inputs follows configurations.
rebind = src: inpt: _: rebound: args:
let
inputs = inpt // { self = rebound; };
in
import src ({ inherit inputs; } // args);
# Dependency Groups - Style
devShellInputs = { inherit nixpkgs devshell beautysh; };
# .. we hope you like this style.
# .. it's adopted by a growing number of projects.
# Please consider adopting it if you want to help to improve flakes.
in
{
lib.writeBashWithPaths = import ./writeBashWithPaths.nix;
nixosModules.bud = import ./nixosModule.nix self;
devshellModules.bud = import ./devshellModule.nix self;
defaultPackage = ufrContract supportedSystems ./. budInputs;
# The flake's functor ...
# ... knows how to consume the self.overlays it's currently bound to
overlays = { };
# ... knows how to consume self.budModules it's currently bound to
budModules = { };
# usage: inputs.bud newSelf { ... };
__functor = rebind ./. budInputs;
# bud-local use
devShell = ufrContract supportedSystems ./shell.nix devShellInputs;
};
}