summaryrefslogtreecommitdiff
path: root/default.nix
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2019-10-27 12:43:49 -0700
committerBen Sima <ben@bsima.me>2019-11-01 14:22:07 -0700
commitc6662575a085242fd216729ee3429a8b69f91f73 (patch)
tree37a017fe67fd2e2a6e99dd72515e572a92898253 /default.nix
parentf82fddd83e8b713e211b6c3a7fcb0eacd88c3689 (diff)
use a standard buildNixOS function
Diffstat (limited to 'default.nix')
-rw-r--r--default.nix74
1 files changed, 23 insertions, 51 deletions
diff --git a/default.nix b/default.nix
index 55f96e7..e3d3ca1 100644
--- a/default.nix
+++ b/default.nix
@@ -2,58 +2,30 @@ let
nixpkgs-tar = builtins.fetchTarball (import ./nixpkgs.nix);
nixpkgs = import "${nixpkgs-tar}" {};
nixos = import "${nixpkgs-tar}/nixos";
+ # TODO(bsima): buildNixOS should be split into multiple functions that each
+ # return one thing, instead of a single function that returns multiple things
+ buildNixOS = opts: let full = (nixos opts); in {
+ system = full.system;
+ vm = full.vm;
+ };
- # a common build function
- #
- bild = file:
- with nixpkgs;
- let
- pack = import file;
-
- depsToPackageSet = packageSet: deps:
- map (s: builtins.getAttr s packageSet) deps;
-
- ghc844_ = pkgs.haskell.packages.ghc844.override (oldAttrs: {
- overrides = with pkgs.haskell.lib; self: super: {
- clay = dontCheck super.clay;
- };
- });
-
- ghc = ghc844_.ghcWithPackages (hp: depsToPackageSet hp
- # we need hinotify for chip/make
- ([ "hinotify" ] ++ pack.deps.both ++ pack.deps.apex));
-
- ghcjs_ = pkgs.haskell.packages.ghcjs.override (oldAttrs: {
- overrides = with pkgs.haskell.lib; self: super: {
- clay = dontCheck super.clay;
- http-types = dontCheck super.http-types;
- tasty-quickcheck = dontCheck super.tasty-quickcheck;
- scientific = dontCheck super.scientific; # takes forever
- servant = dontCheck super.servant;
- comonad = dontCheck super.comonad;
- QuickCheck = dontCheck super.QuickCheck;
- };
- });
-
- ghcjs = ghcjs_.ghcWithPackages (hp:
- depsToPackageSet hp (pack.deps.both ++ pack.deps.aero));
-
- make = ./chip/make;
- in stdenv.mkDerivation {
- name = pack.name;
- version = "0";
- src = ../.;
- nativeBuildInputs = [
- ghc ghcjs
+in {
+ com.simatime = import ./com/simatime.nix { inherit buildNixOS; };
+ com.influencedbybooks = buildNixOS {
+ system = "x86_64-linux";
+ configuration = {
+ imports = [
+ ./com/influencedbybooks/service.nix
+ # common infra
+ ./com/simatime/users.nix
+ ./com/simatime/packages.nix
];
- strictDeps = true;
- buildPhase = "${ghc}/bin/runhaskell ${make} ${pack.name}";
- installPhase = ''
- mkdir -p $out/bin
- cp bild/${pack.name} $out/bin/${pack.name}
- '';
+ nixpkgs.config.allowUnfree = true;
+ services.openssh = {
+ enable = true;
+ passwordAuthentication = false;
+ };
+ security.sudo.wheelNeedsPassword = true;
+ boot.cleanTmpDir = true;
};
-in {
- com.simatime = import ./com/simatime.nix { inherit nixos; };
- com.influencedbybooks = import ./com/influencedbybooks/default.nix {};
}