Skip to content

Commit

Permalink
Add cachix nix config
Browse files Browse the repository at this point in the history
  • Loading branch information
LukeChannings committed Sep 17, 2024
1 parent c75040b commit 1500aec
Show file tree
Hide file tree
Showing 11 changed files with 61 additions and 16 deletions.
1 change: 0 additions & 1 deletion .devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"streetsidesoftware.code-spell-checker",
"eamodio.gitlens",
"tamasfe.even-better-toml",
"jnoortheen.nix-ide",
"1password.op-vscode",
"ibecker.treefmt-vscode",
"jnoortheen.nix-ide"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/binary-cache.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ jobs:
- name: Build dev shell
run: |
export NIXPKGS_ALLOW_UNFREE=1
nix develop --impure --accept-flake-config --build
nix develop --impure --accept-flake-config --accept-flake-config --build
6 changes: 3 additions & 3 deletions .github/workflows/template-darwin-system.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- templates/darwin-system/*

jobs:
binary-cache:
template-test:
permissions:
contents: write
runs-on: macos-latest
Expand All @@ -20,5 +20,5 @@ jobs:
- name: Build packages
run: |
export NIXPKGS_ALLOW_UNFREE=1
nix flake new -t .#darwin-system darwin-system
nix run --flake ./darwin-system#activate
nix flake new --accept-flake-config -t .#darwin-system darwin-system
sudo nix run --accept-flake-config path:"$(pwd)/darwin-system"#activate --show-trace
7 changes: 3 additions & 4 deletions config/default-packages.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
pkgs,
lib,
config,
...
}:
let
Expand Down Expand Up @@ -39,7 +40,7 @@ let
;
};

allDefaultPackages = cliTools // (if pkgs.stdlib.isDarwin then macUtilities else { });
allDefaultPackages = cliTools // (if pkgs.stdenv.isDarwin then macUtilities else { });
in
{
options.dotfiles = {
Expand All @@ -53,8 +54,6 @@ in
};

config = {
home.packages = (
with builtins; attrValues (removeAttrs allDefaultPackages config.dotfiles.disabledDefaultPackages)
);
home.packages = attrValues (removeAttrs allDefaultPackages config.dotfiles.disabledDefaultPackages);
};
}
5 changes: 4 additions & 1 deletion config/vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
"devenv",
"mktemp",
"diffable",
"lukechannings"
"lukechannings",
"channings",
"cachix",
"nixpkgs"
],
"editor.fontFamily": "RecMonoLinear Nerd Font",
"editor.fontLigatures": true,
Expand Down
6 changes: 5 additions & 1 deletion config/wezterm/home.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
enable = true;

extraConfig = builtins.replaceStrings [ "@multiplexingName@" ] [
(lib.toLower ("${osConfig.networking.hostName or "wezterm"}_${config.home.username}"))
(lib.toLower (
"${
(if osConfig.networking.hostName != null then osConfig.networking.hostName else "wezterm")
}_${config.home.username}"
))
] (builtins.readFile ./config.lua);
};
}
23 changes: 20 additions & 3 deletions flake.lock

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

1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
nixpkgs-darwin.url = "github:NixOS/nixpkgs/nixpkgs-24.05-darwin";
flake-parts.url = "github:hercules-ci/flake-parts";
devenv-root = {
url = "file+file:///dev/null";
Expand Down
9 changes: 7 additions & 2 deletions templates/darwin-system/configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,19 @@ in
modules = [
(dotfiles.lib.configureOsModules {
osModules = attrValues dotfiles.modules.darwin;
homeModules = attrValues dotfiles.modules.homeModules;
homeModules = dotfiles.lib.homeModulesWithDisabled [ "default-apps" ];
})
(
let
username = "luke";
in
{ ... }:
{ lib, ... }:
{
# This can be removed for multi-user Nix installs
nix.gc.user = username;

nix.linux-builder.enable = lib.mkForce false;

users = {
knownUsers = [ username ];

Expand Down
10 changes: 10 additions & 0 deletions templates/darwin-system/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,19 @@

activate = pkgs.writeScriptBin "activate" ''
#!${pkgs.bash}/bin/bash
sudo rm -rf ~/.nix-defexpr
sudo mv /etc/nix/nix.conf /etc/nix/nix.conf.before-nix-darwin
export NIX_CONFIG="experimental-features = nix-command flakes"
${darwin-rebuild}/bin/darwin-rebuild switch --flake ${self}#default
'';
};
};
};

nixConfig = {
extra-substituters = [ "https://luke-channings.cachix.org" ];
extra-trusted-public-keys = [
"luke-channings.cachix.org-1:ETsZ3R5ue9QOwO4spg8aGJMwMU6k5tQIaHWnTakGHjo="
];
};
}
7 changes: 7 additions & 0 deletions templates/devenv/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,11 @@
"aarch64-linux"
];
};

nixConfig = {
extra-substituters = [ "https://luke-channings.cachix.org" ];
extra-trusted-public-keys = [
"luke-channings.cachix.org-1:ETsZ3R5ue9QOwO4spg8aGJMwMU6k5tQIaHWnTakGHjo="
];
};
}

0 comments on commit 1500aec

Please sign in to comment.