Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
export AWS_SHARED_CREDENTIALS_FILE=/Users/Shared/.aws-credentials

# Exit if the out path is empty
test -z "$OUT_PATHS" && exit
test -z "$OUT_PATHS" && ( echo "OUT_PATHS is empty; exit)

# Without OUT_PATHS things kind of work most of the time.
# Thus, let just or true and exit, so that if it works, it works, if it doesn't it just ignore
Expand All @@ -80,14 +80,24 @@ jobs:

- name: Configure Nix to use my cache
run: |
cat <<EOF | sudo tee -a /etc/nix/nix.conf
#cat <<EOF | sudo tee -a /etc/nix/nix.conf
echo "NIX_CONFIG=experimental-features = nix-command flakes
substituters = https://cache.nixos.org/ ${{ secrets.S3_URL }}
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= mdots:h40b7TWhz9PqO04aqOAiAEEdulJ2Q9oJ3MxXQCgQVvs=
post-build-hook = /etc/nix/upload-to-cache.sh
trusted-users = $(whoami)
EOF
access-tokens = github.com=$GITHUB_TOKEN" >> $GITHUB_ENV
#EOF

#sudo launchctl kickstart -k system/org.nixos.nix-daemon

sudo launchctl kickstart -k system/org.nixos.nix-daemon
- name: Switch to the ci system
run: |
export AWS_SHARED_CREDENTIALS_FILE=/Users/Shared/.aws-credentials
nix run nix-darwin/master#darwin-rebuild -- build --flake .#ci
mkdir -p /Users/Shared/nix/
sudo mv /etc/nix/nix.conf /Users/Shared/nix/
sudo --preserve-env=NIX_CONFIG nix run nix-darwin/master#darwin-rebuild -- switch --flake .#ci

- name: Build my devShell
run: |
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ rebuild:
darwin-rebuild build --flake .#pro-m2

switch:
darwin-rebuild switch --flake .#pro-m2
sudo darwin-rebuild switch --flake .#pro-m2
77 changes: 68 additions & 9 deletions flake.lock

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

8 changes: 4 additions & 4 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
inputs.nixpkgs.follows = "nixpkgs";
};

#nix-rosetta-builder = {
# url = "github:cpick/nix-rosetta-builder";
# inputs.nixpkgs.follows = "nixpkgs";
#};
nix-rosetta-builder = {
url = "github:cpick/nix-rosetta-builder";
inputs.nixpkgs.follows = "nixpkgs";
};
# TODO: help bring tezos via nix on macOS
#tezos.url = "github:serokell/tezos-packaging";
};
Expand Down
15 changes: 13 additions & 2 deletions src/hosts/darwin/pro.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ in {
environment.variables.LC_ALL = "en_US.UTF-8";
# TODO: date format, local money?

system.primaryUser = "m";

# Show all files including hidden
system.defaults.NSGlobalDomain.AppleShowAllFiles = false;
# Show all extensions in filename
Expand Down Expand Up @@ -70,7 +72,7 @@ in {
# Change default view to list view
system.defaults.finder.FXPreferredViewStyle = "Nlsv";
# Don't show any icons on the desktop
system.defaults.finder.CreateDesktop = false;
system.defaults.finder.CreateDesktop = true;
# Don't warn when changing the extension of a file
system.defaults.finder.FXEnableExtensionChangeWarning = false;

Expand All @@ -86,6 +88,9 @@ in {
# Allow two finger click for right click on the trackpad
system.defaults.trackpad.TrackpadRightClick = true;

# Calendar.app defaults
system.defaults.iCal."TimeZone support enabled" = true;

# Custom user preferences
system.defaults.CustomUserPreferences = {
# GPG tools
Expand Down Expand Up @@ -176,6 +181,7 @@ in {
"kodi"
"little-snitch"
"livebook"
"lm-studio"
"logseq"
"loopback"
#"love"
Expand Down Expand Up @@ -212,7 +218,7 @@ in {
];

brews = [
"ext4fuse"
#"ext4fuse"
"imageoptim-cli"
"pinentry-mac"
#"siril"
Expand Down Expand Up @@ -321,6 +327,11 @@ in {

nix = {
enable = true;
linux-builder = {
enable = true;
config.virtualisation.cores = 4;
};

gc = {
interval = {
Hour = 23;
Expand Down
62 changes: 62 additions & 0 deletions src/hosts/modules/nix-macos.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
config,
pkgs,
lib,
...
}: {
# Log access to the linux builder
launchd.daemons.linux-builder = {
serviceConfig = {
StandardOutPath = "/var/log/darwin-builder.log";
StandardErrorPath = "/var/log/darwin-builder.log";
};
};

nix = {
enable = true;

linux-builder = {
enable = true;
systems = ["aarch64-linux"];
#config = {
# virtualisation.cores = 4;
# services.openssh.enable = true;
#};
};

gc = {
interval = {
Hour = 23;
Minute = 55;
};
options = "--delete-older-than 14d";
};

settings = {
substituters = ["s3://mdots?endpoint=https://s3.fr-par.scw.cloud/&region=fr-par"];
trusted-public-keys = ["mdots:h40b7TWhz9PqO04aqOAiAEEdulJ2Q9oJ3MxXQCgQVvs="];
trusted-users = ["m"];
};

extraOptions = ''
experimental-features = nix-command flakes
keep-outputs = true
keep-derivations = true
keep-failed = false
keep-going = true
builders-use-substitutes = true
'';

distributedBuilds = true;

buildMachines = [
{
hostName = "purism";
system = "x86_64-linux";
protocol = "ssh-ng";
maxJobs = 4;
supportedFeatures = ["kvm"];
}
];
};
}
20 changes: 19 additions & 1 deletion src/hosts/packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,33 @@
inputs,
cell,
}: let
inherit (inputs) nixpkgs darwin m;
inherit (inputs) nixpkgs darwin m nix-rosetta-builder;
in {
# A CI config to start the linux-builder
darwinConfigurations."ci" = darwin.lib.darwinSystem {
system = "aarch64-darwin";
modules = [
{system.stateVersion = 6;}
./modules/nix-macos.nix
];
};

darwinConfigurations."pro-m2" = darwin.lib.darwinSystem {
#default = darwin.lib.darwinSystem {
# you can have multiple darwinConfigurations per flake, one per hostname
specialArgs = {inherit m;};
system = "aarch64-darwin";
modules = [
./modules/nix-macos.nix
./darwin/pro.nix
nix-rosetta-builder.darwinModules.default
{
# see available options in module.nix's options.nix-rosetta-builder`
nix-rosetta-builder = {
enable = true;
onDemand = true;
};
}
];
};
}
Loading