Skip to content

Instantly share code, notes, and snippets.

@cleverca22
Created March 12, 2017 18:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cleverca22/401691d963095103ebb67931aea23755 to your computer and use it in GitHub Desktop.
Save cleverca22/401691d963095103ebb67931aea23755 to your computer and use it in GitHub Desktop.
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.app1;
in {
options = {
app1.foo = mkOption {
description = "option foo";
type = types.string;
};
};
config = {
system.build.app1 = pkgs.writeScriptBin "app1" ''
#!/usr/bin/env bash
export PATH=${config.system.build.app1_internal.env}/bin/
hello
'';
system.build.app1_internal.env = pkgs.buildEnv {
name = "app1-env";
paths = with pkgs; [ hello ];
};
};
}
{ lib, ... }:
with lib;
{
options = {
system.build = mkOption {
internal = true;
default = {};
description = "Attribute set of derivations used to setup the system.";
};
};
}
let
pkgs = import <nixpkgs> {};
pkgsModule = rec {
_file = ./default.nix;
key = _file;
config = {
nixpkgs.system = pkgs.lib.mkDefault builtins.currentSystem;
};
};
eval = pkgs.lib.evalModules {
prefix = [];
check = true;
modules = [
./app1.nix ./config.nix ./common.nix
<nixpkgs/nixos/modules/misc/nixpkgs.nix>
pkgsModule
];
args = {};
};
in eval
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment