Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Write nix.settings to nix.custom.conf instead of nix.conf #57

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
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
7 changes: 7 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ jobs:
rm -f flake.lock
nix flake lock
nix flake check

# don't check custom conf relocation on darwin while we work with nix-darwin to make this a good experience
if [ "$(nix eval --raw --impure --expr 'builtins.currentSystem')" = "x86_64-linux" ]; then
# ensure relocating nix.conf to nix.custom.conf worked
nix build .#custom-conf --out-link /tmp/custom-conf
grep --quiet nix-community /tmp/custom-conf/etc/nix/nix.custom.conf
fi
- run: |
set -eux

Expand Down
4 changes: 4 additions & 0 deletions modules/nixos.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ in
];

config = {
# Push the user's nix.conf into /etc/nix/nix.custom.conf,
# leaving determinate-nixd to manage /etc/nix/nix.conf
environment.etc."nix/nix.conf".target = "nix/nix.custom.conf";

environment.systemPackages = [
inputs.self.packages.${pkgs.stdenv.system}.default
];
Expand Down
100 changes: 72 additions & 28 deletions tests/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,81 @@
url = "github:LnL7/nix-darwin/nix-darwin-24.11";
inputs.nixpkgs.follows = "nixpkgs";
};
home-manager = {
url = "github:nix-community/home-manager/release-24.05";
inputs.nixpkgs.follows = "nixpkgs";
};
};

outputs = { nixpkgs, determinate, home-manager, nix-darwin, ... }: {
checks.x86_64-linux.nixos = (nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
determinate.nixosModules.default
outputs =
{
nixpkgs,
determinate,
nix-darwin,
...
}:
let
mkNixOS =
{
fileSystems."/" = {
device = "/dev/bogus";
fsType = "ext4";
};
boot.loader.grub.devices = [ "/dev/bogus" ];
system.stateVersion = "24.11";
}
];
}).config.system.build.toplevel;

checks.aarch64-darwin.nix-darwin = (nix-darwin.lib.darwinSystem {
system = "aarch64-darwin";
modules ? [ ],
}:
(nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
determinate.nixosModules.default
{
fileSystems."/" = {
device = "/dev/bogus";
fsType = "ext4";
};
boot.loader.grub.devices = [ "/dev/bogus" ];
system.stateVersion = "24.11";
}
] ++ modules;
}).config.system.build.toplevel;

modules = [
determinate.darwinModules.default
mkNixDarwin =
{
system.stateVersion = 5;
}
];
}).system;
};
modules ? [ ],
}:
(nix-darwin.lib.darwinSystem {
system = "aarch64-darwin";

modules = [
determinate.darwinModules.default
{
system.stateVersion = 5;
}
] ++ modules;
}).system;
in
{
packages.x86_64-linux = {
default = mkNixOS { };

custom-conf = mkNixOS {
modules = [
{
nix.settings = {
substituters = [ "https://nix-community.cachix.org" ];
trusted-substituters = [ "https://nix-community.cachix.org" ];
trusted-public-keys = [ "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" ];
};
}
];
};
};

packages.aarch64-darwin = {
default = mkNixDarwin { };

# custom-conf = mkNixDarwin {
# modules = [
# {
# nix.settings = {
# substituters = [ "https://nix-community.cachix.org" ];
# trusted-substituters = [ "https://nix-community.cachix.org" ];
# trusted-public-keys = [ "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" ];
# };
# }
# ];
# };
};
};
}
Loading