Skip to content

Commit

Permalink
modules/community-builder: add nixpkgs clone
Browse files Browse the repository at this point in the history
Co-authored-by: nicoo <nicoo@mur.at>
  • Loading branch information
zowoq and nbraud committed Sep 20, 2024
1 parent b1a826c commit 3392681
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/community-builder.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ IF YOU ARE: making binary bootstrap tools, please only use tools built on a syst

_This section is based on the notes ([1](https://github.com/NixOS/aarch64-build-box), [2](https://github.com/nix-community/darwin-build-box)) written by [@grahamc](https://github.com/grahamc) and [@winterqt](https://github.com/winterqt)._

### Nixpkgs clone

```console
$ git clone --reference /var/lib/nixpkgs.git https://github.com/NixOS/nixpkgs.git
```

### Using your NixOS home-manager configuration on the hosts

If you happen to have your NixOS & home-manager configurations intertwined but you'd like your familiar environment on our infrastructure you can evaluate `pkgs.writeShellScript "hm-activate" config.systemd.services.home-manager-<yourusername>.serviceConfig.ExecStart` from your NixOS configuration, and send this derivation to be realized remotely: (in case you aren't a Nix trusted user)
Expand Down
10 changes: 10 additions & 0 deletions modules/darwin/community-builder/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,14 @@
environment.systemPackages = [
pkgs.vim
];

launchd.daemons.nixpkgs-clone = {
serviceConfig = {
StartCalendarInterval = [ { Minute = 0; } ];
};
path = [
pkgs.git
];
script = builtins.readFile "${inputs.self}/modules/shared/nixpkgs-clone.bash";
};
}
9 changes: 9 additions & 0 deletions modules/nixos/community-builder/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,13 @@
programs.fish.enable = true;
# disable generated completion
environment.etc."fish/generated_completions".text = pkgs.lib.mkForce "";

systemd.services.nixpkgs-clone = {
serviceConfig.Type = "oneshot";
startAt = "hourly";
path = [
pkgs.git
];
script = builtins.readFile "${inputs.self}/modules/shared/nixpkgs-clone.bash";
};
}
5 changes: 5 additions & 0 deletions modules/shared/nixpkgs-clone.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
CLONE_DIR="/var/lib/nixpkgs.git"
if [ ! -d "$CLONE_DIR" ]; then
git clone --bare https://github.com/NixOS/nixpkgs.git "$CLONE_DIR"
fi
git -C "$CLONE_DIR" -c remote.origin.fetch="+refs/heads/*:refs/remotes/origin/*" fetch

0 comments on commit 3392681

Please sign in to comment.