home

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit f6852d81ea2b1f70226c411deb267876af506499
parent f7758ee8ef14bd37b78478066438f60ba365eb6f
Author: Vincent Demeester <vincent@sbr.pm>
Date:   Tue, 30 Jun 2020 20:23:28 +0200

nix-darwin: experimenting with it…

Signed-off-by: Vincent Demeester <vincent@sbr.pm>

Diffstat:
Mdefault.nix | 20++++++++++++++------
Mhosts.nix | 7++++---
Mnix/default.nix | 1+
Mnix/sources.json | 12++++++++++++
Asystems/honshu.nix | 10++++++++++
5 files changed, 41 insertions(+), 9 deletions(-)

diff --git a/default.nix b/default.nix @@ -2,6 +2,7 @@ , lib ? sources.lib , pkgs ? sources.pkgs { } , pkgs-unstable ? sources.pkgs-unstable { } +, pkgs-darwin ? sources.nix-darwin , nixpkgs ? sources.nixpkgs { } }: with builtins; with lib; @@ -10,20 +11,21 @@ let mkNixOS: make a nixos system build with the given name and cfg. cfg is an attributeSet: - - arch is architecture - - type is weither we want to use nixos (stable) or nixos-unstable + - arch is architecture (darwin is a special one) + - channel is the "channel" to use (nixos stable, nixos unstable, …) + - vm is whether it is a vm, or not Example: hokkaido = { arch = "x86_64-linux"; }; - honshu = { arch = "x86_64-linux"; type = "unstable"; }; + naruhodo = { arch = "x86_64-linux"; channel = "unstable"; }; */ mkNixOS = name: cfg: let configuration = ./systems + "/${name}.nix"; system = cfg.arch; - # If type == unstable, use nixos-unstable (pkgs-unstable) otherwise use nixos (pkgs) + # If channel == unstable, use nixos-unstable (pkgs-unstable) otherwise use nixos (pkgs) p = - if cfg ? type && cfg.type == "unstable" + if cfg ? channel && cfg.channel == "unstable" then pkgs-unstable else pkgs; # If vm == true, build a VM, otherwise build the system @@ -31,9 +33,15 @@ let main = if cfg ? vm && cfg.vm then nixos.vm - else nixos.config.system.build; + else + if system == "x86_64-darwin" + then (import (pkgs.darwin.path) { inherit nixpkgs configuration; }).system + else nixos.config.system.build; in main; + /* + mkSystem: make a system build with the given name and cfg. + */ mkSystem = name: cfg: if cfg ? vm && cfg.vm then (mkNixOS name cfg) diff --git a/hosts.nix b/hosts.nix @@ -1,10 +1,11 @@ { - hokkaido = { arch = "x86_64-linux"; type = "unstable"; }; - wakasu = { arch = "x86_64-linux"; type = "unstable"; }; + hokkaido = { arch = "x86_64-linux"; channel = "unstable"; }; + wakasu = { arch = "x86_64-linux"; channel = "unstable"; }; kerkouane = { arch = "x86_64-linux"; }; okinawa = { arch = "x86_64-linux"; }; sakhalin = { arch = "x86_64-linux"; }; + honshu = { arch = "x86_64-darwin"; channel = "unstable"; }; # Test VM - foo = { arch = "x86_64-linux"; type = "unstable"; vm = true; }; + foo = { arch = "x86_64-linux"; channel = "unstable"; vm = true; }; # mypi = { arch = "aarch64-linux" }; } diff --git a/nix/default.nix b/nix/default.nix @@ -12,4 +12,5 @@ rec { gitignore = import sources.gitignore; nixos-hardware = import sources.nixos-hardware; nur = import sources.NUR; + nix-darwin = import sources.nix-darwin; } diff --git a/nix/sources.json b/nix/sources.json @@ -59,6 +59,18 @@ "url": "https://github.com/nmattia/niv/archive/f73bf8d584148677b01859677a63191c31911eae.tar.gz", "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz" }, + "nix-darwin": { + "branch": "master", + "description": "nix modules for darwin", + "homepage": "", + "owner": "LnL7", + "repo": "nix-darwin", + "rev": "47fe6db9c9cd22c4ba57df3281f98f454880bea7", + "sha256": "198lxy1q7z6cmlyxd0rigrabjab4i49w2dk3xqm3bs4y0s0qimwy", + "type": "tarball", + "url": "https://github.com/LnL7/nix-darwin/archive/47fe6db9c9cd22c4ba57df3281f98f454880bea7.tar.gz", + "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz" + }, "nixos": { "branch": "nixos-20.03", "description": "A read-only mirror of NixOS/nixpkgs tracking the released channels. Send issues and PRs to", diff --git a/systems/honshu.nix b/systems/honshu.nix @@ -0,0 +1,10 @@ +{ config, pkgs, ... }: + +{ + environment.systemPackages = with pkgs; [ + htop + vim + ]; + + programs.zsh.enable = true; +}